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>
This commit is contained in:
Philipp Zabel
2021-05-11 17:22:50 +02:00
committed by Pekka Paalanen
parent 54d7682ee8
commit aab722bb17
5 changed files with 16 additions and 16 deletions
+1 -6
View File
@@ -67,7 +67,6 @@ struct weston_pipewire {
struct pipewire_output {
struct weston_output *output;
void (*saved_destroy)(struct weston_output *output);
int (*saved_enable)(struct weston_output *output);
int (*saved_disable)(struct weston_output *output);
int (*saved_start_repaint_loop)(struct weston_output *output);
@@ -316,8 +315,6 @@ pipewire_output_destroy(struct weston_output *base_output)
free(mode);
}
output->saved_destroy(base_output);
pw_stream_destroy(output->stream);
wl_list_remove(&output->link);
@@ -536,14 +533,12 @@ pipewire_output_create(struct weston_compositor *c, char *name)
pw_stream_add_listener(output->stream, &output->stream_listener,
&stream_events, output);
output->output = api->create_output(c, name);
output->output = api->create_output(c, name, pipewire_output_destroy);
if (!output->output) {
weston_log("Cannot create virtual output\n");
goto err;
}
output->saved_destroy = output->output->destroy;
output->output->destroy = pipewire_output_destroy;
output->saved_enable = output->output->enable;
output->output->enable = pipewire_output_enable;
output->saved_disable = output->output->disable;