aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarius Vlad <marius.vlad@collabora.com>2020-06-05 14:00:30 +0300
committerMarius Vlad <marius.vlad@collabora.com>2020-06-08 23:22:46 +0300
commit677b45e1ff759ebf7f63db12eb59f65917537055 (patch)
treeeba95614466ecc971ef15083e80d778018f4d0f1
parentb6610745b8aad74b5cd23e6744286356942f46e1 (diff)
main: Enable remote outputs later than local (DRM) outputs
Will allow the client shell to receive, and to use as primary output, as the local outputs first without the need to (pre-)configure the client shell or the other applications -- making all of the assume the remote output the last sent by the xdg_output protocol. Makes integration much easier and will retain the same functionality we had with weston. Bug-AGL: SPEC-3280 Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: Idc91383aa6edb5f859ead43246906451ed08cd2d
-rw-r--r--src/main.c49
1 files changed, 29 insertions, 20 deletions
diff --git a/src/main.c b/src/main.c
index 613d6ee..590742a 100644
--- a/src/main.c
+++ b/src/main.c
@@ -675,25 +675,12 @@ err:
return ret;
}
-static int
-load_remoting(struct ivi_compositor *ivi, struct weston_config *config)
+static void
+ivi_enable_remote_outputs(struct ivi_compositor *ivi)
{
- struct weston_compositor *compositor = ivi->compositor;
- int (*module_init)(struct weston_compositor *wc);
struct weston_config_section *remote_section = NULL;
const char *section_name;
-
- module_init = weston_load_module("remoting-plugin.so",
- "weston_module_init");
- if (!module_init)
- return -1;
-
- if (module_init(compositor) < 0)
- return -1;
-
- ivi->remoting_api = weston_remoting_get_api(compositor);
- if (!ivi->remoting_api)
- return -1;
+ struct weston_config *config = ivi->config;
while (weston_config_next_section(config, &remote_section, &section_name)) {
if (strcmp(section_name, "remote-output"))
@@ -703,7 +690,8 @@ load_remoting(struct ivi_compositor *ivi, struct weston_config *config)
bool output_found = false;
char *_name = NULL;
- weston_config_section_get_string(remote_section, "name", &_name, NULL);
+ weston_config_section_get_string(remote_section,
+ "name", &_name, NULL);
wl_list_for_each(ivi_output, &ivi->outputs, link) {
if (!strcmp(ivi_output->name, _name)) {
output_found = true;
@@ -722,7 +710,7 @@ load_remoting(struct ivi_compositor *ivi, struct weston_config *config)
ivi_output->name = _name;
ivi_output->config = remote_section;
- if (remote_output_init(ivi_output, compositor,
+ if (remote_output_init(ivi_output, ivi->compositor,
remote_section, ivi->remoting_api)) {
free(ivi_output->name);
free(ivi_output);
@@ -736,12 +724,30 @@ load_remoting(struct ivi_compositor *ivi, struct weston_config *config)
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)
+{
+ struct weston_compositor *compositor = ivi->compositor;
+ int (*module_init)(struct weston_compositor *wc);
+
+ module_init = weston_load_module("remoting-plugin.so",
+ "weston_module_init");
+ if (!module_init)
+ return -1;
+
+ if (module_init(compositor) < 0)
+ return -1;
+
+ ivi->remoting_api = weston_remoting_get_api(compositor);
+ if (!ivi->remoting_api)
+ return -1;
return 0;
}
#else
static int
-load_remoting(struct weston_compositor *compositor, struct weston_config *config)
+load_remoting_plugin(struct weston_compositor *compositor, struct weston_config *config)
{
return -1;
}
@@ -794,7 +800,7 @@ load_drm_backend(struct ivi_compositor *ivi, int *argc, char *argv[])
goto error;
}
- load_remoting(ivi, ivi->config);
+ load_remoting_plugin(ivi, ivi->config);
error:
free(config.gbm_format);
@@ -1472,6 +1478,9 @@ int main(int argc, char *argv[])
ivi_shell_init_black_fs(&ivi);
+ if (ivi.remoting_api)
+ ivi_enable_remote_outputs(&ivi);
+
if (create_listening_socket(display, socket_name) < 0)
goto error_compositor;