summaryrefslogtreecommitdiff
path: root/user/xf86-video-freedreno/api-23.patch
diff options
context:
space:
mode:
Diffstat (limited to 'user/xf86-video-freedreno/api-23.patch')
-rw-r--r--user/xf86-video-freedreno/api-23.patch256
1 files changed, 256 insertions, 0 deletions
diff --git a/user/xf86-video-freedreno/api-23.patch b/user/xf86-video-freedreno/api-23.patch
new file mode 100644
index 000000000..fbe8c48a7
--- /dev/null
+++ b/user/xf86-video-freedreno/api-23.patch
@@ -0,0 +1,256 @@
+From 5c82dc7874b6eaff39dc8c8575e72e5a40f13ea6 Mon Sep 17 00:00:00 2001
+From: Adam Jackson <ajax@redhat.com>
+Date: Tue, 19 Jul 2016 10:03:56 -0400
+Subject: Adapt Block/WakeupHandler signature for ABI 23
+
+Signed-off-by: Adam Jackson <ajax@redhat.com>
+---
+ src/compat-api.h | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/src/compat-api.h b/src/compat-api.h
+index 4f7b9ea..15b92fe 100644
+--- a/src/compat-api.h
++++ b/src/compat-api.h
+@@ -76,8 +76,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, pointer 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
+--
+cgit v1.1
+
+From 5f60ca4fe99199183dced955de0206acb5a5ebe9 Mon Sep 17 00:00:00 2001
+From: Keith Packard <keithp@keithp.com>
+Date: Tue, 19 Jul 2016 08:33:51 -0700
+Subject: Use NotifyFd for drm and udev fds
+
+NotifyFd is available after API 22, and must be used after API 23.
+
+Signed-off-by: Keith Packard <keithp@keithp.com>
+---
+ src/compat-api.h | 4 ++++
+ src/drmmode_display.c | 21 +++++++++++++++++++++
+ 2 files changed, 25 insertions(+)
+
+diff --git a/src/compat-api.h b/src/compat-api.h
+index 15b92fe..80dabc1 100644
+--- a/src/compat-api.h
++++ b/src/compat-api.h
+@@ -76,6 +76,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 0d94bb5..53ae677 100644
+--- a/src/drmmode_display.c
++++ b/src/drmmode_display.c
+@@ -1462,6 +1462,18 @@ drmmode_flip_handler(int fd, unsigned int frame, unsigned int tv_sec,
+ free(flipdata);
+ }
+
++#if HAVE_NOTIFY_FD
++
++static void
++drmmode_notify_fd(int fd, int notify, void *data)
++{
++ ScrnInfoPtr scrn = data;
++ drmmode_ptr drmmode = drmmode_from_scrn(scrn);
++ drmHandleEvent(drmmode->fd, &drmmode->event_context);
++}
++
++#else
++
+ static void
+ drmmode_wakeup_handler(pointer data, int err, pointer p)
+ {
+@@ -1480,6 +1492,7 @@ drmmode_wakeup_handler(pointer data, int err, pointer p)
+ drmmode_handle_uevents(scrn);
+ #endif
+ }
++#endif /* HAVE_NOTIFY_FD */
+
+ void
+ drmmode_wait_for_event(ScrnInfoPtr pScrn)
+@@ -1517,11 +1530,15 @@ drmmode_screen_init(ScreenPtr pScreen)
+ drmmode->event_context.version = DRM_EVENT_CONTEXT_VERSION;
+ drmmode->event_context.page_flip_handler = drmmode_flip_handler;
+
++#if HAVE_NOTIFY_FD
++ SetNotifyFd(drmmode->fd, drmmode_notify_fd, X_NOTIFY_READ, pScrn);
++#else
+ AddGeneralSocket(drmmode->fd);
+
+ /* Register a wakeup handler to get informed on DRM events */
+ RegisterBlockAndWakeupHandlers((BlockHandlerProcPtr)NoopDDA,
+ drmmode_wakeup_handler, pScrn);
++#endif
+
+ return TRUE;
+ }
+@@ -1535,10 +1552,14 @@ drmmode_screen_fini(ScreenPtr pScreen)
+
+ drmmode_uevent_fini(pScrn);
+
++#if HAVE_NOTIFY_FD
++ RemoveNotifyFd(drmmode->fd);
++#else
+ /* Register a wakeup handler to get informed on DRM events */
+ RemoveBlockAndWakeupHandlers((BlockHandlerProcPtr)NoopDDA,
+ drmmode_wakeup_handler, pScrn);
+ RemoveGeneralSocket(drmmode->fd);
++#endif
+
+ drmmode_remove_fb(pScrn);
+ fd_bo_del(pMsm->scanout);
+--
+cgit v1.1
+
+From 6c8e21c686578f22d973a243a09c838943ddbadd Mon Sep 17 00:00:00 2001
+From: Rob Clark <robdclark@gmail.com>
+Date: Wed, 7 Dec 2016 17:59:09 -0500
+Subject: Use NotifyFd more completely
+
+previous commit missed some.
+
+Signed-off-by: Rob Clark <robdclark@gmail.com>
+---
+ src/Makefile.am | 1 -
+ src/compat-api.h | 19 +++++++++++++++++++
+ src/drmmode_display.c | 18 ++++++++++++++++++
+ 3 files changed, 37 insertions(+), 1 deletion(-)
+
+diff --git a/src/Makefile.am b/src/Makefile.am
+index d4c1289..f7d5dd1 100644
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -2,7 +2,6 @@ AM_CFLAGS = \
+ @XORG_CFLAGS@ \
+ @XATRACKER_CFLAGS@ \
+ -Wall \
+- -Werror \
+ -I$(top_srcdir)/system-includes/ \
+ -I$(top_builddir)/
+
+diff --git a/src/compat-api.h b/src/compat-api.h
+index 80dabc1..af1b922 100644
+--- a/src/compat-api.h
++++ b/src/compat-api.h
+@@ -28,6 +28,11 @@
+ #ifndef COMPAT_API_H
+ #define COMPAT_API_H
+
++#include <xorg-server.h>
++#include <xorgVersion.h>
++#include <xf86Module.h>
++
++#include <picturestr.h>
+ #ifndef GLYPH_HAS_GLYPH_PICTURE_ACCESSOR
+ #define GetGlyphPicture(g, s) GlyphPicture((g))[(s)->myNum]
+ #define SetGlyphPicture(g, s, p) GlyphPicture((g))[(s)->myNum] = p
+@@ -35,7 +40,13 @@
+
+ #ifndef XF86_HAS_SCRN_CONV
+ #define xf86ScreenToScrn(s) xf86Screens[(s)->myNum]
++#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1,1,0,0,0)
+ #define xf86ScrnToScreen(s) screenInfo.screens[(s)->scrnIndex]
++#else
++#define xf86ScrnToScreen(s) ((s)->pScreen)
++#endif
++#else
++#define xf86ScrnToScreen(s) ((s)->pScreen)
+ #endif
+
+ #ifndef XF86_SCRN_INTERFACE
+@@ -51,12 +62,17 @@
+ #define BLOCKHANDLER_ARGS_DECL int arg, pointer blockData, pointer pTimeout, pointer pReadmask
+ #define BLOCKHANDLER_ARGS arg, blockData, pTimeout, pReadmask
+
++#define WAKEUPHANDLER_ARGS_DECL int arg, pointer wakeupData, unsigned long result, pointer read_mask
++#define WAKEUPHANDLER_ARGS arg, wakeupData, result, read_mask
++
+ #define CLOSE_SCREEN_ARGS_DECL int scrnIndex, ScreenPtr pScreen
+ #define CLOSE_SCREEN_ARGS scrnIndex, pScreen
+
+ #define ADJUST_FRAME_ARGS_DECL int arg, int x, int y, int flags
++#define ADJUST_FRAME_ARGS(arg, x, y) (arg)->scrnIndex, x, y, 0
+
+ #define SWITCH_MODE_ARGS_DECL int arg, DisplayModePtr mode, int flags
++#define SWITCH_MODE_ARGS(arg, m) (arg)->scrnIndex, m, 0
+
+ #define FREE_SCREEN_ARGS_DECL int arg, int flags
+ #define FREE_SCREEN_ARGS(x) (x)->scrnIndex, 0
+@@ -88,6 +104,9 @@
+ #define BLOCKHANDLER_ARGS arg, pTimeout, pReadmask
+ #endif
+
++#define WAKEUPHANDLER_ARGS_DECL ScreenPtr arg, unsigned long result, pointer read_mask
++#define WAKEUPHANDLER_ARGS arg, result, read_mask
++
+ #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 53ae677..c3a55e6 100644
+--- a/src/drmmode_display.c
++++ b/src/drmmode_display.c
+@@ -1381,6 +1381,15 @@ drmmode_handle_uevents(ScrnInfoPtr scrn)
+ }
+ #endif
+
++#if HAVE_NOTIFY_FD
++static void
++drmmode_udev_notify(int fd, int notify, void *data)
++{
++ ScrnInfoPtr scrn = data;
++ drmmode_handle_uevents(scrn);
++}
++#endif
++
+ static void
+ drmmode_uevent_init(ScrnInfoPtr scrn)
+ {
+@@ -1407,7 +1416,12 @@ drmmode_uevent_init(ScrnInfoPtr scrn)
+ return;
+ }
+
++#if HAVE_NOTIFY_FD
++ SetNotifyFd(udev_monitor_get_fd(mon), drmmode_udev_notify, X_NOTIFY_READ, scrn);
++#else
+ AddGeneralSocket(udev_monitor_get_fd(mon));
++#endif
++
+ drmmode->uevent_monitor = mon;
+ #endif
+ }
+@@ -1421,7 +1435,11 @@ drmmode_uevent_fini(ScrnInfoPtr scrn)
+ if (drmmode->uevent_monitor) {
+ struct udev *u = udev_monitor_get_udev(drmmode->uevent_monitor);
+
++#if HAVE_NOTIFY_FD
++ RemoveNotifyFd(udev_monitor_get_fd(drmmode->uevent_monitor));
++#else
+ RemoveGeneralSocket(udev_monitor_get_fd(drmmode->uevent_monitor));
++#endif
+ udev_monitor_unref(drmmode->uevent_monitor);
+ udev_unref(u);
+ }
+--
+cgit v1.1
+