[Mesa-dev] [PATCH 3/9] panfrost: Preliminary work for cubemaps
Alyssa Rosenzweig
alyssa at rosenzweig.io
Fri Mar 29 01:53:41 UTC 2019
Again, not yet functional, but this sets up the memory management for
cube maps.
Signed-off-by: Alyssa Rosenzweig <alyssa at rosenzweig.io>
---
src/gallium/drivers/panfrost/pan_context.c | 3 ---
src/gallium/drivers/panfrost/pan_resource.c | 8 ++++++--
src/gallium/drivers/panfrost/pan_resource.h | 5 ++++-
3 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c
index 5139a33d0fc..253328f3694 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -1906,9 +1906,6 @@ panfrost_create_sampler_view(
* (data) itself. So, we serialise the descriptor here and cache it for
* later. */
- /* TODO: Other types of textures */
- assert(template->target == PIPE_TEXTURE_2D);
-
/* Make sure it's something with which we're familiar */
assert(bytes_per_pixel >= 1 && bytes_per_pixel <= 4);
diff --git a/src/gallium/drivers/panfrost/pan_resource.c b/src/gallium/drivers/panfrost/pan_resource.c
index 9e663e51422..a1285f21541 100644
--- a/src/gallium/drivers/panfrost/pan_resource.c
+++ b/src/gallium/drivers/panfrost/pan_resource.c
@@ -218,7 +218,10 @@ panfrost_setup_slices(const struct pipe_resource *tmpl, struct panfrost_bo *bo)
height = u_minify(height, 1);
}
- bo->size = ALIGN(offset, 4096);
+ assert(tmpl->array_size);
+
+ bo->cubemap_stride = ALIGN(offset, 64);
+ bo->size = ALIGN(bo->cubemap_stride * tmpl->array_size, 4096);
}
static struct panfrost_bo *
@@ -286,6 +289,7 @@ panfrost_resource_create(struct pipe_screen *screen,
case PIPE_TEXTURE_1D:
case PIPE_TEXTURE_2D:
case PIPE_TEXTURE_3D:
+ case PIPE_TEXTURE_CUBE:
case PIPE_TEXTURE_RECT:
break;
default:
@@ -388,7 +392,6 @@ panfrost_transfer_map(struct pipe_context *pctx,
transfer->base.box = *box;
transfer->base.stride = bo->slices[level].stride;
transfer->base.layer_stride = bytes_per_pixel * resource->width0; /* TODO: Cubemaps */
- assert(!transfer->base.box.z);
pipe_resource_reference(&transfer->base.resource, resource);
@@ -417,6 +420,7 @@ panfrost_transfer_map(struct pipe_context *pctx,
} else {
return bo->cpu
+ bo->slices[level].offset
+ + transfer->base.box.z * bo->cubemap_stride
+ transfer->base.box.y * bo->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 3e076b873f7..a1315ab1b43 100644
--- a/src/gallium/drivers/panfrost/pan_resource.h
+++ b/src/gallium/drivers/panfrost/pan_resource.h
@@ -53,9 +53,12 @@ struct panfrost_bo {
/* GPU address for the object */
mali_ptr gpu;
- /* Size of the entire tree */
+ /* Size of all entire trees */
size_t size;
+ /* Distance from tree to tree */
+ unsigned cubemap_stride;
+
/* Set if this bo was imported rather than allocated */
bool imported;
--
2.20.1
More information about the mesa-dev
mailing list