libweston: Decouple weston_debug_compositor from weston_compositor
This patch allows initialization of weston-debug/log framework much earlier than weston_compositor, which in turn will provide the option start logging before weston_compositor has been created. Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
This commit is contained in:
committed by
Daniel Stone
parent
bc137e345f
commit
880b485d76
@@ -6782,11 +6782,14 @@ debug_scene_graph_cb(struct weston_debug_stream *stream, void *data)
|
||||
*
|
||||
* \param display The Wayland display to be used.
|
||||
* \param user_data A pointer to an object that can later be retrieved
|
||||
* \param wdc A pointer to weston_debug_compositor
|
||||
* using the \ref weston_compositor_get_user_data function.
|
||||
* \return The compositor instance on success or NULL on failure.
|
||||
*/
|
||||
WL_EXPORT struct weston_compositor *
|
||||
weston_compositor_create(struct wl_display *display, void *user_data)
|
||||
weston_compositor_create(struct wl_display *display,
|
||||
struct weston_debug_compositor *wdc,
|
||||
void *user_data)
|
||||
{
|
||||
struct weston_compositor *ec;
|
||||
struct wl_event_loop *loop;
|
||||
@@ -6840,7 +6843,7 @@ weston_compositor_create(struct wl_display *display, void *user_data)
|
||||
ec, bind_presentation))
|
||||
goto fail;
|
||||
|
||||
if (weston_debug_compositor_create(ec) < 0)
|
||||
if (weston_debug_compositor_setup(ec, wdc) < 0)
|
||||
goto fail;
|
||||
|
||||
if (weston_input_init(ec) != 0)
|
||||
|
||||
+26
-10
@@ -253,6 +253,28 @@ bind_weston_debug(struct wl_client *client,
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Connect weston-compositor structure to weston-debug structure
|
||||
* an vice versa.
|
||||
*
|
||||
* \param compositor
|
||||
* \param wdc
|
||||
* \return 0 on success, -1 on failure
|
||||
*
|
||||
*/
|
||||
int
|
||||
weston_debug_compositor_setup(struct weston_compositor *compositor,
|
||||
struct weston_debug_compositor *wdc)
|
||||
{
|
||||
if (compositor->weston_debug)
|
||||
return -1;
|
||||
|
||||
wdc->compositor = compositor;
|
||||
compositor->weston_debug = wdc;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Initialize weston-debug structure
|
||||
*
|
||||
* \param compositor The libweston compositor.
|
||||
@@ -264,24 +286,18 @@ bind_weston_debug(struct wl_client *client,
|
||||
*
|
||||
* \internal
|
||||
*/
|
||||
int
|
||||
weston_debug_compositor_create(struct weston_compositor *compositor)
|
||||
WL_EXPORT struct weston_debug_compositor *
|
||||
weston_debug_compositor_create(void)
|
||||
{
|
||||
struct weston_debug_compositor *wdc;
|
||||
|
||||
if (compositor->weston_debug)
|
||||
return -1;
|
||||
|
||||
wdc = zalloc(sizeof *wdc);
|
||||
if (!wdc)
|
||||
return -1;
|
||||
return NULL;
|
||||
|
||||
wdc->compositor = compositor;
|
||||
wl_list_init(&wdc->scope_list);
|
||||
|
||||
compositor->weston_debug = wdc;
|
||||
|
||||
return 0;
|
||||
return wdc;
|
||||
}
|
||||
|
||||
/** Destroy weston_debug_compositor structure
|
||||
|
||||
Reference in New Issue
Block a user