aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorIcecream95 <[email protected]>2020-06-12 20:14:02 +1200
committerMarge Bot <[email protected]>2020-06-12 19:15:46 +0000
commitfafc305600cb8d54ce18494e2b0d961d694b63c8 (patch)
treec470b6469d29fcf1dcacef6c5a79f1911adbd643 /src/gallium/drivers
parent3baf10adb9232c0878674042182de3fac27549d0 (diff)
panfrost: Create a new sampler view bo when the layout changes
Reviewed-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4628>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/panfrost/pan_cmdstream.c21
-rw-r--r--src/gallium/drivers/panfrost/pan_context.c2
-rw-r--r--src/gallium/drivers/panfrost/pan_context.h1
3 files changed, 21 insertions, 3 deletions
diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c
index 60ab6439cbc..8a8ba10e3a3 100644
--- a/src/gallium/drivers/panfrost/pan_cmdstream.c
+++ b/src/gallium/drivers/panfrost/pan_cmdstream.c
@@ -1382,6 +1382,17 @@ panfrost_get_tex_desc(struct panfrost_batch *batch,
return view->midgard_bo->gpu;
}
+static void
+panfrost_update_sampler_view(struct panfrost_sampler_view *view,
+ struct pipe_context *pctx)
+{
+ struct panfrost_resource *rsrc = pan_resource(view->base.texture);
+ if (view->layout != rsrc->layout) {
+ panfrost_bo_unreference(view->midgard_bo);
+ panfrost_create_sampler_view_bo(view, pctx, &rsrc->base);
+ }
+}
+
void
panfrost_emit_texture_descriptors(struct panfrost_batch *batch,
enum pipe_shader_type stage,
@@ -1426,9 +1437,13 @@ panfrost_emit_texture_descriptors(struct panfrost_batch *batch,
} else {
uint64_t trampolines[PIPE_MAX_SHADER_SAMPLER_VIEWS];
- for (int i = 0; i < ctx->sampler_view_count[stage]; ++i)
- trampolines[i] = panfrost_get_tex_desc(batch, stage,
- ctx->sampler_views[stage][i]);
+ for (int i = 0; i < ctx->sampler_view_count[stage]; ++i) {
+ struct panfrost_sampler_view *view = ctx->sampler_views[stage][i];
+
+ panfrost_update_sampler_view(view, &ctx->base);
+
+ trampolines[i] = panfrost_get_tex_desc(batch, stage, view);
+ }
postfix->textures = panfrost_upload_transient(batch,
trampolines,
diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c
index da683bafdc7..436fae30577 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -918,6 +918,8 @@ panfrost_create_sampler_view_bo(struct panfrost_sampler_view *so,
struct panfrost_resource *prsrc = (struct panfrost_resource *)texture;
assert(prsrc->bo);
+ so->layout = prsrc->layout;
+
unsigned char user_swizzle[4] = {
so->base.swizzle_r,
so->base.swizzle_g,
diff --git a/src/gallium/drivers/panfrost/pan_context.h b/src/gallium/drivers/panfrost/pan_context.h
index c34b666170f..30642964890 100644
--- a/src/gallium/drivers/panfrost/pan_context.h
+++ b/src/gallium/drivers/panfrost/pan_context.h
@@ -266,6 +266,7 @@ struct panfrost_sampler_view {
struct panfrost_bo *midgard_bo;
struct panfrost_bo *bifrost_bo;
struct bifrost_texture_descriptor *bifrost_descriptor;
+ enum mali_texture_layout layout;
};
static inline struct panfrost_context *