Commit 1e2fda2e authored by Marius Vlad's avatar Marius Vlad Committed by Daniel Stone

compositor: Convert weston-debug framework to use weston_debug_compositor

Signed-off-by: Marius Vlad's avatarMarius Vlad <marius.vlad@collabora.com>
parent 880b485d
...@@ -3039,10 +3039,10 @@ int main(int argc, char *argv[]) ...@@ -3039,10 +3039,10 @@ int main(int argc, char *argv[])
} }
segv_compositor = wet.compositor; 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); "Weston and Wayland log\n", NULL, NULL);
protocol_scope = protocol_scope =
weston_compositor_add_debug_scope(wet.compositor, weston_compositor_add_debug_scope(wdc,
"proto", "proto",
"Wayland protocol dump for all clients.\n", "Wayland protocol dump for all clients.\n",
NULL, NULL); NULL, NULL);
......
...@@ -7499,7 +7499,8 @@ drm_backend_create(struct weston_compositor *compositor, ...@@ -7499,7 +7499,8 @@ drm_backend_create(struct weston_compositor *compositor,
b->pageflip_timeout = config->pageflip_timeout; b->pageflip_timeout = config->pageflip_timeout;
b->use_pixman_shadow = config->use_pixman_shadow; 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", "Debug messages from DRM/KMS backend\n",
NULL, NULL); NULL, NULL);
......
...@@ -6889,7 +6889,7 @@ weston_compositor_create(struct wl_display *display, ...@@ -6889,7 +6889,7 @@ weston_compositor_create(struct wl_display *display,
timeline_key_binding_handler, ec); timeline_key_binding_handler, ec);
ec->debug_scene = 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", "Scene graph details\n",
debug_scene_graph_cb, debug_scene_graph_cb,
ec); ec);
......
...@@ -349,16 +349,15 @@ weston_debug_compositor_destroy(struct weston_compositor *compositor) ...@@ -349,16 +349,15 @@ weston_debug_compositor_destroy(struct weston_compositor *compositor)
WL_EXPORT void WL_EXPORT void
weston_compositor_enable_debug_protocol(struct weston_compositor *compositor) weston_compositor_enable_debug_protocol(struct weston_compositor *compositor)
{ {
struct weston_debug_compositor *wdc = compositor->weston_debug; struct weston_log_context *log_ctx = compositor->weston_log_ctx;
assert(log_ctx);
assert(wdc); if (log_ctx->global)
if (wdc->global)
return; return;
wdc->global = wl_global_create(compositor->wl_display, log_ctx->global = wl_global_create(compositor->wl_display,
&weston_debug_v1_interface, 1, &weston_debug_v1_interface, 1,
wdc, bind_weston_debug); log_ctx, bind_weston_debug);
if (!wdc->global) if (!log_ctx->global)
return; return;
weston_log("WARNING: debug protocol has been enabled. " weston_log("WARNING: debug protocol has been enabled. "
...@@ -378,7 +377,7 @@ weston_compositor_is_debug_protocol_enabled(struct weston_compositor *wc) ...@@ -378,7 +377,7 @@ weston_compositor_is_debug_protocol_enabled(struct weston_compositor *wc)
/** Register a new debug stream name, creating a debug scope /** 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 name The debug stream/scope name; must not be NULL.
* \param desc The debug scope description for humans; 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. * \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) ...@@ -411,21 +410,19 @@ weston_compositor_is_debug_protocol_enabled(struct weston_compositor *wc)
* \sa weston_debug_stream, weston_debug_scope_cb * \sa weston_debug_stream, weston_debug_scope_cb
*/ */
WL_EXPORT struct weston_debug_scope * 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 *name,
const char *description, const char *description,
weston_debug_scope_cb begin_cb, weston_debug_scope_cb begin_cb,
void *user_data) void *user_data)
{ {
struct weston_debug_compositor *wdc;
struct weston_debug_scope *scope; 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"); weston_log("Error: cannot add a debug scope without name or description.\n");
return NULL; return NULL;
} }
wdc = compositor->weston_debug;
if (!wdc) { if (!wdc) {
weston_log("Error: cannot add debug scope '%s', infra not initialized.\n", weston_log("Error: cannot add debug scope '%s', infra not initialized.\n",
name); name);
......
...@@ -35,6 +35,8 @@ extern "C" { ...@@ -35,6 +35,8 @@ extern "C" {
#endif #endif
struct weston_compositor; struct weston_compositor;
struct weston_debug_compositor;
struct wl_display;
void void
weston_compositor_enable_debug_protocol(struct weston_compositor *); weston_compositor_enable_debug_protocol(struct weston_compositor *);
...@@ -58,7 +60,7 @@ typedef void (*weston_debug_scope_cb)(struct weston_debug_stream *stream, ...@@ -58,7 +60,7 @@ typedef void (*weston_debug_scope_cb)(struct weston_debug_stream *stream,
void *user_data); void *user_data);
struct weston_debug_scope * 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 *name,
const char *description, const char *description,
weston_debug_scope_cb begin_cb, weston_debug_scope_cb begin_cb,
......
...@@ -394,10 +394,11 @@ weston_module_init(struct weston_compositor *compositor) ...@@ -394,10 +394,11 @@ weston_module_init(struct weston_compositor *compositor)
wxs->destroy_listener.notify = weston_xserver_destroy; wxs->destroy_listener.notify = weston_xserver_destroy;
wl_signal_add(&compositor->destroy_signal, &wxs->destroy_listener); wl_signal_add(&compositor->destroy_signal, &wxs->destroy_listener);
wxs->wm_debug = weston_compositor_add_debug_scope(wxs->compositor, wxs->wm_debug =
"xwm-wm-x11", weston_compositor_add_debug_scope(wxs->compositor->weston_debug,
"XWM's window management X11 events\n", "xwm-wm-x11",
NULL, NULL); "XWM's window management X11 events\n",
NULL, NULL);
return 0; return 0;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment