diff --git a/compositor/main.c b/compositor/main.c index 090bb251..b14c8dc3 100644 --- a/compositor/main.c +++ b/compositor/main.c @@ -3039,10 +3039,10 @@ int main(int argc, char *argv[]) } segv_compositor = wet.compositor; - log_scope = weston_compositor_add_debug_scope(wet.compositor, "log", + log_scope = weston_compositor_add_debug_scope(wdc, "log", "Weston and Wayland log\n", NULL, NULL); protocol_scope = - weston_compositor_add_debug_scope(wet.compositor, + weston_compositor_add_debug_scope(wdc, "proto", "Wayland protocol dump for all clients.\n", NULL, NULL); diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c index bbeb1cfb..0e5cabef 100644 --- a/libweston/compositor-drm.c +++ b/libweston/compositor-drm.c @@ -7499,7 +7499,8 @@ drm_backend_create(struct weston_compositor *compositor, b->pageflip_timeout = config->pageflip_timeout; b->use_pixman_shadow = config->use_pixman_shadow; - b->debug = weston_compositor_add_debug_scope(compositor, "drm-backend", + b->debug = weston_compositor_add_debug_scope(compositor->weston_debug, + "drm-backend", "Debug messages from DRM/KMS backend\n", NULL, NULL); diff --git a/libweston/compositor.c b/libweston/compositor.c index 050f37f6..bbaaadad 100644 --- a/libweston/compositor.c +++ b/libweston/compositor.c @@ -6889,7 +6889,7 @@ weston_compositor_create(struct wl_display *display, timeline_key_binding_handler, ec); ec->debug_scene = - weston_compositor_add_debug_scope(ec, "scene-graph", + weston_compositor_add_debug_scope(ec->weston_debug, "scene-graph", "Scene graph details\n", debug_scene_graph_cb, ec); diff --git a/libweston/weston-debug.c b/libweston/weston-debug.c index f859ca85..e183d01c 100644 --- a/libweston/weston-debug.c +++ b/libweston/weston-debug.c @@ -349,16 +349,15 @@ weston_debug_compositor_destroy(struct weston_compositor *compositor) WL_EXPORT void weston_compositor_enable_debug_protocol(struct weston_compositor *compositor) { - struct weston_debug_compositor *wdc = compositor->weston_debug; - - assert(wdc); - if (wdc->global) + struct weston_log_context *log_ctx = compositor->weston_log_ctx; + assert(log_ctx); + if (log_ctx->global) return; - wdc->global = wl_global_create(compositor->wl_display, + log_ctx->global = wl_global_create(compositor->wl_display, &weston_debug_v1_interface, 1, - wdc, bind_weston_debug); - if (!wdc->global) + log_ctx, bind_weston_debug); + if (!log_ctx->global) return; weston_log("WARNING: debug protocol has been enabled. " @@ -378,7 +377,7 @@ weston_compositor_is_debug_protocol_enabled(struct weston_compositor *wc) /** Register a new debug stream name, creating a debug scope * - * \param compositor The libweston compositor where to add. + * \param wdc The weston_debug_compositor where to add. * \param name The debug stream/scope name; must not be NULL. * \param desc The debug scope description for humans; must not be NULL. * \param begin_cb Optional callback when a client subscribes to this scope. @@ -411,21 +410,19 @@ weston_compositor_is_debug_protocol_enabled(struct weston_compositor *wc) * \sa weston_debug_stream, weston_debug_scope_cb */ WL_EXPORT struct weston_debug_scope * -weston_compositor_add_debug_scope(struct weston_compositor *compositor, +weston_compositor_add_debug_scope(struct weston_debug_compositor *wdc, const char *name, const char *description, weston_debug_scope_cb begin_cb, void *user_data) { - struct weston_debug_compositor *wdc; struct weston_debug_scope *scope; - if (!compositor || !name || !description) { + if (!name || !description) { weston_log("Error: cannot add a debug scope without name or description.\n"); return NULL; } - wdc = compositor->weston_debug; if (!wdc) { weston_log("Error: cannot add debug scope '%s', infra not initialized.\n", name); diff --git a/libweston/weston-debug.h b/libweston/weston-debug.h index 15775250..7b8c884e 100644 --- a/libweston/weston-debug.h +++ b/libweston/weston-debug.h @@ -35,6 +35,8 @@ extern "C" { #endif struct weston_compositor; +struct weston_debug_compositor; +struct wl_display; void weston_compositor_enable_debug_protocol(struct weston_compositor *); @@ -58,7 +60,7 @@ typedef void (*weston_debug_scope_cb)(struct weston_debug_stream *stream, void *user_data); struct weston_debug_scope * -weston_compositor_add_debug_scope(struct weston_compositor *compositor, +weston_compositor_add_debug_scope(struct weston_debug_compositor *compositor, const char *name, const char *description, weston_debug_scope_cb begin_cb, diff --git a/xwayland/launcher.c b/xwayland/launcher.c index d71be145..f406df00 100644 --- a/xwayland/launcher.c +++ b/xwayland/launcher.c @@ -394,10 +394,11 @@ weston_module_init(struct weston_compositor *compositor) wxs->destroy_listener.notify = weston_xserver_destroy; wl_signal_add(&compositor->destroy_signal, &wxs->destroy_listener); - wxs->wm_debug = weston_compositor_add_debug_scope(wxs->compositor, - "xwm-wm-x11", - "XWM's window management X11 events\n", - NULL, NULL); + wxs->wm_debug = + weston_compositor_add_debug_scope(wxs->compositor->weston_debug, + "xwm-wm-x11", + "XWM's window management X11 events\n", + NULL, NULL); return 0; }