VirtualBox

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

Last change on this file since 55723 was 55519, checked in by vboxsync, 10 years ago

Additions/x11/vboxvideo: put something slightly more useful in the version number, though no one seems to be actually using it.

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