vboxvideo.c revision a86135e41c89c7b599607649347a4240809c784b
c6e0905a5f2b95eaf3b7cc4dd054cce617b3f498vboxsync * Linux Additions X11 graphics driver
c6e0905a5f2b95eaf3b7cc4dd054cce617b3f498vboxsync * Copyright (C) 2006-2010 Oracle Corporation
c6e0905a5f2b95eaf3b7cc4dd054cce617b3f498vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
c6e0905a5f2b95eaf3b7cc4dd054cce617b3f498vboxsync * available from http://www.virtualbox.org. This file is free software;
c6e0905a5f2b95eaf3b7cc4dd054cce617b3f498vboxsync * you can redistribute it and/or modify it under the terms of the GNU
c6e0905a5f2b95eaf3b7cc4dd054cce617b3f498vboxsync * General Public License (GPL) as published by the Free Software
c6e0905a5f2b95eaf3b7cc4dd054cce617b3f498vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
c6e0905a5f2b95eaf3b7cc4dd054cce617b3f498vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
c6e0905a5f2b95eaf3b7cc4dd054cce617b3f498vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
c6e0905a5f2b95eaf3b7cc4dd054cce617b3f498vboxsync * --------------------------------------------------------------------
c6e0905a5f2b95eaf3b7cc4dd054cce617b3f498vboxsync * This code is based on:
c6e0905a5f2b95eaf3b7cc4dd054cce617b3f498vboxsync * X11 VESA driver
c6e0905a5f2b95eaf3b7cc4dd054cce617b3f498vboxsync * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com)
57a6e7347196197252bf6ab9ce5d7d3f6a1aafd3vboxsync * Permission is hereby granted, free of charge, to any person obtaining a
57a6e7347196197252bf6ab9ce5d7d3f6a1aafd3vboxsync * copy of this software and associated documentation files (the "Software"),
57a6e7347196197252bf6ab9ce5d7d3f6a1aafd3vboxsync * to deal in the Software without restriction, including without limitation
57a6e7347196197252bf6ab9ce5d7d3f6a1aafd3vboxsync * the rights to use, copy, modify, merge, publish, distribute, sublicense,
c6e0905a5f2b95eaf3b7cc4dd054cce617b3f498vboxsync * and/or sell copies of the Software, and to permit persons to whom the
c6e0905a5f2b95eaf3b7cc4dd054cce617b3f498vboxsync * Software is furnished to do so, subject to the following conditions:
c6e0905a5f2b95eaf3b7cc4dd054cce617b3f498vboxsync * The above copyright notice and this permission notice shall be included in
c6e0905a5f2b95eaf3b7cc4dd054cce617b3f498vboxsync * all copies or substantial portions of the Software.
c6e0905a5f2b95eaf3b7cc4dd054cce617b3f498vboxsync * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
c6e0905a5f2b95eaf3b7cc4dd054cce617b3f498vboxsync * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
c6e0905a5f2b95eaf3b7cc4dd054cce617b3f498vboxsync * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
c6e0905a5f2b95eaf3b7cc4dd054cce617b3f498vboxsync * CONECTIVA LINUX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
c6e0905a5f2b95eaf3b7cc4dd054cce617b3f498vboxsync * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
c6e0905a5f2b95eaf3b7cc4dd054cce617b3f498vboxsync * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
c6e0905a5f2b95eaf3b7cc4dd054cce617b3f498vboxsync * SOFTWARE.
c6e0905a5f2b95eaf3b7cc4dd054cce617b3f498vboxsync * Except as contained in this notice, the name of Conectiva Linux shall
c6e0905a5f2b95eaf3b7cc4dd054cce617b3f498vboxsync * not be used in advertising or otherwise to promote the sale, use or other
c6e0905a5f2b95eaf3b7cc4dd054cce617b3f498vboxsync * dealings in this Software without prior written authorization from
c6e0905a5f2b95eaf3b7cc4dd054cce617b3f498vboxsync * Conectiva Linux.
c6e0905a5f2b95eaf3b7cc4dd054cce617b3f498vboxsync * Authors: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
c6e0905a5f2b95eaf3b7cc4dd054cce617b3f498vboxsync/* All drivers initialising the SW cursor need this */
c6e0905a5f2b95eaf3b7cc4dd054cce617b3f498vboxsync/* All drivers implementing backing store need this */
c6e0905a5f2b95eaf3b7cc4dd054cce617b3f498vboxsync/* Colormap handling */
c6e0905a5f2b95eaf3b7cc4dd054cce617b3f498vboxsync/* #define DPMS_SERVER
c6e0905a5f2b95eaf3b7cc4dd054cce617b3f498vboxsync/* VGA hardware functions for setting and restoring text mode */
c6e0905a5f2b95eaf3b7cc4dd054cce617b3f498vboxsync/* X.org 1.3+ mode setting */
c6e0905a5f2b95eaf3b7cc4dd054cce617b3f498vboxsync# define _HAVE_STRING_ARCH_strsep /* bits/string2.h, __strsep_1c. */
c6e0905a5f2b95eaf3b7cc4dd054cce617b3f498vboxsync/* Mandatory functions */
#ifndef PCIACCESS
char **argv);
unsigned cHeight, int x, int y);
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 *vbeSymbols[] = {
static const char *ramdacSymbols[] = {
static const char *vgahwSymbols[] = {
static VBOXPtr
#ifdef VBOXVIDEO_13
hw/xfree86/modes/xf86Crtc.h and hw/xfree86/modes/xf86Modes.h in the
static Bool
static Bool
{ (void) crtc; }
(void) mode;
{ (void) output; }
return rc;
static Bool
static xf86OutputStatus
(void) output;
return XF86OutputStatusConnected;
const char *pszName, int x, int y,
if (isPreferred)
static DisplayModePtr
TRACE_ENTRY();
/* Also report any modes the user may have requested in the xorg.conf
TRACE_EXIT();
return pModes;
#ifdef RANDR_12_INTERFACE
static Atom
vboxAtomVBoxMode(void)
if (!rc)
return rc;
static Bool
return FALSE;
return FALSE;
return TRUE;
return FALSE;
#ifdef RANDR_12_INTERFACE
#ifdef XFree86LOADER
#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);
#ifdef PCIACCESS
static Bool
TRACE_ENTRY();
#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);
TRACE_EXIT();
static uint16_t
static int32_t
static int32_t
static Bool
unsigned DispiId;
TRACE_ENTRY();
return (FALSE);
return FALSE;
return (FALSE);
return (FALSE);
return FALSE;
return FALSE;
#ifdef VBOX_DRI
return FALSE;
#ifndef PCIACCESS
return FALSE;
return FALSE;
return FALSE;
#ifdef VBOXVIDEO_13
return (FALSE);
return (FALSE);
return FALSE;
TRACE_EXIT();
return (TRUE);
(void)pVisual;
static Bool
unsigned flags;
TRACE_ENTRY();
return (FALSE);
#ifdef PCIACCESS
return (FALSE);
return (FALSE);
return (FALSE);
if (!miSetPixmapDepths())
return (FALSE);
#ifdef VBOX_DRI
return (FALSE);
#ifdef VBOXVIDEO_13
uint32_t i;
szOutput);
return (FALSE);
return FALSE;
uint32_t i;
FALSE);
return FALSE;
return FALSE;
return (FALSE);
return (FALSE);
#ifdef VBOX_DRI
return (TRUE);
cbOldFB = 0;
cbNewFB = 0;
static Bool
TRACE_ENTRY();
#ifdef VBOX_DRI
#ifdef VBOXVIDEO_13
return FALSE;
return FALSE;
return TRUE;
TRACE_ENTRY();
#ifdef VBOX_DRI
TRACE_EXIT();
static Bool
#ifdef VBOX_DRI
static Bool
#ifdef VBOXVIDEO_13
if (rc)
return rc;
static Bool
unsigned cHeight, int x, int y)
if (cDisplay == 0)
return rc;
if (!pPixmap) {
return FALSE;
"Unable to set up a virtual screen size of %dx%d with %lu of %d Kb of video memory available. Please increase the video memory size.\n",
return FALSE;
#ifdef VBOX_DRI
#ifdef VBOXVIDEO_13
return TRUE;
TRACE_ENTRY();
TRACE_EXIT();
static Bool
TRACE_ENTRY();
#ifdef PCIACCESS
return rc;
TRACE_ENTRY();
#ifdef PCIACCESS
TRACE_EXIT();
static Bool
return TRUE;
TRACE_ENTRY();
if (rc)
if (rc)
return rc;
int flags)