1 | /* $Id: vboxvideo.c 57356 2015-08-14 15:03:30Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | *
|
---|
4 | * Linux Additions X11 graphics driver
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2006-2013 Oracle Corporation
|
---|
9 | *
|
---|
10 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
11 | * available from http://www.virtualbox.org. This file is free software;
|
---|
12 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
13 | * General Public License (GPL) as published by the Free Software
|
---|
14 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
15 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
16 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
17 | * --------------------------------------------------------------------
|
---|
18 | *
|
---|
19 | * This code is based on the X.Org VESA driver with the following copyrights:
|
---|
20 | *
|
---|
21 | * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com)
|
---|
22 | * Copyright 2008 Red Hat, Inc.
|
---|
23 | * Copyright 2012 Red Hat, Inc.
|
---|
24 | *
|
---|
25 | * and the following permission notice (not all original sourse files include
|
---|
26 | * the last paragraph):
|
---|
27 | *
|
---|
28 | * Permission is hereby granted, free of charge, to any person obtaining a
|
---|
29 | * copy of this software and associated documentation files (the "Software"),
|
---|
30 | * to deal in the Software without restriction, including without limitation
|
---|
31 | * the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
---|
32 | * and/or sell copies of the Software, and to permit persons to whom the
|
---|
33 | * Software is furnished to do so, subject to the following conditions:
|
---|
34 | *
|
---|
35 | * The above copyright notice and this permission notice shall be included in
|
---|
36 | * all copies or substantial portions of the Software.
|
---|
37 | *
|
---|
38 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
---|
39 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
---|
40 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
---|
41 | * CONECTIVA LINUX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
---|
42 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
---|
43 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
---|
44 | * SOFTWARE.
|
---|
45 | *
|
---|
46 | * Except as contained in this notice, the name of Conectiva Linux shall
|
---|
47 | * not be used in advertising or otherwise to promote the sale, use or other
|
---|
48 | * dealings in this Software without prior written authorization from
|
---|
49 | * Conectiva Linux.
|
---|
50 | *
|
---|
51 | * Authors: Paulo César Pereira de Andrade <[email protected]>
|
---|
52 | * David Dawes <[email protected]>
|
---|
53 | * Adam Jackson <[email protected]>
|
---|
54 | * Dave Airlie <[email protected]>
|
---|
55 | */
|
---|
56 |
|
---|
57 | #include "vboxvideo.h"
|
---|
58 | #include <VBox/VBoxGuest.h>
|
---|
59 | #include <VBox/VBoxGuestLib.h>
|
---|
60 | #include <VBox/Hardware/VBoxVideoVBE.h>
|
---|
61 | #include "version-generated.h"
|
---|
62 | #include "product-generated.h"
|
---|
63 | #include "revision-generated.h"
|
---|
64 |
|
---|
65 | /* Basic definitions and functions needed by all drivers. */
|
---|
66 | #include "xf86.h"
|
---|
67 | /* For video memory mapping. */
|
---|
68 | #include "xf86_OSproc.h"
|
---|
69 | #if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 6
|
---|
70 | /* PCI resources. */
|
---|
71 | # include "xf86Resources.h"
|
---|
72 | #endif
|
---|
73 | /* Generic server linear frame-buffer APIs. */
|
---|
74 | #include "fb.h"
|
---|
75 | /* Colormap and visual handling. */
|
---|
76 | #include "micmap.h"
|
---|
77 | #include "xf86cmap.h"
|
---|
78 | /* ShadowFB support */
|
---|
79 | #include "shadowfb.h"
|
---|
80 | /* VGA hardware functions for setting and restoring text mode */
|
---|
81 | #include "vgaHW.h"
|
---|
82 | #ifdef VBOX_DRI
|
---|
83 | # include "xf86drm.h"
|
---|
84 | # include "xf86drmMode.h"
|
---|
85 | #endif
|
---|
86 | #ifdef VBOXVIDEO_13
|
---|
87 | /* X.org 1.3+ mode setting */
|
---|
88 | # define _HAVE_STRING_ARCH_strsep /* bits/string2.h, __strsep_1c. */
|
---|
89 | # include "xf86Crtc.h"
|
---|
90 | # include "xf86Modes.h"
|
---|
91 | /* For xf86RandR12GetOriginalVirtualSize(). */
|
---|
92 | # include "xf86RandR12.h"
|
---|
93 | #endif
|
---|
94 | /* For setting the root window property. */
|
---|
95 | #include "property.h"
|
---|
96 | #include "X11/Xatom.h"
|
---|
97 |
|
---|
98 | #ifdef XORG_7X
|
---|
99 | # include <stdlib.h>
|
---|
100 | # include <string.h>
|
---|
101 | #endif
|
---|
102 |
|
---|
103 | /* Mandatory functions */
|
---|
104 |
|
---|
105 | static const OptionInfoRec * VBOXAvailableOptions(int chipid, int busid);
|
---|
106 | static void VBOXIdentify(int flags);
|
---|
107 | #ifndef PCIACCESS
|
---|
108 | static Bool VBOXProbe(DriverPtr drv, int flags);
|
---|
109 | #else
|
---|
110 | static Bool VBOXPciProbe(DriverPtr drv, int entity_num,
|
---|
111 | struct pci_device *dev, intptr_t match_data);
|
---|
112 | #endif
|
---|
113 | static Bool VBOXPreInit(ScrnInfoPtr pScrn, int flags);
|
---|
114 | static Bool VBOXScreenInit(ScreenPtr pScreen, int argc, char **argv);
|
---|
115 | static Bool VBOXEnterVT(ScrnInfoPtr pScrn);
|
---|
116 | static void VBOXLeaveVT(ScrnInfoPtr pScrn);
|
---|
117 | static Bool VBOXCloseScreen(ScreenPtr pScreen);
|
---|
118 | static Bool VBOXSaveScreen(ScreenPtr pScreen, int mode);
|
---|
119 | static Bool VBOXSwitchMode(ScrnInfoPtr pScrn, DisplayModePtr pMode);
|
---|
120 | static void VBOXAdjustFrame(ScrnInfoPtr pScrn, int x, int y);
|
---|
121 | static void VBOXFreeScreen(ScrnInfoPtr pScrn);
|
---|
122 | static void VBOXDisplayPowerManagementSet(ScrnInfoPtr pScrn, int mode,
|
---|
123 | int flags);
|
---|
124 |
|
---|
125 | /* locally used functions */
|
---|
126 | static Bool VBOXMapVidMem(ScrnInfoPtr pScrn);
|
---|
127 | static void VBOXUnmapVidMem(ScrnInfoPtr pScrn);
|
---|
128 | static void VBOXSaveMode(ScrnInfoPtr pScrn);
|
---|
129 | static void VBOXRestoreMode(ScrnInfoPtr pScrn);
|
---|
130 | static void setSizesAndCursorIntegration(ScrnInfoPtr pScrn, bool fScreenInitTime);
|
---|
131 |
|
---|
132 | #ifndef XF86_SCRN_INTERFACE
|
---|
133 | # define xf86ScreenToScrn(pScreen) xf86Screens[(pScreen)->myNum]
|
---|
134 | # define xf86ScrnToScreen(pScrn) screenInfo.screens[(pScrn)->scrnIndex]
|
---|
135 | #endif
|
---|
136 |
|
---|
137 | static inline void VBOXSetRec(ScrnInfoPtr pScrn)
|
---|
138 | {
|
---|
139 | if (!pScrn->driverPrivate)
|
---|
140 | {
|
---|
141 | VBOXPtr pVBox = (VBOXPtr)xnfcalloc(sizeof(VBOXRec), 1);
|
---|
142 | pScrn->driverPrivate = pVBox;
|
---|
143 | #if defined(VBOXVIDEO_13) && defined(RT_OS_LINUX)
|
---|
144 | pVBox->fdACPIDevices = -1;
|
---|
145 | #endif
|
---|
146 | }
|
---|
147 | }
|
---|
148 |
|
---|
149 | enum GenericTypes
|
---|
150 | {
|
---|
151 | CHIP_VBOX_GENERIC
|
---|
152 | };
|
---|
153 |
|
---|
154 | #ifdef PCIACCESS
|
---|
155 | static const struct pci_id_match vbox_device_match[] = {
|
---|
156 | {
|
---|
157 | VBOX_VENDORID, VBOX_DEVICEID, PCI_MATCH_ANY, PCI_MATCH_ANY,
|
---|
158 | 0, 0, 0
|
---|
159 | },
|
---|
160 |
|
---|
161 | { 0, 0, 0 },
|
---|
162 | };
|
---|
163 | #endif
|
---|
164 |
|
---|
165 | /* Supported chipsets */
|
---|
166 | static SymTabRec VBOXChipsets[] =
|
---|
167 | {
|
---|
168 | {VBOX_DEVICEID, "vbox"},
|
---|
169 | {-1, NULL}
|
---|
170 | };
|
---|
171 |
|
---|
172 | static PciChipsets VBOXPCIchipsets[] = {
|
---|
173 | { VBOX_DEVICEID, VBOX_DEVICEID, RES_SHARED_VGA },
|
---|
174 | { -1, -1, RES_UNDEFINED },
|
---|
175 | };
|
---|
176 |
|
---|
177 | /*
|
---|
178 | * This contains the functions needed by the server after loading the
|
---|
179 | * driver module. It must be supplied, and gets added the driver list by
|
---|
180 | * the Module Setup function in the dynamic case. In the static case a
|
---|
181 | * reference to this is compiled in, and this requires that the name of
|
---|
182 | * this DriverRec be an upper-case version of the driver name.
|
---|
183 | */
|
---|
184 |
|
---|
185 | #ifdef XORG_7X
|
---|
186 | _X_EXPORT
|
---|
187 | #endif
|
---|
188 | DriverRec VBOXVIDEO = {
|
---|
189 | VBOX_VERSION,
|
---|
190 | VBOX_DRIVER_NAME,
|
---|
191 | VBOXIdentify,
|
---|
192 | #ifdef PCIACCESS
|
---|
193 | NULL,
|
---|
194 | #else
|
---|
195 | VBOXProbe,
|
---|
196 | #endif
|
---|
197 | VBOXAvailableOptions,
|
---|
198 | NULL,
|
---|
199 | 0,
|
---|
200 | #ifdef XORG_7X
|
---|
201 | NULL,
|
---|
202 | #endif
|
---|
203 | #ifdef PCIACCESS
|
---|
204 | vbox_device_match,
|
---|
205 | VBOXPciProbe
|
---|
206 | #endif
|
---|
207 | };
|
---|
208 |
|
---|
209 | /* No options for now */
|
---|
210 | static const OptionInfoRec VBOXOptions[] = {
|
---|
211 | { -1, NULL, OPTV_NONE, {0}, FALSE }
|
---|
212 | };
|
---|
213 |
|
---|
214 | #ifndef XORG_7X
|
---|
215 | /*
|
---|
216 | * List of symbols from other modules that this module references. This
|
---|
217 | * list is used to tell the loader that it is OK for symbols here to be
|
---|
218 | * unresolved providing that it hasn't been told that they haven't been
|
---|
219 | * told that they are essential via a call to xf86LoaderReqSymbols() or
|
---|
220 | * xf86LoaderReqSymLists(). The purpose is this is to avoid warnings about
|
---|
221 | * unresolved symbols that are not required.
|
---|
222 | */
|
---|
223 | static const char *fbSymbols[] = {
|
---|
224 | "fbPictureInit",
|
---|
225 | "fbScreenInit",
|
---|
226 | NULL
|
---|
227 | };
|
---|
228 |
|
---|
229 | static const char *shadowfbSymbols[] = {
|
---|
230 | "ShadowFBInit2",
|
---|
231 | NULL
|
---|
232 | };
|
---|
233 |
|
---|
234 | static const char *ramdacSymbols[] = {
|
---|
235 | "xf86DestroyCursorInfoRec",
|
---|
236 | "xf86InitCursor",
|
---|
237 | "xf86CreateCursorInfoRec",
|
---|
238 | NULL
|
---|
239 | };
|
---|
240 |
|
---|
241 | static const char *vgahwSymbols[] = {
|
---|
242 | "vgaHWFreeHWRec",
|
---|
243 | "vgaHWGetHWRec",
|
---|
244 | "vgaHWGetIOBase",
|
---|
245 | "vgaHWGetIndex",
|
---|
246 | "vgaHWRestore",
|
---|
247 | "vgaHWSave",
|
---|
248 | "vgaHWSetStdFuncs",
|
---|
249 | NULL
|
---|
250 | };
|
---|
251 | #endif /* !XORG_7X */
|
---|
252 |
|
---|
253 | /** Resize the virtual framebuffer. */
|
---|
254 | static Bool adjustScreenPixmap(ScrnInfoPtr pScrn, int width, int height)
|
---|
255 | {
|
---|
256 | ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
|
---|
257 | VBOXPtr pVBox = VBOXGetRec(pScrn);
|
---|
258 | int adjustedWidth = pScrn->bitsPerPixel == 16 ? (width + 1) & ~1 : width;
|
---|
259 | int cbLine = adjustedWidth * pScrn->bitsPerPixel / 8;
|
---|
260 | PixmapPtr pPixmap;
|
---|
261 |
|
---|
262 | TRACE_LOG("width=%d, height=%d\n", width, height);
|
---|
263 | VBVXASSERT(width >= 0 && height >= 0, ("Invalid negative width (%d) or height (%d)\n", width, height));
|
---|
264 | if (pScreen == NULL) /* Not yet initialised. */
|
---|
265 | return TRUE;
|
---|
266 | pPixmap = pScreen->GetScreenPixmap(pScreen);
|
---|
267 | VBVXASSERT(pPixmap != NULL, ("Failed to get the screen pixmap.\n"));
|
---|
268 | TRACE_LOG("pPixmap=%p adjustedWidth=%d height=%d pScrn->depth=%d pScrn->bitsPerPixel=%d cbLine=%d pVBox->base=%p pPixmap->drawable.width=%d pPixmap->drawable.height=%d\n",
|
---|
269 | pPixmap, adjustedWidth, height, pScrn->depth, pScrn->bitsPerPixel, cbLine, pVBox->base, pPixmap->drawable.width,
|
---|
270 | pPixmap->drawable.height);
|
---|
271 | if ( adjustedWidth != pPixmap->drawable.width
|
---|
272 | || height != pPixmap->drawable.height)
|
---|
273 | {
|
---|
274 | if ( adjustedWidth > VBOX_VIDEO_MAX_VIRTUAL || height > VBOX_VIDEO_MAX_VIRTUAL
|
---|
275 | || (unsigned)cbLine * (unsigned)height >= pVBox->cbFBMax)
|
---|
276 | {
|
---|
277 | xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
|
---|
278 | "Virtual framebuffer %dx%d too large. For information, video memory: %u Kb.\n",
|
---|
279 | adjustedWidth, height, (unsigned) pVBox->cbFBMax / 1024);
|
---|
280 | return FALSE;
|
---|
281 | }
|
---|
282 | if (pScrn->vtSema)
|
---|
283 | vbvxClearVRAM(pScrn, ((size_t)pScrn->virtualX) * pScrn->virtualY * (pScrn->bitsPerPixel / 8),
|
---|
284 | ((size_t)adjustedWidth) * height * (pScrn->bitsPerPixel / 8));
|
---|
285 | pScreen->ModifyPixmapHeader(pPixmap, adjustedWidth, height, pScrn->depth, pScrn->bitsPerPixel, cbLine, pVBox->base);
|
---|
286 | }
|
---|
287 | pScrn->displayWidth = pScrn->virtualX = adjustedWidth;
|
---|
288 | pScrn->virtualY = height;
|
---|
289 | #ifdef VBOX_DRI_OLD
|
---|
290 | if (pVBox->useDRI)
|
---|
291 | VBOXDRIUpdateStride(pScrn, pVBox);
|
---|
292 | #endif
|
---|
293 | return TRUE;
|
---|
294 | }
|
---|
295 |
|
---|
296 | /** Set a video mode to the hardware, RandR 1.1 version. Since we no longer do
|
---|
297 | * virtual frame buffers, adjust the screen pixmap dimensions to match. The
|
---|
298 | * "override" parameters are for when we received a mode hint while switched to
|
---|
299 | * a virtual terminal. In this case VBoxClient will have told us about the
|
---|
300 | * mode, but not yet been able to do a mode switch using RandR. We solve this
|
---|
301 | * by setting the requested mode to the host but keeping the virtual frame-
|
---|
302 | * buffer matching what the X server expects. */
|
---|
303 | static void setModeRandR11(ScrnInfoPtr pScrn, DisplayModePtr pMode, bool fScreenInitTime, bool fEnterVTTime,
|
---|
304 | int cXOverRide, int cYOverRide)
|
---|
305 | {
|
---|
306 | VBOXPtr pVBox = VBOXGetRec(pScrn);
|
---|
307 | struct vbvxFrameBuffer frameBuffer = { 0, 0, pMode->HDisplay, pMode->VDisplay, pScrn->bitsPerPixel};
|
---|
308 | int cXPhysical = cXOverRide > 0 ? min(cXOverRide, pMode->HDisplay) : pMode->HDisplay;
|
---|
309 | int cYPhysical = cYOverRide > 0 ? min(cYOverRide, pMode->VDisplay) : pMode->VDisplay;
|
---|
310 |
|
---|
311 | pVBox->pScreens[0].aScreenLocation.cx = pMode->HDisplay;
|
---|
312 | pVBox->pScreens[0].aScreenLocation.cy = pMode->VDisplay;
|
---|
313 | if (fScreenInitTime)
|
---|
314 | {
|
---|
315 | /* The screen structure is not fully set up yet, so do not touch it. */
|
---|
316 | pScrn->displayWidth = pScrn->virtualX = pMode->HDisplay;
|
---|
317 | pScrn->virtualY = pMode->VDisplay;
|
---|
318 | }
|
---|
319 | else
|
---|
320 | {
|
---|
321 | xf86ScrnToScreen(pScrn)->width = pMode->HDisplay;
|
---|
322 | xf86ScrnToScreen(pScrn)->height = pMode->VDisplay;
|
---|
323 | /* This prevents a crash in CentOS 3. I was unable to debug it to
|
---|
324 | * satisfaction, partly due to the lack of symbols. My guess is that
|
---|
325 | * pScrn->ModifyPixmapHeader() expects certain things to be set up when
|
---|
326 | * it sees pScrn->vtSema set to true which are not quite done at this
|
---|
327 | * point of the VT switch. */
|
---|
328 | if (fEnterVTTime)
|
---|
329 | pScrn->vtSema = FALSE;
|
---|
330 | adjustScreenPixmap(pScrn, pMode->HDisplay, pMode->VDisplay);
|
---|
331 | if (fEnterVTTime)
|
---|
332 | pScrn->vtSema = TRUE;
|
---|
333 | }
|
---|
334 | if (pMode->HDisplay != 0 && pMode->VDisplay != 0 && pScrn->vtSema)
|
---|
335 | vbvxSetMode(pScrn, 0, cXPhysical, cYPhysical, 0, 0, true, true, &frameBuffer);
|
---|
336 | pScrn->currentMode = pMode;
|
---|
337 | }
|
---|
338 |
|
---|
339 | #ifdef VBOXVIDEO_13
|
---|
340 | /* X.org 1.3+ mode-setting support ******************************************/
|
---|
341 |
|
---|
342 | /** Set a video mode to the hardware, RandR 1.2 version. If this is the first
|
---|
343 | * screen, re-set the current mode for all others (the offset for the first
|
---|
344 | * screen is always treated as zero by the hardware, so all other screens need
|
---|
345 | * to be changed to compensate for any changes!). The mode to set is taken
|
---|
346 | * from the X.Org Crtc structure. */
|
---|
347 | static void setModeRandR12(ScrnInfoPtr pScrn, unsigned cScreen)
|
---|
348 | {
|
---|
349 | VBOXPtr pVBox = VBOXGetRec(pScrn);
|
---|
350 | unsigned i;
|
---|
351 | struct vbvxFrameBuffer frameBuffer = { pVBox->pScreens[0].paCrtcs->x, pVBox->pScreens[0].paCrtcs->y, pScrn->virtualX,
|
---|
352 | pScrn->virtualY, pScrn->bitsPerPixel };
|
---|
353 | unsigned cFirst = cScreen;
|
---|
354 | unsigned cLast = cScreen != 0 ? cScreen + 1 : pVBox->cScreens;
|
---|
355 | int originalX, originalY;
|
---|
356 |
|
---|
357 | /* Check that this code cannot trigger the resizing bug in X.Org Server 1.3.
|
---|
358 | * See the work-around in ScreenInit. */
|
---|
359 | xf86RandR12GetOriginalVirtualSize(pScrn, &originalX, &originalY);
|
---|
360 | VBVXASSERT(originalX == VBOX_VIDEO_MAX_VIRTUAL && originalY == VBOX_VIDEO_MAX_VIRTUAL, ("OriginalSize=%dx%d",
|
---|
361 | originalX, originalY));
|
---|
362 | for (i = cFirst; i < cLast; ++i)
|
---|
363 | if (pVBox->pScreens[i].paCrtcs->mode.HDisplay != 0 && pVBox->pScreens[i].paCrtcs->mode.VDisplay != 0 && pScrn->vtSema)
|
---|
364 | vbvxSetMode(pScrn, i, pVBox->pScreens[i].paCrtcs->mode.HDisplay, pVBox->pScreens[i].paCrtcs->mode.VDisplay,
|
---|
365 | pVBox->pScreens[i].paCrtcs->x, pVBox->pScreens[i].paCrtcs->y, pVBox->pScreens[i].fPowerOn,
|
---|
366 | pVBox->pScreens[i].paOutputs->status == XF86OutputStatusConnected, &frameBuffer);
|
---|
367 | }
|
---|
368 |
|
---|
369 | /** Wrapper around setModeRandR12() to avoid exposing non-obvious semantics.
|
---|
370 | */
|
---|
371 | static void setAllModesRandR12(ScrnInfoPtr pScrn)
|
---|
372 | {
|
---|
373 | setModeRandR12(pScrn, 0);
|
---|
374 | }
|
---|
375 |
|
---|
376 | /* For descriptions of these functions and structures, see
|
---|
377 | hw/xfree86/modes/xf86Crtc.h and hw/xfree86/modes/xf86Modes.h in the
|
---|
378 | X.Org source tree. */
|
---|
379 |
|
---|
380 | static Bool vbox_config_resize(ScrnInfoPtr pScrn, int cw, int ch)
|
---|
381 | {
|
---|
382 | VBOXPtr pVBox = VBOXGetRec(pScrn);
|
---|
383 | Bool rc;
|
---|
384 | unsigned i;
|
---|
385 |
|
---|
386 | TRACE_LOG("width=%d, height=%d\n", cw, ch);
|
---|
387 | rc = adjustScreenPixmap(pScrn, cw, ch);
|
---|
388 | /* Power-on all screens (the server expects this) and set the new pitch to them. */
|
---|
389 | for (i = 0; i < pVBox->cScreens; ++i)
|
---|
390 | pVBox->pScreens[i].fPowerOn = true;
|
---|
391 | setAllModesRandR12(pScrn);
|
---|
392 | vbvxSetSolarisMouseRange(cw, ch);
|
---|
393 | return rc;
|
---|
394 | }
|
---|
395 |
|
---|
396 | static const xf86CrtcConfigFuncsRec VBOXCrtcConfigFuncs = {
|
---|
397 | vbox_config_resize
|
---|
398 | };
|
---|
399 |
|
---|
400 | static void
|
---|
401 | vbox_crtc_dpms(xf86CrtcPtr crtc, int mode)
|
---|
402 | {
|
---|
403 | ScrnInfoPtr pScrn = crtc->scrn;
|
---|
404 | VBOXPtr pVBox = VBOXGetRec(pScrn);
|
---|
405 | unsigned cDisplay = (uintptr_t)crtc->driver_private;
|
---|
406 |
|
---|
407 | TRACE_LOG("mode=%d\n", mode);
|
---|
408 | pVBox->pScreens[cDisplay].fPowerOn = (mode != DPMSModeOff);
|
---|
409 | setModeRandR12(pScrn, cDisplay);
|
---|
410 | }
|
---|
411 |
|
---|
412 | static Bool
|
---|
413 | vbox_crtc_lock (xf86CrtcPtr crtc)
|
---|
414 | { (void) crtc; return FALSE; }
|
---|
415 |
|
---|
416 |
|
---|
417 | /* We use this function to check whether the X server owns the active virtual
|
---|
418 | * terminal before attempting a mode switch, since the RandR extension isn't
|
---|
419 | * very dilligent here, which can mean crashes if we are unlucky. This is
|
---|
420 | * not the way it the function is intended - it is meant for reporting modes
|
---|
421 | * which the hardware can't handle. I hope that this won't confuse any clients
|
---|
422 | * connecting to us. */
|
---|
423 | static Bool
|
---|
424 | vbox_crtc_mode_fixup (xf86CrtcPtr crtc, DisplayModePtr mode,
|
---|
425 | DisplayModePtr adjusted_mode)
|
---|
426 | { (void) crtc; (void) mode; (void) adjusted_mode; return TRUE; }
|
---|
427 |
|
---|
428 | static void
|
---|
429 | vbox_crtc_stub (xf86CrtcPtr crtc)
|
---|
430 | { (void) crtc; }
|
---|
431 |
|
---|
432 | static void
|
---|
433 | vbox_crtc_mode_set (xf86CrtcPtr crtc, DisplayModePtr mode,
|
---|
434 | DisplayModePtr adjusted_mode, int x, int y)
|
---|
435 | {
|
---|
436 | (void) mode;
|
---|
437 | VBOXPtr pVBox = VBOXGetRec(crtc->scrn);
|
---|
438 | unsigned cDisplay = (uintptr_t)crtc->driver_private;
|
---|
439 |
|
---|
440 | TRACE_LOG("name=%s, HDisplay=%d, VDisplay=%d, x=%d, y=%d\n", adjusted_mode->name,
|
---|
441 | adjusted_mode->HDisplay, adjusted_mode->VDisplay, x, y);
|
---|
442 | pVBox->pScreens[cDisplay].fPowerOn = true;
|
---|
443 | pVBox->pScreens[cDisplay].aScreenLocation.cx = adjusted_mode->HDisplay;
|
---|
444 | pVBox->pScreens[cDisplay].aScreenLocation.cy = adjusted_mode->VDisplay;
|
---|
445 | pVBox->pScreens[cDisplay].aScreenLocation.x = x;
|
---|
446 | pVBox->pScreens[cDisplay].aScreenLocation.y = y;
|
---|
447 | setModeRandR12(crtc->scrn, cDisplay);
|
---|
448 | }
|
---|
449 |
|
---|
450 | static void
|
---|
451 | vbox_crtc_gamma_set (xf86CrtcPtr crtc, CARD16 *red,
|
---|
452 | CARD16 *green, CARD16 *blue, int size)
|
---|
453 | { (void) crtc; (void) red; (void) green; (void) blue; (void) size; }
|
---|
454 |
|
---|
455 | static void *
|
---|
456 | vbox_crtc_shadow_allocate (xf86CrtcPtr crtc, int width, int height)
|
---|
457 | { (void) crtc; (void) width; (void) height; return NULL; }
|
---|
458 |
|
---|
459 | static const xf86CrtcFuncsRec VBOXCrtcFuncs = {
|
---|
460 | .dpms = vbox_crtc_dpms,
|
---|
461 | .save = NULL, /* These two are never called by the server. */
|
---|
462 | .restore = NULL,
|
---|
463 | .lock = vbox_crtc_lock,
|
---|
464 | .unlock = NULL, /* This will not be invoked if lock returns FALSE. */
|
---|
465 | .mode_fixup = vbox_crtc_mode_fixup,
|
---|
466 | .prepare = vbox_crtc_stub,
|
---|
467 | .mode_set = vbox_crtc_mode_set,
|
---|
468 | .commit = vbox_crtc_stub,
|
---|
469 | .gamma_set = vbox_crtc_gamma_set,
|
---|
470 | .shadow_allocate = vbox_crtc_shadow_allocate,
|
---|
471 | .shadow_create = NULL, /* These two should not be invoked if allocate
|
---|
472 | returns NULL. */
|
---|
473 | .shadow_destroy = NULL,
|
---|
474 | .set_cursor_colors = NULL, /* We are still using the old cursor API. */
|
---|
475 | .set_cursor_position = NULL,
|
---|
476 | .show_cursor = NULL,
|
---|
477 | .hide_cursor = NULL,
|
---|
478 | .load_cursor_argb = NULL,
|
---|
479 | .destroy = vbox_crtc_stub
|
---|
480 | };
|
---|
481 |
|
---|
482 | static void
|
---|
483 | vbox_output_stub (xf86OutputPtr output)
|
---|
484 | { (void) output; }
|
---|
485 |
|
---|
486 | static void
|
---|
487 | vbox_output_dpms (xf86OutputPtr output, int mode)
|
---|
488 | {
|
---|
489 | (void)output; (void)mode;
|
---|
490 | }
|
---|
491 |
|
---|
492 | static int
|
---|
493 | vbox_output_mode_valid (xf86OutputPtr output, DisplayModePtr mode)
|
---|
494 | {
|
---|
495 | return MODE_OK;
|
---|
496 | }
|
---|
497 |
|
---|
498 | static Bool
|
---|
499 | vbox_output_mode_fixup (xf86OutputPtr output, DisplayModePtr mode,
|
---|
500 | DisplayModePtr adjusted_mode)
|
---|
501 | { (void) output; (void) mode; (void) adjusted_mode; return TRUE; }
|
---|
502 |
|
---|
503 | static void
|
---|
504 | vbox_output_mode_set (xf86OutputPtr output, DisplayModePtr mode,
|
---|
505 | DisplayModePtr adjusted_mode)
|
---|
506 | { (void) output; (void) mode; (void) adjusted_mode; }
|
---|
507 |
|
---|
508 | /* A virtual monitor is always connected. */
|
---|
509 | static xf86OutputStatus
|
---|
510 | vbox_output_detect (xf86OutputPtr output)
|
---|
511 | {
|
---|
512 | ScrnInfoPtr pScrn = output->scrn;
|
---|
513 | VBOXPtr pVBox = VBOXGetRec(pScrn);
|
---|
514 | uint32_t iScreen = (uintptr_t)output->driver_private;
|
---|
515 | return pVBox->pScreens[iScreen].afConnected
|
---|
516 | ? XF86OutputStatusConnected : XF86OutputStatusDisconnected;
|
---|
517 | }
|
---|
518 |
|
---|
519 | static DisplayModePtr vbox_output_add_mode(VBOXPtr pVBox, DisplayModePtr *pModes, const char *pszName, int x, int y,
|
---|
520 | Bool isPreferred, Bool isUserDef)
|
---|
521 | {
|
---|
522 | TRACE_LOG("pszName=%s, x=%d, y=%d\n", pszName ? pszName : "(null)", x, y);
|
---|
523 | DisplayModePtr pMode = xnfcalloc(1, sizeof(DisplayModeRec));
|
---|
524 | int cRefresh = 60;
|
---|
525 |
|
---|
526 | pMode->status = MODE_OK;
|
---|
527 | /* We don't ask the host whether it likes user defined modes,
|
---|
528 | * as we assume that the user really wanted that mode. */
|
---|
529 | pMode->type = isUserDef ? M_T_USERDEF : M_T_BUILTIN;
|
---|
530 | if (isPreferred)
|
---|
531 | pMode->type |= M_T_PREFERRED;
|
---|
532 | /* Older versions of VBox only support screen widths which are a multiple
|
---|
533 | * of 8 */
|
---|
534 | if (pVBox->fAnyX)
|
---|
535 | pMode->HDisplay = x;
|
---|
536 | else
|
---|
537 | pMode->HDisplay = x & ~7;
|
---|
538 | pMode->HSyncStart = pMode->HDisplay + 2;
|
---|
539 | pMode->HSyncEnd = pMode->HDisplay + 4;
|
---|
540 | pMode->HTotal = pMode->HDisplay + 6;
|
---|
541 | pMode->VDisplay = y;
|
---|
542 | pMode->VSyncStart = pMode->VDisplay + 2;
|
---|
543 | pMode->VSyncEnd = pMode->VDisplay + 4;
|
---|
544 | pMode->VTotal = pMode->VDisplay + 6;
|
---|
545 | pMode->Clock = pMode->HTotal * pMode->VTotal * cRefresh / 1000; /* kHz */
|
---|
546 | if (NULL == pszName) {
|
---|
547 | xf86SetModeDefaultName(pMode);
|
---|
548 | } else {
|
---|
549 | pMode->name = xnfstrdup(pszName);
|
---|
550 | }
|
---|
551 | *pModes = xf86ModesAdd(*pModes, pMode);
|
---|
552 | return pMode;
|
---|
553 | }
|
---|
554 |
|
---|
555 | static DisplayModePtr
|
---|
556 | vbox_output_get_modes (xf86OutputPtr output)
|
---|
557 | {
|
---|
558 | unsigned cIndex = 0;
|
---|
559 | DisplayModePtr pModes = NULL;
|
---|
560 | ScrnInfoPtr pScrn = output->scrn;
|
---|
561 | VBOXPtr pVBox = VBOXGetRec(pScrn);
|
---|
562 |
|
---|
563 | TRACE_ENTRY();
|
---|
564 | uint32_t iScreen = (uintptr_t)output->driver_private;
|
---|
565 | vbox_output_add_mode(pVBox, &pModes, NULL,
|
---|
566 | RT_CLAMP(pVBox->pScreens[iScreen].aPreferredSize.cx, VBOX_VIDEO_MIN_SIZE, VBOX_VIDEO_MAX_VIRTUAL),
|
---|
567 | RT_CLAMP(pVBox->pScreens[iScreen].aPreferredSize.cy, VBOX_VIDEO_MIN_SIZE, VBOX_VIDEO_MAX_VIRTUAL),
|
---|
568 | TRUE, FALSE);
|
---|
569 | vbox_output_add_mode(pVBox, &pModes, NULL, 2560, 1600, FALSE, FALSE);
|
---|
570 | vbox_output_add_mode(pVBox, &pModes, NULL, 2560, 1440, FALSE, FALSE);
|
---|
571 | vbox_output_add_mode(pVBox, &pModes, NULL, 2048, 1536, FALSE, FALSE);
|
---|
572 | vbox_output_add_mode(pVBox, &pModes, NULL, 1920, 1600, FALSE, FALSE);
|
---|
573 | vbox_output_add_mode(pVBox, &pModes, NULL, 1920, 1080, FALSE, FALSE);
|
---|
574 | vbox_output_add_mode(pVBox, &pModes, NULL, 1680, 1050, FALSE, FALSE);
|
---|
575 | vbox_output_add_mode(pVBox, &pModes, NULL, 1600, 1200, FALSE, FALSE);
|
---|
576 | vbox_output_add_mode(pVBox, &pModes, NULL, 1400, 1050, FALSE, FALSE);
|
---|
577 | vbox_output_add_mode(pVBox, &pModes, NULL, 1280, 1024, FALSE, FALSE);
|
---|
578 | vbox_output_add_mode(pVBox, &pModes, NULL, 1024, 768, FALSE, FALSE);
|
---|
579 | vbox_output_add_mode(pVBox, &pModes, NULL, 800, 600, FALSE, FALSE);
|
---|
580 | vbox_output_add_mode(pVBox, &pModes, NULL, 640, 480, FALSE, FALSE);
|
---|
581 | TRACE_EXIT();
|
---|
582 | return pModes;
|
---|
583 | }
|
---|
584 |
|
---|
585 | static const xf86OutputFuncsRec VBOXOutputFuncs = {
|
---|
586 | .create_resources = vbox_output_stub,
|
---|
587 | .dpms = vbox_output_dpms,
|
---|
588 | .save = NULL, /* These two are never called by the server. */
|
---|
589 | .restore = NULL,
|
---|
590 | .mode_valid = vbox_output_mode_valid,
|
---|
591 | .mode_fixup = vbox_output_mode_fixup,
|
---|
592 | .prepare = vbox_output_stub,
|
---|
593 | .commit = vbox_output_stub,
|
---|
594 | .mode_set = vbox_output_mode_set,
|
---|
595 | .detect = vbox_output_detect,
|
---|
596 | .get_modes = vbox_output_get_modes,
|
---|
597 | #ifdef RANDR_12_INTERFACE
|
---|
598 | .set_property = NULL,
|
---|
599 | #endif
|
---|
600 | .destroy = vbox_output_stub
|
---|
601 | };
|
---|
602 | #endif /* VBOXVIDEO_13 */
|
---|
603 |
|
---|
604 | /* Module loader interface */
|
---|
605 | static MODULESETUPPROTO(vboxSetup);
|
---|
606 |
|
---|
607 | static XF86ModuleVersionInfo vboxVersionRec =
|
---|
608 | {
|
---|
609 | VBOX_DRIVER_NAME,
|
---|
610 | VBOX_VENDOR,
|
---|
611 | MODINFOSTRING1,
|
---|
612 | MODINFOSTRING2,
|
---|
613 | #ifdef XORG_7X
|
---|
614 | XORG_VERSION_CURRENT,
|
---|
615 | #else
|
---|
616 | XF86_VERSION_CURRENT,
|
---|
617 | #endif
|
---|
618 | 1, /* Module major version. Xorg-specific */
|
---|
619 | 0, /* Module minor version. Xorg-specific */
|
---|
620 | 1, /* Module patchlevel. Xorg-specific */
|
---|
621 | ABI_CLASS_VIDEODRV, /* This is a video driver */
|
---|
622 | ABI_VIDEODRV_VERSION,
|
---|
623 | MOD_CLASS_VIDEODRV,
|
---|
624 | {0, 0, 0, 0}
|
---|
625 | };
|
---|
626 |
|
---|
627 | /*
|
---|
628 | * This data is accessed by the loader. The name must be the module name
|
---|
629 | * followed by "ModuleData".
|
---|
630 | */
|
---|
631 | #ifdef XORG_7X
|
---|
632 | _X_EXPORT
|
---|
633 | #endif
|
---|
634 | XF86ModuleData vboxvideoModuleData = { &vboxVersionRec, vboxSetup, NULL };
|
---|
635 |
|
---|
636 | static pointer
|
---|
637 | vboxSetup(pointer Module, pointer Options, int *ErrorMajor, int *ErrorMinor)
|
---|
638 | {
|
---|
639 | static Bool Initialised = FALSE;
|
---|
640 |
|
---|
641 | if (!Initialised)
|
---|
642 | {
|
---|
643 | Initialised = TRUE;
|
---|
644 | #ifdef PCIACCESS
|
---|
645 | xf86AddDriver(&VBOXVIDEO, Module, HaveDriverFuncs);
|
---|
646 | #else
|
---|
647 | xf86AddDriver(&VBOXVIDEO, Module, 0);
|
---|
648 | #endif
|
---|
649 | #ifndef XORG_7X
|
---|
650 | LoaderRefSymLists(fbSymbols,
|
---|
651 | shadowfbSymbols,
|
---|
652 | ramdacSymbols,
|
---|
653 | vgahwSymbols,
|
---|
654 | NULL);
|
---|
655 | #endif
|
---|
656 | xf86Msg(X_CONFIG, "Load address of symbol \"VBOXVIDEO\" is %p\n",
|
---|
657 | (void *)&VBOXVIDEO);
|
---|
658 | return (pointer)TRUE;
|
---|
659 | }
|
---|
660 |
|
---|
661 | if (ErrorMajor)
|
---|
662 | *ErrorMajor = LDR_ONCEONLY;
|
---|
663 | return (NULL);
|
---|
664 | }
|
---|
665 |
|
---|
666 |
|
---|
667 | static const OptionInfoRec *
|
---|
668 | VBOXAvailableOptions(int chipid, int busid)
|
---|
669 | {
|
---|
670 | return (VBOXOptions);
|
---|
671 | }
|
---|
672 |
|
---|
673 | static void
|
---|
674 | VBOXIdentify(int flags)
|
---|
675 | {
|
---|
676 | xf86PrintChipsets(VBOX_NAME, "guest driver for VirtualBox", VBOXChipsets);
|
---|
677 | }
|
---|
678 |
|
---|
679 | #ifndef XF86_SCRN_INTERFACE
|
---|
680 | # define SCRNINDEXAPI(pfn) pfn ## Index
|
---|
681 | static Bool VBOXScreenInitIndex(int scrnIndex, ScreenPtr pScreen, int argc,
|
---|
682 | char **argv)
|
---|
683 | { return VBOXScreenInit(pScreen, argc, argv); }
|
---|
684 |
|
---|
685 | static Bool VBOXEnterVTIndex(int scrnIndex, int flags)
|
---|
686 | { (void) flags; return VBOXEnterVT(xf86Screens[scrnIndex]); }
|
---|
687 |
|
---|
688 | static void VBOXLeaveVTIndex(int scrnIndex, int flags)
|
---|
689 | { (void) flags; VBOXLeaveVT(xf86Screens[scrnIndex]); }
|
---|
690 |
|
---|
691 | static Bool VBOXCloseScreenIndex(int scrnIndex, ScreenPtr pScreen)
|
---|
692 | { (void) scrnIndex; return VBOXCloseScreen(pScreen); }
|
---|
693 |
|
---|
694 | static Bool VBOXSwitchModeIndex(int scrnIndex, DisplayModePtr pMode, int flags)
|
---|
695 | { (void) flags; return VBOXSwitchMode(xf86Screens[scrnIndex], pMode); }
|
---|
696 |
|
---|
697 | static void VBOXAdjustFrameIndex(int scrnIndex, int x, int y, int flags)
|
---|
698 | { (void) flags; VBOXAdjustFrame(xf86Screens[scrnIndex], x, y); }
|
---|
699 |
|
---|
700 | static void VBOXFreeScreenIndex(int scrnIndex, int flags)
|
---|
701 | { (void) flags; VBOXFreeScreen(xf86Screens[scrnIndex]); }
|
---|
702 | # else
|
---|
703 | # define SCRNINDEXAPI(pfn) pfn
|
---|
704 | #endif /* XF86_SCRN_INTERFACE */
|
---|
705 |
|
---|
706 | static void setScreenFunctions(ScrnInfoPtr pScrn, xf86ProbeProc pfnProbe)
|
---|
707 | {
|
---|
708 | pScrn->driverVersion = VBOX_VERSION;
|
---|
709 | pScrn->driverName = VBOX_DRIVER_NAME;
|
---|
710 | pScrn->name = VBOX_NAME;
|
---|
711 | pScrn->Probe = pfnProbe;
|
---|
712 | pScrn->PreInit = VBOXPreInit;
|
---|
713 | pScrn->ScreenInit = SCRNINDEXAPI(VBOXScreenInit);
|
---|
714 | pScrn->SwitchMode = SCRNINDEXAPI(VBOXSwitchMode);
|
---|
715 | pScrn->AdjustFrame = SCRNINDEXAPI(VBOXAdjustFrame);
|
---|
716 | pScrn->EnterVT = SCRNINDEXAPI(VBOXEnterVT);
|
---|
717 | pScrn->LeaveVT = SCRNINDEXAPI(VBOXLeaveVT);
|
---|
718 | pScrn->FreeScreen = SCRNINDEXAPI(VBOXFreeScreen);
|
---|
719 | }
|
---|
720 |
|
---|
721 | /*
|
---|
722 | * One of these functions is called once, at the start of the first server
|
---|
723 | * generation to do a minimal probe for supported hardware.
|
---|
724 | */
|
---|
725 |
|
---|
726 | #ifdef PCIACCESS
|
---|
727 | static Bool
|
---|
728 | VBOXPciProbe(DriverPtr drv, int entity_num, struct pci_device *dev,
|
---|
729 | intptr_t match_data)
|
---|
730 | {
|
---|
731 | ScrnInfoPtr pScrn;
|
---|
732 |
|
---|
733 | TRACE_ENTRY();
|
---|
734 | pScrn = xf86ConfigPciEntity(NULL, 0, entity_num, VBOXPCIchipsets,
|
---|
735 | NULL, NULL, NULL, NULL, NULL);
|
---|
736 | if (pScrn != NULL) {
|
---|
737 | VBOXPtr pVBox;
|
---|
738 |
|
---|
739 | VBOXSetRec(pScrn);
|
---|
740 | pVBox = VBOXGetRec(pScrn);
|
---|
741 | if (!pVBox)
|
---|
742 | return FALSE;
|
---|
743 | setScreenFunctions(pScrn, NULL);
|
---|
744 | pVBox->pciInfo = dev;
|
---|
745 | }
|
---|
746 |
|
---|
747 | TRACE_LOG("returning %s\n", BOOL_STR(pScrn != NULL));
|
---|
748 | return (pScrn != NULL);
|
---|
749 | }
|
---|
750 | #endif
|
---|
751 |
|
---|
752 | #ifndef PCIACCESS
|
---|
753 | static Bool
|
---|
754 | VBOXProbe(DriverPtr drv, int flags)
|
---|
755 | {
|
---|
756 | Bool foundScreen = FALSE;
|
---|
757 | int numDevSections;
|
---|
758 | GDevPtr *devSections;
|
---|
759 |
|
---|
760 | /*
|
---|
761 | * Find the config file Device sections that match this
|
---|
762 | * driver, and return if there are none.
|
---|
763 | */
|
---|
764 | if ((numDevSections = xf86MatchDevice(VBOX_NAME,
|
---|
765 | &devSections)) <= 0)
|
---|
766 | return (FALSE);
|
---|
767 |
|
---|
768 | /* PCI BUS */
|
---|
769 | if (xf86GetPciVideoInfo())
|
---|
770 | {
|
---|
771 | int numUsed;
|
---|
772 | int *usedChips;
|
---|
773 | int i;
|
---|
774 | numUsed = xf86MatchPciInstances(VBOX_NAME, VBOX_VENDORID,
|
---|
775 | VBOXChipsets, VBOXPCIchipsets,
|
---|
776 | devSections, numDevSections,
|
---|
777 | drv, &usedChips);
|
---|
778 | if (numUsed > 0)
|
---|
779 | {
|
---|
780 | if (flags & PROBE_DETECT)
|
---|
781 | foundScreen = TRUE;
|
---|
782 | else
|
---|
783 | for (i = 0; i < numUsed; i++)
|
---|
784 | {
|
---|
785 | ScrnInfoPtr pScrn = NULL;
|
---|
786 | /* Allocate a ScrnInfoRec */
|
---|
787 | if ((pScrn = xf86ConfigPciEntity(pScrn,0,usedChips[i],
|
---|
788 | VBOXPCIchipsets,NULL,
|
---|
789 | NULL,NULL,NULL,NULL)))
|
---|
790 | {
|
---|
791 | setScreenFunctions(pScrn, VBOXProbe);
|
---|
792 | foundScreen = TRUE;
|
---|
793 | }
|
---|
794 | }
|
---|
795 | free(usedChips);
|
---|
796 | }
|
---|
797 | }
|
---|
798 | free(devSections);
|
---|
799 | return (foundScreen);
|
---|
800 | }
|
---|
801 | #endif
|
---|
802 |
|
---|
803 |
|
---|
804 | /*
|
---|
805 | * QUOTE from the XFree86 DESIGN document:
|
---|
806 | *
|
---|
807 | * The purpose of this function is to find out all the information
|
---|
808 | * required to determine if the configuration is usable, and to initialise
|
---|
809 | * those parts of the ScrnInfoRec that can be set once at the beginning of
|
---|
810 | * the first server generation.
|
---|
811 | *
|
---|
812 | * (...)
|
---|
813 | *
|
---|
814 | * This includes probing for video memory, clocks, ramdac, and all other
|
---|
815 | * HW info that is needed. It includes determining the depth/bpp/visual
|
---|
816 | * and related info. It includes validating and determining the set of
|
---|
817 | * video modes that will be used (and anything that is required to
|
---|
818 | * determine that).
|
---|
819 | *
|
---|
820 | * This information should be determined in the least intrusive way
|
---|
821 | * possible. The state of the HW must remain unchanged by this function.
|
---|
822 | * Although video memory (including MMIO) may be mapped within this
|
---|
823 | * function, it must be unmapped before returning.
|
---|
824 | *
|
---|
825 | * END QUOTE
|
---|
826 | */
|
---|
827 |
|
---|
828 | static Bool
|
---|
829 | VBOXPreInit(ScrnInfoPtr pScrn, int flags)
|
---|
830 | {
|
---|
831 | VBOXPtr pVBox;
|
---|
832 | Gamma gzeros = {0.0, 0.0, 0.0};
|
---|
833 | rgb rzeros = {0, 0, 0};
|
---|
834 |
|
---|
835 | TRACE_ENTRY();
|
---|
836 | /* Are we really starting the server, or is this just a dummy run? */
|
---|
837 | if (flags & PROBE_DETECT)
|
---|
838 | return (FALSE);
|
---|
839 |
|
---|
840 | xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VirtualBox guest additions video driver version " VBOX_VERSION_STRING "r%d\n",
|
---|
841 | VBOX_SVN_REV);
|
---|
842 |
|
---|
843 | /* Get our private data from the ScrnInfoRec structure. */
|
---|
844 | VBOXSetRec(pScrn);
|
---|
845 | pVBox = VBOXGetRec(pScrn);
|
---|
846 | if (!pVBox)
|
---|
847 | return FALSE;
|
---|
848 |
|
---|
849 | /* Entity information seems to mean bus information. */
|
---|
850 | pVBox->pEnt = xf86GetEntityInfo(pScrn->entityList[0]);
|
---|
851 |
|
---|
852 | /* The ramdac module is needed for the hardware cursor. */
|
---|
853 | if (!xf86LoadSubModule(pScrn, "ramdac"))
|
---|
854 | return FALSE;
|
---|
855 |
|
---|
856 | /* The framebuffer module. */
|
---|
857 | if (!xf86LoadSubModule(pScrn, "fb"))
|
---|
858 | return (FALSE);
|
---|
859 |
|
---|
860 | if (!xf86LoadSubModule(pScrn, "shadowfb"))
|
---|
861 | return FALSE;
|
---|
862 |
|
---|
863 | if (!xf86LoadSubModule(pScrn, "vgahw"))
|
---|
864 | return FALSE;
|
---|
865 |
|
---|
866 | #ifdef VBOX_DRI_OLD
|
---|
867 | /* Load the dri module. */
|
---|
868 | if (!xf86LoadSubModule(pScrn, "dri"))
|
---|
869 | return FALSE;
|
---|
870 | #else
|
---|
871 | # ifdef VBOX_DRI
|
---|
872 | /* Load the dri module. */
|
---|
873 | if (!xf86LoadSubModule(pScrn, "dri2"))
|
---|
874 | return FALSE;
|
---|
875 | # endif
|
---|
876 | #endif
|
---|
877 |
|
---|
878 | #ifndef PCIACCESS
|
---|
879 | if (pVBox->pEnt->location.type != BUS_PCI)
|
---|
880 | return FALSE;
|
---|
881 |
|
---|
882 | pVBox->pciInfo = xf86GetPciInfoForEntity(pVBox->pEnt->index);
|
---|
883 | pVBox->pciTag = pciTag(pVBox->pciInfo->bus,
|
---|
884 | pVBox->pciInfo->device,
|
---|
885 | pVBox->pciInfo->func);
|
---|
886 | #endif
|
---|
887 |
|
---|
888 | /* Set up our ScrnInfoRec structure to describe our virtual
|
---|
889 | capabilities to X. */
|
---|
890 |
|
---|
891 | pScrn->chipset = "vbox";
|
---|
892 | /** @note needed during colourmap initialisation */
|
---|
893 | pScrn->rgbBits = 8;
|
---|
894 |
|
---|
895 | /* Let's create a nice, capable virtual monitor. */
|
---|
896 | pScrn->monitor = pScrn->confScreen->monitor;
|
---|
897 | pScrn->monitor->DDC = NULL;
|
---|
898 | pScrn->monitor->nHsync = 1;
|
---|
899 | pScrn->monitor->hsync[0].lo = 1;
|
---|
900 | pScrn->monitor->hsync[0].hi = 10000;
|
---|
901 | pScrn->monitor->nVrefresh = 1;
|
---|
902 | pScrn->monitor->vrefresh[0].lo = 1;
|
---|
903 | pScrn->monitor->vrefresh[0].hi = 100;
|
---|
904 |
|
---|
905 | pScrn->progClock = TRUE;
|
---|
906 |
|
---|
907 | /* Using the PCI information caused problems with non-powers-of-two
|
---|
908 | sized video RAM configurations */
|
---|
909 | pVBox->cbFBMax = VBoxVideoGetVRAMSize();
|
---|
910 | pScrn->videoRam = pVBox->cbFBMax / 1024;
|
---|
911 |
|
---|
912 | /* Check if the chip restricts horizontal resolution or not. */
|
---|
913 | pVBox->fAnyX = VBoxVideoAnyWidthAllowed();
|
---|
914 |
|
---|
915 | /* Set up clock information that will support all modes we need. */
|
---|
916 | pScrn->clockRanges = xnfcalloc(sizeof(ClockRange), 1);
|
---|
917 | pScrn->clockRanges->minClock = 1000;
|
---|
918 | pScrn->clockRanges->maxClock = 1000000000;
|
---|
919 | pScrn->clockRanges->clockIndex = -1;
|
---|
920 | pScrn->clockRanges->ClockMulFactor = 1;
|
---|
921 | pScrn->clockRanges->ClockDivFactor = 1;
|
---|
922 |
|
---|
923 | if (!xf86SetDepthBpp(pScrn, 24, 0, 0, Support32bppFb))
|
---|
924 | return FALSE;
|
---|
925 | /* We only support 16 and 24 bits depth (i.e. 16 and 32bpp) */
|
---|
926 | if (pScrn->bitsPerPixel != 32 && pScrn->bitsPerPixel != 16)
|
---|
927 | {
|
---|
928 | xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
|
---|
929 | "The VBox additions only support 16 and 32bpp graphics modes\n");
|
---|
930 | return FALSE;
|
---|
931 | }
|
---|
932 | xf86PrintDepthBpp(pScrn);
|
---|
933 | vboxAddModes(pScrn);
|
---|
934 |
|
---|
935 | #ifdef VBOXVIDEO_13
|
---|
936 | pScrn->virtualX = VBOX_VIDEO_MAX_VIRTUAL;
|
---|
937 | pScrn->virtualY = VBOX_VIDEO_MAX_VIRTUAL;
|
---|
938 | #else
|
---|
939 | /* We don't validate with xf86ValidateModes and xf86PruneModes as we
|
---|
940 | * already know what we like and what we don't. */
|
---|
941 |
|
---|
942 | pScrn->currentMode = pScrn->modes;
|
---|
943 |
|
---|
944 | /* Set the right virtual resolution. */
|
---|
945 | pScrn->virtualX = pScrn->bitsPerPixel == 16 ? (pScrn->currentMode->HDisplay + 1) & ~1 : pScrn->currentMode->HDisplay;
|
---|
946 | pScrn->virtualY = pScrn->currentMode->VDisplay;
|
---|
947 |
|
---|
948 | #endif /* !VBOXVIDEO_13 */
|
---|
949 |
|
---|
950 | /* Needed before we initialise DRI. */
|
---|
951 | pScrn->displayWidth = pScrn->virtualX;
|
---|
952 |
|
---|
953 | xf86PrintModes(pScrn);
|
---|
954 |
|
---|
955 | /* VGA hardware initialisation */
|
---|
956 | if (!vgaHWGetHWRec(pScrn))
|
---|
957 | return FALSE;
|
---|
958 | /* Must be called before any VGA registers are saved or restored */
|
---|
959 | vgaHWSetStdFuncs(VGAHWPTR(pScrn));
|
---|
960 | vgaHWGetIOBase(VGAHWPTR(pScrn));
|
---|
961 |
|
---|
962 | /* Colour weight - we always call this, since we are always in
|
---|
963 | truecolour. */
|
---|
964 | if (!xf86SetWeight(pScrn, rzeros, rzeros))
|
---|
965 | return (FALSE);
|
---|
966 |
|
---|
967 | /* visual init */
|
---|
968 | if (!xf86SetDefaultVisual(pScrn, -1))
|
---|
969 | return (FALSE);
|
---|
970 |
|
---|
971 | xf86SetGamma(pScrn, gzeros);
|
---|
972 |
|
---|
973 | /* Set the DPI. Perhaps we should read this from the host? */
|
---|
974 | xf86SetDpi(pScrn, 96, 96);
|
---|
975 |
|
---|
976 | if (pScrn->memPhysBase == 0) {
|
---|
977 | #ifdef PCIACCESS
|
---|
978 | pScrn->memPhysBase = pVBox->pciInfo->regions[0].base_addr;
|
---|
979 | #else
|
---|
980 | pScrn->memPhysBase = pVBox->pciInfo->memBase[0];
|
---|
981 | #endif
|
---|
982 | pScrn->fbOffset = 0;
|
---|
983 | }
|
---|
984 |
|
---|
985 | TRACE_EXIT();
|
---|
986 | return (TRUE);
|
---|
987 | }
|
---|
988 |
|
---|
989 | /**
|
---|
990 | * Dummy function for setting the colour palette, which we actually never
|
---|
991 | * touch. However, the server still requires us to provide this.
|
---|
992 | */
|
---|
993 | static void
|
---|
994 | vboxLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices,
|
---|
995 | LOCO *colors, VisualPtr pVisual)
|
---|
996 | {
|
---|
997 | (void)pScrn; (void) numColors; (void) indices; (void) colors;
|
---|
998 | (void)pVisual;
|
---|
999 | }
|
---|
1000 |
|
---|
1001 | /** Set the graphics and guest cursor support capabilities to the host if
|
---|
1002 | * the user-space helper is running. */
|
---|
1003 | static void updateGraphicsCapability(ScrnInfoPtr pScrn, Bool hasVT)
|
---|
1004 | {
|
---|
1005 | VBOXPtr pVBox = VBOXGetRec(pScrn);
|
---|
1006 | size_t cData;
|
---|
1007 | int32_t *paData;
|
---|
1008 | int rc;
|
---|
1009 |
|
---|
1010 | if (pVBox->fHaveHGSMIModeHints)
|
---|
1011 | return;
|
---|
1012 | rc = vbvxGetIntegerPropery(pScrn, "VBOX_HAS_GRAPHICS", &cData, &paData);
|
---|
1013 | if (rc != VINF_SUCCESS || cData != 1)
|
---|
1014 | return;
|
---|
1015 | if (RT_BOOL(*paData) != hasVT)
|
---|
1016 | {
|
---|
1017 | uint32_t fFeatures;
|
---|
1018 | VbglR3SetGuestCaps(hasVT ? VMMDEV_GUEST_SUPPORTS_GRAPHICS : 0, hasVT ? 0 : VMMDEV_GUEST_SUPPORTS_GRAPHICS);
|
---|
1019 | rc = VbglR3GetMouseStatus(&fFeatures, NULL, NULL);
|
---|
1020 | fFeatures &= VMMDEV_MOUSE_GUEST_CAN_ABSOLUTE | VMMDEV_MOUSE_NEW_PROTOCOL;
|
---|
1021 | if (RT_SUCCESS(rc))
|
---|
1022 | VbglR3SetMouseStatus(hasVT ? fFeatures : fFeatures | VMMDEV_MOUSE_GUEST_NEEDS_HOST_CURSOR);
|
---|
1023 | }
|
---|
1024 | *paData = hasVT;
|
---|
1025 | }
|
---|
1026 |
|
---|
1027 | #ifdef VBOXVIDEO_13
|
---|
1028 |
|
---|
1029 | static void setVirtualSizeRandR12(ScrnInfoPtr pScrn, bool fScreenInitTime)
|
---|
1030 | {
|
---|
1031 | VBOXPtr pVBox = VBOXGetRec(pScrn);
|
---|
1032 | unsigned i;
|
---|
1033 | unsigned cx = 0;
|
---|
1034 | unsigned cy = 0;
|
---|
1035 |
|
---|
1036 | for (i = 0; i < pVBox->cScreens; ++i)
|
---|
1037 | {
|
---|
1038 | if ( pVBox->fHaveHGSMIModeHints && pVBox->pScreens[i].afHaveLocation)
|
---|
1039 | {
|
---|
1040 | pVBox->pScreens[i].paCrtcs->x = pVBox->pScreens[i].aPreferredLocation.x;
|
---|
1041 | pVBox->pScreens[i].paCrtcs->y = pVBox->pScreens[i].aPreferredLocation.y;
|
---|
1042 | }
|
---|
1043 | if ( pVBox->pScreens[i].paOutputs->status == XF86OutputStatusConnected
|
---|
1044 | && pVBox->pScreens[i].paCrtcs->x + pVBox->pScreens[i].aPreferredSize.cx < VBOX_VIDEO_MAX_VIRTUAL
|
---|
1045 | && pVBox->pScreens[i].paCrtcs->y + pVBox->pScreens[i].aPreferredSize.cy < VBOX_VIDEO_MAX_VIRTUAL)
|
---|
1046 | {
|
---|
1047 | cx = max(cx, pVBox->pScreens[i].paCrtcs->x + pVBox->pScreens[i].aPreferredSize.cx);
|
---|
1048 | cy = max(cy, pVBox->pScreens[i].paCrtcs->y + pVBox->pScreens[i].aPreferredSize.cy);
|
---|
1049 | }
|
---|
1050 | }
|
---|
1051 | if (cx != 0 && cy != 0)
|
---|
1052 | {
|
---|
1053 | /* Do not set the virtual resolution in limited context as that can
|
---|
1054 | * cause problems setting up RandR 1.2 which needs it set to the
|
---|
1055 | * maximum size at this point. */
|
---|
1056 | if (!fScreenInitTime)
|
---|
1057 | {
|
---|
1058 | TRACE_LOG("cx=%u, cy=%u\n", cx, cy);
|
---|
1059 | xf86ScrnToScreen(pScrn)->width = cx;
|
---|
1060 | xf86ScrnToScreen(pScrn)->height = cy;
|
---|
1061 | xf86ScrnToScreen(pScrn)->mmWidth = cx * 254 / 960;
|
---|
1062 | xf86ScrnToScreen(pScrn)->mmHeight = cy * 254 / 960;
|
---|
1063 | adjustScreenPixmap(pScrn, cx, cy);
|
---|
1064 | vbvxSetSolarisMouseRange(cx, cy);
|
---|
1065 | }
|
---|
1066 | }
|
---|
1067 | }
|
---|
1068 |
|
---|
1069 | static void setScreenSizesRandR12(ScrnInfoPtr pScrn, bool fScreenInitTime)
|
---|
1070 | {
|
---|
1071 | VBOXPtr pVBox = VBOXGetRec(pScrn);
|
---|
1072 | unsigned i;
|
---|
1073 |
|
---|
1074 | for (i = 0; i < pVBox->cScreens; ++i)
|
---|
1075 | {
|
---|
1076 | if (!pVBox->pScreens[i].afConnected)
|
---|
1077 | continue;
|
---|
1078 | /* The Crtc can get "unset" if the screen was disconnected previously.
|
---|
1079 | * I couldn't find an API to re-set it which did not have side-effects.
|
---|
1080 | */
|
---|
1081 | pVBox->pScreens[i].paOutputs->crtc = pVBox->pScreens[i].paCrtcs;
|
---|
1082 | xf86CrtcSetMode(pVBox->pScreens[i].paCrtcs, pVBox->pScreens[i].paOutputs->probed_modes, RR_Rotate_0,
|
---|
1083 | pVBox->pScreens[i].paCrtcs->x, pVBox->pScreens[i].paCrtcs->y);
|
---|
1084 | if (!fScreenInitTime)
|
---|
1085 | RRCrtcNotify(pVBox->pScreens[i].paCrtcs->randr_crtc, pVBox->pScreens[i].paOutputs->randr_output->modes[0],
|
---|
1086 | pVBox->pScreens[i].paCrtcs->x, pVBox->pScreens[i].paCrtcs->y, RR_Rotate_0,
|
---|
1087 | #if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 5
|
---|
1088 | NULL,
|
---|
1089 | #endif
|
---|
1090 | 1, &pVBox->pScreens[i].paOutputs->randr_output);
|
---|
1091 | }
|
---|
1092 | }
|
---|
1093 |
|
---|
1094 | static void setSizesRandR12(ScrnInfoPtr pScrn, bool fScreenInitTime)
|
---|
1095 | {
|
---|
1096 | VBOXPtr pVBox = VBOXGetRec(pScrn);
|
---|
1097 |
|
---|
1098 | if (!fScreenInitTime)
|
---|
1099 | {
|
---|
1100 | # if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 5
|
---|
1101 | RRGetInfo(xf86ScrnToScreen(pScrn), TRUE);
|
---|
1102 | # else
|
---|
1103 | RRGetInfo(xf86ScrnToScreen(pScrn));
|
---|
1104 | # endif
|
---|
1105 | }
|
---|
1106 | setVirtualSizeRandR12(pScrn, fScreenInitTime);
|
---|
1107 | setScreenSizesRandR12(pScrn, fScreenInitTime);
|
---|
1108 | if (!fScreenInitTime)
|
---|
1109 | {
|
---|
1110 | /* We use RRScreenSizeSet() here and not RRScreenSizeNotify() because
|
---|
1111 | * the first also pushes the virtual screen size to the input driver.
|
---|
1112 | * We were doing this manually by setting screenInfo.width and height
|
---|
1113 | * and calling xf86UpdateDesktopDimensions() where appropriate, but this
|
---|
1114 | * failed on Ubuntu 12.04.0 due to a problematic X server back-port. */
|
---|
1115 | RRScreenSizeSet(xf86ScrnToScreen(pScrn), xf86ScrnToScreen(pScrn)->width, xf86ScrnToScreen(pScrn)->height,
|
---|
1116 | xf86ScrnToScreen(pScrn)->mmWidth, xf86ScrnToScreen(pScrn)->mmHeight);
|
---|
1117 | RRTellChanged(xf86ScrnToScreen(pScrn));
|
---|
1118 | }
|
---|
1119 | }
|
---|
1120 |
|
---|
1121 | #else
|
---|
1122 |
|
---|
1123 | static void setSizesRandR11(ScrnInfoPtr pScrn)
|
---|
1124 | {
|
---|
1125 | VBOXPtr pVBox = VBOXGetRec(pScrn);
|
---|
1126 | DisplayModePtr pNewMode;
|
---|
1127 |
|
---|
1128 | pNewMode = pScrn->modes != pScrn->currentMode ? pScrn->modes : pScrn->modes->next;
|
---|
1129 | pNewMode->HDisplay = RT_CLAMP(pVBox->pScreens[0].aPreferredSize.cx, VBOX_VIDEO_MIN_SIZE, VBOX_VIDEO_MAX_VIRTUAL);
|
---|
1130 | pNewMode->VDisplay = RT_CLAMP(pVBox->pScreens[0].aPreferredSize.cy, VBOX_VIDEO_MIN_SIZE, VBOX_VIDEO_MAX_VIRTUAL);
|
---|
1131 | }
|
---|
1132 |
|
---|
1133 | #endif
|
---|
1134 |
|
---|
1135 | static void setSizesAndCursorIntegration(ScrnInfoPtr pScrn, bool fScreenInitTime)
|
---|
1136 | {
|
---|
1137 | VBOXPtr pVBox = VBOXGetRec(pScrn);
|
---|
1138 |
|
---|
1139 | TRACE_LOG("fScreenInitTime=%d\n", (int)fScreenInitTime);
|
---|
1140 | #ifdef VBOXVIDEO_13
|
---|
1141 | setSizesRandR12(pScrn, fScreenInitTime);
|
---|
1142 | #else
|
---|
1143 | setSizesRandR11(pScrn);
|
---|
1144 | #endif
|
---|
1145 | /* This calls EnableDisableFBAccess(), so only use when switched in. */
|
---|
1146 | if (pScrn->vtSema)
|
---|
1147 | vbvxReprobeCursor(pScrn);
|
---|
1148 | }
|
---|
1149 |
|
---|
1150 | /* We update the size hints from the X11 property set by VBoxClient every time
|
---|
1151 | * that the X server goes to sleep (to catch the property change request).
|
---|
1152 | * Although this is far more often than necessary it should not have real-life
|
---|
1153 | * performance consequences and allows us to simplify the code quite a bit. */
|
---|
1154 | static void vboxBlockHandler(pointer pData, OSTimePtr pTimeout, pointer pReadmask)
|
---|
1155 | {
|
---|
1156 | ScrnInfoPtr pScrn = (ScrnInfoPtr)pData;
|
---|
1157 | VBOXPtr pVBox = VBOXGetRec(pScrn);
|
---|
1158 | bool fNeedUpdate = false;
|
---|
1159 |
|
---|
1160 | (void)pTimeout;
|
---|
1161 | (void)pReadmask;
|
---|
1162 | updateGraphicsCapability(pScrn, pScrn->vtSema);
|
---|
1163 | if (pScrn->vtSema)
|
---|
1164 | vbvxReadSizesAndCursorIntegrationFromHGSMI(pScrn, &fNeedUpdate);
|
---|
1165 | /* This has to be done even when we are switched out so that VBoxClient can
|
---|
1166 | * set a mode using RandR without having to know the virtual terminal state.
|
---|
1167 | */
|
---|
1168 | if (ROOT_WINDOW(pScrn) != NULL)
|
---|
1169 | vbvxReadSizesAndCursorIntegrationFromProperties(pScrn, &fNeedUpdate);
|
---|
1170 | if (fNeedUpdate)
|
---|
1171 | setSizesAndCursorIntegration(pScrn, false);
|
---|
1172 | }
|
---|
1173 |
|
---|
1174 | /*
|
---|
1175 | * QUOTE from the XFree86 DESIGN document:
|
---|
1176 | *
|
---|
1177 | * This is called at the start of each server generation.
|
---|
1178 | *
|
---|
1179 | * (...)
|
---|
1180 | *
|
---|
1181 | * Decide which operations need to be placed under resource access
|
---|
1182 | * control. (...) Map any video memory or other memory regions. (...)
|
---|
1183 | * Save the video card state. (...) Initialise the initial video
|
---|
1184 | * mode.
|
---|
1185 | *
|
---|
1186 | * End QUOTE.
|
---|
1187 | */
|
---|
1188 | static Bool VBOXScreenInit(ScreenPtr pScreen, int argc, char **argv)
|
---|
1189 | {
|
---|
1190 | ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
|
---|
1191 | VBOXPtr pVBox = VBOXGetRec(pScrn);
|
---|
1192 | VisualPtr visual;
|
---|
1193 |
|
---|
1194 | TRACE_ENTRY();
|
---|
1195 |
|
---|
1196 | /* Initialise our guest library if possible: ignore failure. */
|
---|
1197 | VbglR3Init();
|
---|
1198 | if (!VBOXMapVidMem(pScrn))
|
---|
1199 | return (FALSE);
|
---|
1200 |
|
---|
1201 | /* save current video state */
|
---|
1202 | VBOXSaveMode(pScrn);
|
---|
1203 |
|
---|
1204 | /* mi layer - reset the visual list (?)*/
|
---|
1205 | miClearVisualTypes();
|
---|
1206 | if (!miSetVisualTypes(pScrn->depth, TrueColorMask,
|
---|
1207 | pScrn->rgbBits, TrueColor))
|
---|
1208 | return (FALSE);
|
---|
1209 | if (!miSetPixmapDepths())
|
---|
1210 | return (FALSE);
|
---|
1211 |
|
---|
1212 | #ifdef VBOX_DRI
|
---|
1213 | pVBox->useDRI = VBOXDRIScreenInit(pScrn, pScreen, pVBox);
|
---|
1214 | # ifndef VBOX_DRI_OLD /* DRI2 */
|
---|
1215 | if (pVBox->drmFD >= 0)
|
---|
1216 | /* Tell the kernel driver, if present, that we are taking over. */
|
---|
1217 | drmIoctl(pVBox->drmFD, VBOXVIDEO_IOCTL_DISABLE_HGSMI, NULL);
|
---|
1218 | # endif
|
---|
1219 | #endif
|
---|
1220 |
|
---|
1221 | if (!fbScreenInit(pScreen, pVBox->base,
|
---|
1222 | pScrn->virtualX, pScrn->virtualY,
|
---|
1223 | pScrn->xDpi, pScrn->yDpi,
|
---|
1224 | pScrn->displayWidth, pScrn->bitsPerPixel))
|
---|
1225 | return (FALSE);
|
---|
1226 |
|
---|
1227 | /* Fixup RGB ordering */
|
---|
1228 | /** @note the X server uses this even in true colour. */
|
---|
1229 | visual = pScreen->visuals + pScreen->numVisuals;
|
---|
1230 | while (--visual >= pScreen->visuals) {
|
---|
1231 | if ((visual->class | DynamicClass) == DirectColor) {
|
---|
1232 | visual->offsetRed = pScrn->offset.red;
|
---|
1233 | visual->offsetGreen = pScrn->offset.green;
|
---|
1234 | visual->offsetBlue = pScrn->offset.blue;
|
---|
1235 | visual->redMask = pScrn->mask.red;
|
---|
1236 | visual->greenMask = pScrn->mask.green;
|
---|
1237 | visual->blueMask = pScrn->mask.blue;
|
---|
1238 | }
|
---|
1239 | }
|
---|
1240 |
|
---|
1241 | /* must be after RGB ordering fixed */
|
---|
1242 | fbPictureInit(pScreen, 0, 0);
|
---|
1243 |
|
---|
1244 | xf86SetBlackWhitePixels(pScreen);
|
---|
1245 | pScrn->vtSema = TRUE;
|
---|
1246 |
|
---|
1247 | #if defined(VBOXVIDEO_13) && defined(RT_OS_LINUX)
|
---|
1248 | vbvxSetUpLinuxACPI(pScreen);
|
---|
1249 | #endif
|
---|
1250 |
|
---|
1251 | if (!VBoxHGSMIIsSupported())
|
---|
1252 | {
|
---|
1253 | xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Graphics device too old to support.\n");
|
---|
1254 | return FALSE;
|
---|
1255 | }
|
---|
1256 | vbvxSetUpHGSMIHeapInGuest(pVBox, pScrn->videoRam * 1024);
|
---|
1257 | pVBox->cScreens = VBoxHGSMIGetMonitorCount(&pVBox->guestCtx);
|
---|
1258 | pVBox->pScreens = xnfcalloc(pVBox->cScreens, sizeof(*pVBox->pScreens));
|
---|
1259 | pVBox->paVBVAModeHints = xnfcalloc(pVBox->cScreens, sizeof(*pVBox->paVBVAModeHints));
|
---|
1260 | xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Requested monitor count: %u\n", pVBox->cScreens);
|
---|
1261 | vboxEnableVbva(pScrn);
|
---|
1262 | /* Set up the dirty rectangle handler. It will be added into a function
|
---|
1263 | * chain and gets removed when the screen is cleaned up. */
|
---|
1264 | if (ShadowFBInit2(pScreen, NULL, vbvxHandleDirtyRect) != TRUE)
|
---|
1265 | return FALSE;
|
---|
1266 | VBoxInitialiseSizeHints(pScrn);
|
---|
1267 | /* Get any screen size hints from HGSMI. Do not yet try to access X11
|
---|
1268 | * properties, as they are not yet set up, and nor are the clients that
|
---|
1269 | * might have set them. */
|
---|
1270 | vbvxReadSizesAndCursorIntegrationFromHGSMI(pScrn, NULL);
|
---|
1271 |
|
---|
1272 | #ifdef VBOXVIDEO_13
|
---|
1273 | /* Initialise CRTC and output configuration for use with randr1.2. */
|
---|
1274 | xf86CrtcConfigInit(pScrn, &VBOXCrtcConfigFuncs);
|
---|
1275 |
|
---|
1276 | {
|
---|
1277 | uint32_t i;
|
---|
1278 |
|
---|
1279 | for (i = 0; i < pVBox->cScreens; ++i)
|
---|
1280 | {
|
---|
1281 | char szOutput[256];
|
---|
1282 |
|
---|
1283 | /* Setup our virtual CRTCs. */
|
---|
1284 | pVBox->pScreens[i].paCrtcs = xf86CrtcCreate(pScrn, &VBOXCrtcFuncs);
|
---|
1285 | pVBox->pScreens[i].paCrtcs->driver_private = (void *)(uintptr_t)i;
|
---|
1286 |
|
---|
1287 | /* Set up our virtual outputs. */
|
---|
1288 | snprintf(szOutput, sizeof(szOutput), "VGA-%u", i);
|
---|
1289 | pVBox->pScreens[i].paOutputs
|
---|
1290 | = xf86OutputCreate(pScrn, &VBOXOutputFuncs, szOutput);
|
---|
1291 |
|
---|
1292 | /* We are not interested in the monitor section in the
|
---|
1293 | * configuration file. */
|
---|
1294 | xf86OutputUseScreenMonitor(pVBox->pScreens[i].paOutputs, FALSE);
|
---|
1295 | pVBox->pScreens[i].paOutputs->possible_crtcs = 1 << i;
|
---|
1296 | pVBox->pScreens[i].paOutputs->possible_clones = 0;
|
---|
1297 | pVBox->pScreens[i].paOutputs->driver_private = (void *)(uintptr_t)i;
|
---|
1298 | TRACE_LOG("Created crtc (%p) and output %s (%p)\n",
|
---|
1299 | (void *)pVBox->pScreens[i].paCrtcs, szOutput,
|
---|
1300 | (void *)pVBox->pScreens[i].paOutputs);
|
---|
1301 | }
|
---|
1302 | }
|
---|
1303 |
|
---|
1304 | /* Set a sane minimum and maximum mode size to match what the hardware
|
---|
1305 | * supports. */
|
---|
1306 | xf86CrtcSetSizeRange(pScrn, VBOX_VIDEO_MIN_SIZE, VBOX_VIDEO_MIN_SIZE, VBOX_VIDEO_MAX_VIRTUAL, VBOX_VIDEO_MAX_VIRTUAL);
|
---|
1307 |
|
---|
1308 | /* Now create our initial CRTC/output configuration. */
|
---|
1309 | if (!xf86InitialConfiguration(pScrn, TRUE)) {
|
---|
1310 | xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Initial CRTC configuration failed!\n");
|
---|
1311 | return (FALSE);
|
---|
1312 | }
|
---|
1313 |
|
---|
1314 | /* Work around a bug in the original X server modesetting code, which took
|
---|
1315 | * the first valid values set to these two as maxima over the server
|
---|
1316 | * lifetime. This bug was introduced on Feb 15 2007 and was fixed in commit
|
---|
1317 | * fa877d7f three months later, so it was present in X.Org Server 1.3. */
|
---|
1318 | pScrn->virtualX = VBOX_VIDEO_MAX_VIRTUAL;
|
---|
1319 | pScrn->virtualY = VBOX_VIDEO_MAX_VIRTUAL;
|
---|
1320 |
|
---|
1321 | /* Initialise randr 1.2 mode-setting functions. */
|
---|
1322 | if (!xf86CrtcScreenInit(pScreen)) {
|
---|
1323 | return FALSE;
|
---|
1324 | }
|
---|
1325 |
|
---|
1326 | /* set first video mode */
|
---|
1327 | setSizesAndCursorIntegration(pScrn, true);
|
---|
1328 | #else
|
---|
1329 | /* set first video mode */
|
---|
1330 | setModeRandR11(pScrn, pScrn->currentMode, true, false, 0, 0);
|
---|
1331 | #endif
|
---|
1332 |
|
---|
1333 | /* Register block and wake-up handlers for getting new screen size hints. */
|
---|
1334 | RegisterBlockAndWakeupHandlers(vboxBlockHandler, (WakeupHandlerProcPtr)NoopDDA, (pointer)pScrn);
|
---|
1335 |
|
---|
1336 | /* software cursor */
|
---|
1337 | miDCInitialize(pScreen, xf86GetPointerScreenFuncs());
|
---|
1338 |
|
---|
1339 | /* colourmap code */
|
---|
1340 | if (!miCreateDefColormap(pScreen))
|
---|
1341 | return (FALSE);
|
---|
1342 |
|
---|
1343 | if(!xf86HandleColormaps(pScreen, 256, 8, vboxLoadPalette, NULL, 0))
|
---|
1344 | return (FALSE);
|
---|
1345 |
|
---|
1346 | pVBox->CloseScreen = pScreen->CloseScreen;
|
---|
1347 | pScreen->CloseScreen = SCRNINDEXAPI(VBOXCloseScreen);
|
---|
1348 | #ifdef VBOXVIDEO_13
|
---|
1349 | pScreen->SaveScreen = xf86SaveScreen;
|
---|
1350 | #else
|
---|
1351 | pScreen->SaveScreen = VBOXSaveScreen;
|
---|
1352 | #endif
|
---|
1353 |
|
---|
1354 | #ifdef VBOXVIDEO_13
|
---|
1355 | xf86DPMSInit(pScreen, xf86DPMSSet, 0);
|
---|
1356 | #else
|
---|
1357 | /* We probably do want to support power management - even if we just use
|
---|
1358 | a dummy function. */
|
---|
1359 | xf86DPMSInit(pScreen, VBOXDisplayPowerManagementSet, 0);
|
---|
1360 | #endif
|
---|
1361 |
|
---|
1362 | /* Report any unused options (only for the first generation) */
|
---|
1363 | if (serverGeneration == 1)
|
---|
1364 | xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options);
|
---|
1365 |
|
---|
1366 | if (vbvxCursorInit(pScreen) != TRUE)
|
---|
1367 | xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
|
---|
1368 | "Unable to start the VirtualBox mouse pointer integration with the host system.\n");
|
---|
1369 |
|
---|
1370 | #ifdef VBOX_DRI_OLD
|
---|
1371 | if (pVBox->useDRI)
|
---|
1372 | pVBox->useDRI = VBOXDRIFinishScreenInit(pScreen);
|
---|
1373 | #endif
|
---|
1374 |
|
---|
1375 | return (TRUE);
|
---|
1376 | }
|
---|
1377 |
|
---|
1378 | #define NO_VT_ATOM_NAME "VBOXVIDEO_NO_VT"
|
---|
1379 |
|
---|
1380 | static Bool VBOXEnterVT(ScrnInfoPtr pScrn)
|
---|
1381 | {
|
---|
1382 | VBOXPtr pVBox = VBOXGetRec(pScrn);
|
---|
1383 | #ifndef VBOXVIDEO_13
|
---|
1384 | /* If we got a mode request while we were switched out, temporarily override
|
---|
1385 | * the physical mode set to the device while keeping things consistent from
|
---|
1386 | * the server's point of view. */
|
---|
1387 | int cXOverRide = RT_CLAMP(pVBox->pScreens[0].aPreferredSize.cx, VBOX_VIDEO_MIN_SIZE, VBOX_VIDEO_MAX_VIRTUAL);
|
---|
1388 | int cYOverRide = RT_CLAMP(pVBox->pScreens[0].aPreferredSize.cy, VBOX_VIDEO_MIN_SIZE, VBOX_VIDEO_MAX_VIRTUAL);
|
---|
1389 | #endif
|
---|
1390 |
|
---|
1391 | TRACE_ENTRY();
|
---|
1392 | updateGraphicsCapability(pScrn, TRUE);
|
---|
1393 | #ifdef VBOX_DRI_OLD
|
---|
1394 | if (pVBox->useDRI)
|
---|
1395 | DRIUnlock(xf86ScrnToScreen(pScrn));
|
---|
1396 | #elif defined(VBOX_DRI) /* DRI2 */
|
---|
1397 | if (pVBox->drmFD >= 0)
|
---|
1398 | {
|
---|
1399 | /* Tell the kernel driver, if present, that we are taking over. */
|
---|
1400 | drmSetMaster(pVBox->drmFD);
|
---|
1401 | }
|
---|
1402 | #endif
|
---|
1403 | vbvxSetUpHGSMIHeapInGuest(pVBox, pScrn->videoRam * 1024);
|
---|
1404 | vboxEnableVbva(pScrn);
|
---|
1405 | /* Re-set video mode */
|
---|
1406 | #ifdef VBOXVIDEO_13
|
---|
1407 | vbvxReadSizesAndCursorIntegrationFromHGSMI(pScrn, NULL);
|
---|
1408 | setSizesAndCursorIntegration(pScrn, false);
|
---|
1409 | #else
|
---|
1410 | setModeRandR11(pScrn, pScrn->currentMode, false, true, cXOverRide, cYOverRide);
|
---|
1411 | DeleteProperty(ROOT_WINDOW(pScrn), MakeAtom(NO_VT_ATOM_NAME, sizeof(NO_VT_ATOM_NAME) - 1, TRUE));
|
---|
1412 | #endif
|
---|
1413 | return TRUE;
|
---|
1414 | }
|
---|
1415 |
|
---|
1416 | static void VBOXLeaveVT(ScrnInfoPtr pScrn)
|
---|
1417 | {
|
---|
1418 | VBOXPtr pVBox = VBOXGetRec(pScrn);
|
---|
1419 | #ifdef VBOXVIDEO_13
|
---|
1420 | unsigned i;
|
---|
1421 | #else
|
---|
1422 | int32_t propertyValue = 0;
|
---|
1423 | #endif
|
---|
1424 |
|
---|
1425 | TRACE_ENTRY();
|
---|
1426 | updateGraphicsCapability(pScrn, FALSE);
|
---|
1427 | #ifdef VBOXVIDEO_13
|
---|
1428 | for (i = 0; i < pVBox->cScreens; ++i)
|
---|
1429 | vbox_crtc_dpms(pVBox->pScreens[i].paCrtcs, DPMSModeOff);
|
---|
1430 | #else
|
---|
1431 | ChangeWindowProperty(ROOT_WINDOW(pScrn), MakeAtom(NO_VT_ATOM_NAME, sizeof(NO_VT_ATOM_NAME) - 1, FALSE), XA_INTEGER, 32,
|
---|
1432 | PropModeReplace, 1, &propertyValue, TRUE);
|
---|
1433 | #endif
|
---|
1434 | vboxDisableVbva(pScrn);
|
---|
1435 | vbvxClearVRAM(pScrn, ((size_t)pScrn->virtualX) * pScrn->virtualY * (pScrn->bitsPerPixel / 8), 0);
|
---|
1436 | #ifdef VBOX_DRI_OLD
|
---|
1437 | if (pVBox->useDRI)
|
---|
1438 | DRILock(xf86ScrnToScreen(pScrn), 0);
|
---|
1439 | #elif defined(VBOX_DRI) /* DRI2 */
|
---|
1440 | if (pVBox->drmFD >= 0)
|
---|
1441 | drmDropMaster(pVBox->drmFD);
|
---|
1442 | #endif
|
---|
1443 | VBOXRestoreMode(pScrn);
|
---|
1444 | TRACE_EXIT();
|
---|
1445 | }
|
---|
1446 |
|
---|
1447 | static Bool VBOXCloseScreen(ScreenPtr pScreen)
|
---|
1448 | {
|
---|
1449 | ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
|
---|
1450 | VBOXPtr pVBox = VBOXGetRec(pScrn);
|
---|
1451 | #if defined(VBOX_DRI) && !defined(VBOX_DRI_OLD) /* DRI2 */
|
---|
1452 | BOOL fRestore = TRUE;
|
---|
1453 | #endif
|
---|
1454 | BOOL ret;
|
---|
1455 |
|
---|
1456 | if (pScrn->vtSema)
|
---|
1457 | {
|
---|
1458 | #ifdef VBOXVIDEO_13
|
---|
1459 | unsigned i;
|
---|
1460 |
|
---|
1461 | for (i = 0; i < pVBox->cScreens; ++i)
|
---|
1462 | vbox_crtc_dpms(pVBox->pScreens[i].paCrtcs, DPMSModeOff);
|
---|
1463 | #endif
|
---|
1464 | vboxDisableVbva(pScrn);
|
---|
1465 | vbvxClearVRAM(pScrn, ((size_t)pScrn->virtualX) * pScrn->virtualY * (pScrn->bitsPerPixel / 8), 0);
|
---|
1466 | }
|
---|
1467 | #ifdef VBOX_DRI
|
---|
1468 | # ifndef VBOX_DRI_OLD /* DRI2 */
|
---|
1469 | if ( pVBox->drmFD >= 0
|
---|
1470 | /* Tell the kernel driver, if present, that we are going away. */
|
---|
1471 | && drmIoctl(pVBox->drmFD, VBOXVIDEO_IOCTL_ENABLE_HGSMI, NULL) >= 0)
|
---|
1472 | fRestore = false;
|
---|
1473 | # endif
|
---|
1474 | if (pVBox->useDRI)
|
---|
1475 | VBOXDRICloseScreen(pScreen, pVBox);
|
---|
1476 | pVBox->useDRI = false;
|
---|
1477 | #endif
|
---|
1478 | #if defined(VBOX_DRI) && !defined(VBOX_DRI_OLD) /* DRI2 */
|
---|
1479 | if (fRestore)
|
---|
1480 | #endif
|
---|
1481 | if (pScrn->vtSema)
|
---|
1482 | VBOXRestoreMode(pScrn);
|
---|
1483 | if (pScrn->vtSema)
|
---|
1484 | VBOXUnmapVidMem(pScrn);
|
---|
1485 | pScrn->vtSema = FALSE;
|
---|
1486 |
|
---|
1487 | vbvxCursorTerm(pVBox);
|
---|
1488 |
|
---|
1489 | pScreen->CloseScreen = pVBox->CloseScreen;
|
---|
1490 | #if defined(VBOXVIDEO_13) && defined(RT_OS_LINUX)
|
---|
1491 | vbvxCleanUpLinuxACPI(pScreen);
|
---|
1492 | #endif
|
---|
1493 | #ifndef XF86_SCRN_INTERFACE
|
---|
1494 | ret = pScreen->CloseScreen(pScreen->myNum, pScreen);
|
---|
1495 | #else
|
---|
1496 | ret = pScreen->CloseScreen(pScreen);
|
---|
1497 | #endif
|
---|
1498 | VbglR3Term();
|
---|
1499 | return ret;
|
---|
1500 | }
|
---|
1501 |
|
---|
1502 | static Bool VBOXSwitchMode(ScrnInfoPtr pScrn, DisplayModePtr pMode)
|
---|
1503 | {
|
---|
1504 | Bool rc = TRUE;
|
---|
1505 |
|
---|
1506 | TRACE_LOG("HDisplay=%d, VDisplay=%d\n", pMode->HDisplay, pMode->VDisplay);
|
---|
1507 | #ifdef VBOXVIDEO_13
|
---|
1508 | rc = xf86SetSingleMode(pScrn, pMode, RR_Rotate_0);
|
---|
1509 | #else
|
---|
1510 | setModeRandR11(pScrn, pMode, false, false, 0, 0);
|
---|
1511 | #endif
|
---|
1512 | TRACE_LOG("returning %s\n", rc ? "TRUE" : "FALSE");
|
---|
1513 | return rc;
|
---|
1514 | }
|
---|
1515 |
|
---|
1516 | static void VBOXAdjustFrame(ScrnInfoPtr pScrn, int x, int y)
|
---|
1517 | { (void)pScrn; (void)x; (void)y; }
|
---|
1518 |
|
---|
1519 | static void VBOXFreeScreen(ScrnInfoPtr pScrn)
|
---|
1520 | {
|
---|
1521 | /* Destroy the VGA hardware record */
|
---|
1522 | vgaHWFreeHWRec(pScrn);
|
---|
1523 | /* And our private record */
|
---|
1524 | free(pScrn->driverPrivate);
|
---|
1525 | pScrn->driverPrivate = NULL;
|
---|
1526 | }
|
---|
1527 |
|
---|
1528 | static Bool
|
---|
1529 | VBOXMapVidMem(ScrnInfoPtr pScrn)
|
---|
1530 | {
|
---|
1531 | VBOXPtr pVBox = VBOXGetRec(pScrn);
|
---|
1532 | Bool rc = TRUE;
|
---|
1533 |
|
---|
1534 | TRACE_ENTRY();
|
---|
1535 | if (!pVBox->base)
|
---|
1536 | {
|
---|
1537 | #ifdef PCIACCESS
|
---|
1538 | (void) pci_device_map_range(pVBox->pciInfo,
|
---|
1539 | pScrn->memPhysBase,
|
---|
1540 | pScrn->videoRam * 1024,
|
---|
1541 | PCI_DEV_MAP_FLAG_WRITABLE,
|
---|
1542 | & pVBox->base);
|
---|
1543 | #else
|
---|
1544 | pVBox->base = xf86MapPciMem(pScrn->scrnIndex,
|
---|
1545 | VIDMEM_FRAMEBUFFER,
|
---|
1546 | pVBox->pciTag, pScrn->memPhysBase,
|
---|
1547 | (unsigned) pScrn->videoRam * 1024);
|
---|
1548 | #endif
|
---|
1549 | if (!pVBox->base)
|
---|
1550 | rc = FALSE;
|
---|
1551 | }
|
---|
1552 | TRACE_LOG("returning %s\n", rc ? "TRUE" : "FALSE");
|
---|
1553 | return rc;
|
---|
1554 | }
|
---|
1555 |
|
---|
1556 | static void
|
---|
1557 | VBOXUnmapVidMem(ScrnInfoPtr pScrn)
|
---|
1558 | {
|
---|
1559 | VBOXPtr pVBox = VBOXGetRec(pScrn);
|
---|
1560 |
|
---|
1561 | TRACE_ENTRY();
|
---|
1562 | if (pVBox->base == NULL)
|
---|
1563 | return;
|
---|
1564 |
|
---|
1565 | #ifdef PCIACCESS
|
---|
1566 | (void) pci_device_unmap_range(pVBox->pciInfo,
|
---|
1567 | pVBox->base,
|
---|
1568 | pScrn->videoRam * 1024);
|
---|
1569 | #else
|
---|
1570 | xf86UnMapVidMem(pScrn->scrnIndex, pVBox->base,
|
---|
1571 | (unsigned) pScrn->videoRam * 1024);
|
---|
1572 | #endif
|
---|
1573 | pVBox->base = NULL;
|
---|
1574 | TRACE_EXIT();
|
---|
1575 | }
|
---|
1576 |
|
---|
1577 | static Bool
|
---|
1578 | VBOXSaveScreen(ScreenPtr pScreen, int mode)
|
---|
1579 | {
|
---|
1580 | (void)pScreen; (void)mode;
|
---|
1581 | return TRUE;
|
---|
1582 | }
|
---|
1583 |
|
---|
1584 | void
|
---|
1585 | VBOXSaveMode(ScrnInfoPtr pScrn)
|
---|
1586 | {
|
---|
1587 | VBOXPtr pVBox = VBOXGetRec(pScrn);
|
---|
1588 | vgaRegPtr vgaReg;
|
---|
1589 |
|
---|
1590 | TRACE_ENTRY();
|
---|
1591 | vgaReg = &VGAHWPTR(pScrn)->SavedReg;
|
---|
1592 | vgaHWSave(pScrn, vgaReg, VGA_SR_ALL);
|
---|
1593 | pVBox->fSavedVBEMode = VBoxVideoGetModeRegisters(&pVBox->cSavedWidth,
|
---|
1594 | &pVBox->cSavedHeight,
|
---|
1595 | &pVBox->cSavedPitch,
|
---|
1596 | &pVBox->cSavedBPP,
|
---|
1597 | &pVBox->fSavedFlags);
|
---|
1598 | }
|
---|
1599 |
|
---|
1600 | void
|
---|
1601 | VBOXRestoreMode(ScrnInfoPtr pScrn)
|
---|
1602 | {
|
---|
1603 | VBOXPtr pVBox = VBOXGetRec(pScrn);
|
---|
1604 | vgaRegPtr vgaReg;
|
---|
1605 | #ifdef VBOX_DRI
|
---|
1606 | drmModeResPtr pRes;
|
---|
1607 | #endif
|
---|
1608 |
|
---|
1609 | TRACE_ENTRY();
|
---|
1610 | #ifdef VBOX_DRI
|
---|
1611 | /* Do not try to re-set the VGA state if a mode-setting driver is loaded. */
|
---|
1612 | if ( pVBox->drmFD >= 0
|
---|
1613 | && LoaderSymbol("drmModeGetResources") != NULL
|
---|
1614 | && (pRes = drmModeGetResources(pVBox->drmFD)) != NULL)
|
---|
1615 | {
|
---|
1616 | drmModeFreeResources(pRes);
|
---|
1617 | return;
|
---|
1618 | }
|
---|
1619 | #endif
|
---|
1620 | vgaReg = &VGAHWPTR(pScrn)->SavedReg;
|
---|
1621 | vgaHWRestore(pScrn, vgaReg, VGA_SR_ALL);
|
---|
1622 | if (pVBox->fSavedVBEMode)
|
---|
1623 | VBoxVideoSetModeRegisters(pVBox->cSavedWidth, pVBox->cSavedHeight,
|
---|
1624 | pVBox->cSavedPitch, pVBox->cSavedBPP,
|
---|
1625 | pVBox->fSavedFlags, 0, 0);
|
---|
1626 | else
|
---|
1627 | VBoxVideoDisableVBE();
|
---|
1628 | }
|
---|
1629 |
|
---|
1630 | static void
|
---|
1631 | VBOXDisplayPowerManagementSet(ScrnInfoPtr pScrn, int mode,
|
---|
1632 | int flags)
|
---|
1633 | {
|
---|
1634 | (void)pScrn; (void)mode; (void) flags;
|
---|
1635 | }
|
---|