libweston: move weston_compositor_shutdown call out of backends
If we want to support multiple backends, the compositor must take care to call this once, at the appropriate moment, so stop letting the backends handle compositor shutdown themselves. Move the weston_compositor_shutdown() calls from the backend::destroy callbacks into weston_compositor_destroy() and the calls in the backend creation error paths into weston_compositor_load_backend(). Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
This commit is contained in:
parent
fcde7fae66
commit
90c11cf40e
|
@ -3260,8 +3260,6 @@ drm_destroy(struct weston_backend *backend)
|
||||||
struct drm_crtc *crtc, *crtc_tmp;
|
struct drm_crtc *crtc, *crtc_tmp;
|
||||||
struct drm_writeback *writeback, *writeback_tmp;
|
struct drm_writeback *writeback, *writeback_tmp;
|
||||||
|
|
||||||
weston_compositor_shutdown(ec);
|
|
||||||
|
|
||||||
wl_list_for_each_safe(crtc, crtc_tmp, &b->drm->crtc_list, link)
|
wl_list_for_each_safe(crtc, crtc_tmp, &b->drm->crtc_list, link)
|
||||||
drm_crtc_destroy(crtc);
|
drm_crtc_destroy(crtc);
|
||||||
|
|
||||||
|
@ -4021,7 +4019,6 @@ err_udev:
|
||||||
err_launcher:
|
err_launcher:
|
||||||
weston_launcher_destroy(compositor->launcher);
|
weston_launcher_destroy(compositor->launcher);
|
||||||
err_compositor:
|
err_compositor:
|
||||||
weston_compositor_shutdown(compositor);
|
|
||||||
#ifdef BUILD_DRM_GBM
|
#ifdef BUILD_DRM_GBM
|
||||||
if (b->gbm)
|
if (b->gbm)
|
||||||
gbm_device_destroy(b->gbm);
|
gbm_device_destroy(b->gbm);
|
||||||
|
|
|
@ -506,8 +506,6 @@ headless_destroy(struct weston_backend *backend)
|
||||||
struct weston_compositor *ec = b->compositor;
|
struct weston_compositor *ec = b->compositor;
|
||||||
struct weston_head *base, *next;
|
struct weston_head *base, *next;
|
||||||
|
|
||||||
weston_compositor_shutdown(ec);
|
|
||||||
|
|
||||||
wl_list_for_each_safe(base, next, &ec->head_list, compositor_link) {
|
wl_list_for_each_safe(base, next, &ec->head_list, compositor_link) {
|
||||||
if (to_headless_head(base))
|
if (to_headless_head(base))
|
||||||
headless_head_destroy(base);
|
headless_head_destroy(base);
|
||||||
|
@ -625,8 +623,6 @@ headless_backend_create(struct weston_compositor *compositor,
|
||||||
err_input:
|
err_input:
|
||||||
if (b->theme)
|
if (b->theme)
|
||||||
theme_destroy(b->theme);
|
theme_destroy(b->theme);
|
||||||
|
|
||||||
weston_compositor_shutdown(compositor);
|
|
||||||
err_free:
|
err_free:
|
||||||
free(b);
|
free(b);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -645,8 +645,6 @@ pipewire_destroy(struct weston_backend *base)
|
||||||
weston_log_scope_destroy(b->debug);
|
weston_log_scope_destroy(b->debug);
|
||||||
b->debug = NULL;
|
b->debug = NULL;
|
||||||
|
|
||||||
weston_compositor_shutdown(ec);
|
|
||||||
|
|
||||||
pw_loop_leave(b->loop);
|
pw_loop_leave(b->loop);
|
||||||
pw_loop_destroy(b->loop);
|
pw_loop_destroy(b->loop);
|
||||||
wl_event_source_remove(b->loop_source);
|
wl_event_source_remove(b->loop_source);
|
||||||
|
@ -1098,8 +1096,6 @@ pipewire_backend_create(struct weston_compositor *compositor,
|
||||||
return backend;
|
return backend;
|
||||||
|
|
||||||
err_compositor:
|
err_compositor:
|
||||||
weston_compositor_shutdown(compositor);
|
|
||||||
|
|
||||||
free(backend);
|
free(backend);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -740,8 +740,6 @@ rdp_destroy(struct weston_backend *backend)
|
||||||
b->verbose = NULL;
|
b->verbose = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
weston_compositor_shutdown(ec);
|
|
||||||
|
|
||||||
wl_list_for_each_safe(base, next, &ec->head_list, compositor_link) {
|
wl_list_for_each_safe(base, next, &ec->head_list, compositor_link) {
|
||||||
if (to_rdp_head(base))
|
if (to_rdp_head(base))
|
||||||
rdp_head_destroy(base);
|
rdp_head_destroy(base);
|
||||||
|
@ -2035,8 +2033,6 @@ err_compositor:
|
||||||
if (to_rdp_head(base))
|
if (to_rdp_head(base))
|
||||||
rdp_head_destroy(base);
|
rdp_head_destroy(base);
|
||||||
}
|
}
|
||||||
|
|
||||||
weston_compositor_shutdown(compositor);
|
|
||||||
err_free_strings:
|
err_free_strings:
|
||||||
if (b->clipboard_debug)
|
if (b->clipboard_debug)
|
||||||
weston_log_scope_destroy(b->clipboard_debug);
|
weston_log_scope_destroy(b->clipboard_debug);
|
||||||
|
|
|
@ -884,8 +884,6 @@ vnc_destroy(struct weston_backend *base)
|
||||||
struct weston_compositor *ec = backend->compositor;
|
struct weston_compositor *ec = backend->compositor;
|
||||||
struct weston_head *head, *next;
|
struct weston_head *head, *next;
|
||||||
|
|
||||||
weston_compositor_shutdown(ec);
|
|
||||||
|
|
||||||
wl_event_source_remove(backend->aml_event);
|
wl_event_source_remove(backend->aml_event);
|
||||||
|
|
||||||
aml_unref(backend->aml);
|
aml_unref(backend->aml);
|
||||||
|
@ -1344,7 +1342,6 @@ err_output:
|
||||||
wl_list_for_each_safe(base, next, &compositor->head_list, compositor_link)
|
wl_list_for_each_safe(base, next, &compositor->head_list, compositor_link)
|
||||||
vnc_head_destroy(base);
|
vnc_head_destroy(base);
|
||||||
err_compositor:
|
err_compositor:
|
||||||
weston_compositor_shutdown(compositor);
|
|
||||||
free(backend);
|
free(backend);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2756,8 +2756,6 @@ wayland_destroy(struct weston_backend *backend)
|
||||||
struct wayland_parent_output *output, *next_output;
|
struct wayland_parent_output *output, *next_output;
|
||||||
struct wayland_input *input, *next_input;
|
struct wayland_input *input, *next_input;
|
||||||
|
|
||||||
weston_compositor_shutdown(ec);
|
|
||||||
|
|
||||||
wl_list_for_each_safe(base, next, &ec->head_list, compositor_link) {
|
wl_list_for_each_safe(base, next, &ec->head_list, compositor_link) {
|
||||||
if (to_wayland_head(base))
|
if (to_wayland_head(base))
|
||||||
wayland_head_destroy(base);
|
wayland_head_destroy(base);
|
||||||
|
@ -2961,7 +2959,6 @@ err_renderer:
|
||||||
err_display:
|
err_display:
|
||||||
wl_display_disconnect(b->parent.wl_display);
|
wl_display_disconnect(b->parent.wl_display);
|
||||||
err_compositor:
|
err_compositor:
|
||||||
weston_compositor_shutdown(compositor);
|
|
||||||
free(b->formats);
|
free(b->formats);
|
||||||
free(b);
|
free(b);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -2978,7 +2975,6 @@ wayland_backend_destroy(struct wayland_backend *b)
|
||||||
cairo_device_destroy(b->frame_device);
|
cairo_device_destroy(b->frame_device);
|
||||||
wl_cursor_theme_destroy(b->cursor_theme);
|
wl_cursor_theme_destroy(b->cursor_theme);
|
||||||
|
|
||||||
weston_compositor_shutdown(b->compositor);
|
|
||||||
cleanup_after_cairo();
|
cleanup_after_cairo();
|
||||||
free(b->formats);
|
free(b->formats);
|
||||||
free(b);
|
free(b);
|
||||||
|
|
|
@ -1844,8 +1844,6 @@ x11_destroy(struct weston_backend *base)
|
||||||
struct weston_compositor *ec = backend->compositor;
|
struct weston_compositor *ec = backend->compositor;
|
||||||
struct weston_head *head, *next;
|
struct weston_head *head, *next;
|
||||||
|
|
||||||
weston_compositor_shutdown(ec); /* destroys outputs, too */
|
|
||||||
|
|
||||||
wl_list_for_each_safe(head, next, &ec->head_list, compositor_link) {
|
wl_list_for_each_safe(head, next, &ec->head_list, compositor_link) {
|
||||||
if (to_x11_head(head))
|
if (to_x11_head(head))
|
||||||
x11_head_destroy(head);
|
x11_head_destroy(head);
|
||||||
|
|
|
@ -8714,7 +8714,7 @@ fail:
|
||||||
/** weston_compositor_shutdown
|
/** weston_compositor_shutdown
|
||||||
* \ingroup compositor
|
* \ingroup compositor
|
||||||
*/
|
*/
|
||||||
WL_EXPORT void
|
static void
|
||||||
weston_compositor_shutdown(struct weston_compositor *ec)
|
weston_compositor_shutdown(struct weston_compositor *ec)
|
||||||
{
|
{
|
||||||
struct weston_output *output, *next;
|
struct weston_output *output, *next;
|
||||||
|
@ -9091,6 +9091,8 @@ weston_compositor_destroy(struct weston_compositor *compositor)
|
||||||
if (compositor->backend && compositor->backend->shutdown)
|
if (compositor->backend && compositor->backend->shutdown)
|
||||||
compositor->backend->shutdown(compositor->backend);
|
compositor->backend->shutdown(compositor->backend);
|
||||||
|
|
||||||
|
weston_compositor_shutdown(compositor);
|
||||||
|
|
||||||
if (compositor->backend)
|
if (compositor->backend)
|
||||||
compositor->backend->destroy(compositor->backend);
|
compositor->backend->destroy(compositor->backend);
|
||||||
|
|
||||||
|
@ -9196,6 +9198,7 @@ weston_compositor_load_backend(struct weston_compositor *compositor,
|
||||||
|
|
||||||
if (backend_init(compositor, config_base) < 0) {
|
if (backend_init(compositor, config_base) < 0) {
|
||||||
compositor->backend = NULL;
|
compositor->backend = NULL;
|
||||||
|
weston_compositor_shutdown(compositor);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -243,8 +243,6 @@ weston_compositor_set_presentation_clock(struct weston_compositor *compositor,
|
||||||
int
|
int
|
||||||
weston_compositor_set_presentation_clock_software(
|
weston_compositor_set_presentation_clock_software(
|
||||||
struct weston_compositor *compositor);
|
struct weston_compositor *compositor);
|
||||||
void
|
|
||||||
weston_compositor_shutdown(struct weston_compositor *ec);
|
|
||||||
|
|
||||||
void
|
void
|
||||||
weston_compositor_xkb_destroy(struct weston_compositor *ec);
|
weston_compositor_xkb_destroy(struct weston_compositor *ec);
|
||||||
|
|
Loading…
Reference in New Issue