diff options
author | Philipp Zabel <p.zabel@pengutronix.de> | 2021-05-11 17:22:50 +0200 |
---|---|---|
committer | Pekka Paalanen <pq@iki.fi> | 2022-06-10 09:27:43 +0000 |
commit | aab722bb178584e418eb777392773e36f4647c2e (patch) | |
tree | aa87d51da27838daa8400357fce09c93c257936f /libweston/backend-drm | |
parent | 54d7682ee844e8bdb2fe9fe9ad445eab30a82999 (diff) | |
download | weston-aab722bb178584e418eb777392773e36f4647c2e.tar.gz |
backend-drm: prepare virtual output API for heterogeneous outputs
Stop plugins from overwriting the struct weston_output::destroy vfunc,
as that will be used by backends to recognize their outputs.
Instead, pass a plugin-specific destroy callback when creating the
virtual output.
See: https://gitlab.freedesktop.org/wayland/weston/-/issues/268
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Diffstat (limited to 'libweston/backend-drm')
-rw-r--r-- | libweston/backend-drm/drm-internal.h | 1 | ||||
-rw-r--r-- | libweston/backend-drm/drm-virtual.c | 7 |
2 files changed, 7 insertions, 1 deletions
diff --git a/libweston/backend-drm/drm-internal.h b/libweston/backend-drm/drm-internal.h index 107f91e7..77200f2f 100644 --- a/libweston/backend-drm/drm-internal.h +++ b/libweston/backend-drm/drm-internal.h @@ -579,6 +579,7 @@ struct drm_output { struct wl_event_source *pageflip_timer; bool virtual; + void (*virtual_destroy)(struct weston_output *base); submit_frame_cb virtual_submit_frame; }; diff --git a/libweston/backend-drm/drm-virtual.c b/libweston/backend-drm/drm-virtual.c index d2b4c8e3..8f1d3abf 100644 --- a/libweston/backend-drm/drm-virtual.c +++ b/libweston/backend-drm/drm-virtual.c @@ -259,6 +259,9 @@ drm_virtual_output_destroy(struct weston_output *base) drm_output_state_free(output->state_cur); + if (output->virtual_destroy) + output->virtual_destroy(base); + free(output); } @@ -324,7 +327,8 @@ drm_virtual_output_disable(struct weston_output *base) } static struct weston_output * -drm_virtual_output_create(struct weston_compositor *c, char *name) +drm_virtual_output_create(struct weston_compositor *c, char *name, + void (*destroy_func)(struct weston_output *)) { struct drm_output *output; struct drm_backend *b = to_drm_backend(c); @@ -343,6 +347,7 @@ drm_virtual_output_create(struct weston_compositor *c, char *name) } output->virtual = true; + output->virtual_destroy = destroy_func; output->gbm_bo_flags = GBM_BO_USE_LINEAR | GBM_BO_USE_RENDERING; weston_output_init(&output->base, c, name); |