[Mesa-dev] [PATCH] mesa: Add missing call to _mesa_unlock_debug_state(ctx);

Tom Stellard thomas.stellard at amd.com
Wed Nov 16 21:23:30 UTC 2016


cd724208d3e1e3307f84a794f2c1fc83b69ccf8a added a call to
_mesa_lock_debug_state(ctx) but wasn't unlocking the debug state.

This fixes a hang in glsl-fs-loop piglit test with MESA_DEBUG=context.
---
 src/gallium/drivers/radeonsi/si_pipe.c | 8 +++++---
 src/mesa/main/debug_output.c           | 5 +++--
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c
index 1737e23..b086f0e 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.c
+++ b/src/gallium/drivers/radeonsi/si_pipe.c
@@ -128,9 +128,11 @@ si_create_llvm_target_machine(struct si_screen *sscreen)
 {
 	const char *triple = "amdgcn--";
 
-	if (sscreen->b.debug_flags & DBG_GLOBAL_ISEL) {
-		const char *options[1] = {"-global-isel"};
-		LLVMParseCommandLineOptions(1, options, NULL);
+	static bool cl_set = false;
+	if (!cl_set && sscreen->b.debug_flags & DBG_GLOBAL_ISEL) {
+		const char *options[4] = {"radeonsi", "-global-isel","-global-isel-abort=2", "-debug-only=instruction-select"};
+		LLVMParseCommandLineOptions(3, options, NULL);
+		cl_set = true;
 	}
 
 	return LLVMCreateTargetMachine(si_llvm_get_amdgpu_target(triple), triple,
diff --git a/src/mesa/main/debug_output.c b/src/mesa/main/debug_output.c
index 4e9209b..b3d9398 100644
--- a/src/mesa/main/debug_output.c
+++ b/src/mesa/main/debug_output.c
@@ -1282,15 +1282,16 @@ _mesa_init_debug_output(struct gl_context *ctx)
        */
       struct gl_debug_state *debug = _mesa_lock_debug_state(ctx);
       if (!debug) {
-         return;
+         goto done;
       }
       debug->DebugOutput = GL_TRUE;
       debug->LogToStderr = GL_TRUE;
       ctx->Const.ContextFlags |= GL_CONTEXT_FLAG_DEBUG_BIT;
    }
+done:
+   _mesa_unlock_debug_state(ctx);
 }
 
-
 void
 _mesa_free_errors_data(struct gl_context *ctx)
 {
-- 
2.7.4



More information about the mesa-dev mailing list