xf86-video-amdgpu: Branch 'master'

Keith Packard keithp at kemper.freedesktop.org
Tue Jul 19 16:17:23 UTC 2016


 src/compat-api.h      |    4 ++++
 src/drmmode_display.c |   16 ++++++++++++++++
 2 files changed, 20 insertions(+)

New commits:
commit fdd1209e26128b3e894f2867fac3a1b08fe1f29e
Author: Keith Packard <keithp at keithp.com>
Date:   Tue Jul 19 09:16:32 2016 -0700

    Use NotifyFd for drm fd
    
    NotifyFd is available after API 22, and must be used after API 23.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/src/compat-api.h b/src/compat-api.h
index 80a3ac4..ebe9cf3 100644
--- a/src/compat-api.h
+++ b/src/compat-api.h
@@ -73,6 +73,10 @@
 
 #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 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 bcb4340..3a7be27 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -2048,6 +2048,13 @@ drmmode_flip_handler(xf86CrtcPtr crtc, uint32_t frame, uint64_t usec, void *even
 	drmmode_crtc->flip_pending = FALSE;
 }
 
+#if HAVE_NOTIFY_FD
+static void drmmode_notify_fd(int fd, int notify, void *data)
+{
+	drmmode_ptr drmmode = data;
+	drmHandleEvent(fd, &drmmode->event_context);
+}
+#else
 static void drm_wakeup_handler(pointer data, int err, pointer p)
 {
 	drmmode_ptr drmmode = data;
@@ -2058,6 +2065,7 @@ static void drm_wakeup_handler(pointer data, int err, pointer p)
 		drmHandleEvent(pAMDGPUEnt->fd, &drmmode->event_context);
 	}
 }
+#endif
 
 Bool drmmode_pre_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int cpp)
 {
@@ -2136,9 +2144,13 @@ void drmmode_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
 
 	info->drmmode_inited = TRUE;
 	if (pAMDGPUEnt->fd_wakeup_registered != serverGeneration) {
+#if HAVE_NOTIFY_FD
+		SetNotifyFd(pAMDGPUEnt->fd, drmmode_notify_fd, X_NOTIFY_READ, drmmode);
+#else
 		AddGeneralSocket(pAMDGPUEnt->fd);
 		RegisterBlockAndWakeupHandlers((BlockHandlerProcPtr) NoopDDA,
 					       drm_wakeup_handler, drmmode);
+#endif
 		pAMDGPUEnt->fd_wakeup_registered = serverGeneration;
 		pAMDGPUEnt->fd_wakeup_ref = 1;
 	} else
@@ -2157,9 +2169,13 @@ void drmmode_fini(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
 
 	if (pAMDGPUEnt->fd_wakeup_registered == serverGeneration &&
 	    !--pAMDGPUEnt->fd_wakeup_ref) {
+#if HAVE_NOTIFY_FD
+		RemoveNotifyFd(pAMDGPUEnt->fd);
+#else
 		RemoveGeneralSocket(pAMDGPUEnt->fd);
 		RemoveBlockAndWakeupHandlers((BlockHandlerProcPtr) NoopDDA,
 					     drm_wakeup_handler, drmmode);
+#endif
 	}
 
 	for (c = 0; c < config->num_crtc; c++) {


More information about the xorg-commit mailing list