From 425658e792b354165f82f46638529593c2709448 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Mon, 13 Dec 2021 11:11:38 -0800 Subject: [PATCH] server: set debug callback This redirects virglrenderer logs to syslog. Signed-off-by: Chia-I Wu Reviewed-by: Ryan Neph Reviewed-by: Yiwei Zhang --- server/render_virgl.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/server/render_virgl.c b/server/render_virgl.c index b83caba..5817363 100644 --- a/server/render_virgl.c +++ b/server/render_virgl.c @@ -59,6 +59,14 @@ render_virgl_lookup_context(uint32_t ctx_id) return ctx; } +static void +render_virgl_debug_callback(const char *fmt, va_list ap) +{ + char buf[1024]; + vsnprintf(buf, sizeof(buf), fmt, ap); + render_log(buf); +} + static void render_virgl_cb_write_context_fence(UNUSED void *cookie, uint32_t ctx_id, @@ -130,6 +138,7 @@ render_virgl_init(uint32_t init_flags) } } else { render_virgl_lock_dispatch(); + virgl_set_debug_callback(render_virgl_debug_callback); int ret = virgl_renderer_init(virgl, init_flags, (struct virgl_renderer_callbacks *)&render_virgl_cbs); render_virgl_unlock_dispatch();