1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
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
|