summaryrefslogtreecommitdiffstats
path: root/meta/recipes-graphics/xorg-driver/xf86-video-vmware
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-graphics/xorg-driver/xf86-video-vmware')
-rw-r--r--meta/recipes-graphics/xorg-driver/xf86-video-vmware/vmware-port-vmware-driver-to-new-compat-API.patch655
1 files changed, 655 insertions, 0 deletions
diff --git a/meta/recipes-graphics/xorg-driver/xf86-video-vmware/vmware-port-vmware-driver-to-new-compat-API.patch b/meta/recipes-graphics/xorg-driver/xf86-video-vmware/vmware-port-vmware-driver-to-new-compat-API.patch
new file mode 100644
index 0000000000..610a133b05
--- /dev/null
+++ b/meta/recipes-graphics/xorg-driver/xf86-video-vmware/vmware-port-vmware-driver-to-new-compat-API.patch
@@ -0,0 +1,655 @@
1Upstream-Status: Backport
2
3From 61df95a86f4997e342d50d7779b00aba2e8849a6 Mon Sep 17 00:00:00 2001
4From: Dave Airlie <airlied@redhat.com>
5Date: Wed, 6 Jun 2012 09:58:01 +0100
6Subject: [PATCH] vmware: port vmware driver to new compat API
7
8This is a port of the vmware driver to the new compat API.
9
10Tested-by: Jakob Bornecrantz <jakob@vmware.com>
11Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
12Signed-off-by: Dave Airlie <airlied@redhat.com>
13Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
14---
15 saa/saa.c | 4 +-
16 saa/saa.h | 4 +-
17 src/Makefile.am | 1 +
18 src/compat-api.h | 99 +++++++++++++++++++++++++++++++++++++++++++++
19 src/vmware.c | 40 +++++++++---------
20 src/vmware.h | 2 +-
21 src/vmware_common.h | 2 +
22 vmwgfx/vmwgfx_dri2.c | 4 +-
23 vmwgfx/vmwgfx_driver.c | 73 +++++++++++++++++----------------
24 vmwgfx/vmwgfx_driver.h | 7 ++--
25 vmwgfx/vmwgfx_saa.c | 4 +-
26 vmwgfx/vmwgfx_tex_video.c | 6 +--
27 12 files changed, 174 insertions(+), 72 deletions(-)
28 create mode 100644 src/compat-api.h
29
30diff --git a/saa/saa.c b/saa/saa.c
31index 173c090..f2d68e9 100644
32--- a/saa/saa.c
33+++ b/saa/saa.c
34@@ -594,7 +594,7 @@ saa_set_fallback_debug(ScreenPtr screen, Bool enable)
35 * screen private, before calling down to the next CloseScreen.
36 */
37 Bool
38-saa_close_screen(int i, ScreenPtr pScreen)
39+saa_close_screen(CLOSE_SCREEN_ARGS_DECL)
40 {
41 struct saa_screen_priv *sscreen = saa_screen(pScreen);
42 struct saa_driver *driver = sscreen->driver;
43@@ -624,7 +624,7 @@ saa_close_screen(int i, ScreenPtr pScreen)
44
45 free(sscreen);
46
47- return (*pScreen->CloseScreen) (i, pScreen);
48+ return (*pScreen->CloseScreen) (CLOSE_SCREEN_ARGS);
49 }
50
51 struct saa_driver *
52diff --git a/saa/saa.h b/saa/saa.h
53index c7aa3b6..4e5ced5 100644
54--- a/saa/saa.h
55+++ b/saa/saa.h
56@@ -44,6 +44,8 @@
57 #include <damage.h>
58 #include <picturestr.h>
59
60+#include "../src/compat-api.h"
61+
62 #define SAA_VERSION_MAJOR 0
63 #define SAA_VERSION_MINOR 1
64
65@@ -173,7 +175,7 @@ extern _X_EXPORT RegionPtr
66 saa_bitmap_to_region(PixmapPtr pPix);
67
68 extern _X_EXPORT Bool
69-saa_close_screen(int i, ScreenPtr pScreen);
70+saa_close_screen(CLOSE_SCREEN_ARGS_DECL);
71
72 extern _X_EXPORT Bool
73 saa_gc_reads_destination(DrawablePtr pDrawable, GCPtr pGC);
74diff --git a/src/Makefile.am b/src/Makefile.am
75index 04c9e0d..b0dd147 100644
76--- a/src/Makefile.am
77+++ b/src/Makefile.am
78@@ -37,6 +37,7 @@ endif
79 vmware_drv_la_SOURCES = \
80 bits2pixels.c \
81 bits2pixels.h \
82+ compat-api.h \
83 guest_os.h \
84 includeCheck.h \
85 svga_escape.h \
86diff --git a/src/compat-api.h b/src/compat-api.h
87new file mode 100644
88index 0000000..6bc946f
89--- /dev/null
90+++ b/src/compat-api.h
91@@ -0,0 +1,99 @@
92+/*
93+ * Copyright 2012 Red Hat, Inc.
94+ *
95+ * Permission is hereby granted, free of charge, to any person obtaining a
96+ * copy of this software and associated documentation files (the "Software"),
97+ * to deal in the Software without restriction, including without limitation
98+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
99+ * and/or sell copies of the Software, and to permit persons to whom the
100+ * Software is furnished to do so, subject to the following conditions:
101+ *
102+ * The above copyright notice and this permission notice (including the next
103+ * paragraph) shall be included in all copies or substantial portions of the
104+ * Software.
105+ *
106+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
107+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
108+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
109+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
110+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
111+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
112+ * DEALINGS IN THE SOFTWARE.
113+ *
114+ * Author: Dave Airlie <airlied@redhat.com>
115+ */
116+
117+/* this file provides API compat between server post 1.13 and pre it,
118+ it should be reused inside as many drivers as possible */
119+#ifndef COMPAT_API_H
120+#define COMPAT_API_H
121+
122+#ifndef GLYPH_HAS_GLYPH_PICTURE_ACCESSOR
123+#define GetGlyphPicture(g, s) GlyphPicture((g))[(s)->myNum]
124+#define SetGlyphPicture(g, s, p) GlyphPicture((g))[(s)->myNum] = p
125+#endif
126+
127+#ifndef XF86_HAS_SCRN_CONV
128+#define xf86ScreenToScrn(s) xf86Screens[(s)->myNum]
129+#define xf86ScrnToScreen(s) screenInfo.screens[(s)->scrnIndex]
130+#endif
131+
132+#ifndef XF86_SCRN_INTERFACE
133+
134+#define SCRN_ARG_TYPE int
135+#define SCRN_INFO_PTR(arg1) ScrnInfoPtr pScrn = xf86Screens[(arg1)]
136+
137+#define SCREEN_ARG_TYPE int
138+#define SCREEN_PTR(arg1) ScreenPtr pScreen = screenInfo.screens[(arg1)]
139+
140+#define SCREEN_INIT_ARGS_DECL int i, ScreenPtr pScreen, int argc, char **argv
141+
142+#define BLOCKHANDLER_ARGS_DECL int arg, pointer blockData, pointer pTimeout, pointer pReadmask
143+#define BLOCKHANDLER_ARGS arg, blockData, pTimeout, pReadmask
144+
145+#define CLOSE_SCREEN_ARGS_DECL int scrnIndex, ScreenPtr pScreen
146+#define CLOSE_SCREEN_ARGS scrnIndex, pScreen
147+
148+#define ADJUST_FRAME_ARGS_DECL int arg, int x, int y, int flags
149+#define ADJUST_FRAME_ARGS(arg, x, y) (arg)->scrnIndex, x, y, 0
150+
151+#define SWITCH_MODE_ARGS_DECL int arg, DisplayModePtr mode, int flags
152+#define SWITCH_MODE_ARGS(arg, m) (arg)->scrnIndex, m, 0
153+
154+#define FREE_SCREEN_ARGS_DECL int arg, int flags
155+
156+#define VT_FUNC_ARGS_DECL int arg, int flags
157+#define VT_FUNC_ARGS pScrn->scrnIndex, 0
158+
159+#define XF86_SCRN_ARG(x) ((x)->scrnIndex)
160+#else
161+#define SCRN_ARG_TYPE ScrnInfoPtr
162+#define SCRN_INFO_PTR(arg1) ScrnInfoPtr pScrn = (arg1)
163+
164+#define SCREEN_ARG_TYPE ScreenPtr
165+#define SCREEN_PTR(arg1) ScreenPtr pScreen = (arg1)
166+
167+#define SCREEN_INIT_ARGS_DECL ScreenPtr pScreen, int argc, char **argv
168+
169+#define BLOCKHANDLER_ARGS_DECL ScreenPtr arg, pointer pTimeout, pointer pReadmask
170+#define BLOCKHANDLER_ARGS arg, pTimeout, pReadmask
171+
172+#define CLOSE_SCREEN_ARGS_DECL ScreenPtr pScreen
173+#define CLOSE_SCREEN_ARGS pScreen
174+
175+#define ADJUST_FRAME_ARGS_DECL ScrnInfoPtr arg, int x, int y
176+#define ADJUST_FRAME_ARGS(arg, x, y) arg, x, y
177+
178+#define SWITCH_MODE_ARGS_DECL ScrnInfoPtr arg, DisplayModePtr mode
179+#define SWITCH_MODE_ARGS(arg, m) arg, m
180+
181+#define FREE_SCREEN_ARGS_DECL ScrnInfoPtr arg
182+
183+#define VT_FUNC_ARGS_DECL ScrnInfoPtr arg
184+#define VT_FUNC_ARGS pScrn
185+
186+#define XF86_SCRN_ARG(x) (x)
187+
188+#endif
189+
190+#endif
191diff --git a/src/vmware.c b/src/vmware.c
192index e3892f1..41201f1 100644
193--- a/src/vmware.c
194+++ b/src/vmware.c
195@@ -901,8 +901,8 @@ VMWAREModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode, Bool rebuildPixmap)
196 pScrn->pScreen->rootDepth),
197 (pointer)(pVMWARE->FbBase + pScrn->fbOffset));
198
199- (*pScrn->EnableDisableFBAccess)(pScrn->pScreen->myNum, FALSE);
200- (*pScrn->EnableDisableFBAccess)(pScrn->pScreen->myNum, TRUE);
201+ (*pScrn->EnableDisableFBAccess)(XF86_SCRN_ARG(pScrn), FALSE);
202+ (*pScrn->EnableDisableFBAccess)(XF86_SCRN_ARG(pScrn), TRUE);
203 }
204
205 vgaHWProtect(pScrn, FALSE);
206@@ -1018,7 +1018,7 @@ vmwareNextXineramaState(VMWAREPtr pVMWARE)
207 }
208
209 static void
210-VMWAREAdjustFrame(int scrnIndex, int x, int y, int flags)
211+VMWAREAdjustFrame(ADJUST_FRAME_ARGS_DECL)
212 {
213 /* FIXME */
214 }
215@@ -1089,9 +1089,9 @@ VMWAREStopFIFO(ScrnInfoPtr pScrn)
216 }
217
218 static Bool
219-VMWARECloseScreen(int scrnIndex, ScreenPtr pScreen)
220+VMWARECloseScreen(CLOSE_SCREEN_ARGS_DECL)
221 {
222- ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
223+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
224 VMWAREPtr pVMWARE = VMWAREPTR(pScrn);
225 ScreenPtr save = &pVMWARE->ScrnFuncs;
226
227@@ -1119,7 +1119,7 @@ VMWARECloseScreen(int scrnIndex, ScreenPtr pScreen)
228 pScrn->DriverFunc = NULL;
229 #endif
230
231- return (*pScreen->CloseScreen)(scrnIndex, pScreen);
232+ return (*pScreen->CloseScreen)(CLOSE_SCREEN_ARGS);
233 }
234
235 static Bool
236@@ -1296,16 +1296,14 @@ vmwareIsRegionEqual(const RegionPtr reg1,
237 }
238
239 static Bool
240-VMWAREScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
241+VMWAREScreenInit(SCREEN_INIT_ARGS_DECL)
242 {
243- ScrnInfoPtr pScrn;
244+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
245 vgaHWPtr hwp;
246 VMWAREPtr pVMWARE;
247 OptionInfoPtr options;
248 Bool useXinerama = TRUE;
249
250- /* Get the ScrnInfoRec */
251- pScrn = xf86Screens[pScreen->myNum];
252 pVMWARE = VMWAREPTR(pScrn);
253
254
255@@ -1381,7 +1379,7 @@ VMWAREScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
256 VMWAREModeInit(pScrn, pScrn->currentMode, FALSE);
257
258 /* Set the viewport if supported */
259- VMWAREAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
260+ VMWAREAdjustFrame(ADJUST_FRAME_ARGS(pScrn, pScrn->frameX0, pScrn->frameY0));
261
262 /*
263 * Setup the screen's visuals, and initialise the framebuffer
264@@ -1582,10 +1580,9 @@ VMWAREScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
265 }
266
267 static Bool
268-VMWARESwitchMode(int scrnIndex, DisplayModePtr mode, int flags)
269-
270+VMWARESwitchMode(SWITCH_MODE_ARGS_DECL)
271 {
272- ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
273+ SCRN_INFO_PTR(arg);
274 ScreenPtr pScreen = pScrn->pScreen;
275
276 pScreen->mmWidth = (pScreen->width * VMWARE_INCHTOMM +
277@@ -1597,9 +1594,9 @@ VMWARESwitchMode(int scrnIndex, DisplayModePtr mode, int flags)
278 }
279
280 static Bool
281-VMWAREEnterVT(int scrnIndex, int flags)
282+VMWAREEnterVT(VT_FUNC_ARGS_DECL)
283 {
284- ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
285+ SCRN_INFO_PTR(arg);
286 VMWAREPtr pVMWARE = VMWAREPTR(pScrn);
287
288 /*
289@@ -1616,9 +1613,9 @@ VMWAREEnterVT(int scrnIndex, int flags)
290 }
291
292 static void
293-VMWARELeaveVT(int scrnIndex, int flags)
294+VMWARELeaveVT(VT_FUNC_ARGS_DECL)
295 {
296- ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
297+ SCRN_INFO_PTR(arg);
298 VMWAREPtr pVMWARE = VMWAREPTR(pScrn);
299
300 /*
301@@ -1631,17 +1628,18 @@ VMWARELeaveVT(int scrnIndex, int flags)
302 }
303
304 static void
305-VMWAREFreeScreen(int scrnIndex, int flags)
306+VMWAREFreeScreen(FREE_SCREEN_ARGS_DECL)
307 {
308+ SCRN_INFO_PTR(arg);
309 /*
310 * If the vgahw module is used vgaHWFreeHWRec() would be called
311 * here.
312 */
313- VMWAREFreeRec(xf86Screens[scrnIndex]);
314+ VMWAREFreeRec(pScrn);
315 }
316
317 static ModeStatus
318-VMWAREValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags)
319+VMWAREValidMode(SCRN_ARG_TYPE arg, DisplayModePtr mode, Bool verbose, int flags)
320 {
321 return MODE_OK;
322 }
323diff --git a/src/vmware.h b/src/vmware.h
324index 458390a..4818e16 100644
325--- a/src/vmware.h
326+++ b/src/vmware.h
327@@ -177,7 +177,7 @@ typedef struct {
328 #define VMWAREPTR(p) ((VMWAREPtr)((p)->driverPrivate))
329
330 static __inline ScrnInfoPtr infoFromScreen(ScreenPtr s) {
331- return xf86Screens[s->myNum];
332+ return xf86ScreenToScrn(s);
333 }
334
335 #define MIN(a,b) ((a)<(b)?(a):(b))
336diff --git a/src/vmware_common.h b/src/vmware_common.h
337index 9cd7194..5629c10 100644
338--- a/src/vmware_common.h
339+++ b/src/vmware_common.h
340@@ -32,6 +32,8 @@
341 #include <X11/extensions/panoramiXproto.h>
342 #include <xf86.h>
343
344+#include "compat-api.h"
345+
346 xXineramaScreenInfo *
347 VMWAREParseTopologyString(ScrnInfoPtr pScrn,
348 const char *topology,
349diff --git a/vmwgfx/vmwgfx_dri2.c b/vmwgfx/vmwgfx_dri2.c
350index 1b82ac4..7de0772 100644
351--- a/vmwgfx/vmwgfx_dri2.c
352+++ b/vmwgfx/vmwgfx_dri2.c
353@@ -83,7 +83,7 @@ static Bool
354 dri2_do_create_buffer(DrawablePtr pDraw, DRI2Buffer2Ptr buffer, unsigned int format)
355 {
356 ScreenPtr pScreen = pDraw->pScreen;
357- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
358+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
359 modesettingPtr ms = modesettingPTR(pScrn);
360 BufferPrivatePtr private = buffer->driverPrivate;
361 PixmapPtr pPixmap;
362@@ -371,7 +371,7 @@ dri2_copy_region(DrawablePtr pDraw, RegionPtr pRegion,
363 Bool
364 xorg_dri2_init(ScreenPtr pScreen)
365 {
366- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
367+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
368 modesettingPtr ms = modesettingPTR(pScrn);
369 DRI2InfoRec dri2info;
370 int major, minor;
371diff --git a/vmwgfx/vmwgfx_driver.c b/vmwgfx/vmwgfx_driver.c
372index ed1eb8c..9959ffb 100644
373--- a/vmwgfx/vmwgfx_driver.c
374+++ b/vmwgfx/vmwgfx_driver.c
375@@ -107,14 +107,13 @@ typedef uint8_t uint8;
376 */
377
378 static Bool drv_pre_init(ScrnInfoPtr pScrn, int flags);
379-static Bool drv_screen_init(int scrnIndex, ScreenPtr pScreen, int argc,
380- char **argv);
381-static Bool drv_switch_mode(int scrnIndex, DisplayModePtr mode, int flags);
382-static void drv_adjust_frame(int scrnIndex, int x, int y, int flags);
383-static Bool drv_enter_vt(int scrnIndex, int flags);
384-static void drv_leave_vt(int scrnIndex, int flags);
385-static void drv_free_screen(int scrnIndex, int flags);
386-static ModeStatus drv_valid_mode(int scrnIndex, DisplayModePtr mode, Bool verbose,
387+static Bool drv_screen_init(SCREEN_INIT_ARGS_DECL);
388+static Bool drv_switch_mode(SWITCH_MODE_ARGS_DECL);
389+static void drv_adjust_frame(ADJUST_FRAME_ARGS_DECL);
390+static Bool drv_enter_vt(VT_FUNC_ARGS_DECL);
391+static void drv_leave_vt(VT_FUNC_ARGS_DECL);
392+static void drv_free_screen(FREE_SCREEN_ARGS_DECL);
393+static ModeStatus drv_valid_mode(SCRN_ARG_TYPE arg, DisplayModePtr mode, Bool verbose,
394 int flags);
395
396 extern void xorg_tracker_set_functions(ScrnInfoPtr scrn);
397@@ -133,7 +132,7 @@ vmwgfx_hookup(ScrnInfoPtr pScrn)
398 * Internal function definitions
399 */
400
401-static Bool drv_close_screen(int scrnIndex, ScreenPtr pScreen);
402+static Bool drv_close_screen(CLOSE_SCREEN_ARGS_DECL);
403
404 /*
405 * Internal functions
406@@ -633,7 +632,7 @@ vmwgfx_scanout_present(ScreenPtr pScreen, int drm_fd,
407
408 void xorg_flush(ScreenPtr pScreen)
409 {
410- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
411+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
412 modesettingPtr ms = modesettingPTR(pScrn);
413 xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
414 PixmapPtr pixmap = NULL;
415@@ -708,14 +707,13 @@ void xorg_flush(ScreenPtr pScreen)
416 free(pixmaps);
417 }
418
419-static void drv_block_handler(int i, pointer blockData, pointer pTimeout,
420- pointer pReadmask)
421+static void drv_block_handler(BLOCKHANDLER_ARGS_DECL)
422 {
423- ScreenPtr pScreen = screenInfo.screens[i];
424- modesettingPtr ms = modesettingPTR(xf86Screens[pScreen->myNum]);
425+ SCREEN_PTR(arg);
426+ modesettingPtr ms = modesettingPTR(xf86ScreenToScrn(pScreen));
427
428 vmwgfx_swap(ms, pScreen, BlockHandler);
429- pScreen->BlockHandler(i, blockData, pTimeout, pReadmask);
430+ pScreen->BlockHandler(BLOCKHANDLER_ARGS);
431 vmwgfx_swap(ms, pScreen, BlockHandler);
432
433 vmwgfx_flush_dri2(pScreen);
434@@ -725,7 +723,7 @@ static void drv_block_handler(int i, pointer blockData, pointer pTimeout,
435 static Bool
436 drv_create_screen_resources(ScreenPtr pScreen)
437 {
438- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
439+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
440 modesettingPtr ms = modesettingPTR(pScrn);
441 Bool ret;
442
443@@ -735,9 +733,9 @@ drv_create_screen_resources(ScreenPtr pScreen)
444 if (!ret)
445 return ret;
446
447- drv_adjust_frame(pScrn->scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
448+ drv_adjust_frame(ADJUST_FRAME_ARGS(pScrn, pScrn->frameX0, pScrn->frameY0));
449
450- return drv_enter_vt(pScreen->myNum, 1);
451+ return drv_enter_vt(VT_FUNC_ARGS);
452 }
453
454 static Bool
455@@ -773,7 +771,7 @@ drv_set_master(ScrnInfoPtr pScrn)
456 static Bool
457 vmwgfx_use_hw_cursor_argb(ScreenPtr screen, CursorPtr cursor)
458 {
459- ScrnInfoPtr pScrn = xf86Screens[screen->myNum];
460+ ScrnInfoPtr pScrn = xf86ScreenToScrn(screen);
461 xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
462 xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
463 modesettingPtr ms = modesettingPTR(pScrn);
464@@ -804,7 +802,7 @@ vmwgfx_use_hw_cursor_argb(ScreenPtr screen, CursorPtr cursor)
465 static Bool
466 vmwgfx_use_hw_cursor(ScreenPtr screen, CursorPtr cursor)
467 {
468- ScrnInfoPtr pScrn = xf86Screens[screen->myNum];
469+ ScrnInfoPtr pScrn = xf86ScreenToScrn(screen);
470 xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
471 xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
472 modesettingPtr ms = modesettingPTR(pScrn);
473@@ -902,9 +900,9 @@ static void drv_load_palette(ScrnInfoPtr pScrn, int numColors,
474
475
476 static Bool
477-drv_screen_init(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
478+drv_screen_init(SCREEN_INIT_ARGS_DECL)
479 {
480- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
481+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
482 modesettingPtr ms = modesettingPTR(pScrn);
483 VisualPtr visual;
484
485@@ -1088,9 +1086,9 @@ drv_screen_init(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
486 }
487
488 static void
489-drv_adjust_frame(int scrnIndex, int x, int y, int flags)
490+drv_adjust_frame(ADJUST_FRAME_ARGS_DECL)
491 {
492- ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
493+ SCRN_INFO_PTR(arg);
494 xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
495 xf86OutputPtr output = config->output[config->compat_output];
496 xf86CrtcPtr crtc = output->crtc;
497@@ -1104,15 +1102,16 @@ drv_adjust_frame(int scrnIndex, int x, int y, int flags)
498 }
499
500 static void
501-drv_free_screen(int scrnIndex, int flags)
502+drv_free_screen(FREE_SCREEN_ARGS_DECL)
503 {
504- drv_free_rec(xf86Screens[scrnIndex]);
505+ SCRN_INFO_PTR(arg);
506+ drv_free_rec(pScrn);
507 }
508
509 static void
510-drv_leave_vt(int scrnIndex, int flags)
511+drv_leave_vt(VT_FUNC_ARGS_DECL)
512 {
513- ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
514+ SCRN_INFO_PTR(arg);
515 modesettingPtr ms = modesettingPTR(pScrn);
516
517 vmwgfx_cursor_bypass(ms->fd, 0, 0);
518@@ -1130,9 +1129,9 @@ drv_leave_vt(int scrnIndex, int flags)
519 * This gets called when gaining control of the VT, and from ScreenInit().
520 */
521 static Bool
522-drv_enter_vt(int scrnIndex, int flags)
523+drv_enter_vt(VT_FUNC_ARGS_DECL)
524 {
525- ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
526+ SCRN_INFO_PTR(arg);
527
528 if (!drv_set_master(pScrn))
529 return FALSE;
530@@ -1144,17 +1143,17 @@ drv_enter_vt(int scrnIndex, int flags)
531 }
532
533 static Bool
534-drv_switch_mode(int scrnIndex, DisplayModePtr mode, int flags)
535+drv_switch_mode(SWITCH_MODE_ARGS_DECL)
536 {
537- ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
538+ SCRN_INFO_PTR(arg);
539
540 return xf86SetSingleMode(pScrn, mode, RR_Rotate_0);
541 }
542
543 static Bool
544-drv_close_screen(int scrnIndex, ScreenPtr pScreen)
545+drv_close_screen(CLOSE_SCREEN_ARGS_DECL)
546 {
547- ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
548+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
549 modesettingPtr ms = modesettingPTR(pScrn);
550
551 if (ms->cursor) {
552@@ -1166,7 +1165,7 @@ drv_close_screen(int scrnIndex, ScreenPtr pScreen)
553 xorg_dri2_close(pScreen);
554
555 if (pScrn->vtSema)
556- pScrn->LeaveVT(scrnIndex, 0);
557+ pScrn->LeaveVT(VT_FUNC_ARGS);
558
559 pScrn->vtSema = FALSE;
560
561@@ -1180,11 +1179,11 @@ drv_close_screen(int scrnIndex, ScreenPtr pScreen)
562 if (ms->xat)
563 xa_tracker_destroy(ms->xat);
564
565- return (*pScreen->CloseScreen) (scrnIndex, pScreen);
566+ return (*pScreen->CloseScreen) (CLOSE_SCREEN_ARGS);
567 }
568
569 static ModeStatus
570-drv_valid_mode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags)
571+drv_valid_mode(SCRN_ARG_TYPE arg, DisplayModePtr mode, Bool verbose, int flags)
572 {
573 return MODE_OK;
574 }
575diff --git a/vmwgfx/vmwgfx_driver.h b/vmwgfx/vmwgfx_driver.h
576index 4fcfed6..f78a85f 100644
577--- a/vmwgfx/vmwgfx_driver.h
578+++ b/vmwgfx/vmwgfx_driver.h
579@@ -46,6 +46,7 @@
580 #include <xa_tracker.h>
581 #include <xf86Module.h>
582
583+#include "../src/compat-api.h"
584 #ifdef DRI2
585 #include <dri2.h>
586 #if (!defined(DRI2INFOREC_VERSION) || (DRI2INFOREC_VERSION < 3))
587@@ -118,9 +119,9 @@ typedef struct _modesettingRec
588 ScreenBlockHandlerProcPtr saved_BlockHandler;
589 CreateScreenResourcesProcPtr saved_CreateScreenResources;
590 CloseScreenProcPtr saved_CloseScreen;
591- Bool (*saved_EnterVT)(int, int);
592- void (*saved_LeaveVT)(int, int);
593- void (*saved_AdjustFrame)(int, int, int, int);
594+ Bool (*saved_EnterVT)(VT_FUNC_ARGS_DECL);
595+ void (*saved_LeaveVT)(VT_FUNC_ARGS_DECL);
596+ void (*saved_AdjustFrame)(ADJUST_FRAME_ARGS_DECL);
597 Bool (*saved_UseHWCursor)(ScreenPtr, CursorPtr);
598 Bool (*saved_UseHWCursorARGB)(ScreenPtr, CursorPtr);
599
600diff --git a/vmwgfx/vmwgfx_saa.c b/vmwgfx/vmwgfx_saa.c
601index 469598a..63df3a1 100644
602--- a/vmwgfx/vmwgfx_saa.c
603+++ b/vmwgfx/vmwgfx_saa.c
604@@ -460,7 +460,7 @@ vmwgfx_flush_dri2(ScreenPtr pScreen)
605 struct vmwgfx_saa *vsaa =
606 to_vmwgfx_saa(saa_get_driver(pScreen));
607 struct _WsbmListHead *list, *next;
608- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
609+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
610
611 if (!pScrn->vtSema)
612 return;
613@@ -1199,7 +1199,7 @@ vmwgfx_operation_complete(struct saa_driver *driver,
614 struct vmwgfx_saa *vsaa = to_vmwgfx_saa(driver);
615 struct saa_pixmap *spix = saa_get_saa_pixmap(pixmap);
616 struct vmwgfx_saa_pixmap *vpix = to_vmwgfx_saa_pixmap(spix);
617- ScrnInfoPtr pScrn = xf86Screens[vsaa->pScreen->myNum];
618+ ScrnInfoPtr pScrn = xf86ScreenToScrn(vsaa->pScreen);
619
620 /*
621 * Make dri2 drawables up to date, or add them to the flush list
622diff --git a/vmwgfx/vmwgfx_tex_video.c b/vmwgfx/vmwgfx_tex_video.c
623index af53379..449266b 100644
624--- a/vmwgfx/vmwgfx_tex_video.c
625+++ b/vmwgfx/vmwgfx_tex_video.c
626@@ -638,7 +638,7 @@ put_image(ScrnInfoPtr pScrn,
627 DrawablePtr pDraw)
628 {
629 struct xorg_xv_port_priv *pPriv = (struct xorg_xv_port_priv *) data;
630- ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex];
631+ ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
632 PixmapPtr pPixmap;
633 INT32 x1, x2, y1, y2;
634 BoxRec dstBox;
635@@ -732,7 +732,7 @@ vmwgfx_free_textured_adaptor(XF86VideoAdaptorPtr adaptor, Bool free_ports)
636 static XF86VideoAdaptorPtr
637 xorg_setup_textured_adapter(ScreenPtr pScreen)
638 {
639- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
640+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
641 modesettingPtr ms = modesettingPTR(pScrn);
642 XF86VideoAdaptorPtr adapt;
643 XF86AttributePtr attrs;
644@@ -799,7 +799,7 @@ xorg_setup_textured_adapter(ScreenPtr pScreen)
645 void
646 xorg_xv_init(ScreenPtr pScreen)
647 {
648- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
649+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
650 modesettingPtr ms = modesettingPTR(pScrn);
651 XF86VideoAdaptorPtr *adaptors, *new_adaptors = NULL;
652 XF86VideoAdaptorPtr textured_adapter = NULL, overlay_adaptor = NULL;
653--
6541.7.9.5
655