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