vboxvideo.h revision ef84500df40b6e627171081e8b56cd7358bf7e58
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync * VirtualBox X11 Additions graphics driver
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync * Copyright (C) 2006-2013 Oracle Corporation
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 * This code is based on:
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync * X11 VESA driver
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com)
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 * The above copyright notice and this permission notice shall be included in
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync * all copies or substantial portions of the Software.
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 * 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 * Authors: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.h,v 1.9 2001/05/04 19:05:49 dawes Exp $
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#define TRACE_LOG(...) \
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync# define TRACE_LINE() do \
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync vbvxMsg("%s: line %d\n", __FUNCTION__, __LINE__); \
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#else /* !DEBUG */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#define TRACE_ENTRY() do { } while (0)
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#define TRACE_EXIT() do { } while (0)
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#define TRACE_LOG(...) do { } while (0)
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#endif /* !DEBUG */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync/* Not just for debug builds. If something is wrong we want to know at once. */
87c5113417e917cdf64545d4f8e0a27047cea783vboxsync vbvxMsg("at %s (%s:%d)\n", RT_GCC_EXTENSION __PRETTY_FUNCTION__, __FILE__, __LINE__); \
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync/* DRI support */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync/* Hack to work around a libdrm header which is broken on Solaris */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync/* Get rid of a warning due to a broken header file */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync/* For some reason this is not in the header files. */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsyncextern void GlxSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs,
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/** 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 \
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync# define ROOT_WINDOW(pScrn) screenInfo.screens[(pScrn)->scrnIndex]->root
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync# define ROOT_WINDOW(pScrn) WindowTable[(pScrn)->scrnIndex]
87c5113417e917cdf64545d4f8e0a27047cea783vboxsync/** Structure containing all virtual monitor-specific information. */
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync /** Position information for each virtual screen for the purposes of
476493afbafe452ee52b3b3b2bb77e07e5e56285vboxsync * sending dirty rectangle information to the right one. */
81c6115ff3bb02e166ee8f762d30c4ba5e3db08avboxsync /** Is this CRTC enabled or in DPMS off state? */
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync /** Is this output enabled or in DPMS low power state? */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync /** The virtual crtcs. */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync /** The virtual outputs, logically not distinct from crtcs. */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync /** Offsets of VBVA buffers in video RAM */
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync /** Context information about the VBVA buffers for each screen */
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync /** The current preferred resolution for the screen */
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync /** Has this screen been enabled by the host? */
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync /** The last mode hint data read from the X11 property. */
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsynctypedef struct VBOXRec
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 /** Whether the pre-X-server mode was a VBE mode */
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync /** Paramters of the saved pre-X-server VBE mode, invalid if there is none
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync uint16_t cSavedWidth, cSavedHeight, cSavedPitch, cSavedBPP, fSavedFlags;
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync /** Default X server procedure for enabling and disabling framebuffer access */
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync xf86EnableDisableFBAccessProc *EnableDisableFBAccess;
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync /** @todo we never actually free this */
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync /** Do we currently want to use the host cursor? */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync /** The last cursor capabilities data read from the X11 property. */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync /** Number of screens attached */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync /** Information about each virtual screen. */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync /** The last requested framebuffer size. */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync /** Array of structures for receiving mode hints. */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync /** Input device file descriptor for getting ACPI hot-plug events. */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync /** Input handler handle for ACPI hot-plug listener. */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync /** Have we read all available HGSMI mode hint data? */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync /** The original CreateScreenResources procedure which we wrap with our own.
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync CreateScreenResourcesProcPtr pfnCreateScreenResources;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync /** HGSMI guest heap context */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync /** Unrestricted horizontal resolution flag. */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsyncextern void vbvxMsgV(const char *pszFormat, va_list args);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsyncextern void vbvxAbortServer(void);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsyncextern int vbvxGetIntegerPropery(ScrnInfoPtr pScrn, char *pszName, size_t *pcData, int32_t **ppaData);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsyncextern void vbvxSetSolarisMouseRange(int width, int height);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsyncextern void vbox_open (ScrnInfoPtr pScrn, ScreenPtr pScreen, VBOXPtr pVBox);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsyncextern void vbox_close (ScrnInfoPtr pScrn, VBOXPtr pVBox);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsyncextern void VBoxInitialiseSizeHints(ScrnInfoPtr pScrn);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync/* DRI stuff */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsyncextern Bool VBOXDRIScreenInit(ScrnInfoPtr pScrn, ScreenPtr pScreen,
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsyncextern Bool VBOXDRIFinishScreenInit(ScreenPtr pScreen);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsyncextern void VBOXDRIUpdateStride(ScrnInfoPtr pScrn, VBOXPtr pVBox);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsyncextern void VBOXDRICloseScreen(ScreenPtr pScreen, VBOXPtr pVBox);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync/* Utilities */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync/** Calculate the BPP from the screen depth */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync/** Calculate the scan line length for a display width */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsyncstatic inline int32_t vboxLineLength(ScrnInfoPtr pScrn, int32_t cDisplayWidth)
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync uint32_t cbLine = (cDisplayWidth * vboxBPP(pScrn) / 8 + 3) & ~3;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync/** Calculate the display pitch from the scan line length */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsyncstatic inline int32_t vboxDisplayPitch(ScrnInfoPtr pScrn, int32_t cbLine)
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#endif /* _VBOXVIDEO_H_ */