Init waltham loading
authorMarius Vlad <marius.vlad@collabora.com>
Fri, 2 Oct 2020 18:28:51 +0000 (21:28 +0300)
committerMarius Vlad <marius.vlad@collabora.com>
Fri, 2 Oct 2020 18:28:51 +0000 (21:28 +0300)
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: Ic16b6b9672802f4f83be121385c0798b9dbe08e9

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

index ab4f086..2ab3c78 100644 (file)
@@ -53,16 +53,29 @@ depnames = [
   'gobject-2.0', 'glib-2.0'
 ]
 
+depnames_waltham = [
+  'waltham'
+]
+
 deps_remoting = []
 foreach depname : depnames
   dep = dependency(depname, required: false)
   if not dep.found()
     message('Remoting requires @0@ which was not found. '.format(depname))
   endif
-deps_remoting += dep
+  deps_remoting += dep
 endforeach
 
 
+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
+
 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 +210,11 @@ if deps_remoting.length() == depnames.length()
   message('Found remoting depends, enabling remoting')
 endif
 
+if deps_waltham.length() == depnames_waltham.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 4708b5d..ea80b1a 100644 (file)
@@ -70,6 +70,8 @@ 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;
+       /* not really useful atm */
+       const struct weston_transmitter_api *waltham_transmitter_api;
 
        struct wl_global *agl_shell;
        struct wl_global *agl_shell_desktop;
index 590977f..3e56013 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;
 
@@ -558,6 +562,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,
@@ -1367,6 +1403,7 @@ int main(int argc, char *argv[])
        int version = 0;
        int no_config = 0;
        int debug = 0;
+       int waltham = 0;
        char *config_file = NULL;
        struct weston_log_context *log_ctx = NULL;
        struct weston_log_subscriber *logger;
@@ -1380,6 +1417,7 @@ int main(int argc, char *argv[])
                { WESTON_OPTION_BOOLEAN, "version", 0, &version },
                { WESTON_OPTION_BOOLEAN, "no-config", 0, &no_config },
                { WESTON_OPTION_BOOLEAN, "debug", 0, &debug },
+               { WESTON_OPTION_BOOLEAN, "waltham", 0, &waltham },
                { WESTON_OPTION_STRING, "config", 'c', &config_file },
        };
 
@@ -1489,6 +1527,9 @@ int main(int argc, char *argv[])
        if (ivi.remoting_api)
                ivi_enable_remote_outputs(&ivi);
 
+       if (waltham)
+               load_waltham_plugin(&ivi, ivi.config);
+
        ivi_shell_init_black_fs(&ivi);
 
        if (create_listening_socket(display, socket_name) < 0)