VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/vboxvideo/vboxvideo.c@ 56985

Last change on this file since 56985 was 56886, checked in by vboxsync, 10 years ago

Additions/x11/vboxvideo: additional default video modes.

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

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette