Mesa (main): panfrost: Use s->info.stage instead of tgsi stage

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


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

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

panfrost: Use s->info.stage instead of tgsi stage

Now that we have the NIR handy.

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_assemble.c |  7 ++-----
 src/gallium/drivers/panfrost/pan_compute.c  |  2 +-
 src/gallium/drivers/panfrost/pan_context.c  | 27 +++++----------------------
 src/gallium/drivers/panfrost/pan_context.h  |  1 -
 4 files changed, 8 insertions(+), 29 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pan_assemble.c b/src/gallium/drivers/panfrost/pan_assemble.c
index 82b8bb3ca00..af01b3dab1f 100644
--- a/src/gallium/drivers/panfrost/pan_assemble.c
+++ b/src/gallium/drivers/panfrost/pan_assemble.c
@@ -40,7 +40,6 @@ panfrost_shader_compile(struct pipe_screen *pscreen,
                         struct panfrost_pool *shader_pool,
                         struct panfrost_pool *desc_pool,
                         const nir_shader *ir,
-                        gl_shader_stage stage,
                         struct panfrost_shader_state *state)
 {
         struct panfrost_screen *screen = pan_screen(pscreen);
@@ -49,11 +48,9 @@ panfrost_shader_compile(struct pipe_screen *pscreen,
         nir_shader *s = nir_shader_clone(NULL, ir);
 
         /* Lower this early so the backends don't have to worry about it */
-        if (stage == MESA_SHADER_FRAGMENT)
+        if (s->info.stage == MESA_SHADER_FRAGMENT)
                 NIR_PASS_V(s, nir_lower_fragcolor, state->nr_cbufs);
 
-        s->info.stage = stage;
-
         /* Call out to Midgard compiler given the above NIR */
         struct panfrost_compile_inputs inputs = {
                 .gpu_id = dev->gpu_id,
@@ -78,7 +75,7 @@ panfrost_shader_compile(struct pipe_screen *pscreen,
          * merging for e.g. depth/stencil/alpha. RSDs are replaced by simpler
          * shader program descriptors on Valhall, which can be preuploaded even
          * for fragment shaders. */
-        bool upload = !(stage == MESA_SHADER_FRAGMENT && dev->arch <= 7);
+        bool upload = !(s->info.stage == MESA_SHADER_FRAGMENT && dev->arch <= 7);
         screen->vtbl.prepare_shader(state, desc_pool, upload);
 
         panfrost_analyze_sysvals(state);
diff --git a/src/gallium/drivers/panfrost/pan_compute.c b/src/gallium/drivers/panfrost/pan_compute.c
index 32ea70fece6..1759252e542 100644
--- a/src/gallium/drivers/panfrost/pan_compute.c
+++ b/src/gallium/drivers/panfrost/pan_compute.c
@@ -71,7 +71,7 @@ panfrost_create_compute_state(
         }
 
         panfrost_shader_compile(pctx->screen, &ctx->shaders, &ctx->descs,
-                                deserialized ?: cso->prog, MESA_SHADER_COMPUTE, v);
+                                deserialized ?: cso->prog, v);
 
         /* There are no variants so we won't need the NIR again */
         ralloc_free(deserialized);
diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c
index 0bc16a9f447..f4e2249e5e0 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -293,8 +293,7 @@ panfrost_bind_vertex_elements_state(
 static void *
 panfrost_create_shader_state(
         struct pipe_context *pctx,
-        const struct pipe_shader_state *cso,
-        enum pipe_shader_type stage)
+        const struct pipe_shader_state *cso)
 {
         struct panfrost_shader_variants *so = CALLOC_STRUCT(panfrost_shader_variants);
         struct panfrost_device *dev = pan_device(pctx->screen);
@@ -316,9 +315,7 @@ panfrost_create_shader_state(
 
                 panfrost_shader_compile(pctx->screen,
                                         &ctx->shaders, &ctx->descs,
-                                        so->nir,
-                                        tgsi_processor_to_shader_stage(stage),
-                                        &state);
+                                        so->nir, &state);
         }
 
         return so;
@@ -518,9 +515,7 @@ panfrost_bind_shader_state(
         if (!shader_state->compiled) {
                 panfrost_shader_compile(ctx->base.screen,
                                         &ctx->shaders, &ctx->descs,
-                                        variants->nir,
-                                        tgsi_processor_to_shader_stage(type),
-                                        shader_state);
+                                        variants->nir, shader_state);
 
                 shader_state->compiled = true;
 
@@ -537,18 +532,6 @@ panfrost_bind_shader_state(
         simple_mtx_unlock(&variants->lock);
 }
 
-static void *
-panfrost_create_vs_state(struct pipe_context *pctx, const struct pipe_shader_state *hwcso)
-{
-        return panfrost_create_shader_state(pctx, hwcso, PIPE_SHADER_VERTEX);
-}
-
-static void *
-panfrost_create_fs_state(struct pipe_context *pctx, const struct pipe_shader_state *hwcso)
-{
-        return panfrost_create_shader_state(pctx, hwcso, PIPE_SHADER_FRAGMENT);
-}
-
 static void
 panfrost_bind_vs_state(struct pipe_context *pctx, void *hwcso)
 {
@@ -1074,11 +1057,11 @@ panfrost_create_context(struct pipe_screen *screen, void *priv, unsigned flags)
         gallium->bind_vertex_elements_state = panfrost_bind_vertex_elements_state;
         gallium->delete_vertex_elements_state = panfrost_generic_cso_delete;
 
-        gallium->create_fs_state = panfrost_create_fs_state;
+        gallium->create_fs_state = panfrost_create_shader_state;
         gallium->delete_fs_state = panfrost_delete_shader_state;
         gallium->bind_fs_state = panfrost_bind_fs_state;
 
-        gallium->create_vs_state = panfrost_create_vs_state;
+        gallium->create_vs_state = panfrost_create_shader_state;
         gallium->delete_vs_state = panfrost_delete_shader_state;
         gallium->bind_vs_state = panfrost_bind_vs_state;
 
diff --git a/src/gallium/drivers/panfrost/pan_context.h b/src/gallium/drivers/panfrost/pan_context.h
index 2b071b71ba3..15b5cd59996 100644
--- a/src/gallium/drivers/panfrost/pan_context.h
+++ b/src/gallium/drivers/panfrost/pan_context.h
@@ -368,7 +368,6 @@ panfrost_shader_compile(struct pipe_screen *pscreen,
                         struct panfrost_pool *shader_pool,
                         struct panfrost_pool *desc_pool,
                         const nir_shader *ir,
-                        gl_shader_stage stage,
                         struct panfrost_shader_state *state);
 
 void



More information about the mesa-commit mailing list