summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarius Vlad <marius.vlad@collabora.com>2024-03-11 20:24:30 +0200
committerMarius Vlad <marius.vlad@collabora.com>2024-03-21 14:16:37 +0200
commitbf7c3de795a3d80cb78b8fd5b8640a564fa0155d (patch)
tree06df8235c90dc6b05e717cd24e4be96fa86c6368
parent0ca7f35ae449428e7c2bd969d20a88f03de442bc (diff)
compositor: Adapt loading to latest version
Some missing bits to adapt to loading correctly the backends. Bug-AGL: SPEC-5096, SPEC-5061 Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: Ibc97d9701ca6dfd7326362fcd2dcf3af681ad704
-rw-r--r--src/compositor.c63
-rw-r--r--src/shell.c6
2 files changed, 38 insertions, 31 deletions
diff --git a/src/compositor.c b/src/compositor.c
index 909f771..564c0ec 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -329,8 +329,7 @@ ivi_ensure_output(struct ivi_compositor *ivi, char *name,
if (ivi->simple_output_configure) {
output->output =
- weston_compositor_create_output_with_head(ivi->compositor,
- head);
+ weston_compositor_create_output(ivi->compositor, head, head->name);
if (!output->output) {
free(output->name);
free(output);
@@ -356,7 +355,7 @@ ivi_ensure_output(struct ivi_compositor *ivi, char *name,
} else {
output->output =
- weston_compositor_create_output(ivi->compositor, name);
+ weston_compositor_create_output(ivi->compositor, head, name);
if (!output->output) {
free(output->name);
free(output);
@@ -1105,6 +1104,10 @@ load_drm_backend(struct ivi_compositor *ivi, int *argc, char *argv[],
if (without_input)
ivi->compositor->require_input = !without_input;
+ ivi->heads_changed.notify = heads_changed;
+ weston_compositor_add_heads_changed_listener(ivi->compositor,
+ &ivi->heads_changed);
+
if (!weston_compositor_load_backend(ivi->compositor, WESTON_BACKEND_DRM,
&config.base))
return -1;
@@ -1117,6 +1120,8 @@ load_drm_backend(struct ivi_compositor *ivi, int *argc, char *argv[],
load_remoting_plugin(ivi, ivi->config);
+ return 0;
+
error:
free(config.gbm_format);
free(config.seat_id);
@@ -1286,11 +1291,8 @@ load_x11_backend(struct ivi_compositor *ivi, int *argc, char *argv[],
config.renderer = WESTON_RENDERER_AUTO;
config.no_input = no_input;
- ret = weston_compositor_load_backend(ivi->compositor, WESTON_BACKEND_X11,
- &config.base);
-
- if (ret < 0)
- return ret;
+ if (!weston_compositor_load_backend(ivi->compositor, WESTON_BACKEND_X11, &config.base))
+ return -1;
ivi->window_api = weston_windowed_output_get_api(ivi->compositor);
if (!ivi->window_api) {
@@ -1315,7 +1317,6 @@ load_headless_backend(struct ivi_compositor *ivi, int *argc, char **argv,
enum weston_renderer_type renderer)
{
struct weston_headless_backend_config config = {};
- int ret = 0;
bool force_pixman = false;
bool fullscreen;
@@ -1350,10 +1351,8 @@ load_headless_backend(struct ivi_compositor *ivi, int *argc, char **argv,
config.base.struct_size = sizeof(struct weston_headless_backend_config);
/* load the actual headless-backend and configure it */
- ret = weston_compositor_load_backend(c, WESTON_BACKEND_HEADLESS,
- &config.base);
- if (ret < 0)
- return ret;
+ if (!weston_compositor_load_backend(c, WESTON_BACKEND_HEADLESS, &config.base))
+ return -1;
ivi->window_api = weston_windowed_output_get_api(c);
if (!ivi->window_api) {
@@ -1456,7 +1455,6 @@ static int
load_rdp_backend(struct ivi_compositor *ivi, int *argc, char **argv)
{
struct weston_rdp_backend_config config = {};
- int ret = 0;
struct weston_config_section *section;
struct ivi_output_config *parsed_options = ivi_init_parsed_options(ivi->compositor);
@@ -1492,14 +1490,15 @@ load_rdp_backend(struct ivi_compositor *ivi, int *argc, char **argv)
parse_options(rdp_options, ARRAY_LENGTH(rdp_options), argc, argv);
ivi->simple_output_configure = rdp_backend_output_configure;
- ret = weston_compositor_load_backend(ivi->compositor, WESTON_BACKEND_RDP, &config.base);
+ if (!weston_compositor_load_backend(ivi->compositor, WESTON_BACKEND_RDP, &config.base))
+ return -1;
free(config.bind_address);
free(config.rdp_key);
free(config.server_cert);
free(config.server_key);
- return ret;
+ return 0;
}
#else
static int
@@ -1526,19 +1525,23 @@ load_backend(struct ivi_compositor *ivi, int *argc, char **argv,
weston_log("Error: unknown renderer \"%s\"\n", renderer_name);
return -1;
}
- if (strcmp(backend, "drm-backend.so") == 0) {
- return load_drm_backend(ivi, argc, argv);
- } else if (strcmp(backend, "wayland-backend.so") == 0) {
- return load_wayland_backend(ivi, argc, argv);
- } else if (strcmp(backend, "x11-backend.so") == 0) {
- return load_x11_backend(ivi, argc, argv);
- } else if (strcmp(backend, "headless-backend.so") == 0) {
- return load_headless_backend(ivi, argc, argv);
- } else if (strcmp(backend, "rdp-backend.so") == 0) {
+
+ switch (backend) {
+ case WESTON_BACKEND_DRM:
+ return load_drm_backend(ivi, argc, argv, renderer);
+ case WESTON_BACKEND_HEADLESS:
+ return load_headless_backend(ivi, argc, argv, renderer);
+ case WESTON_BACKEND_RDP:
return load_rdp_backend(ivi, argc, argv);
+ case WESTON_BACKEND_WAYLAND:
+ return load_wayland_backend(ivi, argc, argv, renderer);
+ case WESTON_BACKEND_X11:
+ return load_x11_backend(ivi, argc, argv, renderer);
+ default:
+ assert(!"unknown backend type in load_backend()");
+ }
- weston_log("fatal: unknown backend '%s'.\n", backend_name);
- return -1;
+ return 0;
}
static int
@@ -2151,11 +2154,11 @@ int wet_main(int argc, char *argv[], const struct weston_testsuite_data *test_da
goto error_compositor;
}
- ivi.heads_changed.notify = heads_changed;
- weston_compositor_add_heads_changed_listener(ivi.compositor,
- &ivi.heads_changed);
+ if (weston_compositor_backends_loaded(ivi.compositor) < 0)
+ goto error_compositor;
weston_compositor_flush_heads_changed(ivi.compositor);
+
if (ivi_desktop_init(&ivi) < 0)
goto error_compositor;
diff --git a/src/shell.c b/src/shell.c
index a6c8a5b..3ef24ef 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -1866,6 +1866,7 @@ _ivi_set_shell_surface_split(struct ivi_surface *surface, struct ivi_output *iou
struct weston_view *ev = surface->view;
struct weston_geometry geom = {};
struct ivi_output *output = NULL;
+ struct weston_coord_global pos;
int new_width, new_height;
int x, y;
@@ -1970,7 +1971,10 @@ _ivi_set_shell_surface_split(struct ivi_surface *surface, struct ivi_output *iou
ivi_shell_activate_surface(surface, ivi_seat, WESTON_ACTIVATE_FLAG_NONE);
}
- weston_view_set_position(surface->view, x, y);
+ pos.c.x = x;
+ pos.c.y = y;
+
+ weston_view_set_position(surface->view, pos);
weston_desktop_surface_set_size(surface->dsurface, new_width, new_height);
weston_desktop_surface_set_orientation(surface->dsurface, orientation);
surface->orientation = orientation;