aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <[email protected]>2019-03-27 04:37:26 +0000
committerAlyssa Rosenzweig <[email protected]>2019-03-31 02:36:37 +0000
commite658f7225d2ac4c8246d8c5c06ae275bf00117a1 (patch)
tree1578bd2f42fd98599b680456606985e9281aa560 /src/gallium
parent499f31aab869205ea92b2635267d792ef1837077 (diff)
panfrost: Preliminary work for cubemaps
Again, not yet functional, but this sets up the memory management for cube maps. Signed-off-by: Alyssa Rosenzweig <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/panfrost/pan_context.c3
-rw-r--r--src/gallium/drivers/panfrost/pan_resource.c8
-rw-r--r--src/gallium/drivers/panfrost/pan_resource.h5
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 8fed5270f50..43e0a6268fe 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -1907,9 +1907,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;