radeonsi: implement pipe_context::set_log_context
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Fri, 4 Aug 2017 13:54:56 +0000 (15:54 +0200)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Tue, 22 Aug 2017 07:50:48 +0000 (09:50 +0200)
We'll add radeonsi-specific code to set_log_context in later patches,
but we may want to log from common code. Hence keep the log pointer
in r600_common_context.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/drivers/radeon/r600_pipe_common.h
src/gallium/drivers/radeonsi/si_pipe.c

index c7e4c8a78801c26ff54b3d75d2b50c686b5218da..af84c788a93c1fd0fc8bb6d722259643791ec8ea 100644 (file)
@@ -47,6 +47,8 @@
 #include "util/u_transfer.h"
 #include "util/u_threaded_context.h"
 
+struct u_log_context;
+
 #define ATI_VENDOR_ID 0x1002
 
 #define R600_RESOURCE_FLAG_TRANSFER            (PIPE_RESOURCE_FLAG_DRV_PRIV << 0)
@@ -652,6 +654,7 @@ struct r600_common_context {
 
        struct pipe_debug_callback      debug;
        struct pipe_device_reset_callback device_reset_callback;
+       struct u_log_context            *log;
 
        void                            *query_result_shader;
 
index 80a77a8f1f2fdba36d1bb85971e9c9871841fc4a..88fa97d3b0e0d35391c6becd010c12e932b38483 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "radeon/radeon_uvd.h"
 #include "util/hash_table.h"
+#include "util/u_log.h"
 #include "util/u_memory.h"
 #include "util/u_suballoc.h"
 #include "util/u_tests.h"
@@ -157,6 +158,13 @@ si_create_llvm_target_machine(struct si_screen *sscreen)
                                       LLVMCodeModelDefault);
 }
 
+static void si_set_log_context(struct pipe_context *ctx,
+                              struct u_log_context *log)
+{
+       struct si_context *sctx = (struct si_context *)ctx;
+       sctx->b.log = log;
+}
+
 static struct pipe_context *si_create_context(struct pipe_screen *screen,
                                               unsigned flags)
 {
@@ -175,6 +183,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_log_context = si_set_log_context;
        sctx->b.set_atom_dirty = (void *)si_set_atom_dirty;
        sctx->screen = sscreen; /* Easy accessing of screen/winsys. */
        sctx->is_debug = (flags & PIPE_CONTEXT_DEBUG) != 0;