vboxvideo.c revision 23ff0a80f28ba27da3cb458face82665fe65e96c
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * Linux Additions X11 graphics driver
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * Copyright (C) 2006-2013 Oracle Corporation
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * available from http://www.virtualbox.org. This file is free software;
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * you can redistribute it and/or modify it under the terms of the GNU
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * General Public License (GPL) as published by the Free Software
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * --------------------------------------------------------------------
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * This code is based on the X.Org VESA driver with the following copyrights:
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com)
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * Copyright 2008 Red Hat, Inc.
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * Copyright 2012 Red Hat, Inc.
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * and the following permission notice (not all original sourse files include
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * the last paragraph):
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * Permission is hereby granted, free of charge, to any person obtaining a
750df3fe104e01cadbc3d5bd20243055d283d4e5vboxsync * copy of this software and associated documentation files (the "Software"),
750df3fe104e01cadbc3d5bd20243055d283d4e5vboxsync * to deal in the Software without restriction, including without limitation
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * the rights to use, copy, modify, merge, publish, distribute, sublicense,
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * and/or sell copies of the Software, and to permit persons to whom the
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * Software is furnished to do so, subject to the following conditions:
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * The above copyright notice and this permission notice shall be included in
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * all copies or substantial portions of the Software.
c10a6f0c7041e4d1ee50ad38425aab9d43c55522vboxsync * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
c10a6f0c7041e4d1ee50ad38425aab9d43c55522vboxsync * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
c10a6f0c7041e4d1ee50ad38425aab9d43c55522vboxsync * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
c10a6f0c7041e4d1ee50ad38425aab9d43c55522vboxsync * CONECTIVA LINUX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
c10a6f0c7041e4d1ee50ad38425aab9d43c55522vboxsync * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
c10a6f0c7041e4d1ee50ad38425aab9d43c55522vboxsync * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * SOFTWARE.
750df3fe104e01cadbc3d5bd20243055d283d4e5vboxsync * Except as contained in this notice, the name of Conectiva Linux shall
750df3fe104e01cadbc3d5bd20243055d283d4e5vboxsync * not be used in advertising or otherwise to promote the sale, use or other
750df3fe104e01cadbc3d5bd20243055d283d4e5vboxsync * dealings in this Software without prior written authorization from
750df3fe104e01cadbc3d5bd20243055d283d4e5vboxsync * Conectiva Linux.
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * Authors: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync * David Dawes <dawes@xfree86.org>
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync * Adam Jackson <ajax@redhat.com>
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync * Dave Airlie <airlied@redhat.com>
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync/* This was accepted upstream in X.Org Server 1.16 which bumped the video
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * driver ABI to 17. */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync/* Drivers for PCI hardware need this */
750df3fe104e01cadbc3d5bd20243055d283d4e5vboxsync/* Drivers that need to access the PCI config space directly need this */
750df3fe104e01cadbc3d5bd20243055d283d4e5vboxsync/* All drivers initialising the SW cursor need this */
750df3fe104e01cadbc3d5bd20243055d283d4e5vboxsync/* Colormap handling */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync/* #define DPMS_SERVER
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync/* VGA hardware functions for setting and restoring text mode */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync/* X.org 1.3+ mode setting */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync# define _HAVE_STRING_ARCH_strsep /* bits/string2.h, __strsep_1c. */
ffb50166c9adb4ae583b914d405197035cf890advboxsync/* For setting the root window property. */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync/* Mandatory functions */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsyncstatic const OptionInfoRec * VBOXAvailableOptions(int chipid, int busid);
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsyncstatic Bool VBOXPciProbe(DriverPtr drv, int entity_num,
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsyncstatic Bool VBOXPreInit(ScrnInfoPtr pScrn, int flags);
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsyncstatic Bool VBOXScreenInit(ScreenPtr pScreen, int argc, char **argv);
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsyncstatic Bool VBOXSaveScreen(ScreenPtr pScreen, int mode);
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsyncstatic Bool VBOXSwitchMode(ScrnInfoPtr pScrn, DisplayModePtr pMode);
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsyncstatic void VBOXAdjustFrame(ScrnInfoPtr pScrn, int x, int y);
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsyncstatic void VBOXDisplayPowerManagementSet(ScrnInfoPtr pScrn, int mode,
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync/* locally used functions */
b4d7b4dbcc45b8bde7502aa129440d92d7ffd038vboxsync VBOXPtr pVBox = (VBOXPtr)xnfcalloc(sizeof(VBOXRec), 1);
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsyncstatic const struct pci_id_match vbox_device_match[] = {
11b175175a0ed424b8e8354acda681ad0adde0f8vboxsync VBOX_VENDORID, VBOX_DEVICEID, PCI_MATCH_ANY, PCI_MATCH_ANY,
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync { 0, 0, 0 },
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync/* Supported chipsets */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * This contains the functions needed by the server after loading the
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * driver module. It must be supplied, and gets added the driver list by
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * the Module Setup function in the dynamic case. In the static case a
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * reference to this is compiled in, and this requires that the name of
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * this DriverRec be an upper-case version of the driver name.
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync/* No options for now */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * List of symbols from other modules that this module references. This
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * list is used to tell the loader that it is OK for symbols here to be
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * unresolved providing that it hasn't been told that they haven't been
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * told that they are essential via a call to xf86LoaderReqSymbols() or
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * xf86LoaderReqSymLists(). The purpose is this is to avoid warnings about
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * unresolved symbols that are not required.
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsyncstatic const char *fbSymbols[] = {
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync "fbPictureInit",
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync "fbScreenInit",
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsyncstatic const char *shadowfbSymbols[] = {
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync "ShadowFBInit2",
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsyncstatic const char *ramdacSymbols[] = {
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync "xf86DestroyCursorInfoRec",
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync "xf86InitCursor",
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync "xf86CreateCursorInfoRec",
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsyncstatic const char *vgahwSymbols[] = {
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync "vgaHWFreeHWRec",
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync "vgaHWGetHWRec",
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync "vgaHWGetIOBase",
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync "vgaHWGetIndex",
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync "vgaHWRestore",
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync "vgaHWSave",
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync "vgaHWSetStdFuncs",
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync#endif /* !XORG_7X */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync/* X.org 1.3+ mode-setting support ******************************************/
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync/* For descriptions of these functions and structures, see
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync hw/xfree86/modes/xf86Crtc.h and hw/xfree86/modes/xf86Modes.h in the
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync X.Org source tree. */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsyncstatic Bool vbox_config_resize(ScrnInfoPtr pScrn, int cw, int ch)
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync /* Save the size in case we need to re-set it later. */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync /* Don't fiddle with the hardware if we are switched
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * to a virtual terminal. */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync "We do not own the active VT, exiting.\n");
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsyncstatic const xf86CrtcConfigFuncsRec VBOXCrtcConfigFuncs = {
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync unsigned cDisplay = (uintptr_t)crtc->driver_private;
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync TRACE_LOG("cDisplay=%u, mode=%i\n", cDisplay, mode);
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync /* Don't fiddle with the hardware if we are switched
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * to a virtual terminal. */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync "We do not own the active VT, exiting.\n");
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync/* We use this function to check whether the X server owns the active virtual
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * terminal before attempting a mode switch, since the RandR extension isn't
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * very dilligent here, which can mean crashes if we are unlucky. This is
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * not the way it the function is intended - it is meant for reporting modes
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * which the hardware can't handle. I hope that this won't confuse any clients
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * connecting to us. */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsyncvbox_crtc_mode_fixup (xf86CrtcPtr crtc, DisplayModePtr mode,
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync{ (void) crtc; (void) mode; (void) adjusted_mode; return TRUE; }
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsyncvbox_crtc_mode_set (xf86CrtcPtr crtc, DisplayModePtr mode,
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync unsigned cDisplay = (uintptr_t)crtc->driver_private;
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync TRACE_LOG("name=%s, HDisplay=%d, VDisplay=%d, x=%d, y=%d\n", adjusted_mode->name,
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync adjusted_mode->HDisplay, adjusted_mode->VDisplay, x, y);
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync pVBox->pScreens[cDisplay].aScreenLocation.cx = adjusted_mode->HDisplay;
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync pVBox->pScreens[cDisplay].aScreenLocation.cy = adjusted_mode->VDisplay;
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync /* Don't fiddle with the hardware if we are switched
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * to a virtual terminal. */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync "We do not own the active VT, exiting.\n");
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync VBOXSetMode(crtc->scrn, cDisplay, adjusted_mode->HDisplay,
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync{ (void) crtc; (void) red; (void) green; (void) blue; (void) size; }
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsyncstatic void *
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsyncvbox_crtc_shadow_allocate (xf86CrtcPtr crtc, int width, int height)
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync{ (void) crtc; (void) width; (void) height; return NULL; }
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync .save = NULL, /* These two are never called by the server. */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync .unlock = NULL, /* This will not be invoked if lock returns FALSE. */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync .shadow_create = NULL, /* These two should not be invoked if allocate
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync returns NULL. */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync .set_cursor_colors = NULL, /* We are still using the old cursor API. */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync unsigned cDisplay = (uintptr_t)output->driver_private;
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync TRACE_LOG("cDisplay=%u, mode=%i\n", cDisplay, mode);
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync pVBox->pScreens[cDisplay].fOutputEnabled = fEnabled;
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync /* Don't fiddle with the hardware if we are switched
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * to a virtual terminal. */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync "We do not own the active VT, exiting.\n");
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsyncvbox_output_mode_valid (xf86OutputPtr output, DisplayModePtr mode)
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsyncvbox_output_mode_fixup (xf86OutputPtr output, DisplayModePtr mode,
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync{ (void) output; (void) mode; (void) adjusted_mode; return TRUE; }
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsyncvbox_output_mode_set (xf86OutputPtr output, DisplayModePtr mode,
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync{ (void) output; (void) mode; (void) adjusted_mode; }
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync/* A virtual monitor is always connected. */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync uint32_t iScreen = (uintptr_t)output->driver_private;
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync ? XF86OutputStatusConnected : XF86OutputStatusDisconnected;
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsyncstatic DisplayModePtr vbox_output_add_mode(VBOXPtr pVBox, DisplayModePtr *pModes, const char *pszName, int x, int y,
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync TRACE_LOG("pszName=%s, x=%d, y=%d\n", pszName ? pszName : "(null)", x, y);
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync DisplayModePtr pMode = xnfcalloc(1, sizeof(DisplayModeRec));
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync /* We don't ask the host whether it likes user defined modes,
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * as we assume that the user really wanted that mode. */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync pMode->type = isUserDef ? M_T_USERDEF : M_T_BUILTIN;
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync /* Older versions of VBox only support screen widths which are a multiple
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync pMode->Clock = pMode->HTotal * pMode->VTotal * cRefresh / 1000; /* kHz */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync unsigned i, cIndex = 0;
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync pMode = vbox_output_add_mode(pVBox, &pModes, NULL, pVBox->pScreens[iScreen].aPreferredSize.cx,
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync pVBox->pScreens[iScreen].aPreferredSize.cy, TRUE, FALSE);
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync .save = NULL, /* These two are never called by the server. */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync#endif /* VBOXVIDEO_13 */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync/* Module loader interface */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync 0, /* Module minor version. Xorg-specific */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync {0, 0, 0, 0}
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * This data is accessed by the loader. The name must be the module name
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * followed by "ModuleData".
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsyncXF86ModuleData vboxvideoModuleData = { &vboxVersionRec, vboxSetup, NULL };
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsyncvboxSetup(pointer Module, pointer Options, int *ErrorMajor, int *ErrorMinor)
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync xf86AddDriver(&VBOXVIDEO, Module, HaveDriverFuncs);
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync xf86Msg(X_CONFIG, "Load address of symbol \"VBOXVIDEO\" is %p\n",
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync xf86PrintChipsets(VBOX_NAME, "guest driver for VirtualBox", VBOXChipsets);
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync# define xf86ScreenToScrn(pScreen) xf86Screens[(pScreen)->myNum]
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync# define xf86ScrnToScreen(pScrn) screenInfo.screens[(pScrn)->scrnIndex]
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsyncstatic Bool VBOXScreenInitIndex(int scrnIndex, ScreenPtr pScreen, int argc,
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsyncstatic Bool VBOXEnterVTIndex(int scrnIndex, int flags)
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync{ (void) flags; return VBOXEnterVT(xf86Screens[scrnIndex]); }
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsyncstatic void VBOXLeaveVTIndex(int scrnIndex, int flags)
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync{ (void) flags; VBOXLeaveVT(xf86Screens[scrnIndex]); }
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsyncstatic Bool VBOXCloseScreenIndex(int scrnIndex, ScreenPtr pScreen)
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync{ (void) scrnIndex; return VBOXCloseScreen(pScreen); }
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsyncstatic Bool VBOXSwitchModeIndex(int scrnIndex, DisplayModePtr pMode, int flags)
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync{ (void) flags; return VBOXSwitchMode(xf86Screens[scrnIndex], pMode); }
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsyncstatic void VBOXAdjustFrameIndex(int scrnIndex, int x, int y, int flags)
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync{ (void) flags; VBOXAdjustFrame(xf86Screens[scrnIndex], x, y); }
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsyncstatic void VBOXFreeScreenIndex(int scrnIndex, int flags)
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync{ (void) flags; VBOXFreeScreen(xf86Screens[scrnIndex]); }
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync#endif /* XF86_SCRN_INTERFACE */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsyncstatic void setScreenFunctions(ScrnInfoPtr pScrn, xf86ProbeProc pfnProbe)
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync pScrn->AdjustFrame = SCRNINDEXAPI(VBOXAdjustFrame);
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * One of these functions is called once, at the start of the first server
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * generation to do a minimal probe for supported hardware.
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsyncVBOXPciProbe(DriverPtr drv, int entity_num, struct pci_device *dev,
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync pScrn = xf86ConfigPciEntity(NULL, 0, entity_num, VBOXPCIchipsets,
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync TRACE_LOG("returning %s\n", BOOL_STR(pScrn != NULL));
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * Find the config file Device sections that match this
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * driver, and return if there are none.
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync /* PCI BUS */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync numUsed = xf86MatchPciInstances(VBOX_NAME, VBOX_VENDORID,
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync for (i = 0; i < numUsed; i++)
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync /* Allocate a ScrnInfoRec */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync if ((pScrn = xf86ConfigPciEntity(pScrn,0,usedChips[i],
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * QUOTE from the XFree86 DESIGN document:
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * The purpose of this function is to find out all the information
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * required to determine if the configuration is usable, and to initialise
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * those parts of the ScrnInfoRec that can be set once at the beginning of
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * the first server generation.
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * This includes probing for video memory, clocks, ramdac, and all other
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * HW info that is needed. It includes determining the depth/bpp/visual
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * and related info. It includes validating and determining the set of
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * video modes that will be used (and anything that is required to
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * determine that).
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * This information should be determined in the least intrusive way
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * possible. The state of the HW must remain unchanged by this function.
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * Although video memory (including MMIO) may be mapped within this
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * function, it must be unmapped before returning.
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * END QUOTE
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync /* Are we really starting the server, or is this just a dummy run? */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync "VirtualBox guest additions video driver version "
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync /* Get our private data from the ScrnInfoRec structure. */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync /* Entity information seems to mean bus information. */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync pVBox->pEnt = xf86GetEntityInfo(pScrn->entityList[0]);
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync /* The ramdac module is needed for the hardware cursor. */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync /* The framebuffer module. */
ffb50166c9adb4ae583b914d405197035cf890advboxsync /* Load the dri module. */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync /* Load the dri module. */
ffb50166c9adb4ae583b914d405197035cf890advboxsync pVBox->pciInfo = xf86GetPciInfoForEntity(pVBox->pEnt->index);
ffb50166c9adb4ae583b914d405197035cf890advboxsync /* Set up our ScrnInfoRec structure to describe our virtual
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync capabilities to X. */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync /** @note needed during colourmap initialisation */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync /* Let's create a nice, capable virtual monitor. */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync /* Using the PCI information caused problems with non-powers-of-two
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync sized video RAM configurations */
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync /* Check if the chip restricts horizontal resolution or not. */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync /* Set up clock information that will support all modes we need. */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync pScrn->clockRanges = xnfcalloc(sizeof(ClockRange), 1);
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync if (!xf86SetDepthBpp(pScrn, 24, 0, 0, Support32bppFb))
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync /* We only support 16 and 24 bits depth (i.e. 16 and 32bpp) */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync if (pScrn->bitsPerPixel != 32 && pScrn->bitsPerPixel != 16)
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync "The VBox additions only support 16 and 32bpp graphics modes\n");
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync /* Work around a bug in the original X server modesetting code, which
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * took the first valid values set to these two as maxima over the
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * server lifetime. */
b4d7b4dbcc45b8bde7502aa129440d92d7ffd038vboxsync /* We don't validate with xf86ValidateModes and xf86PruneModes as we
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * already know what we like and what we don't. */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync /* Set the right virtual resolution. */
b4d7b4dbcc45b8bde7502aa129440d92d7ffd038vboxsync#endif /* !VBOXVIDEO_13 */
b4d7b4dbcc45b8bde7502aa129440d92d7ffd038vboxsync /* Needed before we initialise DRI. */
b4d7b4dbcc45b8bde7502aa129440d92d7ffd038vboxsync pVBox->cbLine = vboxLineLength(pScrn, pScrn->virtualX);
b4d7b4dbcc45b8bde7502aa129440d92d7ffd038vboxsync pScrn->displayWidth = vboxDisplayPitch(pScrn, pVBox->cbLine);
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync /* VGA hardware initialisation */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync /* Must be called before any VGA registers are saved or restored */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync /* Colour weight - we always call this, since we are always in
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync truecolour. */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync /* visual init */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync /* Set the DPI. Perhaps we should read this from the host? */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync pScrn->memPhysBase = pVBox->pciInfo->regions[0].base_addr;
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync * Dummy function for setting the colour palette, which we actually never
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync * touch. However, the server still requires us to provide this.
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsyncvboxLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices,
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync (void)pScrn; (void) numColors; (void) indices; (void) colors;
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync#define VBOXVIDEO_DRIVER_ATOM_NAME "VBOXVIDEO_DRIVER_IN_USE"
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync/* The memory storing the initial value of the XFree86_has_VT root window
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync * property. This has to remain available until server start-up, so we just
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync * use a global. */
0dd3967035b8a02985920baa57f948dc542b9388vboxsync/** Initialise a flag property on the root window to say whether the server VT
0dd3967035b8a02985920baa57f948dc542b9388vboxsync * is currently the active one as some clients need to know this. */
0dd3967035b8a02985920baa57f948dc542b9388vboxsync atom = MakeAtom(HAS_VT_ATOM_NAME, sizeof(HAS_VT_ATOM_NAME) - 1, TRUE);
6475559a7e0e52892efbab4fbdedc879f6866109vboxsync if (xf86RegisterRootWindowProperty(pScrn->scrnIndex, atom, XA_INTEGER,
6475559a7e0e52892efbab4fbdedc879f6866109vboxsync FatalError("vboxvideo: failed to register VT property\n");
6475559a7e0e52892efbab4fbdedc879f6866109vboxsync#endif /* SET_HAVE_VT_PROPERTY */
0dd3967035b8a02985920baa57f948dc542b9388vboxsync if (xf86RegisterRootWindowProperty(pScrn->scrnIndex, atom, XA_INTEGER,
0dd3967035b8a02985920baa57f948dc542b9388vboxsync FatalError("vboxvideo: failed to register driver in use property\n");
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync/** Update a flag property on the root window to say whether the server VT
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync * is currently the active one as some clients need to know this. */
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsyncstatic void updateHasVTProperty(ScrnInfoPtr pScrn, Bool hasVT)
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync property_name = MakeAtom(HAS_VT_ATOM_NAME, sizeof(HAS_VT_ATOM_NAME) - 1,
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync FatalError("Failed to retrieve \"HAS_VT\" atom\n");
0dd3967035b8a02985920baa57f948dc542b9388vboxsync ChangeWindowProperty(ROOT_WINDOW(pScrn), property_name, XA_INTEGER, 32,
0dd3967035b8a02985920baa57f948dc542b9388vboxsync#endif /* SET_HAVE_VT_PROPERTY */
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync * QUOTE from the XFree86 DESIGN document:
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync * This is called at the start of each server generation.
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync * Decide which operations need to be placed under resource access
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync * control. (...) Map any video memory or other memory regions. (...)
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync * Save the video card state. (...) Initialise the initial video
f75c6db919d277952ca03b7acf643e5e3ac96cafvboxsync * End QUOTE.
f75c6db919d277952ca03b7acf643e5e3ac96cafvboxsyncstatic Bool VBOXScreenInit(ScreenPtr pScreen, int argc, char **argv)
f75c6db919d277952ca03b7acf643e5e3ac96cafvboxsync /* save current video state */
f75c6db919d277952ca03b7acf643e5e3ac96cafvboxsync /* mi layer - reset the visual list (?)*/
3c6306a66deef467e3c13483dd6529e1e1c6b822vboxsync pVBox->useDRI = VBOXDRIScreenInit(pScrn, pScreen, pVBox);
3c6306a66deef467e3c13483dd6529e1e1c6b822vboxsync /* Tell the kernel driver, if present, that we are taking over. */
750df3fe104e01cadbc3d5bd20243055d283d4e5vboxsync drmIoctl(pVBox->drmFD, VBOXVIDEO_IOCTL_DISABLE_HGSMI, NULL);
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync /* Fixup RGB ordering */
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync /** @note the X server uses this even in true colour. */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync if ((visual->class | DynamicClass) == DirectColor) {
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync /* must be after RGB ordering fixed */
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync /* Initialise CRTC and output configuration for use with randr1.2. */
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync /* Setup our virtual CRTCs. */
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync pVBox->pScreens[i].paCrtcs = xf86CrtcCreate(pScrn, &VBOXCrtcFuncs);
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync pVBox->pScreens[i].paCrtcs->driver_private = (void *)(uintptr_t)i;
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync /* Set up our virtual outputs. */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync = xf86OutputCreate(pScrn, &VBOXOutputFuncs, szOutput);
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync /* We are not interested in the monitor section in the
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync * configuration file. */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync xf86OutputUseScreenMonitor(pVBox->pScreens[i].paOutputs, FALSE);
3c6306a66deef467e3c13483dd6529e1e1c6b822vboxsync pVBox->pScreens[i].paOutputs->possible_crtcs = 1 << i;
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync pVBox->pScreens[i].paOutputs->driver_private = (void *)(uintptr_t)i;
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync TRACE_LOG("Created crtc (%p) and output %s (%p)\n",
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync /* Set a sane minimum and maximum mode size to match what the hardware
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * supports. */
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync xf86CrtcSetSizeRange(pScrn, VBOX_VIDEO_MIN_SIZE, VBOX_VIDEO_MIN_SIZE, VBOX_VIDEO_MAX_VIRTUAL, VBOX_VIDEO_MAX_VIRTUAL);
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync /* Now create our initial CRTC/output configuration. */
ffb50166c9adb4ae583b914d405197035cf890advboxsync xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Initial CRTC configuration failed!\n");
ffb50166c9adb4ae583b914d405197035cf890advboxsync /* Initialise randr 1.2 mode-setting functions and set first mode.
ffb50166c9adb4ae583b914d405197035cf890advboxsync * Note that the mode won't be usable until the server has resized the
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync * framebuffer to something reasonable. */
3c6306a66deef467e3c13483dd6529e1e1c6b822vboxsync#else /* !VBOXVIDEO_13 */
ffb50166c9adb4ae583b914d405197035cf890advboxsync /* set first video mode */
ffb50166c9adb4ae583b914d405197035cf890advboxsync if (!VBOXSetMode(pScrn, 0, pScrn->currentMode->HDisplay,
f75c6db919d277952ca03b7acf643e5e3ac96cafvboxsync /* Save the size in case we need to re-set it later. */
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync pVBox->pScreens[0].aScreenLocation.cx = pScrn->currentMode->HDisplay;
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync pVBox->pScreens[0].aScreenLocation.cy = pScrn->currentMode->VDisplay;
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync pVBox->pScreens[0].aScreenLocation.x = pScrn->frameX0;
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync pVBox->pScreens[0].aScreenLocation.y = pScrn->frameY0;
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync#endif /* !VBOXVIDEO_13 */
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync /* software cursor */
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync miDCInitialize(pScreen, xf86GetPointerScreenFuncs());
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync /* colourmap code */
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync if(!xf86HandleColormaps(pScreen, 256, 8, vboxLoadPalette, NULL, 0))
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync pScreen->CloseScreen = SCRNINDEXAPI(VBOXCloseScreen);
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync /* We probably do want to support power management - even if we just use
0dd3967035b8a02985920baa57f948dc542b9388vboxsync a dummy function. */
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync xf86DPMSInit(pScreen, VBOXDisplayPowerManagementSet, 0);
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync /* Report any unused options (only for the first generation) */
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options);
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync "Unable to start the VirtualBox mouse pointer integration with the host system.\n");
ffb50166c9adb4ae583b914d405197035cf890advboxsync /* Tell the kernel driver, if present, that we are taking over. */
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync /* Re-assert this in case we had a change request while switched out. */
ffb50166c9adb4ae583b914d405197035cf890advboxsync VBOXAdjustScreenPixmap(pScrn, pVBox->FBSize.cx, pVBox->FBSize.cy);
ffb50166c9adb4ae583b914d405197035cf890advboxsync if (!VBOXSetMode(pScrn, 0, pScrn->currentMode->HDisplay,
ffb50166c9adb4ae583b914d405197035cf890advboxsync unsigned i;
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync vbox_output_dpms(pVBox->pScreens[i].paOutputs, DPMSModeOff);
750df3fe104e01cadbc3d5bd20243055d283d4e5vboxsync#if defined(VBOX_DRI) && !defined(VBOX_DRI_OLD) /* DRI2 */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync unsigned i;
ffb50166c9adb4ae583b914d405197035cf890advboxsync vbox_output_dpms(pVBox->pScreens[i].paOutputs, DPMSModeOff);
750df3fe104e01cadbc3d5bd20243055d283d4e5vboxsync /* Tell the kernel driver, if present, that we are going away. */
ffb50166c9adb4ae583b914d405197035cf890advboxsync && drmIoctl(pVBox->drmFD, VBOXVIDEO_IOCTL_ENABLE_HGSMI, NULL) >= 0)
ffb50166c9adb4ae583b914d405197035cf890advboxsync#if defined(VBOX_DRI) && !defined(VBOX_DRI_OLD) /* DRI2 */
750df3fe104e01cadbc3d5bd20243055d283d4e5vboxsync /* Do additional bits which are separate for historical reasons */
6475559a7e0e52892efbab4fbdedc879f6866109vboxsync return pScreen->CloseScreen(pScreen->myNum, pScreen);
6475559a7e0e52892efbab4fbdedc879f6866109vboxsyncstatic Bool VBOXSwitchMode(ScrnInfoPtr pScrn, DisplayModePtr pMode)
6475559a7e0e52892efbab4fbdedc879f6866109vboxsync TRACE_LOG("HDisplay=%d, VDisplay=%d\n", pMode->HDisplay, pMode->VDisplay);
6475559a7e0e52892efbab4fbdedc879f6866109vboxsync /* Save the size in case we need to re-set it later. */
6475559a7e0e52892efbab4fbdedc879f6866109vboxsync pVBox->pScreens[0].aScreenLocation.cx = pMode->HDisplay;
ffb50166c9adb4ae583b914d405197035cf890advboxsync pVBox->pScreens[0].aScreenLocation.cy = pMode->VDisplay;
6475559a7e0e52892efbab4fbdedc879f6866109vboxsync pVBox->pScreens[0].aScreenLocation.x = pScrn->frameX0;
6475559a7e0e52892efbab4fbdedc879f6866109vboxsync pVBox->pScreens[0].aScreenLocation.y = pScrn->frameY0;
ffb50166c9adb4ae583b914d405197035cf890advboxsync "We do not own the active VT, exiting.\n");
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync VBOXAdjustScreenPixmap(pScrn, pMode->HDisplay, pMode->VDisplay);
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync rc = VBOXSetMode(pScrn, 0, pMode->HDisplay, pMode->VDisplay,
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync TRACE_LOG("returning %s\n", rc ? "TRUE" : "FALSE");
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsyncstatic void VBOXAdjustFrame(ScrnInfoPtr pScrn, int x, int y)
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync /* Don't fiddle with the hardware if we are switched
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * to a virtual terminal. */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync "We do not own the active VT, exiting.\n");
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync VBOXSetMode(pScrn, 0, pVBox->pScreens[0].aScreenLocation.cx,
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync /* Destroy the VGA hardware record */
static Bool
TRACE_ENTRY();
#ifdef PCIACCESS
return rc;
TRACE_ENTRY();
#ifdef PCIACCESS
TRACE_EXIT();
static Bool
return TRUE;
TRACE_ENTRY();
#ifdef VBOX_DRI
TRACE_ENTRY();
#ifdef VBOX_DRI
int flags)