From a3d2936a8e9e1c263e5d18b6832c238e7aa6700e Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Tue, 21 Apr 2020 16:08:07 -0400 Subject: panfrost: The texture descriptor has a pointer to a trampoline Not to the texture itself, and can have a stride right after for linear textures. Signed-off-by: Alyssa Rosenzweig Signed-off-by: Tomeu Vizoso Reviewed-by: Alyssa Rosenzweig Part-of: --- src/gallium/drivers/panfrost/pan_context.c | 23 ++++++++++++++++++++--- src/gallium/drivers/panfrost/pan_context.h | 1 + 2 files changed, 21 insertions(+), 3 deletions(-) (limited to 'src/gallium/drivers/panfrost') diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c index d8bcdd28fa5..1a87a7bf014 100644 --- a/src/gallium/drivers/panfrost/pan_context.c +++ b/src/gallium/drivers/panfrost/pan_context.c @@ -930,6 +930,20 @@ panfrost_create_sampler_view( panfrost_translate_texture_type(template->target); if (device->quirks & IS_BIFROST) { + const struct util_format_description *desc = + util_format_description(template->format); + unsigned char composed_swizzle[4]; + util_format_compose_swizzles(desc->swizzle, user_swizzle, composed_swizzle); + + unsigned size = panfrost_estimate_texture_payload_size( + template->u.tex.first_level, + template->u.tex.last_level, + template->u.tex.first_layer, + template->u.tex.last_layer, + type, prsrc->layout); + + so->bifrost_bo = pan_bo_create(device, size, 0); + so->bifrost_descriptor = rzalloc(pctx, struct bifrost_texture_descriptor); panfrost_new_texture_bifrost( so->bifrost_descriptor, @@ -942,16 +956,18 @@ panfrost_create_sampler_view( template->u.tex.first_layer, template->u.tex.last_layer, prsrc->cubemap_stride, - panfrost_translate_swizzle_4(user_swizzle), + panfrost_translate_swizzle_4(composed_swizzle), prsrc->bo->gpu, - prsrc->slices); + prsrc->slices, + so->bifrost_bo); } else { - unsigned size = panfrost_estimate_texture_size( + unsigned size = panfrost_estimate_texture_payload_size( template->u.tex.first_level, template->u.tex.last_level, template->u.tex.first_layer, template->u.tex.last_layer, type, prsrc->layout); + size += sizeof(struct mali_texture_descriptor); so->midgard_bo = pan_bo_create(device, size, 0); @@ -1010,6 +1026,7 @@ panfrost_sampler_view_destroy( pipe_resource_reference(&pview->texture, NULL); panfrost_bo_unreference(view->midgard_bo); + panfrost_bo_unreference(view->bifrost_bo); if (view->bifrost_descriptor) ralloc_free(view->bifrost_descriptor); ralloc_free(view); diff --git a/src/gallium/drivers/panfrost/pan_context.h b/src/gallium/drivers/panfrost/pan_context.h index 7a4315036f9..d43c202a855 100644 --- a/src/gallium/drivers/panfrost/pan_context.h +++ b/src/gallium/drivers/panfrost/pan_context.h @@ -257,6 +257,7 @@ struct panfrost_sampler_state { struct panfrost_sampler_view { struct pipe_sampler_view base; struct panfrost_bo *midgard_bo; + struct panfrost_bo *bifrost_bo; struct bifrost_texture_descriptor *bifrost_descriptor; }; -- cgit v1.2.3