Mesa (master): iris: Refactor iris_debug_recompile interface to take a shader.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jan 22 00:26:49 UTC 2021


Module: Mesa
Branch: master
Commit: 0f9f625089e1e3b8d62c74cfa8dc9b9ef4ef8f32
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=0f9f625089e1e3b8d62c74cfa8dc9b9ef4ef8f32

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Tue Nov 17 13:38:03 2020 -0800

iris: Refactor iris_debug_recompile interface to take a shader.

This simplifies each call site slightly and will save some interface
churn in the next rework.

Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8634>

---

 src/gallium/drivers/iris/iris_program.c | 52 ++++++++++-----------------------
 1 file changed, 16 insertions(+), 36 deletions(-)

diff --git a/src/gallium/drivers/iris/iris_program.c b/src/gallium/drivers/iris/iris_program.c
index a6e48bc61dd..95c24bb88b2 100644
--- a/src/gallium/drivers/iris/iris_program.c
+++ b/src/gallium/drivers/iris/iris_program.c
@@ -1022,15 +1022,21 @@ iris_setup_binding_table(const struct gen_device_info *devinfo,
 
 static void
 iris_debug_recompile(struct iris_context *ice,
-                     struct shader_info *info,
+                     struct iris_uncompiled_shader *ish,
                      const struct brw_base_prog_key *key)
 {
+   if (!ish)
+      return;
+
+   if (!ish->compiled_once) {
+      ish->compiled_once = true;
+      return;
+   }
+
    struct iris_screen *screen = (struct iris_screen *) ice->ctx.screen;
    const struct gen_device_info *devinfo = &screen->devinfo;
    const struct brw_compiler *c = screen->compiler;
-
-   if (!info)
-      return;
+   const struct shader_info *info = &ish->nir->info;
 
    c->shader_perf_log(&ice->dbg, "Recompiling %s shader for program %s: %s\n",
                       _mesa_shader_stage_to_string(info->stage),
@@ -1144,11 +1150,7 @@ iris_compile_vs(struct iris_context *ice,
       return false;
    }
 
-   if (ish->compiled_once) {
-      iris_debug_recompile(ice, &nir->info, &brw_key.base);
-   } else {
-      ish->compiled_once = true;
-   }
+   iris_debug_recompile(ice, ish, &brw_key.base);
 
    uint32_t *so_decls =
       screen->vtbl.create_so_decl_list(&ish->stream_output,
@@ -1352,13 +1354,7 @@ iris_compile_tcs(struct iris_context *ice,
       return false;
    }
 
-   if (ish) {
-      if (ish->compiled_once) {
-         iris_debug_recompile(ice, &nir->info, &brw_key.base);
-      } else {
-         ish->compiled_once = true;
-      }
-   }
+   iris_debug_recompile(ice, ish, &brw_key.base);
 
    struct iris_compiled_shader *shader =
       iris_upload_shader(ice, IRIS_CACHE_TCS, sizeof(*key), key, program,
@@ -1478,11 +1474,7 @@ iris_compile_tes(struct iris_context *ice,
       return false;
    }
 
-   if (ish->compiled_once) {
-      iris_debug_recompile(ice, &nir->info, &brw_key.base);
-   } else {
-      ish->compiled_once = true;
-   }
+   iris_debug_recompile(ice, ish, &brw_key.base);
 
    uint32_t *so_decls =
       screen->vtbl.create_so_decl_list(&ish->stream_output,
@@ -1600,11 +1592,7 @@ iris_compile_gs(struct iris_context *ice,
       return false;
    }
 
-   if (ish->compiled_once) {
-      iris_debug_recompile(ice, &nir->info, &brw_key.base);
-   } else {
-      ish->compiled_once = true;
-   }
+   iris_debug_recompile(ice, ish, &brw_key.base);
 
    uint32_t *so_decls =
       screen->vtbl.create_so_decl_list(&ish->stream_output,
@@ -1719,11 +1707,7 @@ iris_compile_fs(struct iris_context *ice,
       return false;
    }
 
-   if (ish->compiled_once) {
-      iris_debug_recompile(ice, &nir->info, &brw_key.base);
-   } else {
-      ish->compiled_once = true;
-   }
+   iris_debug_recompile(ice, ish, &brw_key.base);
 
    struct iris_compiled_shader *shader =
       iris_upload_shader(ice, IRIS_CACHE_FS, sizeof(*key), key, program,
@@ -2003,11 +1987,7 @@ iris_compile_cs(struct iris_context *ice,
       return false;
    }
 
-   if (ish->compiled_once) {
-      iris_debug_recompile(ice, &nir->info, &brw_key.base);
-   } else {
-      ish->compiled_once = true;
-   }
+   iris_debug_recompile(ice, ish, &brw_key.base);
 
    struct iris_compiled_shader *shader =
       iris_upload_shader(ice, IRIS_CACHE_CS, sizeof(*key), key, program,



More information about the mesa-commit mailing list