<div dir="ltr"><div><div>With this patch plus the one I just sent about drop_privileges, weston-launch can be used on the rpi.<br><br></div>Thanks!<br><br></div>Tomeu<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">

On 27 September 2013 19:58, Adrian Negreanu <span dir="ltr"><<a href="mailto:groleo@gmail.com" target="_blank">groleo@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

From: Adrian Negreanu <<a href="mailto:adrian.m.negreanu@intel.com">adrian.m.negreanu@intel.com</a>><br>
<br>
Add drm_set_master and drm_drop_master<br>
as wrappers for drm(Set|Drop)Master, when building compositor-drm<br>
or as empty functions otherwise.<br>
<br>
Signed-off-by: Adrian Negreanu <<a href="mailto:adrian.m.negreanu@intel.com">adrian.m.negreanu@intel.com</a>><br>
---<br>
 src/launcher-util.c |   28 ++++++++++++++++++++++++----<br>
 1 file changed, 24 insertions(+), 4 deletions(-)<br>
<br>
diff --git a/src/launcher-util.c b/src/launcher-util.c<br>
index a2ad0ec..bdddbb8 100644<br>
--- a/src/launcher-util.c<br>
+++ b/src/launcher-util.c<br>
@@ -40,7 +40,9 @@<br>
 #include <linux/kd.h><br>
 #include <linux/major.h><br>
<br>
+#ifdef BUILD_DRM_COMPOSITOR<br>
 #include <xf86drm.h><br>
+#endif<br>
<br>
 #include "compositor.h"<br>
 #include "launcher-util.h"<br>
@@ -196,6 +198,26 @@ weston_launcher_data(int fd, uint32_t mask, void *data)<br>
        return 1;<br>
 }<br>
<br>
+#ifdef BUILD_DRM_COMPOSITOR<br>
+static int<br>
+drm_drop_master(int drm_fd)<br>
+{<br>
+       if (drm_fd != -1)<br>
+               return drmDropMaster(drm_fd);<br>
+       return -EBADF;<br>
+}<br>
+static int<br>
+drm_set_master(int drm_fd)<br>
+{<br>
+       if (drm_fd != -1)<br>
+               return drmSetMaster(drm_fd);<br>
+       return -EBADF;<br>
+}<br>
+#else<br>
+static int drm_drop_master(int drm_fd) {return 0;}<br>
+static int drm_set_master(int drm_fd) {return 0;}<br>
+#endif<br>
+<br>
 static int<br>
 vt_handler(int signal_number, void *data)<br>
 {<br>
@@ -205,13 +227,11 @@ vt_handler(int signal_number, void *data)<br>
        if (compositor->session_active) {<br>
                compositor->session_active = 0;<br>
                wl_signal_emit(&compositor->session_signal, compositor);<br>
-               if (launcher->drm_fd != -1)<br>
-                       drmDropMaster(launcher->drm_fd);<br>
+               drm_drop_master(launcher->drm_fd);<br>
                ioctl(launcher->tty, VT_RELDISP, 1);<br>
        } else {<br>
                ioctl(launcher->tty, VT_RELDISP, VT_ACKACQ);<br>
-               if (launcher->drm_fd != -1)<br>
-                       drmSetMaster(launcher->drm_fd);<br>
+               drm_set_master(launcher->drm_fd);<br>
                compositor->session_active = 1;<br>
                wl_signal_emit(&compositor->session_signal, compositor);<br>
        }<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.7.9.5<br>
<br>
_______________________________________________<br>
wayland-devel mailing list<br>
<a href="mailto:wayland-devel@lists.freedesktop.org">wayland-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/wayland-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/wayland-devel</a><br>
</font></span></blockquote></div><br></div>