VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/vboxvideo/vboxvideo.h@ 67954

Last change on this file since 67954 was 65381, checked in by vboxsync, 8 years ago

bugref:8282: Additions/linux: submit DRM driver to the Linux kernel: move all graphics device-related header files to a separate sub-directory and add that to the include path where they are needed. The intention is too be able to remove the VBox/ include folder in the DRM driver package.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 9.3 KB
Line 
1/* $Id: vboxvideo.h 65381 2017-01-20 09:23:53Z vboxsync $ */
2/** @file
3 * VirtualBox X11 Additions graphics driver
4 */
5
6/*
7 * Copyright (C) 2006-2016 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 * --------------------------------------------------------------------
17 *
18 * This code is based on:
19 *
20 * X11 VESA driver
21 *
22 * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com)
23 *
24 * Permission is hereby granted, free of charge, to any person obtaining a
25 * copy of this software and associated documentation files (the "Software"),
26 * to deal in the Software without restriction, including without limitation
27 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
28 * and/or sell copies of the Software, and to permit persons to whom the
29 * Software is furnished to do so, subject to the following conditions:
30 *
31 * The above copyright notice and this permission notice shall be included in
32 * all copies or substantial portions of the Software.
33 *
34 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
35 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
36 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
37 * CONECTIVA LINUX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
38 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
39 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
40 * SOFTWARE.
41 *
42 * Except as contained in this notice, the name of Conectiva Linux shall
43 * not be used in advertising or otherwise to promote the sale, use or other
44 * dealings in this Software without prior written authorization from
45 * Conectiva Linux.
46 *
47 * Authors: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
48 *
49 * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.h,v 1.9 2001/05/04 19:05:49 dawes Exp $
50 */
51
52#ifndef _VBOXVIDEO_H_
53#define _VBOXVIDEO_H_
54
55#include <VBoxVideoGuest.h>
56#include <VBoxVideo.h>
57#include "version-generated.h"
58
59#ifndef VBVA_SCREEN_F_BLANK
60# define VBVA_SCREEN_F_BLANK 0x0004
61#endif
62
63#ifdef DEBUG
64
65#define TRACE_ENTRY() \
66do { \
67 vbvxMsg(RT_GCC_EXTENSION __PRETTY_FUNCTION__); \
68 vbvxMsg(": entering\n"); \
69} while(0)
70#define TRACE_EXIT() \
71do { \
72 vbvxMsg(RT_GCC_EXTENSION __PRETTY_FUNCTION__); \
73 vbvxMsg(": leaving\n"); \
74} while(0)
75#define TRACE_LOG(...) \
76do { \
77 vbvxMsg("%s: ", RT_GCC_EXTENSION __PRETTY_FUNCTION__); \
78 vbvxMsg(__VA_ARGS__); \
79} while(0)
80# define TRACE_LINE() do \
81{ \
82 vbvxMsg("%s: line %d\n", __FUNCTION__, __LINE__); \
83} while(0)
84#else /* !DEBUG */
85
86#define TRACE_ENTRY() do { } while (0)
87#define TRACE_EXIT() do { } while (0)
88#define TRACE_LOG(...) do { } while (0)
89
90#endif /* !DEBUG */
91
92/* Not just for debug builds. If something is wrong we want to know at once. */
93#define VBVXASSERT(expr, out) \
94if (!(expr)) \
95{ \
96 vbvxMsg("\nAssertion failed!\n\n"); \
97 vbvxMsg("%s\n", #expr); \
98 vbvxMsg("at %s (%s:%d)\n", RT_GCC_EXTENSION __PRETTY_FUNCTION__, __FILE__, __LINE__); \
99 vbvxMsg out; \
100 vbvxAbortServer(); \
101}
102
103#define BOOL_STR(a) ((a) ? "TRUE" : "FALSE")
104
105#include <VBoxVideoVBE.h>
106
107#include "xf86str.h"
108#include "xf86Cursor.h"
109
110#define VBOX_VERSION VBOX_VERSION_MAJOR * 10000 + VBOX_VERSION_MINOR * 100 + VBOX_VERSION_BUILD
111#define VBOX_NAME "VBoxVideo"
112#define VBOX_DRIVER_NAME "vboxvideo"
113
114#define VBOX_VIDEO_MAJOR VBOX_VERSION_MAJOR
115#define VBOX_VIDEO_MINOR VBOX_VERSION_MINOR
116
117#define VBOX_VIDEO_MIN_SIZE 64
118#define VBOX_VIDEO_MAX_VIRTUAL (INT16_MAX - 1)
119
120#define VBOXPTR(p) ((VBOXPtr)((p)->driverPrivate))
121
122/** Helper to work round different ways of getting the root window in different
123 * server versions. */
124#if defined(XORG_VERSION_CURRENT) && XORG_VERSION_CURRENT < 70000000 \
125 && XORG_VERSION_CURRENT >= 10900000
126# define ROOT_WINDOW(pScrn) screenInfo.screens[(pScrn)->scrnIndex]->root
127#else
128# define ROOT_WINDOW(pScrn) WindowTable[(pScrn)->scrnIndex]
129#endif
130
131/** Structure containing all virtual monitor-specific information. */
132struct VBoxScreen
133{
134 /** Position information for each virtual screen for the purposes of
135 * sending dirty rectangle information to the right one. */
136 RTRECT2 aScreenLocation;
137 /** Is this CRTC enabled or in DPMS off state? */
138 Bool fPowerOn;
139#ifdef VBOXVIDEO_13
140 /** The virtual crtcs. */
141 struct _xf86Crtc *paCrtcs;
142 /** The virtual outputs, logically not distinct from crtcs. */
143 struct _xf86Output *paOutputs;
144#endif
145 /** Offsets of VBVA buffers in video RAM */
146 uint32_t aoffVBVABuffer;
147 /** Context information about the VBVA buffers for each screen */
148 struct VBVABUFFERCONTEXT aVbvaCtx;
149 /** The current preferred resolution for the screen */
150 RTRECTSIZE aPreferredSize;
151 /** The current preferred location for the screen. */
152 RTPOINT aPreferredLocation;
153 /** Has this screen been enabled by the host? */
154 Bool afConnected;
155 /** Does this screen have a preferred location? */
156 Bool afHaveLocation;
157};
158
159typedef struct VBOXRec
160{
161 EntityInfoPtr pEnt;
162#ifdef PCIACCESS
163 struct pci_device *pciInfo;
164#else
165 pciVideoPtr pciInfo;
166 PCITAG pciTag;
167#endif
168 void *base;
169 /** The amount of VRAM available for use as a framebuffer */
170 unsigned long cbFBMax;
171 /** The size of the framebuffer and the VBVA buffers at the end of it. */
172 unsigned long cbView;
173 /** Whether the pre-X-server mode was a VBE mode */
174 bool fSavedVBEMode;
175 /** Paramters of the saved pre-X-server VBE mode, invalid if there is none
176 */
177 uint16_t cSavedWidth, cSavedHeight, cSavedPitch, cSavedBPP, fSavedFlags;
178 CloseScreenProcPtr CloseScreen;
179 /** Default X server procedure for enabling and disabling framebuffer access */
180 xf86EnableDisableFBAccessProc *EnableDisableFBAccess;
181 OptionInfoPtr Options;
182 /** @todo we never actually free this */
183 xf86CursorInfoPtr pCurs;
184 /** Do we currently want to use the host cursor? */
185 Bool fUseHardwareCursor;
186 /** Number of screens attached */
187 uint32_t cScreens;
188 /** Information about each virtual screen. */
189 struct VBoxScreen *pScreens;
190 /** Can we get mode hint and cursor integration information from HGSMI? */
191 bool fHaveHGSMIModeHints;
192 /** Does the host support the screen blanking flag? */
193 bool fHostHasScreenBlankingFlag;
194 /** Array of structures for receiving mode hints. */
195 VBVAMODEHINT *paVBVAModeHints;
196#ifdef VBOXVIDEO_13
197# ifdef RT_OS_LINUX
198 /** Input device file descriptor for getting ACPI hot-plug events. */
199 int fdACPIDevices;
200 /** Input handler handle for ACPI hot-plug listener. */
201 void *hACPIEventHandler;
202# endif
203#endif
204 /** HGSMI guest heap context */
205 HGSMIGUESTCOMMANDCONTEXT guestCtx;
206 /** Unrestricted horizontal resolution flag. */
207 Bool fAnyX;
208} VBOXRec, *VBOXPtr;
209
210/* helpers.c */
211extern void vbvxMsg(const char *pszFormat, ...);
212extern void vbvxMsgV(const char *pszFormat, va_list args);
213extern void vbvxAbortServer(void);
214extern VBOXPtr vbvxGetRec(ScrnInfoPtr pScrn);
215#define VBOXGetRec vbvxGetRec /* Temporary */
216extern int vbvxGetIntegerPropery(ScrnInfoPtr pScrn, char *pszName, size_t *pcData, int32_t **ppaData);
217extern void vbvxSetIntegerPropery(ScrnInfoPtr pScrn, char *pszName, size_t cData, int32_t *paData, Bool fSendEvent);
218extern void vbvxReprobeCursor(ScrnInfoPtr pScrn);
219
220/* setmode.c */
221
222/** Structure describing the virtual frame buffer. It starts at the beginning
223 * of the video RAM. */
224struct vbvxFrameBuffer {
225 /** X offset of first screen in frame buffer. */
226 int x0;
227 /** Y offset of first screen in frame buffer. */
228 int y0;
229 /** Frame buffer virtual width. */
230 unsigned cWidth;
231 /** Frame buffer virtual height. */
232 unsigned cHeight;
233 /** Bits per pixel. */
234 unsigned cBPP;
235};
236
237extern void vbvxClearVRAM(ScrnInfoPtr pScrn, size_t cbOldSize, size_t cbNewSize);
238extern void vbvxSetMode(ScrnInfoPtr pScrn, unsigned cDisplay, unsigned cWidth, unsigned cHeight, int x, int y, bool fEnabled,
239 bool fConnected, struct vbvxFrameBuffer *pFrameBuffer);
240extern void vbvxSetSolarisMouseRange(int width, int height);
241
242/* pointer.h */
243extern Bool vbvxCursorInit(ScreenPtr pScreen);
244extern void vbvxCursorTerm(VBOXPtr pVBox);
245
246/* vbva.c */
247extern void vbvxHandleDirtyRect(ScrnInfoPtr pScrn, int iRects, BoxPtr aRects);
248extern void vbvxSetUpHGSMIHeapInGuest(VBOXPtr pVBox, uint32_t cbVRAM);
249extern Bool vboxEnableVbva(ScrnInfoPtr pScrn);
250extern void vboxDisableVbva(ScrnInfoPtr pScrn);
251
252/* getmode.c */
253extern void vboxAddModes(ScrnInfoPtr pScrn);
254extern void VBoxInitialiseSizeHints(ScrnInfoPtr pScrn);
255extern void vbvxReadSizesAndCursorIntegrationFromProperties(ScrnInfoPtr pScrn, bool *pfNeedUpdate);
256extern void vbvxReadSizesAndCursorIntegrationFromHGSMI(ScrnInfoPtr pScrn, bool *pfNeedUpdate);
257extern void vbvxSetUpLinuxACPI(ScreenPtr pScreen);
258extern void vbvxCleanUpLinuxACPI(ScreenPtr pScreen);
259
260/* EDID generation */
261#ifdef VBOXVIDEO_13
262extern Bool VBOXEDIDSet(struct _xf86Output *output, DisplayModePtr pmode);
263#endif
264
265#endif /* _VBOXVIDEO_H_ */
266
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette