diff options
author | Christian Gmeiner <christian.gmeiner@gmail.com> | 2016-12-04 21:55:09 +0100 |
---|---|---|
committer | Russell King <rmk@armlinux.org.uk> | 2017-02-04 12:26:05 +0000 |
commit | 8ba65118e447f179da2317a72d656370f8a1e90d (patch) | |
tree | 7af1d8471931f15d8ebb2efa01e5c1bbec8019bf /src | |
parent | d58ad8ab68a5882da8a6fcb628bd491e975a8990 (diff) |
armada: Use NotifyFd for drm fd
NotifyFd is available after API 22, and must be used after API 23.
Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Signed-off-by: Russell King <rmk@armlinux.org.uk>
Diffstat (limited to 'src')
-rw-r--r-- | src/common_drm.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/common_drm.c b/src/common_drm.c index 92700ce..18e48a0 100644 --- a/src/common_drm.c +++ b/src/common_drm.c @@ -35,6 +35,10 @@ #include <libudev.h> #endif +#if ABI_VIDEODRV_VERSION >= SET_ABI_VERSION(22,0) +#define HAVE_NOTIFY_FD 1 +#endif + enum { OPTION_HW_CURSOR, OPTION_HOTPLUG, @@ -1158,6 +1162,15 @@ Bool common_drm_PreScreenInit(ScreenPtr pScreen) return TRUE; } +#if HAVE_NOTIFY_FD +static void +drmmode_notify_fd(int fd, int notify, void *data) +{ + struct common_drm_info *drm = data; + + drmHandleEvent(drm->fd, &drm->event_context); +} +#else static void common_drm_wakeup_handler(pointer data, int err, pointer p) { struct common_drm_info *drm = data; @@ -1169,6 +1182,7 @@ static void common_drm_wakeup_handler(pointer data, int err, pointer p) if (FD_ISSET(drm->fd, read_mask)) drmHandleEvent(drm->fd, &drm->event_context); } +#endif Bool common_drm_PostScreenInit(ScreenPtr pScreen) { @@ -1236,9 +1250,13 @@ Bool common_drm_PostScreenInit(ScreenPtr pScreen) xf86DPMSInit(pScreen, xf86DPMSSet, 0); /* Setup the synchronisation feedback */ +#if HAVE_NOTIFY_FD + SetNotifyFd(drm->fd, drmmode_notify_fd, X_NOTIFY_READ, drm); +#else AddGeneralSocket(drm->fd); RegisterBlockAndWakeupHandlers((BlockHandlerProcPtr)NoopDDA, common_drm_wakeup_handler, drm); +#endif #ifdef HAVE_UDEV if (!common_drm_udev_init(pScreen)) { |