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[])
}
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);
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
......@@ -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,
......
......@@ -394,7 +394,8 @@ 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,
wxs->wm_debug =
weston_compositor_add_debug_scope(wxs->compositor->weston_debug,
"xwm-wm-x11",
"XWM's window management X11 events\n",
NULL, NULL);
......
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