From: Alyssa Rosenzweig Date: Wed, 27 Mar 2019 04:37:26 +0000 (+0000) Subject: panfrost: Preliminary work for cubemaps X-Git-Tag: upstream/19.3.0~7678 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e658f7225d2ac4c8246d8c5c06ae275bf00117a1;p=platform%2Fupstream%2Fmesa.git panfrost: Preliminary work for cubemaps Again, not yet functional, but this sets up the memory management for cube maps. Signed-off-by: Alyssa Rosenzweig --- diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c index 8fed527..43e0a62 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 9e663e5..a1285f2 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 3e076b8..a1315ab 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;