Mesa (master): freedreno: Emit debug messages when doing draw-time recompiles of shaders.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri May 1 16:46:33 UTC 2020


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

Author: Eric Anholt <eric at anholt.net>
Date:   Tue Apr 14 15:31:20 2020 -0700

freedreno: Emit debug messages when doing draw-time recompiles of shaders.

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                  |  8 ++++++++
 src/gallium/drivers/freedreno/ir3/ir3_gallium.c | 15 +++++++++++++++
 2 files changed, 23 insertions(+)

diff --git a/src/freedreno/ir3/ir3_shader.h b/src/freedreno/ir3/ir3_shader.h
index 14f579baf41..3b9b3f29204 100644
--- a/src/freedreno/ir3/ir3_shader.h
+++ b/src/freedreno/ir3/ir3_shader.h
@@ -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;
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_gallium.c b/src/gallium/drivers/freedreno/ir3/ir3_gallium.c
index f58e295b5a7..6e31fa0195a 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_gallium.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3_gallium.c
@@ -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;
 }
 



More information about the mesa-commit mailing list