diff options
author | Rob Clark <[email protected]> | 2018-12-18 10:27:10 -0500 |
---|---|---|
committer | Rob Clark <[email protected]> | 2018-12-22 15:27:37 -0500 |
commit | d71a50f83146864df097566c413454366a61bb3c (patch) | |
tree | 5dfd36aaf0d37db82f3b9670fa32387a4b030a01 /src/gallium/drivers | |
parent | 6667dde098c4d9f30720024e76e35963eec2c511 (diff) |
freedreno: combine fd_resource_layer_offset()/fd_resource_offset()
We really only need this logic in one place.
Signed-off-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r-- | src/gallium/drivers/freedreno/freedreno_resource.c | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/src/gallium/drivers/freedreno/freedreno_resource.c b/src/gallium/drivers/freedreno/freedreno_resource.c index 06e68af3a82..482ce949595 100644 --- a/src/gallium/drivers/freedreno/freedreno_resource.c +++ b/src/gallium/drivers/freedreno/freedreno_resource.c @@ -347,17 +347,6 @@ fd_blit_to_staging(struct fd_context *ctx, struct fd_transfer *trans) do_blit(ctx, &blit, false); } -static unsigned -fd_resource_layer_offset(struct fd_resource *rsc, - struct fd_resource_slice *slice, - unsigned layer) -{ - if (rsc->layer_first) - return layer * rsc->layer_size; - else - return layer * slice->size0; -} - static void fd_resource_transfer_flush_region(struct pipe_context *pctx, struct pipe_transfer *ptrans, const struct pipe_box *box) @@ -626,10 +615,10 @@ fd_resource_transfer_map(struct pipe_context *pctx, } buf = fd_bo_map(rsc->bo); - offset = slice->offset + + offset = box->y / util_format_get_blockheight(format) * ptrans->stride + box->x / util_format_get_blockwidth(format) * rsc->cpp + - fd_resource_layer_offset(rsc, slice, box->z); + fd_resource_offset(rsc, level, box->z); if (usage & PIPE_TRANSFER_WRITE) rsc->valid = true; |