VirtualBox

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

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

Additions/x11/vboxvideo: remove dependencies on more VirtualBox headers.
bugref:9017: Additions/x11: put vboxvideo into upstream X.Org

Remove dependencies on product-generated.h, revision-generated.h and
VBox/param.h. Remove dependency on the subversion revision. Hard-code
the PCI Ids in the driver header and hard code the vendor name (used in one
place only) to Oracle Corporation.

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

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