vboxvideo.h revision 10028648143893a0291db53b6a5f7d061f8b0fa8
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync/** @file
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync *
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync * VirtualBox X11 Additions graphics driver
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync */
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync/*
c58f1213e628a545081c70e26c6b67a841cff880vboxsync * Copyright (C) 2006-2013 Oracle Corporation
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync *
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync * available from http://www.virtualbox.org. This file is free software;
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync * you can redistribute it and/or modify it under the terms of the GNU
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync * General Public License (GPL) as published by the Free Software
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync * --------------------------------------------------------------------
0d12c7f9423f2745f8e282523d0930f91bff03b3vboxsync *
0d12c7f9423f2745f8e282523d0930f91bff03b3vboxsync * This code is based on:
0d12c7f9423f2745f8e282523d0930f91bff03b3vboxsync *
0d12c7f9423f2745f8e282523d0930f91bff03b3vboxsync * X11 VESA driver
0d12c7f9423f2745f8e282523d0930f91bff03b3vboxsync *
0d12c7f9423f2745f8e282523d0930f91bff03b3vboxsync * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com)
0d12c7f9423f2745f8e282523d0930f91bff03b3vboxsync *
0d12c7f9423f2745f8e282523d0930f91bff03b3vboxsync * Permission is hereby granted, free of charge, to any person obtaining a
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync * copy of this software and associated documentation files (the "Software"),
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync * to deal in the Software without restriction, including without limitation
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync * the rights to use, copy, modify, merge, publish, distribute, sublicense,
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync * and/or sell copies of the Software, and to permit persons to whom the
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync * Software is furnished to do so, subject to the following conditions:
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync *
032a52c5b2984e26e84c2961f8f7f98a3954c8f2vboxsync * The above copyright notice and this permission notice shall be included in
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync * all copies or substantial portions of the Software.
590bfe12ce22cd3716448fbb9f4dc51664bfe5e2vboxsync *
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
45c3e41d012100c5f4a3f77e391e4c6da8f5b97avboxsync * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
45c3e41d012100c5f4a3f77e391e4c6da8f5b97avboxsync * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync * CONECTIVA LINUX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync * SOFTWARE.
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync *
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync * Except as contained in this notice, the name of Conectiva Linux shall
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync * not be used in advertising or otherwise to promote the sale, use or other
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync * dealings in this Software without prior written authorization from
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync * Conectiva Linux.
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync *
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync * Authors: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync *
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.h,v 1.9 2001/05/04 19:05:49 dawes Exp $
c2046db2cc346cc299f0cd9b2d1e160179159cfcvboxsync */
9939c713bffcfc4305d99d994552aa2ad9bce097vboxsync
c2046db2cc346cc299f0cd9b2d1e160179159cfcvboxsync#ifndef _VBOXVIDEO_H_
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync#define _VBOXVIDEO_H_
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync
c2046db2cc346cc299f0cd9b2d1e160179159cfcvboxsync#include <VBox/VBoxVideoGuest.h>
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync#include <VBox/VBoxVideo.h>
c2046db2cc346cc299f0cd9b2d1e160179159cfcvboxsync
c2046db2cc346cc299f0cd9b2d1e160179159cfcvboxsync#ifdef DEBUG
c2046db2cc346cc299f0cd9b2d1e160179159cfcvboxsync
c2046db2cc346cc299f0cd9b2d1e160179159cfcvboxsync#define TRACE_ENTRY() \
c2046db2cc346cc299f0cd9b2d1e160179159cfcvboxsyncdo { \
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync vbvxMsg(__PRETTY_FUNCTION__); \
044af0d1e6474076366759db86f101778c5f20ccvboxsync vbvxMsg(": entering\n"); \
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync} while(0)
2d8870843ff566fee9bd3a6a5942414254106479vboxsync#define TRACE_EXIT() \
2d8870843ff566fee9bd3a6a5942414254106479vboxsyncdo { \
2d8870843ff566fee9bd3a6a5942414254106479vboxsync vbvxMsg(__PRETTY_FUNCTION__); \
2d8870843ff566fee9bd3a6a5942414254106479vboxsync vbvxMsg(": leaving\n"); \
2d8870843ff566fee9bd3a6a5942414254106479vboxsync} while(0)
2d8870843ff566fee9bd3a6a5942414254106479vboxsync#define TRACE_LOG(...) \
2d8870843ff566fee9bd3a6a5942414254106479vboxsyncdo { \
2d8870843ff566fee9bd3a6a5942414254106479vboxsync vbvxMsg("%s: ", __PRETTY_FUNCTION__); \
2d8870843ff566fee9bd3a6a5942414254106479vboxsync vbvxMsg(__VA_ARGS__); \
2d8870843ff566fee9bd3a6a5942414254106479vboxsync} while(0)
2d8870843ff566fee9bd3a6a5942414254106479vboxsync# define TRACE_LINE() do \
2d8870843ff566fee9bd3a6a5942414254106479vboxsync{ \
044af0d1e6474076366759db86f101778c5f20ccvboxsync vbvxMsg("%s: line %d\n", __FUNCTION__, __LINE__); \
044af0d1e6474076366759db86f101778c5f20ccvboxsync} while(0)
044af0d1e6474076366759db86f101778c5f20ccvboxsync#else /* !DEBUG */
044af0d1e6474076366759db86f101778c5f20ccvboxsync
044af0d1e6474076366759db86f101778c5f20ccvboxsync#define TRACE_ENTRY() do { } while (0)
044af0d1e6474076366759db86f101778c5f20ccvboxsync#define TRACE_EXIT() do { } while (0)
044af0d1e6474076366759db86f101778c5f20ccvboxsync#define TRACE_LOG(...) do { } while (0)
044af0d1e6474076366759db86f101778c5f20ccvboxsync
044af0d1e6474076366759db86f101778c5f20ccvboxsync#endif /* !DEBUG */
044af0d1e6474076366759db86f101778c5f20ccvboxsync
044af0d1e6474076366759db86f101778c5f20ccvboxsync/* Not just for debug builds. If something is wrong we want to know at once. */
044af0d1e6474076366759db86f101778c5f20ccvboxsync#define VBVXASSERT(expr, out) \
044af0d1e6474076366759db86f101778c5f20ccvboxsyncif (!(expr)) \
044af0d1e6474076366759db86f101778c5f20ccvboxsync{ \
044af0d1e6474076366759db86f101778c5f20ccvboxsync vbvxMsg("\nAssertion failed!\n\n"); \
044af0d1e6474076366759db86f101778c5f20ccvboxsync vbvxMsg("%s\n", #expr); \
044af0d1e6474076366759db86f101778c5f20ccvboxsync vbvxMsg("at %s (%s:%d)\n", RT_GCC_EXTENSION __PRETTY_FUNCTION__, __FILE__, __LINE__); \
044af0d1e6474076366759db86f101778c5f20ccvboxsync vbvxMsg out; \
044af0d1e6474076366759db86f101778c5f20ccvboxsync vbvxAbortServer(); \
044af0d1e6474076366759db86f101778c5f20ccvboxsync}
044af0d1e6474076366759db86f101778c5f20ccvboxsync
044af0d1e6474076366759db86f101778c5f20ccvboxsync#define BOOL_STR(a) ((a) ? "TRUE" : "FALSE")
044af0d1e6474076366759db86f101778c5f20ccvboxsync
044af0d1e6474076366759db86f101778c5f20ccvboxsync#include <VBox/Hardware/VBoxVideoVBE.h>
044af0d1e6474076366759db86f101778c5f20ccvboxsync
044af0d1e6474076366759db86f101778c5f20ccvboxsync#include "xf86str.h"
044af0d1e6474076366759db86f101778c5f20ccvboxsync#include "xf86Cursor.h"
044af0d1e6474076366759db86f101778c5f20ccvboxsync
044af0d1e6474076366759db86f101778c5f20ccvboxsync#define VBOX_VERSION 4000 /* Why? */
044af0d1e6474076366759db86f101778c5f20ccvboxsync#define VBOX_NAME "VBoxVideo"
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync#define VBOX_DRIVER_NAME "vboxvideo"
044af0d1e6474076366759db86f101778c5f20ccvboxsync
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync#ifdef VBOX_DRI_OLD
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync/* DRI support */
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync#define _XF86DRI_SERVER_
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync/* Hack to work around a libdrm header which is broken on Solaris */
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync#define u_int64_t uint64_t
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync/* Get rid of a warning due to a broken header file */
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsyncenum drm_bo_type { DRM_BO_TYPE };
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync#include "dri.h"
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync#undef u_int64_t
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync#include "sarea.h"
044af0d1e6474076366759db86f101778c5f20ccvboxsync#include "GL/glxint.h"
044af0d1e6474076366759db86f101778c5f20ccvboxsync
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync/* For some reason this is not in the header files. */
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsyncextern void GlxSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs,
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync void **configprivs);
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync#endif
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync#define VBOX_VIDEO_MAJOR 1
044af0d1e6474076366759db86f101778c5f20ccvboxsync#define VBOX_VIDEO_MINOR 0
044af0d1e6474076366759db86f101778c5f20ccvboxsync#define VBOX_DRM_DRIVER_NAME "vboxvideo" /* For now, as this driver is basically a stub. */
044af0d1e6474076366759db86f101778c5f20ccvboxsync#define VBOX_DRI_DRIVER_NAME "vboxvideo" /* For starters. */
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync#define VBOX_MAX_DRAWABLES 256 /* At random. */
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync#define VBOX_VIDEO_MIN_SIZE 64
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync#define VBOX_VIDEO_MAX_VIRTUAL (INT16_MAX - 1)
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync#define VBOXPTR(p) ((VBOXPtr)((p)->driverPrivate))
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync/** Helper to work round different ways of getting the root window in different
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync * server versions. */
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync#if defined(XORG_VERSION_CURRENT) && XORG_VERSION_CURRENT < 70000000 \
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync && XORG_VERSION_CURRENT >= 10900000
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync# define ROOT_WINDOW(pScrn) screenInfo.screens[(pScrn)->scrnIndex]->root
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync#else
7d80dfbe5d66fc4c6de6fe109ce96a081496dcd4vboxsync# define ROOT_WINDOW(pScrn) WindowTable[(pScrn)->scrnIndex]
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync#endif
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync/** Structure containing all virtual monitor-specific information. */
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsyncstruct VBoxScreen
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync{
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync /** Position information for each virtual screen for the purposes of
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * sending dirty rectangle information to the right one. */
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync RTRECT2 aScreenLocation;
a1df400bbe9d64aad400442e56eb637019300a5evboxsync /** Is this CRTC enabled or in DPMS off state? */
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync Bool fCrtcEnabled;
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync /** Is this output enabled or in DPMS low power state? */
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync Bool fOutputEnabled;
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync#ifdef VBOXVIDEO_13
a1df400bbe9d64aad400442e56eb637019300a5evboxsync /** The virtual crtcs. */
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync struct _xf86Crtc *paCrtcs;
a1df400bbe9d64aad400442e56eb637019300a5evboxsync /** The virtual outputs, logically not distinct from crtcs. */
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync struct _xf86Output *paOutputs;
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync#endif
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync /** Offsets of VBVA buffers in video RAM */
044af0d1e6474076366759db86f101778c5f20ccvboxsync uint32_t aoffVBVABuffer;
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync /** Context information about the VBVA buffers for each screen */
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync struct VBVABUFFERCONTEXT aVbvaCtx;
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync /** The current preferred resolution for the screen */
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync RTRECTSIZE aPreferredSize;
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync /** The current preferred location for the screen. */
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync RTPOINT aPreferredLocation;
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync /** Has this screen been enabled by the host? */
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync Bool afConnected;
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync /** The last mode hint data read from the X11 property. */
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync int32_t lastModeHintFromProperty;
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync /** Does this screen have a preferred location? */
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync Bool afHaveLocation;
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync};
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsynctypedef struct VBOXRec
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync{
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync EntityInfoPtr pEnt;
044af0d1e6474076366759db86f101778c5f20ccvboxsync#ifdef PCIACCESS
044af0d1e6474076366759db86f101778c5f20ccvboxsync struct pci_device *pciInfo;
044af0d1e6474076366759db86f101778c5f20ccvboxsync#else
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync pciVideoPtr pciInfo;
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync PCITAG pciTag;
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync#endif
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync void *base;
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync /** The amount of VRAM available for use as a framebuffer */
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync unsigned long cbFBMax;
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync /** The size of the framebuffer and the VBVA buffers at the end of it. */
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync unsigned long cbView;
7d80dfbe5d66fc4c6de6fe109ce96a081496dcd4vboxsync /** The current line size in bytes */
7d80dfbe5d66fc4c6de6fe109ce96a081496dcd4vboxsync uint32_t cbLine;
7d80dfbe5d66fc4c6de6fe109ce96a081496dcd4vboxsync /** Whether the pre-X-server mode was a VBE mode */
7d80dfbe5d66fc4c6de6fe109ce96a081496dcd4vboxsync bool fSavedVBEMode;
7d80dfbe5d66fc4c6de6fe109ce96a081496dcd4vboxsync /** Paramters of the saved pre-X-server VBE mode, invalid if there is none
7d80dfbe5d66fc4c6de6fe109ce96a081496dcd4vboxsync */
7d80dfbe5d66fc4c6de6fe109ce96a081496dcd4vboxsync uint16_t cSavedWidth, cSavedHeight, cSavedPitch, cSavedBPP, fSavedFlags;
7d80dfbe5d66fc4c6de6fe109ce96a081496dcd4vboxsync CloseScreenProcPtr CloseScreen;
7d80dfbe5d66fc4c6de6fe109ce96a081496dcd4vboxsync /** Default X server procedure for enabling and disabling framebuffer access */
7d80dfbe5d66fc4c6de6fe109ce96a081496dcd4vboxsync xf86EnableDisableFBAccessProc *EnableDisableFBAccess;
7d80dfbe5d66fc4c6de6fe109ce96a081496dcd4vboxsync OptionInfoPtr Options;
7d80dfbe5d66fc4c6de6fe109ce96a081496dcd4vboxsync /** @todo we never actually free this */
7d80dfbe5d66fc4c6de6fe109ce96a081496dcd4vboxsync xf86CursorInfoPtr pCurs;
7d80dfbe5d66fc4c6de6fe109ce96a081496dcd4vboxsync /** Do we currently want to use the host cursor? */
7d80dfbe5d66fc4c6de6fe109ce96a081496dcd4vboxsync Bool fUseHardwareCursor;
7d80dfbe5d66fc4c6de6fe109ce96a081496dcd4vboxsync /** The last cursor capabilities data read from the X11 property. */
7d80dfbe5d66fc4c6de6fe109ce96a081496dcd4vboxsync int32_t fLastCursorCapabilitiesFromProperty;
7d80dfbe5d66fc4c6de6fe109ce96a081496dcd4vboxsync /** Number of screens attached */
7d80dfbe5d66fc4c6de6fe109ce96a081496dcd4vboxsync uint32_t cScreens;
7d80dfbe5d66fc4c6de6fe109ce96a081496dcd4vboxsync /** Information about each virtual screen. */
7d80dfbe5d66fc4c6de6fe109ce96a081496dcd4vboxsync struct VBoxScreen *pScreens;
7d80dfbe5d66fc4c6de6fe109ce96a081496dcd4vboxsync /** The last requested framebuffer size. */
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync RTRECTSIZE FBSize;
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync /** Can we get mode hint and cursor integration information from HGSMI? */
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync bool fHaveHGSMIModeHints;
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync /** Does the host support the screen blanking flag? */
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync bool fHostHasScreenBlankingFlag;
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync /** Array of structures for receiving mode hints. */
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync VBVAMODEHINT *paVBVAModeHints;
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync#ifdef VBOXVIDEO_13
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync# ifdef RT_OS_LINUX
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync /** Input device file descriptor for getting ACPI hot-plug events. */
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync int fdACPIDevices;
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync /** Input handler handle for ACPI hot-plug listener. */
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync void *hACPIEventHandler;
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync# endif
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync /** Have we read all available HGSMI mode hint data? */
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync bool fHaveReadHGSMIModeHintData;
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync#else
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync /** The original CreateScreenResources procedure which we wrap with our own.
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync */
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync CreateScreenResourcesProcPtr pfnCreateScreenResources;
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync#endif
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync /** HGSMI guest heap context */
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync HGSMIGUESTCOMMANDCONTEXT guestCtx;
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync /** Unrestricted horizontal resolution flag. */
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync Bool fAnyX;
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync#ifdef VBOX_DRI
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync Bool useDRI;
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync#ifdef VBOX_DRI_OLD
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync int cVisualConfigs;
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync __GLXvisualConfig *pVisualConfigs;
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync DRIInfoRec *pDRIInfo;
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync# endif
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync int drmFD;
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync#endif
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync} VBOXRec, *VBOXPtr;
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync/* helpers.c */
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsyncextern void vbvxMsg(const char *pszFormat, ...);
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsyncextern void vbvxMsgV(const char *pszFormat, va_list args);
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsyncextern void vbvxAbortServer(void);
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsyncextern VBOXPtr vbvxGetRec(ScrnInfoPtr pScrn);
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync#define VBOXGetRec vbvxGetRec /* Temporary */
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsyncextern int vbvxGetIntegerPropery(ScrnInfoPtr pScrn, char *pszName, size_t *pcData, int32_t **ppaData);
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsyncextern void vbvxSetIntegerPropery(ScrnInfoPtr pScrn, char *pszName, size_t cData, int32_t *paData, Bool fSendEvent);
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsyncextern void vbvxReprobeCursor(ScrnInfoPtr pScrn);
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync/* setmode.c */
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync/** Structure describing the virtual frame buffer. It starts at the beginning
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * of the video RAM. */
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsyncstruct vbvxFrameBuffer {
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync /** X offset of first screen in frame buffer. */
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync int x0;
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync /** Y offset of first screen in frame buffer. */
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync int y0;
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync /** Frame buffer virtual width. */
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync unsigned cWidth;
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync /** Frame buffer virtual height. */
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync unsigned cHeight;
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync /** Bits per pixel. */
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync unsigned cBPP;
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync};
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsyncextern void vbvxSetMode(ScrnInfoPtr pScrn, unsigned cDisplay, unsigned cWidth, unsigned cHeight, int x, int y, bool fEnabled,
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync bool fConnected, struct vbvxFrameBuffer *pFrameBuffer);
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsyncextern void vbvxClearVRAM(ScrnInfoPtr pScrn, size_t cbOldSize, size_t cbNewSize);
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsyncextern void vbvxSetSolarisMouseRange(int width, int height);
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsyncextern Bool vbox_cursor_init (ScreenPtr pScreen);
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsyncextern void vbox_open (ScrnInfoPtr pScrn, ScreenPtr pScreen, VBOXPtr pVBox);
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsyncextern void vbox_close (ScrnInfoPtr pScrn, VBOXPtr pVBox);
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsyncextern Bool vboxEnableVbva(ScrnInfoPtr pScrn);
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsyncextern void vboxDisableVbva(ScrnInfoPtr pScrn);
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync/* getmode.c */
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsyncextern void vboxAddModes(ScrnInfoPtr pScrn);
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsyncextern void VBoxInitialiseSizeHints(ScrnInfoPtr pScrn);
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsyncextern void VBoxUpdateSizeHints(ScrnInfoPtr pScrn);
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync#ifndef VBOXVIDEO_13
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsyncextern void VBoxSetUpRandR11(ScreenPtr pScreen);
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync#else
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsyncvoid VBoxSetUpLinuxACPI(ScreenPtr pScreen);
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsyncvoid VBoxCleanUpLinuxACPI(ScreenPtr pScreen);
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync#endif
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync/* DRI stuff */
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsyncextern Bool VBOXDRIScreenInit(ScrnInfoPtr pScrn, ScreenPtr pScreen,
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync VBOXPtr pVBox);
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsyncextern Bool VBOXDRIFinishScreenInit(ScreenPtr pScreen);
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsyncextern void VBOXDRIUpdateStride(ScrnInfoPtr pScrn, VBOXPtr pVBox);
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsyncextern void VBOXDRICloseScreen(ScreenPtr pScreen, VBOXPtr pVBox);
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync/* Utilities */
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync/** Calculate the BPP from the screen depth */
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsyncstatic inline uint16_t vboxBPP(ScrnInfoPtr pScrn)
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync{
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync return pScrn->depth == 24 ? 32 : 16;
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync}
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync/** Calculate the scan line length for a display width */
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsyncstatic inline int32_t vboxLineLength(ScrnInfoPtr pScrn, int32_t cDisplayWidth)
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync{
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync uint32_t cbLine = (cDisplayWidth * vboxBPP(pScrn) / 8 + 3) & ~3;
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync return cbLine < INT32_MAX ? cbLine : INT32_MAX;
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync}
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync/** Calculate the display pitch from the scan line length */
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsyncstatic inline int32_t vboxDisplayPitch(ScrnInfoPtr pScrn, int32_t cbLine)
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync{
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync return cbLine * 8 / vboxBPP(pScrn);
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync}
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsyncextern void vboxClearVRAM(ScrnInfoPtr pScrn, int32_t cNewX, int32_t cNewY);
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsyncextern Bool VBOXSetMode(ScrnInfoPtr pScrn, unsigned cDisplay, unsigned cWidth,
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync unsigned cHeight, int x, int y);
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsyncextern Bool VBOXAdjustScreenPixmap(ScrnInfoPtr pScrn, int width, int height);
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync#endif /* _VBOXVIDEO_H_ */
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync