radeonsi: move pipe debug callback to si_context
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Sun, 22 Oct 2017 15:38:39 +0000 (17:38 +0200)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Thu, 9 Nov 2017 10:53:19 +0000 (11:53 +0100)
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/drivers/radeon/r600_pipe_common.c
src/gallium/drivers/radeon/r600_pipe_common.h
src/gallium/drivers/radeonsi/si_compute.c
src/gallium/drivers/radeonsi/si_pipe.c
src/gallium/drivers/radeonsi/si_pipe.h
src/gallium/drivers/radeonsi/si_state_shaders.c

index aa72187c5706ebdfc01ca23b8339e7ad5756e9f5..c9502182a7ebee497e6da172eac6a6bc82b6eaa4 100644 (file)
@@ -589,17 +589,6 @@ static enum pipe_reset_status r600_get_reset_status(struct pipe_context *ctx)
        return PIPE_UNKNOWN_CONTEXT_RESET;
 }
 
-static void r600_set_debug_callback(struct pipe_context *ctx,
-                                   const struct pipe_debug_callback *cb)
-{
-       struct r600_common_context *rctx = (struct r600_common_context *)ctx;
-
-       if (cb)
-               rctx->debug = *cb;
-       else
-               memset(&rctx->debug, 0, sizeof(rctx->debug));
-}
-
 static void r600_set_device_reset_callback(struct pipe_context *ctx,
                                           const struct pipe_device_reset_callback *cb)
 {
@@ -694,7 +683,6 @@ bool si_common_context_init(struct r600_common_context *rctx,
        rctx->b.texture_subdata = u_default_texture_subdata;
        rctx->b.memory_barrier = r600_memory_barrier;
        rctx->b.flush = r600_flush_from_st;
-       rctx->b.set_debug_callback = r600_set_debug_callback;
        rctx->b.create_fence_fd = r600_create_fence_fd;
        rctx->b.fence_server_sync = r600_fence_server_sync;
        rctx->dma_clear_buffer = r600_dma_clear_buffer_fallback;
index f803ee46339e402d5f6b1f08ac62651abe86c5bd..0ef5a2820261f5d2ed511450cbedf33e7a01af1f 100644 (file)
@@ -596,7 +596,6 @@ struct r600_common_context {
                bool                            query_active;
        } dcc_stats[5];
 
-       struct pipe_debug_callback      debug;
        struct pipe_device_reset_callback device_reset_callback;
        struct u_log_context            *log;
 
index 942750b225657ec2b7f2a8b3e36d6c91dcfa09e3..e55988af4cc2c1f9a0ff0093d2e5b44bcaf87a42 100644 (file)
@@ -168,12 +168,12 @@ static void *si_create_compute_state(
                }
 
                program->compiler_ctx_state.tm = sctx->tm;
-               program->compiler_ctx_state.debug = sctx->b.debug;
+               program->compiler_ctx_state.debug = sctx->debug;
                program->compiler_ctx_state.is_debug_context = sctx->is_debug;
                p_atomic_inc(&sscreen->b.num_shaders_created);
                util_queue_fence_init(&program->ready);
 
-               if ((sctx->b.debug.debug_message && !sctx->b.debug.async) ||
+               if ((sctx->debug.debug_message && !sctx->debug.async) ||
                    sctx->is_debug ||
                    si_can_dump_shader(&sscreen->b, PIPE_SHADER_COMPUTE))
                        si_create_compute_state_async(program, -1);
@@ -196,7 +196,7 @@ static void *si_create_compute_state(
                        si_shader_binary_read_config(&program->shader.binary,
                                     &program->shader.config, 0);
                }
-               si_shader_dump(sctx->screen, &program->shader, &sctx->b.debug,
+               si_shader_dump(sctx->screen, &program->shader, &sctx->debug,
                               PIPE_SHADER_COMPUTE, stderr, true);
                if (si_shader_binary_upload(sctx->screen, &program->shader) < 0) {
                        fprintf(stderr, "LLVM failed to upload shader\n");
index 391997db8423554b10cb6665c24db0bc5c020068..7940fc8d5b24cacf78d318d1364fa3895b633933 100644 (file)
@@ -154,6 +154,17 @@ si_create_llvm_target_machine(struct si_screen *sscreen)
        return ac_create_target_machine(sscreen->b.family, tm_options);
 }
 
+static void si_set_debug_callback(struct pipe_context *ctx,
+                                 const struct pipe_debug_callback *cb)
+{
+       struct si_context *sctx = (struct si_context *)ctx;
+
+       if (cb)
+               sctx->debug = *cb;
+       else
+               memset(&sctx->debug, 0, sizeof(sctx->debug));
+}
+
 static void si_set_log_context(struct pipe_context *ctx,
                               struct u_log_context *log)
 {
@@ -182,6 +193,7 @@ static struct pipe_context *si_create_context(struct pipe_screen *screen,
        sctx->b.b.priv = NULL;
        sctx->b.b.destroy = si_destroy_context;
        sctx->b.b.emit_string_marker = si_emit_string_marker;
+       sctx->b.b.set_debug_callback = si_set_debug_callback;
        sctx->b.b.set_log_context = si_set_log_context;
        sctx->b.set_atom_dirty = (void *)si_set_atom_dirty;
        sctx->screen = sscreen; /* Easy accessing of screen/winsys. */
index 6be51bb3ec9b2e187f802b41ef5a423bf3006501..6b42a54f00e02ecef63de5bfb66820a7221b2bf1 100644 (file)
@@ -361,6 +361,7 @@ struct si_context {
        void                            *vs_blit_color_layered;
        void                            *vs_blit_texcoord;
        struct si_screen                *screen;
+       struct pipe_debug_callback      debug;
        LLVMTargetMachineRef            tm; /* only non-threaded compilation */
        struct si_shader_ctx_state      fixed_func_tcs_shader;
        struct r600_resource            *wait_mem_scratch;
index 75b16487480cf7d6d7791d83a56724e0f279932c..757e889c3b730d91cc24632a1e424013351311ed 100644 (file)
@@ -2043,7 +2043,7 @@ static void *si_create_shader_selector(struct pipe_context *ctx,
        pipe_reference_init(&sel->reference, 1);
        sel->screen = sscreen;
        sel->compiler_ctx_state.tm = sctx->tm;
-       sel->compiler_ctx_state.debug = sctx->b.debug;
+       sel->compiler_ctx_state.debug = sctx->debug;
        sel->compiler_ctx_state.is_debug_context = sctx->is_debug;
 
        sel->so = state->stream_output;
@@ -2272,7 +2272,7 @@ static void *si_create_shader_selector(struct pipe_context *ctx,
        (void) mtx_init(&sel->mutex, mtx_plain);
        util_queue_fence_init(&sel->ready);
 
-       if ((sctx->b.debug.debug_message && !sctx->b.debug.async) ||
+       if ((sctx->debug.debug_message && !sctx->debug.async) ||
            sctx->is_debug ||
            si_can_dump_shader(&sscreen->b, sel->info.processor))
                si_init_shader_selector_async(sel, -1);
@@ -3237,7 +3237,7 @@ bool si_update_shaders(struct si_context *sctx)
        int r;
 
        compiler_state.tm = sctx->tm;
-       compiler_state.debug = sctx->b.debug;
+       compiler_state.debug = sctx->debug;
        compiler_state.is_debug_context = sctx->is_debug;
 
        /* Update stages before GS. */