libweston: store backends in a list
In preparation for multi-backend support, add a list of backends to the weston_compositor structure. Until backends are converted, this list just contains the single weston_compositor::backend. Keep that pointer for now, until the conversion is complete. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
This commit is contained in:
parent
08018d3a28
commit
76372375ab
@ -1440,6 +1440,8 @@ struct weston_compositor {
|
||||
const struct pixel_format_info *read_format;
|
||||
|
||||
struct weston_backend *backend;
|
||||
struct wl_list backend_list;
|
||||
|
||||
struct weston_launcher *launcher;
|
||||
|
||||
struct weston_dmabuf_feedback *default_dmabuf_feedback;
|
||||
|
@ -40,6 +40,8 @@
|
||||
struct weston_hdr_metadata_type1;
|
||||
|
||||
struct weston_backend {
|
||||
struct wl_list link; /**< in weston_compositor::backend_list */
|
||||
|
||||
/** Bitfield of supported presentation clocks
|
||||
*
|
||||
* Bit positions correspond to system clock IDs.
|
||||
|
@ -8973,6 +8973,8 @@ weston_compositor_create(struct wl_display *display,
|
||||
wl_list_init(&ec->debug_binding_list);
|
||||
wl_list_init(&ec->tablet_manager_resource_list);
|
||||
|
||||
wl_list_init(&ec->backend_list);
|
||||
|
||||
wl_list_init(&ec->plugin_api_list);
|
||||
|
||||
wl_data_device_manager_init(ec->wl_display);
|
||||
@ -9399,6 +9401,25 @@ weston_compositor_add_destroy_listener_once(struct weston_compositor *compositor
|
||||
return true;
|
||||
}
|
||||
|
||||
static void
|
||||
weston_compositor_shutdown_backends(struct weston_compositor *compositor)
|
||||
{
|
||||
struct weston_backend *backend;
|
||||
|
||||
wl_list_for_each(backend, &compositor->backend_list, link)
|
||||
if (backend->shutdown)
|
||||
backend->shutdown(backend);
|
||||
}
|
||||
|
||||
static void
|
||||
weston_compositor_destroy_backends(struct weston_compositor *compositor)
|
||||
{
|
||||
struct weston_backend *backend, *tmp;
|
||||
|
||||
wl_list_for_each_safe(backend, tmp, &compositor->backend_list, link)
|
||||
backend->destroy(backend);
|
||||
}
|
||||
|
||||
/** Destroys the compositor.
|
||||
*
|
||||
* This function cleans up the compositor state and then destroys it.
|
||||
@ -9417,13 +9438,11 @@ weston_compositor_destroy(struct weston_compositor *compositor)
|
||||
|
||||
weston_compositor_xkb_destroy(compositor);
|
||||
|
||||
if (compositor->backend && compositor->backend->shutdown)
|
||||
compositor->backend->shutdown(compositor->backend);
|
||||
weston_compositor_shutdown_backends(compositor);
|
||||
|
||||
weston_compositor_shutdown(compositor);
|
||||
|
||||
if (compositor->backend)
|
||||
compositor->backend->destroy(compositor->backend);
|
||||
weston_compositor_destroy_backends(compositor);
|
||||
|
||||
/* The backend is responsible for destroying the heads. */
|
||||
assert(wl_list_empty(&compositor->head_list));
|
||||
@ -9530,6 +9549,8 @@ weston_compositor_load_backend(struct weston_compositor *compositor,
|
||||
return -1;
|
||||
}
|
||||
|
||||
wl_list_insert(&compositor->backend_list, &compositor->backend->link);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user