X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=src%2Fcompositor.c;h=078157a06b69a9e4c26f0135e71e4deef7bfda5c;hb=refs%2Fheads%2Fnext;hp=3a4b6286040d47fe3d220487157ad22156853df8;hpb=8280cd49161c8f47412ac7cc427ae04b0a1867d2;p=src%2Fagl-compositor.git diff --git a/src/compositor.c b/src/compositor.c index 3a4b628..078157a 100644 --- a/src/compositor.c +++ b/src/compositor.c @@ -73,6 +73,16 @@ to_ivi_compositor(struct weston_compositor *ec) return weston_compositor_get_user_data(ec); } +void +ivi_process_destroy(struct wet_process *process, int status, bool call_cleanup) +{ + wl_list_remove(&process->link); + if (call_cleanup && process->cleanup) + process->cleanup(process, status, process->cleanup_data); + free(process->path); + free(process); +} + struct ivi_output_config * ivi_init_parsed_options(struct weston_compositor *compositor) { @@ -93,6 +103,13 @@ ivi_init_parsed_options(struct weston_compositor *compositor) return config; } +static void +screenshot_allow_all(struct wl_listener *l, struct weston_output_capture_attempt *att) +{ + att->authorized = true; +} + + static void sigint_helper(int sig) { @@ -182,6 +199,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 +258,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 +285,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 +360,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 +371,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; @@ -1075,8 +1103,10 @@ load_drm_backend(struct ivi_compositor *ivi, int *argc, char *argv[], &ivi->heads_changed); if (!weston_compositor_load_backend(ivi->compositor, WESTON_BACKEND_DRM, - &config.base)) + &config.base)) { + weston_log("Failed to load DRM backend\n"); return -1; + } ivi->drm_api = weston_drm_output_get_api(ivi->compositor); if (!ivi->drm_api) { @@ -1175,6 +1205,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, @@ -1182,6 +1214,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); } @@ -1222,8 +1259,12 @@ load_wayland_backend(struct ivi_compositor *ivi, int *argc, char *argv[], weston_compositor_add_heads_changed_listener(ivi->compositor, &ivi->heads_changed); - ivi->backend = weston_compositor_load_backend(ivi->compositor, WESTON_BACKEND_WAYLAND, + ivi->backend = weston_compositor_load_backend(ivi->compositor, + WESTON_BACKEND_WAYLAND, &config.base); + if (!ivi->backend) { + weston_log("Failed to create Wayland backend!\n"); + } free(config.cursor_theme); free(config.display_name); @@ -1250,6 +1291,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, @@ -1257,7 +1300,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 @@ -1294,8 +1343,13 @@ load_x11_backend(struct ivi_compositor *ivi, int *argc, char *argv[], weston_compositor_add_heads_changed_listener(ivi->compositor, &ivi->heads_changed); - if (!weston_compositor_load_backend(ivi->compositor, WESTON_BACKEND_X11, &config.base)) + ivi->backend = weston_compositor_load_backend(ivi->compositor, + WESTON_BACKEND_X11, + &config.base); + if (!ivi->backend) { + weston_log("Failed to create X11 backend!\n"); return -1; + } ivi->window_api = weston_windowed_output_get_api(ivi->compositor); if (!ivi->window_api) { @@ -1321,14 +1375,19 @@ weston_rdp_backend_config_init(struct weston_rdp_backend_config *config) config->base.struct_version = WESTON_RDP_BACKEND_CONFIG_VERSION; config->base.struct_size = sizeof(struct weston_rdp_backend_config); + config->renderer = WESTON_RENDERER_AUTO; config->bind_address = NULL; config->port = 3389; config->rdp_key = NULL; config->server_cert = NULL; config->server_key = NULL; config->env_socket = 0; - config->no_clients_resize = 1; + config->external_listener_fd = -1; + config->no_clients_resize = 0; config->force_no_compression = 0; + config->remotefx_codec = true; + config->refresh_rate = RDP_DEFAULT_FREQ; + } static int @@ -1384,6 +1443,8 @@ rdp_backend_output_configure(struct weston_output *output) new_mode.width = width; new_mode.height = height; + weston_log("Setting modeline to %dx%d\n", width, height); + api->output_set_mode(output, &new_mode); weston_output_set_transform(output, transform); @@ -1391,10 +1452,12 @@ rdp_backend_output_configure(struct weston_output *output) } static int -load_rdp_backend(struct ivi_compositor *ivi, int *argc, char **argv) +load_rdp_backend(struct ivi_compositor *ivi, int *argc, char **argv, + enum weston_renderer_type renderer) { struct weston_rdp_backend_config config = {}; struct weston_config_section *section; + bool no_remotefx_codec = false; struct ivi_output_config *parsed_options = ivi_init_parsed_options(ivi->compositor); if (!parsed_options) @@ -1404,21 +1467,28 @@ load_rdp_backend(struct ivi_compositor *ivi, int *argc, char **argv) const struct weston_option rdp_options[] = { { WESTON_OPTION_BOOLEAN, "env-socket", 0, &config.env_socket }, + { WESTON_OPTION_INTEGER, "external-listener-fd", 0, &config.external_listener_fd }, { WESTON_OPTION_INTEGER, "width", 0, &parsed_options->width }, { WESTON_OPTION_INTEGER, "height", 0, &parsed_options->height }, - { WESTON_OPTION_INTEGER, "transform", 0, &parsed_options->transform }, - { WESTON_OPTION_INTEGER, "scale", 0, &parsed_options->scale }, { WESTON_OPTION_STRING, "address", 0, &config.bind_address }, { WESTON_OPTION_INTEGER, "port", 0, &config.port }, { WESTON_OPTION_BOOLEAN, "no-clients-resize", 0, &config.no_clients_resize }, { WESTON_OPTION_STRING, "rdp4-key", 0, &config.rdp_key }, { WESTON_OPTION_STRING, "rdp-tls-cert", 0, &config.server_cert }, { WESTON_OPTION_STRING, "rdp-tls-key", 0, &config.server_key }, + { WESTON_OPTION_INTEGER, "scale", 0, &parsed_options->scale }, { WESTON_OPTION_BOOLEAN, "force-no-compression", 0, &config.force_no_compression }, + { WESTON_OPTION_BOOLEAN, "no-remotefx-codec", 0, &no_remotefx_codec }, }; + config.remotefx_codec = !no_remotefx_codec; + config.renderer = renderer; + section = weston_config_get_section(ivi->config, "rdp", NULL, NULL); + weston_config_section_get_int(section, "refresh-rate", + &config.refresh_rate, RDP_DEFAULT_FREQ); + weston_config_section_get_string(section, "tls-cert", &config.server_cert, config.server_cert); @@ -1427,6 +1497,7 @@ load_rdp_backend(struct ivi_compositor *ivi, int *argc, char **argv) parse_options(rdp_options, ARRAY_LENGTH(rdp_options), argc, argv); + weston_log("No clients resize: %d\n", config.no_clients_resize); ivi->simple_output_configure = rdp_backend_output_configure; @@ -1435,8 +1506,10 @@ load_rdp_backend(struct ivi_compositor *ivi, int *argc, char **argv) &ivi->heads_changed); if (!weston_compositor_load_backend(ivi->compositor, - WESTON_BACKEND_RDP, &config.base)) + WESTON_BACKEND_RDP, &config.base)) { + weston_log("Failed to create RDP backend\n"); return -1; + } free(config.bind_address); free(config.rdp_key); @@ -1447,7 +1520,8 @@ load_rdp_backend(struct ivi_compositor *ivi, int *argc, char **argv) } #else static int -load_rdp_backend(struct ivi_compositor *ivi, int *argc, char **argv) +load_rdp_backend(struct ivi_compositor *ivi, int *argc, char **argv, + enum weston_renderer_type renderer) { return -1; } @@ -1475,7 +1549,7 @@ load_backend(struct ivi_compositor *ivi, int *argc, char **argv, case WESTON_BACKEND_DRM: return load_drm_backend(ivi, argc, argv, renderer); case WESTON_BACKEND_RDP: - return load_rdp_backend(ivi, argc, argv); + return load_rdp_backend(ivi, argc, argv, renderer); case WESTON_BACKEND_WAYLAND: return load_wayland_backend(ivi, argc, argv, renderer); case WESTON_BACKEND_X11: @@ -1771,7 +1845,7 @@ log_timestamp(char *buf, size_t len) strftime(timestr, sizeof(timestr), "%H:%M:%S", brokendown_time); /* if datestr is empty it prints only timestr*/ - snprintf(buf, len, "%s[%s.%03li]", datestr, + snprintf(buf, len, "%s[%s.%03"PRIi64"]", datestr, timestr, (tv.tv_usec / 1000)); return buf; @@ -1977,6 +2051,7 @@ int wet_main(int argc, char *argv[], const struct weston_testsuite_data *test_da bool xwayland = false; struct sigaction action; char *renderer = NULL; + struct wet_process *process, *process_tmp; const struct weston_option core_options[] = { { WESTON_OPTION_STRING, "renderer", 'r', &renderer }, @@ -2169,8 +2244,11 @@ int wet_main(int argc, char *argv[], const struct weston_testsuite_data *test_da ivi_launch_shell_client(&ivi, "shell-client-ext", &ivi.shell_client_ext.client); - if (debug) - ivi_screenshooter_create(&ivi); + if (debug) { + weston_compositor_add_screenshot_authority(ivi.compositor, + &ivi.screenshot_auth, + screenshot_allow_all); + } ivi_agl_systemd_notify(&ivi); wl_display_run(display); @@ -2195,6 +2273,9 @@ error_compositor: ivi_policy_destroy(ivi.policy); + wl_list_for_each_safe(process, process_tmp, &ivi.child_process_list, link) + ivi_process_destroy(process, 0, false); + error_signals: for (size_t i = 0; i < ARRAY_LENGTH(signals); ++i) if (signals[i])