summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarius Vlad <marius.vlad@collabora.com>2024-03-28 13:55:06 +0200
committerMarius Vlad <marius.vlad@collabora.com>2024-03-28 14:40:56 +0200
commit35f6b047373cf5b42ff2d5a11753fcb5c55475b0 (patch)
treec788c6aeaf9534f28a85fe9e9bb8b0f1b0d6b579
parent3514c203c2781bc02cc29c7a57ff30b2b4d9434c (diff)
compositor: Fix loading nested X11/Wayland backendssandbox/mvlad/next-phase-fix-next
The AGL compositor frontend uses ivi_output to denote an output and pass it around, with the implication that's available on retrieval later on. In order for that to actually work, and by the mechanism we are retriving it we need to install a destruction handler a bit earlier, such that is available. Bug-AGL: SPEC-5096, SPEC-5061 Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: I7e5ff1ef72c6c7ab09fc4a252672141879d0a9b2
-rw-r--r--src/compositor.c36
1 files changed, 31 insertions, 5 deletions
diff --git a/src/compositor.c b/src/compositor.c
index cd36eeb..abc7daa 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -182,6 +182,9 @@ to_ivi_output(struct weston_output *o)
struct ivi_output *output;
listener = weston_output_get_destroy_listener(o, handle_output_destroy);
+ if (!listener)
+ return NULL;
+
output = wl_container_of(listener, output, output_destroy);
return output;
@@ -238,6 +241,14 @@ ivi_ensure_output(struct ivi_compositor *ivi, char *name,
return NULL;
}
+ /* simple_output_configure might assume we have an ivi_output created
+ * by this point, which we do but we can only link it to a
+ * weston_output through the destroy listener, so install it earlier
+ * before actually running the callback handler */
+ output->output_destroy.notify = handle_output_destroy;
+ weston_output_add_destroy_listener(output->output,
+ &output->output_destroy);
+
if (ivi->simple_output_configure) {
int ret = ivi->simple_output_configure(output->output);
if (ret < 0) {
@@ -257,12 +268,10 @@ ivi_ensure_output(struct ivi_compositor *ivi, char *name,
}
}
- output->output_destroy.notify = handle_output_destroy;
- weston_output_add_destroy_listener(output->output,
- &output->output_destroy);
wl_list_insert(&ivi->outputs, &output->link);
ivi_output_configure_app_id(output);
+
return output;
}
@@ -334,6 +343,9 @@ ivi_configure_windowed_output_from_config(struct ivi_output *output,
height = defaults->height;
}
free(mode);
+ } else {
+ width = defaults->width;
+ height = defaults->height;
}
scale = defaults->scale;
@@ -342,7 +354,6 @@ ivi_configure_windowed_output_from_config(struct ivi_output *output,
width = ivi->cmdline.width;
if (ivi->cmdline.height)
height = ivi->cmdline.height;
-
if (ivi->cmdline.scale)
scale = ivi->cmdline.scale;
@@ -1177,6 +1188,8 @@ windowed_create_outputs(struct ivi_compositor *ivi, int output_count,
static int
wayland_backend_output_configure(struct weston_output *output)
{
+ struct ivi_output *ivi_output = to_ivi_output(output);
+
struct ivi_output_config defaults = {
.width = WINDOWED_DEFAULT_WIDTH,
.height = WINDOWED_DEFAULT_HEIGHT,
@@ -1184,6 +1197,11 @@ wayland_backend_output_configure(struct weston_output *output)
.transform = WL_OUTPUT_TRANSFORM_NORMAL
};
+ if (!ivi_output) {
+ weston_log("Failed to configure and enable Wayland output. No ivi-output available!\n");
+ return -1;
+ }
+
return ivi_configure_windowed_output_from_config(to_ivi_output(output), &defaults);
}
@@ -1256,6 +1274,8 @@ load_wayland_backend(struct ivi_compositor *ivi, int *argc, char *argv[],
static int
x11_backend_output_configure(struct weston_output *output)
{
+ struct ivi_output *ivi_output = to_ivi_output(output);
+
struct ivi_output_config defaults = {
.width = WINDOWED_DEFAULT_WIDTH,
.height = WINDOWED_DEFAULT_HEIGHT,
@@ -1263,7 +1283,13 @@ x11_backend_output_configure(struct weston_output *output)
.transform = WL_OUTPUT_TRANSFORM_NORMAL
};
- return ivi_configure_windowed_output_from_config(to_ivi_output(output), &defaults);
+ if (!ivi_output) {
+ weston_log("Failed to configure and enable X11 output. No ivi-output available!\n");
+ return -1;
+ }
+
+
+ return ivi_configure_windowed_output_from_config(ivi_output, &defaults);
}
static int