summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/panfrost/pan_resource.c
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <[email protected]>2019-04-03 03:52:36 +0000
committerAlyssa Rosenzweig <[email protected]>2019-04-04 03:51:43 +0000
commitb34d8222c7874bded1d8b3849252f40aadc7e1b5 (patch)
treef3fef2306c0a53e6a999d2509d44f2fa31df37ca /src/gallium/drivers/panfrost/pan_resource.c
parentc0183e8eedec8f4e023ca312456ae957c9dafbe7 (diff)
panfrost: Size tiled temp buffers correctly
This should lower transient memory usage and improve performance slightly (due to less memory to malloc/free, better cache locality, etc). Signed-off-by: Alyssa Rosenzweig <[email protected]>
Diffstat (limited to 'src/gallium/drivers/panfrost/pan_resource.c')
-rw-r--r--src/gallium/drivers/panfrost/pan_resource.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/gallium/drivers/panfrost/pan_resource.c b/src/gallium/drivers/panfrost/pan_resource.c
index 217b27c5778..15d522f1963 100644
--- a/src/gallium/drivers/panfrost/pan_resource.c
+++ b/src/gallium/drivers/panfrost/pan_resource.c
@@ -390,8 +390,6 @@ panfrost_transfer_map(struct pipe_context *pctx,
transfer->base.level = level;
transfer->base.usage = usage;
transfer->base.box = *box;
- transfer->base.stride = bo->slices[level].stride;
- transfer->base.layer_stride = bo->cubemap_stride;
pipe_resource_reference(&transfer->base.resource, resource);
@@ -413,12 +411,17 @@ panfrost_transfer_map(struct pipe_context *pctx,
if (usage & PIPE_TRANSFER_MAP_DIRECTLY)
return NULL;
+ transfer->base.stride = box->width * bytes_per_pixel;
+ transfer->base.layer_stride = transfer->base.stride * box->height;
+
/* TODO: Reads */
- /* TODO: Only allocate "just" enough, shortening the stride */
- transfer->map = malloc(transfer->base.stride * box->height);
+ transfer->map = malloc(transfer->base.layer_stride * box->depth);
return transfer->map;
} else {
+ transfer->base.stride = bo->slices[level].stride;
+ transfer->base.layer_stride = bo->cubemap_stride;
+
return bo->cpu
+ bo->slices[level].offset
+ transfer->base.box.z * bo->cubemap_stride
@@ -440,7 +443,6 @@ panfrost_tile_texture(struct panfrost_screen *screen, struct panfrost_resource *
trans->base.box.width,
trans->base.box.height,
util_format_get_blocksize(rsrc->base.format),
- bo->slices[level].stride,
u_minify(rsrc->base.width0, level),
trans->map,
bo->cpu