From 3f05a28017b2e04cff63c96225adf5a4fc322cc1 Mon Sep 17 00:00:00 2001 From: Marius Vlad Date: Wed, 14 Oct 2020 13:58:57 +0300 Subject: [PATCH] main: Create a remoting output if the waltham plug-in has been loaded The waltham-transmitter will no longer create an output on its own so we'll re-use the remoting plug-in for streaming out the buffers to the remoting side. Bug-AGL: 3601 Signed-off-by: Marius Vlad Change-Id: I6f85c3dfc54e81e8fa05f518b77fae24334fafc1 --- src/main.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/src/main.c b/src/main.c index 431d1d4..4a2ffca 100644 --- a/src/main.c +++ b/src/main.c @@ -771,6 +771,58 @@ ivi_enable_remote_outputs(struct ivi_compositor *ivi) } } +static void +ivi_enable_waltham_outputs(struct ivi_compositor *ivi) +{ + struct weston_config_section *transmitter_section = NULL; + const char *sect_name; + struct weston_config *config = ivi->config; + + while (weston_config_next_section(config, &transmitter_section, §_name)) { + if (strcmp(sect_name, "transmitter-output")) + continue; + + struct ivi_output *ivi_output = NULL; + bool output_found = false; + char *_name = NULL; + + weston_config_section_get_string(transmitter_section, + "name", &_name, NULL); + wl_list_for_each(ivi_output, &ivi->outputs, link) { + if (!strcmp(ivi_output->name, _name)) { + output_found = true; + break; + } + } + + if (output_found) { + free(_name); + continue; + } + + ivi_output = zalloc(sizeof(*ivi_output)); + + ivi_output->ivi = ivi; + ivi_output->name = _name; + ivi_output->config = transmitter_section; + + if (remote_output_init(ivi_output, ivi->compositor, + transmitter_section, ivi->remoting_api)) { + free(ivi_output->name); + free(ivi_output); + continue; + } + + ivi_output->type = OUTPUT_WALTHAM; + ivi_output->output_destroy.notify = handle_output_destroy; + weston_output_add_destroy_listener(ivi_output->output, + &ivi_output->output_destroy); + + wl_list_insert(&ivi->outputs, &ivi_output->link); + ivi_output_configure_app_id(ivi_output); + } +} + static int load_remoting_plugin(struct ivi_compositor *ivi, struct weston_config *config) { @@ -1531,6 +1583,9 @@ int main(int argc, char *argv[]) if (ivi.remoting_api) ivi_enable_remote_outputs(&ivi); + if (ivi.waltham_transmitter_api) + ivi_enable_waltham_outputs(&ivi); + if (create_listening_socket(display, socket_name) < 0) goto error_compositor; -- 2.16.6