freedreno: Emit debug messages when doing draw-time recompiles of shaders.
authorEric Anholt <eric@anholt.net>
Tue, 14 Apr 2020 22:31:20 +0000 (15:31 -0700)
committerMarge Bot <eric+marge@anholt.net>
Fri, 1 May 2020 16:26:32 +0000 (16:26 +0000)
Right now that's "always" unless you have shaderdb set.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4562>

src/freedreno/ir3/ir3_shader.h
src/gallium/drivers/freedreno/ir3/ir3_gallium.c

index 14f579b..3b9b3f2 100644 (file)
@@ -225,6 +225,9 @@ struct ir3_sampler_prefetch {
 /* Configuration key used to identify a shader variant.. different
  * shader variants can be used to implement features not supported
  * in hw (two sided color), binning-pass vertex shader, etc.
+ *
+ * When adding to this struct, please update ir3_shader_variant()'s debug
+ * output.
  */
 struct ir3_shader_key {
        union {
@@ -651,6 +654,11 @@ struct ir3_shader {
        uint32_t id;
        uint32_t variant_count;
 
+       /* Set by freedreno after shader_state_create, so we can emit debug info
+        * when recompiling a shader at draw time.
+        */
+       bool initial_variants_done;
+
        struct ir3_compiler *compiler;
 
        struct ir3_ubo_analysis_state ubo_state;
index f58e295..6e31fa0 100644 (file)
@@ -86,6 +86,17 @@ ir3_shader_variant(struct ir3_shader *shader, struct ir3_shader_key key,
        v = ir3_shader_get_variant(shader, &key, binning_pass, &created);
 
        if (created) {
+               if (shader->initial_variants_done) {
+                       pipe_debug_message(debug, SHADER_INFO,
+                                       "%s shader: recompiling at draw time: global 0x%08x, vsats %x/%x/%x, fsats %x/%x/%x, vfsamples %x/%x, astc %x/%x\n",
+                                       ir3_shader_stage(v),
+                                       key.global,
+                                       key.vsaturate_s, key.vsaturate_t, key.vsaturate_r,
+                                       key.fsaturate_s, key.fsaturate_t, key.fsaturate_r,
+                                       key.vsamples, key.fsamples,
+                                       key.vastc_srgb, key.fastc_srgb);
+
+               }
                dump_shader_info(v, binning_pass, debug);
        }
 
@@ -176,6 +187,8 @@ ir3_shader_create(struct ir3_compiler *compiler,
                        ir3_shader_variant(shader, key, true, debug);
        }
 
+       shader->initial_variants_done = true;
+
        return shader;
 }
 
@@ -211,6 +224,8 @@ ir3_shader_create_compute(struct ir3_compiler *compiler,
                ir3_shader_variant(shader, key, false, debug);
        }
 
+       shader->initial_variants_done = true;
+
        return shader;
 }