Mesa (master): panfrost: Map with size of first layer for 3D textures
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Jan 2 18:15:06 UTC 2020
Module: Mesa
Branch: master
Commit: 14bc4c7cce6dccca6efed5207f7d38d5d654999a
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=14bc4c7cce6dccca6efed5207f7d38d5d654999a
Author: Tomeu Vizoso <tomeu.vizoso at collabora.com>
Date: Thu Jan 2 11:27:00 2020 +0100
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 <tomeu.vizoso at collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
---
src/gallium/drivers/panfrost/pan_resource.c | 9 +++++++--
src/gallium/drivers/panfrost/pan_resource.h | 1 +
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 */
More information about the mesa-commit
mailing list