Mesa (main): i915g: Log program compile errors to mesa_loge().

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jun 28 22:17:31 UTC 2021


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

Author: Emma Anholt <emma at anholt.net>
Date:   Sun Jun 27 14:15:41 2021 -0700

i915g: Log program compile errors to mesa_loge().

Now these major driver failures are no longer hidden under -DDEBUG, and
would also work on android (you know, if you cared).  We do want to
suppress logging for u_blitter shaders that fail to compile during
util_blitter_cache_all_shaders().

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

---

 src/gallium/drivers/i915/i915_context.c       |  2 ++
 src/gallium/drivers/i915/i915_context.h       |  2 ++
 src/gallium/drivers/i915/i915_fpc.h           |  1 +
 src/gallium/drivers/i915/i915_fpc_translate.c | 16 ++++++++--------
 4 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/src/gallium/drivers/i915/i915_context.c b/src/gallium/drivers/i915/i915_context.c
index cbe5fe9d49e..3ad6720e2e3 100644
--- a/src/gallium/drivers/i915/i915_context.c
+++ b/src/gallium/drivers/i915/i915_context.c
@@ -220,7 +220,9 @@ i915_create_context(struct pipe_screen *screen, void *priv, unsigned flags)
    assert(i915->blitter);
 
    /* must be done before installing Draw stages */
+   i915->no_log_program_errors = true;
    util_blitter_cache_all_shaders(i915->blitter);
+   i915->no_log_program_errors = false;
 
    draw_install_aaline_stage(i915->draw, &i915->base);
    draw_install_aapoint_stage(i915->draw, &i915->base);
diff --git a/src/gallium/drivers/i915/i915_context.h b/src/gallium/drivers/i915/i915_context.h
index 385e9ca6e00..ecf7d79afdd 100644
--- a/src/gallium/drivers/i915/i915_context.h
+++ b/src/gallium/drivers/i915/i915_context.h
@@ -295,6 +295,8 @@ struct i915_context {
    int fired_vertices;
    int queued_vertices;
 
+   bool no_log_program_errors;
+
    /** blitter/hw-clear */
    struct blitter_context *blitter;
 };
diff --git a/src/gallium/drivers/i915/i915_fpc.h b/src/gallium/drivers/i915/i915_fpc.h
index 59b517d8492..5ccbbc7e035 100644
--- a/src/gallium/drivers/i915/i915_fpc.h
+++ b/src/gallium/drivers/i915/i915_fpc.h
@@ -75,6 +75,7 @@ struct i915_fp_compile {
    uint nr_alu_insn;
    uint nr_decl_insn;
 
+   bool log_program_errors;
    boolean error; /**< Set if i915_program_error() is called */
    uint NumNativeInstructions;
    uint NumNativeAluInstructions;
diff --git a/src/gallium/drivers/i915/i915_fpc_translate.c b/src/gallium/drivers/i915/i915_fpc_translate.c
index 9f385b70a0d..6a70b630e48 100644
--- a/src/gallium/drivers/i915/i915_fpc_translate.c
+++ b/src/gallium/drivers/i915/i915_fpc_translate.c
@@ -107,15 +107,13 @@ i915_use_passthrough_shader(struct i915_fragment_shader *fs)
 void
 i915_program_error(struct i915_fp_compile *p, const char *msg, ...)
 {
-   va_list args;
-   char buffer[1024];
+   if (p->log_program_errors) {
+      va_list args;
 
-   debug_printf("i915_program_error: ");
-   va_start(args, msg);
-   vsnprintf(buffer, sizeof(buffer), msg, args);
-   va_end(args);
-   debug_printf("%s", buffer);
-   debug_printf("\n");
+      va_start(args, msg);
+      mesa_loge_v(msg, args);
+      va_end(args);
+   }
 
    p->error = 1;
 }
@@ -943,6 +941,8 @@ i915_init_compile(struct i915_context *i915, struct i915_fragment_shader *ifs)
    for (i = 0; i < I915_TEX_UNITS; i++)
       ifs->generic_mapping[i] = -1;
 
+   p->log_program_errors = !i915->no_log_program_errors;
+
    p->first_instruction = TRUE;
 
    p->nr_tex_indirect = 1; /* correct? */



More information about the mesa-commit mailing list