aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/panfrost
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <[email protected]>2020-04-21 16:08:07 -0400
committerTomeu Vizoso <[email protected]>2020-04-24 06:55:05 +0200
commita3d2936a8e9e1c263e5d18b6832c238e7aa6700e (patch)
treecd5008723486c98bbfb2816a9b64d2ad0061323c /src/gallium/drivers/panfrost
parent36d49b1fb18a9b401c47d53ab75942d496c40e1c (diff)
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 <[email protected]> Signed-off-by: Tomeu Vizoso <[email protected]> Reviewed-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4680>
Diffstat (limited to 'src/gallium/drivers/panfrost')
-rw-r--r--src/gallium/drivers/panfrost/pan_context.c23
-rw-r--r--src/gallium/drivers/panfrost/pan_context.h1
2 files changed, 21 insertions, 3 deletions
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;
};