[PATCH xf86-video-ati] Adapt to video API 23 [v2]

Keith Packard keithp at keithp.com
Tue Jul 19 04:24:23 UTC 2016


Also deal with drm fd wakeup

Block and wakeup handlers lose their pReadmask arguments

Signed-off-by: Keith Packard <keithp at keithp.com>
---
 src/compat-api.h      |  5 +++++
 src/drmmode_display.c | 22 +++++++++++++++++++++-
 2 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/src/compat-api.h b/src/compat-api.h
index b299f83..1039b0e 100644
--- a/src/compat-api.h
+++ b/src/compat-api.h
@@ -73,8 +73,13 @@
 
 #define SCREEN_INIT_ARGS_DECL ScreenPtr pScreen, int argc, char **argv
 
+#if ABI_VIDEODRV_VERSION >= SET_ABI_VERSION(23,0)
+#define BLOCKHANDLER_ARGS_DECL ScreenPtr arg, void *pTimeout
+#define BLOCKHANDLER_ARGS arg, pTimeout
+#else
 #define BLOCKHANDLER_ARGS_DECL ScreenPtr arg, pointer pTimeout, pointer pReadmask
 #define BLOCKHANDLER_ARGS arg, pTimeout, pReadmask
+#endif
 
 #define CLOSE_SCREEN_ARGS_DECL ScreenPtr pScreen
 #define CLOSE_SCREEN_ARGS pScreen
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 2555465..b1de952 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -59,6 +59,10 @@
 
 #define DEFAULT_NOMINAL_FRAME_RATE 60
 
+#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 22
+#define HAVE_NOTIFY_FD	1
+#endif
+
 static Bool
 drmmode_xf86crtc_resize (ScrnInfoPtr scrn, int width, int height);
 
@@ -2231,13 +2235,21 @@ drmmode_flip_handler(xf86CrtcPtr crtc, uint32_t frame, uint64_t usec, void *even
 }
 
 
+#if HAVE_NOTIFY_FD
+static void
+drm_notify_fd(int fd, int ready, void *data)
+#else
 static void
 drm_wakeup_handler(pointer data, int err, pointer p)
+#endif
 {
 	drmmode_ptr drmmode = data;
+#if !HAVE_NOTIFY_FD
 	fd_set *read_mask = p;
 
-	if (err >= 0 && FD_ISSET(drmmode->fd, read_mask)) {
+	if (err >= 0 && FD_ISSET(drmmode->fd, read_mask))
+#endif
+	{
 		drmHandleEvent(drmmode->fd, &drmmode->event_context);
 	}
 }
@@ -2321,9 +2333,13 @@ void drmmode_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
 
 	info->drmmode_inited = TRUE;
 	if (pRADEONEnt->fd_wakeup_registered != serverGeneration) {
+#if HAVE_NOTIFY_FD
+		SetNotifyFd(drmmode->fd, drm_notify_fd, X_NOTIFY_READ, drmmode);
+#else
 		AddGeneralSocket(drmmode->fd);
 		RegisterBlockAndWakeupHandlers((BlockHandlerProcPtr)NoopDDA,
 				drm_wakeup_handler, drmmode);
+#endif
 		pRADEONEnt->fd_wakeup_registered = serverGeneration;
 		pRADEONEnt->fd_wakeup_ref = 1;
 	} else
@@ -2340,9 +2356,13 @@ void drmmode_fini(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
 
 	if (pRADEONEnt->fd_wakeup_registered == serverGeneration &&
 	    !--pRADEONEnt->fd_wakeup_ref) {
+#if HAVE_NOTIFY_FD
+		RemoveNotifyFd(drmmode->fd);
+#else
 		RemoveGeneralSocket(drmmode->fd);
 		RemoveBlockAndWakeupHandlers((BlockHandlerProcPtr)NoopDDA,
 				drm_wakeup_handler, drmmode);
+#endif
 	}
 }
 
-- 
2.8.1



More information about the xorg-devel mailing list