r300: Use u_default_set_debug_callback
authorAlyssa Rosenzweig <alyssa@collabora.com>
Wed, 31 Aug 2022 18:30:32 +0000 (14:30 -0400)
committerMarge Bot <emma+marge@anholt.net>
Thu, 1 Sep 2022 14:50:24 +0000 (14:50 +0000)
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Pavel Ondračka <pavel.ondracka@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18351>

src/gallium/drivers/r300/r300_context.c
src/gallium/drivers/r300/r300_context.h
src/gallium/drivers/r300/r300_fs.c
src/gallium/drivers/r300/r300_vs.c

index f45dbf7..7773a18 100644 (file)
@@ -25,6 +25,7 @@
 #include "util/u_memory.h"
 #include "util/u_sampler.h"
 #include "util/u_upload_mgr.h"
+#include "util/u_debug_cb.h"
 #include "util/os_time.h"
 #include "vl/vl_decoder.h"
 #include "vl/vl_video_buffer.h"
@@ -367,18 +368,6 @@ static void r300_init_states(struct pipe_context *pipe)
     }
 }
 
-static void
-r300_set_debug_callback(struct pipe_context *context,
-                        const struct util_debug_callback *cb)
-{
-    struct r300_context *r300 = r300_context(context);
-
-    if (cb)
-        r300->debug = *cb;
-    else
-        memset(&r300->debug, 0, sizeof(r300->debug));
-}
-
 struct pipe_context* r300_create_context(struct pipe_screen* screen,
                                          void *priv, unsigned flags)
 {
@@ -394,7 +383,7 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
 
     r300->context.screen = screen;
     r300->context.priv = priv;
-    r300->context.set_debug_callback = r300_set_debug_callback;
+    r300->context.set_debug_callback = u_default_set_debug_callback;
 
     r300->context.destroy = r300_destroy_context;
 
index 60016a3..a822880 100644 (file)
@@ -547,8 +547,6 @@ struct r300_context {
     /* Occlusion query. */
     struct r300_atom query_start;
 
-    struct util_debug_callback debug;
-
     /* The pointers to the first and the last atom. */
     struct r300_atom *first_dirty, *last_dirty;
 
index 934f230..13abe6f 100644 (file)
@@ -432,7 +432,7 @@ static void r300_translate_fragment_shader(
     compiler.code = &shader->code;
     compiler.state = shader->compare_state;
     if (!shader->dummy)
-        compiler.Base.debug = &r300->debug;
+        compiler.Base.debug = &r300->context.debug;
     compiler.Base.is_r500 = r300->screen->caps.is_r500;
     compiler.Base.is_r400 = r300->screen->caps.is_r400;
     compiler.Base.disable_optimizations = DBG_ON(r300, DBG_NO_OPT);
index 776d838..2ffaf62 100644 (file)
@@ -195,7 +195,7 @@ void r300_translate_vertex_shader(struct r300_context *r300,
     DBG_ON(r300, DBG_VP) ? compiler.Base.Debug |= RC_DBG_LOG : 0;
     compiler.code = &vs->code;
     compiler.UserData = vs;
-    compiler.Base.debug = &r300->debug;
+    compiler.Base.debug = &r300->context.debug;
     compiler.Base.is_r500 = r300->screen->caps.is_r500;
     compiler.Base.disable_optimizations = DBG_ON(r300, DBG_NO_OPT);
     compiler.Base.has_half_swizzles = FALSE;