diff options
author | Denys Dmytriyenko <denys@konsulko.com> | 2024-01-30 19:04:13 -0500 |
---|---|---|
committer | Marius Vlad <marius.vlad@collabora.com> | 2024-03-11 19:59:17 +0200 |
commit | 48124d46cd8cc2e0cf68805afdb7cea2c12895c2 (patch) | |
tree | 0fb8347f4f52274f3248a97247a475f4896de461 | |
parent | 6d2720303d8441525ba2e37c9d87daef568f8cdc (diff) |
src: weston_compositor_load_backend now returns backend
And since weston_compositor structure now doesn't provide backend
field, move it to the parent ivi_compositor structure.
Bug-AGL: SPEC-5061
Change-Id: Ia0463ecdf149172c67857131530fc42e56fe5190
Signed-off-by: Denys Dmytriyenko <denys@konsulko.com>
-rw-r--r-- | src/compositor.c | 30 | ||||
-rw-r--r-- | src/ivi-compositor.h | 1 |
2 files changed, 14 insertions, 17 deletions
diff --git a/src/compositor.c b/src/compositor.c index 6097da0..909f771 100644 --- a/src/compositor.c +++ b/src/compositor.c @@ -1076,7 +1076,6 @@ load_drm_backend(struct ivi_compositor *ivi, int *argc, char *argv[], bool force_pixman = false; bool use_shadow; bool without_input = false; - int ret; const struct weston_option options[] = { { WESTON_OPTION_STRING, "seat", 0, &config.seat_id }, @@ -1106,15 +1105,13 @@ load_drm_backend(struct ivi_compositor *ivi, int *argc, char *argv[], if (without_input) ivi->compositor->require_input = !without_input; - ret = weston_compositor_load_backend(ivi->compositor, WESTON_BACKEND_DRM, - &config.base); - if (ret < 0) - return ret; + if (!weston_compositor_load_backend(ivi->compositor, WESTON_BACKEND_DRM, + &config.base)) + return -1; ivi->drm_api = weston_drm_output_get_api(ivi->compositor); if (!ivi->drm_api) { weston_log("Cannot use drm output api.\n"); - ret = -1; goto error; } @@ -1123,7 +1120,7 @@ load_drm_backend(struct ivi_compositor *ivi, int *argc, char *argv[], error: free(config.gbm_format); free(config.seat_id); - return ret; + return -1; } static void @@ -1179,7 +1176,7 @@ windowed_create_outputs(struct ivi_compositor *ivi, int output_count, continue; } - if (ivi->window_api->create_head(ivi->compositor->backend, output_name) < 0) { + if (ivi->window_api->create_head(ivi->backend, output_name) < 0) { free(output_name); return -1; } @@ -1192,7 +1189,7 @@ windowed_create_outputs(struct ivi_compositor *ivi, int output_count, if (asprintf(&default_output, "%s%d", name_prefix, i) < 0) return -1; - if (ivi->window_api->create_head(ivi->compositor->backend, default_output) < 0) { + if (ivi->window_api->create_head(ivi->backend, default_output) < 0) { free(default_output); return -1; } @@ -1217,7 +1214,6 @@ load_wayland_backend(struct ivi_compositor *ivi, int *argc, char *argv[], int sprawl = 0; int output_count; bool force_pixman = false; - int ret; const struct weston_option options[] = { { WESTON_OPTION_STRING, "display", 0, &config.display_name }, @@ -1236,14 +1232,14 @@ load_wayland_backend(struct ivi_compositor *ivi, int *argc, char *argv[], weston_config_section_get_int(section, "cursor-size", &config.cursor_size, 32); - ret = weston_compositor_load_backend(ivi->compositor, WESTON_BACKEND_WAYLAND, - &config.base); + ivi->backend = weston_compositor_load_backend(ivi->compositor, WESTON_BACKEND_WAYLAND, + &config.base); free(config.cursor_theme); free(config.display_name); - if (ret < 0) - return ret; + if (!ivi->backend) + return -1; ivi->window_api = weston_windowed_output_get_api(ivi->compositor); @@ -1970,12 +1966,12 @@ copy_command_line(int argc, char * const argv[]) } #if !defined(BUILD_XWAYLAND) -int +void * wet_load_xwayland(struct weston_compositor *comp) { weston_log("Attempted to load xwayland library but compositor " "was *not* built with xwayland support!\n"); - return -1; + return NULL; } #endif @@ -2182,7 +2178,7 @@ int wet_main(int argc, char *argv[], const struct weston_testsuite_data *test_da goto error_compositor; if (xwayland) { - if (wet_load_xwayland(ivi.compositor) < 0) + if (!wet_load_xwayland(ivi.compositor)) goto error_compositor; } diff --git a/src/ivi-compositor.h b/src/ivi-compositor.h index 693c6d1..026df71 100644 --- a/src/ivi-compositor.h +++ b/src/ivi-compositor.h @@ -60,6 +60,7 @@ struct ivi_output_config { struct ivi_compositor { struct weston_compositor *compositor; + struct weston_backend *backend; struct weston_config *config; struct ivi_output_config *parsed_options; |