summaryrefslogtreecommitdiff
blob: cfb476649125b38537fa46f3f70cd6a5d5777bb6 (plain)
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
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
From f1a9c1b33bff038807755824190c69889ef6d794 Mon Sep 17 00:00:00 2001
From: Dave Airlie <airlied@redhat.com>
Date: Wed, 06 Jun 2012 13:19:04 +0000
Subject: qxl: add API compat for latest X server.

Signed-off-by: Dave Airlie <airlied@redhat.com>
---
diff --git a/src/Makefile.am b/src/Makefile.am
index c3ba074..79ea3cc 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -47,7 +47,8 @@ qxl_drv_la_SOURCES =				\
 	mspace.h				\
 	murmurhash3.c				\
 	murmurhash3.h				\
-	qxl_cursor.c
+	qxl_cursor.c				\
+	compat-api.h
 endif
 
 if BUILD_XSPICE
diff --git a/src/compat-api.h b/src/compat-api.h
new file mode 100644
index 0000000..6bc946f
--- a/dev/null
+++ b/src/compat-api.h
@@ -0,0 +1,99 @@
+/*
+ * Copyright 2012 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Author: Dave Airlie <airlied@redhat.com>
+ */
+
+/* this file provides API compat between server post 1.13 and pre it,
+   it should be reused inside as many drivers as possible */
+#ifndef COMPAT_API_H
+#define COMPAT_API_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
+#endif
+
+#ifndef XF86_HAS_SCRN_CONV
+#define xf86ScreenToScrn(s) xf86Screens[(s)->myNum]
+#define xf86ScrnToScreen(s) screenInfo.screens[(s)->scrnIndex]
+#endif
+
+#ifndef XF86_SCRN_INTERFACE
+
+#define SCRN_ARG_TYPE int
+#define SCRN_INFO_PTR(arg1) ScrnInfoPtr pScrn = xf86Screens[(arg1)]
+
+#define SCREEN_ARG_TYPE int
+#define SCREEN_PTR(arg1) ScreenPtr pScreen = screenInfo.screens[(arg1)]
+
+#define SCREEN_INIT_ARGS_DECL int i, ScreenPtr pScreen, int argc, char **argv
+
+#define BLOCKHANDLER_ARGS_DECL int arg, pointer blockData, pointer pTimeout, pointer pReadmask
+#define BLOCKHANDLER_ARGS arg, blockData, pTimeout, pReadmask
+
+#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 VT_FUNC_ARGS_DECL int arg, int flags
+#define VT_FUNC_ARGS pScrn->scrnIndex, 0
+
+#define XF86_SCRN_ARG(x) ((x)->scrnIndex)
+#else
+#define SCRN_ARG_TYPE ScrnInfoPtr
+#define SCRN_INFO_PTR(arg1) ScrnInfoPtr pScrn = (arg1)
+
+#define SCREEN_ARG_TYPE ScreenPtr
+#define SCREEN_PTR(arg1) ScreenPtr pScreen = (arg1)
+
+#define SCREEN_INIT_ARGS_DECL ScreenPtr pScreen, int argc, char **argv
+
+#define BLOCKHANDLER_ARGS_DECL ScreenPtr arg, pointer pTimeout, pointer pReadmask
+#define BLOCKHANDLER_ARGS arg, pTimeout, pReadmask
+
+#define CLOSE_SCREEN_ARGS_DECL ScreenPtr pScreen
+#define CLOSE_SCREEN_ARGS pScreen
+
+#define ADJUST_FRAME_ARGS_DECL ScrnInfoPtr arg, int x, int y
+#define ADJUST_FRAME_ARGS(arg, x, y) arg, x, y
+
+#define SWITCH_MODE_ARGS_DECL ScrnInfoPtr arg, DisplayModePtr mode
+#define SWITCH_MODE_ARGS(arg, m) arg, m
+
+#define FREE_SCREEN_ARGS_DECL ScrnInfoPtr arg
+
+#define VT_FUNC_ARGS_DECL ScrnInfoPtr arg
+#define VT_FUNC_ARGS pScrn
+
+#define XF86_SCRN_ARG(x) (x)
+
+#endif
+
+#endif
diff --git a/src/qxl.h b/src/qxl.h
index ed12680..46155c9 100644
--- a/src/qxl.h
+++ b/src/qxl.h
@@ -50,6 +50,7 @@
 #include "vgaHW.h"
 #endif /* XSPICE */
 
+#include "compat-api.h"
 #define hidden _X_HIDDEN
 
 #ifdef XSPICE
diff --git a/src/qxl_driver.c b/src/qxl_driver.c
index f7ccbbf..b0250e5 100644
--- a/src/qxl_driver.c
+++ b/src/qxl_driver.c
@@ -328,7 +328,7 @@ qxl_blank_screen(ScreenPtr pScreen, int mode)
 
 #ifdef XSPICE
 static void
-unmap_memory_helper(qxl_screen_t *qxl, int scrnIndex)
+unmap_memory_helper(qxl_screen_t *qxl)
 {
     free(qxl->ram);
     free(qxl->vram);
@@ -336,7 +336,7 @@ unmap_memory_helper(qxl_screen_t *qxl, int scrnIndex)
 }
 
 static void
-map_memory_helper(qxl_screen_t *qxl, int scrnIndex)
+map_memory_helper(qxl_screen_t *qxl)
 {
     qxl->ram = malloc(RAM_SIZE);
     qxl->ram_physical = qxl->ram;
@@ -349,7 +349,7 @@ map_memory_helper(qxl_screen_t *qxl, int scrnIndex)
 }
 #else /* Default */
 static void
-unmap_memory_helper(qxl_screen_t *qxl, int scrnIndex)
+unmap_memory_helper(qxl_screen_t *qxl)
 {
 #ifdef XSERVER_LIBPCIACCESS
     if (qxl->ram)
@@ -369,7 +369,7 @@ unmap_memory_helper(qxl_screen_t *qxl, int scrnIndex)
 }
 
 static void
-map_memory_helper(qxl_screen_t *qxl, int scrnIndex)
+map_memory_helper(qxl_screen_t *qxl)
 {
 #ifdef XSERVER_LIBPCIACCESS
     pci_device_map_range(qxl->pci, qxl->pci->regions[0].base_addr,
@@ -412,7 +412,7 @@ map_memory_helper(qxl_screen_t *qxl, int scrnIndex)
 #endif /* XSPICE */
 
 static void
-qxl_unmap_memory(qxl_screen_t *qxl, int scrnIndex)
+qxl_unmap_memory(qxl_screen_t *qxl)
 {
 #ifdef XSPICE
     if (qxl->worker) {
@@ -420,7 +420,7 @@ qxl_unmap_memory(qxl_screen_t *qxl, int scrnIndex)
         qxl->worker_running = FALSE;
     }
 #endif
-    unmap_memory_helper(qxl, scrnIndex);
+    unmap_memory_helper(qxl);
     qxl->ram = qxl->ram_physical = qxl->vram = qxl->rom = NULL;
 
     qxl->num_modes = 0;
@@ -430,7 +430,7 @@ qxl_unmap_memory(qxl_screen_t *qxl, int scrnIndex)
 static Bool
 qxl_map_memory(qxl_screen_t *qxl, int scrnIndex)
 {
-    map_memory_helper(qxl, scrnIndex);
+    map_memory_helper(qxl);
 
     if (!qxl->ram || !qxl->vram || !qxl->rom)
 	return FALSE;
@@ -556,9 +556,9 @@ qxl_reset (qxl_screen_t *qxl)
 }
 
 static Bool
-qxl_close_screen(int scrnIndex, ScreenPtr pScreen)
+qxl_close_screen(CLOSE_SCREEN_ARGS_DECL)
 {
-    ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+    ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
     qxl_screen_t *qxl = pScrn->driverPrivate;
     Bool result;
     
@@ -569,7 +569,7 @@ qxl_close_screen(int scrnIndex, ScreenPtr pScreen)
     pScreen->CreateScreenResources = qxl->create_screen_resources;
     pScreen->CloseScreen = qxl->close_screen;
     
-    result = pScreen->CloseScreen(scrnIndex, pScreen);
+    result = pScreen->CloseScreen(CLOSE_SCREEN_ARGS);
 
 #ifndef XSPICE
     if (!xf86IsPrimaryPci (qxl->pci) && qxl->primary)
@@ -579,7 +579,7 @@ qxl_close_screen(int scrnIndex, ScreenPtr pScreen)
     if (pScrn->vtSema)
     {
         qxl_restore_state(pScrn);
-	qxl_unmap_memory(qxl, scrnIndex);
+	qxl_unmap_memory(qxl);
     }
     pScrn->vtSema = FALSE;
 
@@ -589,7 +589,7 @@ qxl_close_screen(int scrnIndex, ScreenPtr pScreen)
 static void
 set_screen_pixmap_header (ScreenPtr pScreen)
 {
-    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+    ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
     qxl_screen_t *qxl = pScrn->driverPrivate;
     PixmapPtr pPixmap = pScreen->GetScreenPixmap(pScreen);
     
@@ -611,10 +611,11 @@ set_screen_pixmap_header (ScreenPtr pScreen)
 }
 
 static Bool
-qxl_switch_mode(int scrnIndex, DisplayModePtr p, int flags)
+qxl_switch_mode(SWITCH_MODE_ARGS_DECL)
 {
-    qxl_screen_t *qxl = xf86Screens[scrnIndex]->driverPrivate;
-    int mode_index = (int)(unsigned long)p->Private;
+    SCRN_INFO_PTR(arg);
+    qxl_screen_t *qxl = pScrn->driverPrivate;
+    int mode_index = (int)(unsigned long)mode->Private;
     struct QXLMode *m = qxl->modes + mode_index;
     ScreenPtr pScreen;
     void *evacuated;
@@ -680,7 +681,7 @@ enum ROPDescriptor
 static Bool
 qxl_create_screen_resources(ScreenPtr pScreen)
 {
-    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+    ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
     qxl_screen_t *qxl = pScrn->driverPrivate;
     Bool ret;
     PixmapPtr pPixmap;
@@ -848,7 +849,7 @@ qxl_set_screen_pixmap (PixmapPtr pixmap)
 static PixmapPtr
 qxl_create_pixmap (ScreenPtr screen, int w, int h, int depth, unsigned usage)
 {
-    ScrnInfoPtr scrn = xf86Screens[screen->myNum];
+    ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
     PixmapPtr pixmap;
     qxl_screen_t *qxl = scrn->driverPrivate;
     qxl_surface_t *surface;
@@ -906,7 +907,7 @@ static Bool
 qxl_destroy_pixmap (PixmapPtr pixmap)
 {
     ScreenPtr screen = pixmap->drawable.pScreen;
-    ScrnInfoPtr scrn = xf86Screens[screen->myNum];
+    ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
     qxl_screen_t *qxl = scrn->driverPrivate;
     qxl_surface_t *surface = NULL;
 
@@ -936,7 +937,7 @@ qxl_destroy_pixmap (PixmapPtr pixmap)
 static Bool
 setup_uxa (qxl_screen_t *qxl, ScreenPtr screen)
 {
-    ScrnInfoPtr scrn = xf86Screens[screen->myNum];
+    ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
 #if HAS_DIXREGISTERPRIVATEKEY
     if (!dixRegisterPrivateKey(&uxa_pixmap_index, PRIVATE_PIXMAP, 0))
 	return FALSE;
@@ -1030,9 +1031,9 @@ spiceqxl_screen_init(int scrnIndex, ScrnInfoPtr pScrn, qxl_screen_t *qxl)
 #endif
 
 static Bool
-qxl_screen_init(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
+qxl_screen_init(SCREEN_INIT_ARGS_DECL)
 {
-    ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+    ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
     qxl_screen_t *qxl = pScrn->driverPrivate;
     struct QXLRam *ram_header;
     VisualPtr visual;
@@ -1041,7 +1042,7 @@ qxl_screen_init(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
 
     qxl->pScrn = pScrn;
 
-    if (!qxl_map_memory(qxl, scrnIndex))
+    if (!qxl_map_memory(qxl, pScrn->scrnIndex))
 	return FALSE;
 
 #ifdef XSPICE
@@ -1160,7 +1161,7 @@ qxl_screen_init(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
     pScreen->width = pScrn->currentMode->HDisplay;
     pScreen->height = pScrn->currentMode->VDisplay;
     
-    qxl_switch_mode(scrnIndex, pScrn->currentMode, 0);
+    qxl_switch_mode(SWITCH_MODE_ARGS(pScrn, pScrn->currentMode));
     
     CHECK_POINT();
 
@@ -1171,13 +1172,13 @@ out:
 }
 
 static Bool
-qxl_enter_vt(int scrnIndex, int flags)
+qxl_enter_vt(VT_FUNC_ARGS_DECL)
 {
-    ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+    SCRN_INFO_PTR(arg);
     qxl_screen_t *qxl = pScrn->driverPrivate;
 
     qxl_save_state(pScrn);
-    qxl_switch_mode(scrnIndex, pScrn->currentMode, 0);
+    qxl_switch_mode(SWITCH_MODE_ARGS(pScrn, pScrn->currentMode));
 
     if (qxl->vt_surfaces)
     {
@@ -1186,18 +1187,18 @@ qxl_enter_vt(int scrnIndex, int flags)
 	qxl->vt_surfaces = NULL;
     }
 
-    pScrn->EnableDisableFBAccess (scrnIndex, TRUE);
+    pScrn->EnableDisableFBAccess (XF86_SCRN_ARG(pScrn), TRUE);
     
     return TRUE;
 }
 
 static void
-qxl_leave_vt(int scrnIndex, int flags)
+qxl_leave_vt(VT_FUNC_ARGS_DECL)
 {
-    ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+    SCRN_INFO_PTR(arg);
     qxl_screen_t *qxl = pScrn->driverPrivate;
     
-    pScrn->EnableDisableFBAccess (scrnIndex, FALSE);
+    pScrn->EnableDisableFBAccess (XF86_SCRN_ARG(pScrn), FALSE);
 
     qxl->vt_surfaces = qxl_surface_cache_evacuate_all (qxl->surface_cache);
 
@@ -1327,9 +1328,9 @@ qxl_find_native_mode(ScrnInfoPtr pScrn, DisplayModePtr p)
 }
 
 static ModeStatus
-qxl_valid_mode(int scrn, DisplayModePtr p, Bool flag, int pass)
+qxl_valid_mode(SCRN_ARG_TYPE arg, DisplayModePtr p, Bool flag, int pass)
 {
-    ScrnInfoPtr pScrn = xf86Screens[scrn];
+    SCRN_INFO_PTR(arg);
     int scrnIndex = pScrn->scrnIndex;
     qxl_screen_t *qxl = pScrn->driverPrivate;
     int bpp = pScrn->bitsPerPixel;
@@ -1550,7 +1551,7 @@ qxl_pre_init(ScrnInfoPtr pScrn, int flags)
 #endif
 
     /* hate */
-    qxl_unmap_memory(qxl, scrnIndex);
+    qxl_unmap_memory(qxl);
     
     CHECK_POINT();
     
diff --git a/src/qxl_surface.c b/src/qxl_surface.c
index a8901f0..c6f21a9 100644
--- a/src/qxl_surface.c
+++ b/src/qxl_surface.c
@@ -842,7 +842,7 @@ qxl_surface_prepare_access (qxl_surface_t  *surface,
     int n_boxes;
     BoxPtr boxes;
     ScreenPtr pScreen = pixmap->drawable.pScreen;
-    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+    ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
     RegionRec new;
 
     if (!pScrn->vtSema)
diff --git a/src/uxa/uxa-glyphs.c b/src/uxa/uxa-glyphs.c
index c9fae0f..dd50dfc 100644
--- a/src/uxa/uxa-glyphs.c
+++ b/src/uxa/uxa-glyphs.c
@@ -221,7 +221,7 @@ uxa_glyph_cache_upload_glyph(ScreenPtr screen,
 			     GlyphPtr glyph,
 			     int x, int y)
 {
-	PicturePtr pGlyphPicture = GlyphPicture(glyph)[screen->myNum];
+	PicturePtr pGlyphPicture = GetGlyphPicture(glyph, screen);
 	PixmapPtr pGlyphPixmap = (PixmapPtr) pGlyphPicture->pDrawable;
 	PixmapPtr pCachePixmap = (PixmapPtr) cache->picture->pDrawable;
 	PixmapPtr scratch;
@@ -430,7 +430,7 @@ uxa_check_glyphs(CARD8 op,
 		 INT16 xSrc,
 		 INT16 ySrc, int nlist, GlyphListPtr list, GlyphPtr * glyphs)
 {
-	int screen = dst->pDrawable->pScreen->myNum;
+	ScreenPtr pScreen = dst->pDrawable->pScreen;
 	pixman_image_t *image;
 	PixmapPtr scratch;
 	PicturePtr mask;
@@ -494,7 +494,7 @@ uxa_check_glyphs(CARD8 op,
 		n = list->len;
 		while (n--) {
 			GlyphPtr glyph = *glyphs++;
-			PicturePtr g = GlyphPicture(glyph)[screen];
+			PicturePtr g = GetGlyphPicture(glyph, pScreen);
 			if (g) {
 				if (maskFormat) {
 					CompositePicture(PictOpAdd, g, NULL, mask,
@@ -560,7 +560,7 @@ static PicturePtr
 uxa_glyph_cache(ScreenPtr screen, GlyphPtr glyph, int *out_x, int *out_y)
 {
 	uxa_screen_t *uxa_screen = uxa_get_screen(screen);
-	PicturePtr glyph_picture = GlyphPicture(glyph)[screen->myNum];
+	PicturePtr glyph_picture = GetGlyphPicture(glyph, screen);
 	uxa_glyph_cache_t *cache = &uxa_screen->glyphCaches[PICT_FORMAT_RGB(glyph_picture->format) != 0];
 	struct uxa_glyph *priv = NULL;
 	int size, mask, pos, s;
@@ -760,7 +760,7 @@ uxa_glyphs_to_dst(CARD8 op,
 				this_atlas = uxa_glyph_cache(screen, glyph, &mask_x, &mask_y);
 				if (this_atlas == NULL) {
 					/* no cache for this glyph */
-					this_atlas = GlyphPicture(glyph)[screen->myNum];
+					this_atlas = GetGlyphPicture(glyph, screen);
 					mask_x = mask_y = 0;
 				}
 			}
@@ -970,7 +970,7 @@ uxa_glyphs_via_mask(CARD8 op,
 				this_atlas = uxa_glyph_cache(screen, glyph, &src_x, &src_y);
 				if (this_atlas == NULL) {
 					/* no cache for this glyph */
-					this_atlas = GlyphPicture(glyph)[screen->myNum];
+					this_atlas = GetGlyphPicture(glyph, screen);
 					src_x = src_y = 0;
 				}
 			}
diff --git a/src/uxa/uxa-priv.h b/src/uxa/uxa-priv.h
index 80095ac..7a3c85e 100644
--- a/src/uxa/uxa-priv.h
+++ b/src/uxa/uxa-priv.h
@@ -60,6 +60,7 @@
 #endif
 #include "damage.h"
 
+#include "../compat-api.h"
 /* Provide substitutes for gcc's __FUNCTION__ on other compilers */
 #if !defined(__GNUC__) && !defined(__FUNCTION__)
 # if defined(__STDC__) && (__STDC_VERSION__>=199901L)	/* C99 */
@@ -110,7 +111,7 @@ typedef struct {
 
 #define UXA_NUM_SOLID_CACHE 16
 
-typedef void (*EnableDisableFBAccessProcPtr) (int, Bool);
+typedef void (*EnableDisableFBAccessProcPtr) (SCREEN_ARG_TYPE, Bool);
 typedef struct {
 	uxa_driver_t *info;
 	CreateGCProcPtr SavedCreateGC;
diff --git a/src/uxa/uxa.c b/src/uxa/uxa.c
index dc973ef..4acf53f 100644
--- a/src/uxa/uxa.c
+++ b/src/uxa/uxa.c
@@ -361,10 +361,10 @@ static RegionPtr uxa_bitmap_to_region(PixmapPtr pPix)
 	return ret;
 }
 
-static void uxa_xorg_enable_disable_fb_access(int index, Bool enable)
+static void uxa_xorg_enable_disable_fb_access(SCREEN_ARG_TYPE arg, Bool enable)
 {
-	ScreenPtr screen = screenInfo.screens[index];
-	uxa_screen_t *uxa_screen = uxa_get_screen(screen);
+	SCREEN_PTR(arg);
+	uxa_screen_t *uxa_screen = uxa_get_screen(pScreen);
 
 	if (!enable && uxa_screen->disableFbCount++ == 0)
 		uxa_screen->swappedOut = TRUE;
@@ -373,7 +373,7 @@ static void uxa_xorg_enable_disable_fb_access(int index, Bool enable)
 		uxa_screen->swappedOut = FALSE;
 
 	if (uxa_screen->SavedEnableDisableFBAccess)
-		uxa_screen->SavedEnableDisableFBAccess(index, enable);
+		uxa_screen->SavedEnableDisableFBAccess(arg, enable);
 }
 
 void uxa_set_fallback_debug(ScreenPtr screen, Bool enable)
@@ -401,10 +401,10 @@ Bool uxa_swapped_out(ScreenPtr screen)
  * uxa_close_screen() unwraps its wrapped screen functions and tears down UXA's
  * screen private, before calling down to the next CloseSccreen.
  */
-static Bool uxa_close_screen(int i, ScreenPtr pScreen)
+static Bool uxa_close_screen(CLOSE_SCREEN_ARGS_DECL)
 {
 	uxa_screen_t *uxa_screen = uxa_get_screen(pScreen);
-	ScrnInfoPtr scrn = xf86Screens[pScreen->myNum];
+	ScrnInfoPtr scrn = xf86ScreenToScrn(pScreen);
 #ifdef RENDER
 	PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
 #endif
@@ -447,7 +447,7 @@ static Bool uxa_close_screen(int i, ScreenPtr pScreen)
 
 	free(uxa_screen);
 
-	return (*pScreen->CloseScreen) (i, pScreen);
+	return (*pScreen->CloseScreen) (CLOSE_SCREEN_ARGS);
 }
 
 /**
@@ -478,7 +478,7 @@ uxa_driver_t *uxa_driver_alloc(void)
 Bool uxa_driver_init(ScreenPtr screen, uxa_driver_t * uxa_driver)
 {
 	uxa_screen_t *uxa_screen;
-	ScrnInfoPtr scrn = xf86Screens[screen->myNum];
+	ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
 
 	if (!uxa_driver)
 		return FALSE;
--
cgit v0.9.0.2-2-gbebe