radeonsi: prevent a crash with DBG_CHECK_VM and u_threaded_context
authorMarek Olšák <marek.olsak@amd.com>
Sun, 9 Jul 2017 21:44:57 +0000 (23:44 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Mon, 17 Jul 2017 14:56:51 +0000 (10:56 -0400)
by setting PIPE_CONTEXT_DEBUG in the caller

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/gallium/drivers/radeonsi/si_pipe.c

index 8a4bc41a4edb369a5ed629a79b165289054be597..371d3372aa9e1e11abf06a6e35b8a74b1b17b8e4 100644 (file)
@@ -165,9 +165,6 @@ static struct pipe_context *si_create_context(struct pipe_screen *screen,
        if (!sctx)
                return NULL;
 
-       if (sscreen->b.debug_flags & DBG_CHECK_VM)
-               flags |= PIPE_CONTEXT_DEBUG;
-
        if (flags & PIPE_CONTEXT_DEBUG)
                sscreen->record_llvm_ir = true; /* racy but not critical */
 
@@ -378,7 +375,12 @@ static struct pipe_context *si_pipe_create_context(struct pipe_screen *screen,
                                                   void *priv, unsigned flags)
 {
        struct si_screen *sscreen = (struct si_screen *)screen;
-       struct pipe_context *ctx = si_create_context(screen, flags);
+       struct pipe_context *ctx;
+
+       if (sscreen->b.debug_flags & DBG_CHECK_VM)
+               flags |= PIPE_CONTEXT_DEBUG;
+
+       ctx = si_create_context(screen, flags);
 
        if (!(flags & PIPE_CONTEXT_PREFER_THREADED))
                return ctx;