launcher-util: pull in drm only for compositor-drm

Add drm_set_master and drm_drop_master
as wrappers for drm(Set|Drop)Master, when building compositor-drm
or as empty functions otherwise.

Signed-off-by: Adrian Negreanu <adrian.m.negreanu@intel.com>
dev
Adrian Negreanu 11 years ago committed by Kristian Høgsberg
parent a356f7b1ef
commit 908e6d0b8f
  1. 28
      src/launcher-util.c

@ -40,7 +40,9 @@
#include <linux/kd.h> #include <linux/kd.h>
#include <linux/major.h> #include <linux/major.h>
#ifdef BUILD_DRM_COMPOSITOR
#include <xf86drm.h> #include <xf86drm.h>
#endif
#include "compositor.h" #include "compositor.h"
#include "launcher-util.h" #include "launcher-util.h"
@ -196,6 +198,26 @@ weston_launcher_data(int fd, uint32_t mask, void *data)
return 1; return 1;
} }
#ifdef BUILD_DRM_COMPOSITOR
static int
drm_drop_master(int drm_fd)
{
if (drm_fd != -1)
return drmDropMaster(drm_fd);
return -EBADF;
}
static int
drm_set_master(int drm_fd)
{
if (drm_fd != -1)
return drmSetMaster(drm_fd);
return -EBADF;
}
#else
static int drm_drop_master(int drm_fd) {return 0;}
static int drm_set_master(int drm_fd) {return 0;}
#endif
static int static int
vt_handler(int signal_number, void *data) vt_handler(int signal_number, void *data)
{ {
@ -205,13 +227,11 @@ vt_handler(int signal_number, void *data)
if (compositor->session_active) { if (compositor->session_active) {
compositor->session_active = 0; compositor->session_active = 0;
wl_signal_emit(&compositor->session_signal, compositor); wl_signal_emit(&compositor->session_signal, compositor);
if (launcher->drm_fd != -1) drm_drop_master(launcher->drm_fd);
drmDropMaster(launcher->drm_fd);
ioctl(launcher->tty, VT_RELDISP, 1); ioctl(launcher->tty, VT_RELDISP, 1);
} else { } else {
ioctl(launcher->tty, VT_RELDISP, VT_ACKACQ); ioctl(launcher->tty, VT_RELDISP, VT_ACKACQ);
if (launcher->drm_fd != -1) drm_set_master(launcher->drm_fd);
drmSetMaster(launcher->drm_fd);
compositor->session_active = 1; compositor->session_active = 1;
wl_signal_emit(&compositor->session_signal, compositor); wl_signal_emit(&compositor->session_signal, compositor);
} }

Loading…
Cancel
Save