Mesa (main): panfrost: Refactor variant rebind code

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon May 2 14:14:35 UTC 2022


Module: Mesa
Branch: main
Commit: b6909ebb36b7c0ee9a5efa89a4e48eb8f47fa0cd
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=b6909ebb36b7c0ee9a5efa89a4e48eb8f47fa0cd

Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date:   Tue Apr 26 15:46:00 2022 -0400

panfrost: Refactor variant rebind code

For point sprite lowering on Bifrost and Valhall.

Signed-off-by: Alyssa Rosenzweig <alyssa at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16173>

---

 src/gallium/drivers/panfrost/pan_context.c | 15 ++++++++++++---
 src/gallium/drivers/panfrost/pan_context.h |  3 +++
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c
index 59c3f9bed4e..757c6efc494 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -485,12 +485,21 @@ panfrost_bind_shader_state(
         ctx->dirty |= PAN_DIRTY_TLS_SIZE;
         ctx->dirty_shader[type] |= PAN_DIRTY_STAGE_SHADER;
 
-        if (!hwcso) return;
+        if (hwcso)
+                panfrost_update_shader_variant(ctx, type);
+}
 
-        /* Match the appropriate variant */
+void
+panfrost_update_shader_variant(struct panfrost_context *ctx,
+                               enum pipe_shader_type type)
+{
+        /* No shader variants for compute */
+        if (type == PIPE_SHADER_COMPUTE)
+                return;
 
+        /* Match the appropriate variant */
         signed variant = -1;
-        struct panfrost_shader_variants *variants = (struct panfrost_shader_variants *) hwcso;
+        struct panfrost_shader_variants *variants = ctx->shader[type];
 
         simple_mtx_lock(&variants->lock);
 
diff --git a/src/gallium/drivers/panfrost/pan_context.h b/src/gallium/drivers/panfrost/pan_context.h
index a1791452786..b6465e11011 100644
--- a/src/gallium/drivers/panfrost/pan_context.h
+++ b/src/gallium/drivers/panfrost/pan_context.h
@@ -373,6 +373,9 @@ panfrost_flush(
 bool
 panfrost_render_condition_check(struct panfrost_context *ctx);
 
+void
+panfrost_update_shader_variant(struct panfrost_context *ctx,
+                               enum pipe_shader_type type);
 void
 panfrost_shader_compile(struct pipe_screen *pscreen,
                         struct panfrost_pool *shader_pool,



More information about the mesa-commit mailing list