diff options
author | Keith Packard <keithp@keithp.com> | 2016-07-19 08:51:12 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2016-07-19 08:51:12 -0700 |
commit | 36709c64a70a2891f7aa027c689740125ae7dc54 (patch) | |
tree | 70eca62f4818d5897f122df3b25e905b3d3ae38a | |
parent | 58a04ad9c750d6d978ad2206e18845a278e4bb28 (diff) |
Use NotifyFd for drm fd
NotifyFd is available after API 22, and must be used after API 23.
Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r-- | src/compat-api.h | 5 | ||||
-rw-r--r-- | src/drmmode_display.c | 18 |
2 files changed, 23 insertions, 0 deletions
diff --git a/src/compat-api.h b/src/compat-api.h index 78d3c91..54f9f64 100644 --- a/src/compat-api.h +++ b/src/compat-api.h @@ -77,7 +77,12 @@ #define SCREEN_INIT_ARGS_DECL ScreenPtr pScreen, int argc, char **argv +#if ABI_VIDEODRV_VERSION >= SET_ABI_VERSION(22,0) +#define HAVE_NOTIFY_FD 1 +#endif + #if ABI_VIDEODRV_VERSION >= SET_ABI_VERSION(23, 0) +#define RELOAD_CURSORS_DEPRECATED 1 #define BLOCKHANDLER_ARGS_DECL \ ScreenPtr arg, pointer pTimeout #define BLOCKHANDLER_ARGS arg, pTimeout diff --git a/src/drmmode_display.c b/src/drmmode_display.c index 8e45b5f..39fa75c 100644 --- a/src/drmmode_display.c +++ b/src/drmmode_display.c @@ -410,9 +410,11 @@ done_setting: drmmode_output_dpms(output, DPMSModeOn); } +#if !RELOAD_CURSORS_DEPRECATED /* if hw cursor is initialized, reload it */ if (drmmode->cursor) xf86_reload_cursors(pScrn->pScreen); +#endif cleanup: if (newcrtc) @@ -1889,6 +1891,13 @@ drmmode_uevent_fini(ScrnInfoPtr pScrn) TRACE_EXIT(); } +#if HAVE_NOTIFY_FD +static void +drmmode_notify_fd(int fd, int notify, void *data) +{ + drmHandleEvent(fd, &event_context); +} +#else static void drmmode_wakeup_handler(pointer data, int err, pointer p) { @@ -1902,19 +1911,28 @@ drmmode_wakeup_handler(pointer data, int err, pointer p) if (FD_ISSET(fd, read_mask)) drmHandleEvent(fd, &event_context); } +#endif void drmmode_init_wakeup_handler(struct ARMSOCRec *pARMSOC) { +#if HAVE_NOTIFY_FD + SetNotifyFd(pARMSOC->drmFD, drmmode_notify_fd, X_NOTIFY_READ, pARMSOC); +#else AddGeneralSocket(pARMSOC->drmFD); RegisterBlockAndWakeupHandlers((BlockHandlerProcPtr)NoopDDA, drmmode_wakeup_handler, pARMSOC); +#endif } void drmmode_fini_wakeup_handler(struct ARMSOCRec *pARMSOC) { +#if HAVE_NOTIFY_FD + RemoveNotifyFd(pARMSOC->drmFD); +#else RemoveBlockAndWakeupHandlers((BlockHandlerProcPtr)NoopDDA, drmmode_wakeup_handler, pARMSOC); RemoveGeneralSocket(pARMSOC->drmFD); +#endif } void |