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