vboxvideo.c revision 84cbac6212750be6733ce171fcdec2e24fd378c8
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * Linux Additions X11 graphics driver
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * Copyright (C) 2006-2013 Oracle Corporation
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * available from http://www.virtualbox.org. This file is free software;
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * you can redistribute it and/or modify it under the terms of the GNU
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * General Public License (GPL) as published by the Free Software
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * --------------------------------------------------------------------
930b5f872e89407f445d4000d4e4aaecaa6a0998vboxsync * This code is based on the X.Org VESA driver with the following copyrights:
930b5f872e89407f445d4000d4e4aaecaa6a0998vboxsync * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com)
930b5f872e89407f445d4000d4e4aaecaa6a0998vboxsync * Copyright 2008 Red Hat, Inc.
930b5f872e89407f445d4000d4e4aaecaa6a0998vboxsync * Copyright 2012 Red Hat, Inc.
930b5f872e89407f445d4000d4e4aaecaa6a0998vboxsync * and the following permission notice (not all original sourse files include
930b5f872e89407f445d4000d4e4aaecaa6a0998vboxsync * the last paragraph):
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * Permission is hereby granted, free of charge, to any person obtaining a
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * copy of this software and associated documentation files (the "Software"),
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * to deal in the Software without restriction, including without limitation
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * the rights to use, copy, modify, merge, publish, distribute, sublicense,
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * and/or sell copies of the Software, and to permit persons to whom the
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * Software is furnished to do so, subject to the following conditions:
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * The above copyright notice and this permission notice shall be included in
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * all copies or substantial portions of the Software.
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * CONECTIVA LINUX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * SOFTWARE.
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * Except as contained in this notice, the name of Conectiva Linux shall
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * not be used in advertising or otherwise to promote the sale, use or other
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * dealings in this Software without prior written authorization from
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * Conectiva Linux.
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * Authors: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * David Dawes <dawes@xfree86.org>
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * Adam Jackson <ajax@redhat.com>
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * Dave Airlie <airlied@redhat.com>
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync/* This was accepted upstream in X.Org Server 1.16 which bumped the video
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * driver ABI to 17. */
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync/* Drivers for PCI hardware need this */
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync/* Drivers that need to access the PCI config space directly need this */
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync/* All drivers initialising the SW cursor need this */
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync/* Colormap handling */
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync/* #define DPMS_SERVER
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync/* VGA hardware functions for setting and restoring text mode */
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync/* X.org 1.3+ mode setting */
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync# define _HAVE_STRING_ARCH_strsep /* bits/string2.h, __strsep_1c. */
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync/* For setting the root window property. */
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync/* Mandatory functions */
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsyncstatic const OptionInfoRec * VBOXAvailableOptions(int chipid, int busid);
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsyncstatic Bool VBOXPciProbe(DriverPtr drv, int entity_num,
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsyncstatic Bool VBOXPreInit(ScrnInfoPtr pScrn, int flags);
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsyncstatic Bool VBOXScreenInit(ScreenPtr pScreen, int argc, char **argv);
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsyncstatic Bool VBOXSaveScreen(ScreenPtr pScreen, int mode);
int flags);
enum GenericTypes
#ifdef PCIACCESS
#ifdef XORG_7X
#ifdef PCIACCESS
NULL,
NULL,
#ifdef XORG_7X
NULL,
#ifdef PCIACCESS
#ifndef XORG_7X
static const char *fbSymbols[] = {
static const char *shadowfbSymbols[] = {
static const char *ramdacSymbols[] = {
static const char *vgahwSymbols[] = {
#ifdef VBOXVIDEO_13
hw/xfree86/modes/xf86Crtc.h and hw/xfree86/modes/xf86Modes.h in the
return TRUE;
static Bool
static Bool
{ (void) crtc; }
(void) mode;
{ (void) output; }
return MODE_OK;
static Bool
static xf86OutputStatus
static DisplayModePtr
const char *pszName, int x, int y,
if (isPreferred)
return pMode;
static DisplayModePtr
unsigned i, cIndex = 0;
TRACE_ENTRY();
FALSE);
if (cIndex == 0)
/* Also report any modes the user may have requested in the xorg.conf
TRACE_EXIT();
return pModes;
#ifdef RANDR_12_INTERFACE
#ifdef XORG_7X
#ifdef XORG_7X
static pointer
if (!Initialised)
#ifdef PCIACCESS
#ifndef XORG_7X
NULL);
(void *)&VBOXVIDEO);
if (ErrorMajor)
return (NULL);
static const OptionInfoRec *
return (VBOXOptions);
#ifndef XF86_SCRN_INTERFACE
char **argv)
#ifdef PCIACCESS
static Bool
TRACE_ENTRY();
if (!pVBox)
return FALSE;
#ifndef PCIACCESS
static Bool
int numDevSections;
&devSections)) <= 0)
return (FALSE);
if (xf86GetPciVideoInfo())
int numUsed;
int *usedChips;
if (numUsed > 0)
for (i = 0; i < numUsed; i++)
return (foundScreen);
static Bool
unsigned DispiId;
TRACE_ENTRY();
return (FALSE);
if (!pVBox)
return FALSE;
return FALSE;
return (FALSE);
return FALSE;
return FALSE;
#ifdef VBOX_DRI_OLD
return FALSE;
# ifdef VBOX_DRI
return FALSE;
#ifndef PCIACCESS
return FALSE;
return FALSE;
return FALSE;
#ifdef VBOXVIDEO_13
return FALSE;
return (FALSE);
return (FALSE);
#ifdef PCIACCESS
TRACE_EXIT();
return (TRUE);
(void)pVisual;
#ifdef SET_HAVE_VT_PROPERTY
#ifdef SET_HAVE_VT_PROPERTY
FALSE);
unsigned flags;
TRACE_ENTRY();
return (FALSE);
return (FALSE);
if (!miSetPixmapDepths())
return (FALSE);
#ifdef VBOX_DRI
return (FALSE);
#ifdef VBOXVIDEO_13
uint32_t i;
return (FALSE);
return FALSE;
return FALSE;
return FALSE;
return (FALSE);
return (FALSE);
#ifdef VBOXVIDEO_13
#ifdef VBOXVIDEO_13
#ifdef VBOX_DRI_OLD
return (TRUE);
TRACE_ENTRY();
#ifdef VBOX_DRI_OLD
#ifdef VBOXVIDEO_13
return FALSE;
return FALSE;
#ifdef SET_HAVE_VT_PROPERTY
return TRUE;
TRACE_ENTRY();
#ifdef VBOX_DRI_OLD
#ifdef SET_HAVE_VT_PROPERTY
TRACE_EXIT();
#ifdef VBOX_DRI
fRestore = false;
if (fRestore)
#ifndef XF86_SCRN_INTERFACE
#ifndef VBOXVIDEO_13
return TRUE;
#ifdef VBOXVIDEO_13
return rc;
TRACE_ENTRY();
TRACE_EXIT();
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)