main: Add support loading waltham transmitter plug-in 35/25435/3
authorMarius Vlad <marius.vlad@collabora.com>
Fri, 2 Oct 2020 18:28:51 +0000 (21:28 +0300)
committerMarius Vlad <marius.vlad@collabora.com>
Thu, 5 Nov 2020 08:41:32 +0000 (10:41 +0200)
This is the same as the remoting plug-in, given that we'll be using the
remoting plug-in to create the remoting output.

The difference would be that instead of the 'remoting-output' section
we'll use 'transmitter-output', with all other section specific being
the same. For instance, using agl-shell-app-id we can instruct the
application to be assigned to that 'transmitter-output'.

Bug-AGL: SPEC-3611

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: Ic16b6b9672802f4f83be121385c0798b9dbe08e9

meson.build
src/ivi-compositor.h
src/main.c

index ab4f086..34f8558 100644 (file)
@@ -59,10 +59,28 @@ foreach depname : depnames
   if not dep.found()
     message('Remoting requires @0@ which was not found. '.format(depname))
   endif
-deps_remoting += dep
+  deps_remoting += dep
 endforeach
 
 
+# the transmitter plug-in requires waltham but we don't have a cflags or libs
+# for it so we add waltham depends here. Further more, the output is being
+# handled by remoting plug-in
+depnames_waltham = [
+  'waltham'
+]
+
+deps_waltham = []
+foreach depname : depnames_waltham
+  dep = dependency(depname, required: false)
+  if not dep.found()
+    message('Waltham requires @0@ which was not found. '.format(depname))
+  endif
+  deps_waltham += dep
+endforeach
+
+deps_waltham += deps_remoting
+
 agl_shell_xml = files('protocol/agl-shell.xml')
 agl_shell_desktop_xml = files('protocol/agl-shell-desktop.xml')
 agl_screenshooter = files('protocol/agl-screenshooter.xml')
@@ -197,6 +215,11 @@ if deps_remoting.length() == depnames.length()
   message('Found remoting depends, enabling remoting')
 endif
 
+if deps_waltham.length() == depnames_waltham.length() + depnames.length()
+  config_h.set('HAVE_WALTHAM', 1)
+  message('Found waltham depends, enabling waltham')
+endif
+
 if dep_libsmack.found()
   config_h.set('HAVE_SMACK', 1)
   deps_libweston += dep_libsmack
index 0c9d604..50e516b 100644 (file)
@@ -70,6 +70,7 @@ struct ivi_compositor {
        const struct weston_windowed_output_api *window_api;
        const struct weston_drm_output_api *drm_api;
        const struct weston_remoting_api *remoting_api;
+       const struct weston_transmitter_api *waltham_transmitter_api;
 
        struct wl_global *agl_shell;
        struct wl_global *agl_shell_desktop;
index 8492f54..6580abc 100644 (file)
 #include "remote.h"
 #endif
 
+#ifdef HAVE_WALTHAM
+#include <waltham-transmitter/transmitter_api.h>
+#endif
+
 static int cached_tm_mday = -1;
 static struct weston_log_scope *log_scope;
 
@@ -563,6 +567,38 @@ heads_changed(struct wl_listener *listener, void *arg)
        }
 }
 
+#ifdef HAVE_WALTHAM
+static int
+load_waltham_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("waltham-transmitter.so",
+                                        "wet_module_init");
+       if (!module_init)
+               return -1;
+
+       if (module_init(compositor) < 0)
+               return -1;
+
+       ivi->waltham_transmitter_api = weston_get_transmitter_api(compositor);
+       if (!ivi->waltham_transmitter_api) {
+               weston_log("Failed to load waltham-transmitter plugin.\n");
+               return -1;
+       }
+
+       weston_log("waltham-transmitter plug-in loaded\n");
+       return 0;
+}
+#else
+static int
+load_waltham_plugin(struct ivi_compositor *ivi, struct weston_config *config)
+{
+       return -1;
+}
+#endif
+
 #ifdef HAVE_REMOTING
 static int
 drm_backend_remoted_output_configure(struct weston_output *output,
@@ -809,6 +845,7 @@ load_drm_backend(struct ivi_compositor *ivi, int *argc, char *argv[])
        }
 
        load_remoting_plugin(ivi, ivi->config);
+       load_waltham_plugin(ivi, ivi->config);
 
 error:
        free(config.gbm_format);