aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomeu Vizoso <[email protected]>2020-01-02 11:27:00 +0100
committerAlyssa Rosenzweig <[email protected]>2020-01-02 12:41:15 -0500
commit14bc4c7cce6dccca6efed5207f7d38d5d654999a (patch)
treec0e907e0319f8beb9fb4cb28c00d3c65df4a783f
parented3eede296e09a1c779d0d8f89ed50765c26b2dc (diff)
panfrost: Map with size of first layer for 3D textures
As that's what Gallium expects in transfer.layer_stride. Signed-off-by: Tomeu Vizoso <[email protected]> Reviewed-by: Alyssa Rosenzweig <[email protected]>
-rw-r--r--src/gallium/drivers/panfrost/pan_resource.c9
-rw-r--r--src/gallium/drivers/panfrost/pan_resource.h1
2 files changed, 8 insertions, 2 deletions
diff --git a/src/gallium/drivers/panfrost/pan_resource.c b/src/gallium/drivers/panfrost/pan_resource.c
index df0fc9e5cac..1de9d5acf2d 100644
--- a/src/gallium/drivers/panfrost/pan_resource.c
+++ b/src/gallium/drivers/panfrost/pan_resource.c
@@ -322,6 +322,8 @@ panfrost_setup_slices(struct panfrost_resource *pres, size_t *bo_size)
unsigned slice_one_size = slice->stride * effective_height;
unsigned slice_full_size = slice_one_size * effective_depth;
+ slice->size0 = slice_one_size;
+
/* Report 2D size for 3D texturing */
if (l == 0)
@@ -665,7 +667,10 @@ panfrost_transfer_map(struct pipe_context *pctx,
return transfer->map;
} else {
transfer->base.stride = rsrc->slices[level].stride;
- transfer->base.layer_stride = rsrc->cubemap_stride;
+ if (resource->target == PIPE_TEXTURE_3D)
+ transfer->base.layer_stride = rsrc->slices[level].size0;
+ else
+ transfer->base.layer_stride = rsrc->cubemap_stride;
/* By mapping direct-write, we're implicitly already
* initialized (maybe), so be conservative */
@@ -675,7 +680,7 @@ panfrost_transfer_map(struct pipe_context *pctx,
return bo->cpu
+ rsrc->slices[level].offset
- + transfer->base.box.z * rsrc->cubemap_stride
+ + transfer->base.box.z * transfer->base.layer_stride
+ transfer->base.box.y * rsrc->slices[level].stride
+ transfer->base.box.x * bytes_per_pixel;
}
diff --git a/src/gallium/drivers/panfrost/pan_resource.h b/src/gallium/drivers/panfrost/pan_resource.h
index a9c4d7cc539..0dcfbbd3a18 100644
--- a/src/gallium/drivers/panfrost/pan_resource.h
+++ b/src/gallium/drivers/panfrost/pan_resource.h
@@ -43,6 +43,7 @@ enum panfrost_memory_layout {
struct panfrost_slice {
unsigned offset;
unsigned stride;
+ unsigned size0;
/* If there is a header preceding each slice, how big is
* that header? Used for AFBC */