VirtualBox

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

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

Additions/x11/vboxvideo: Several small clean-ups.
bugref:9017: Additions/x11: put vboxvideo into upstream X.Org

This change:

  • Removes a forgotten unneeded dependency.
  • Corrects the usage of quote and angular brackets with X.Org and X11

header files.

  • Removes an out-dated comment.
  • Removes the BOOL_STR macro which was only used in one place.
  • Removes the unneeded initialisation of the guest library, which is no

longer used in the driver at all.

  • 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 69075 2017-10-13 14:17: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#include <VBoxVideoVBE.h>
97
98#include "xf86str.h"
99#include "xf86Cursor.h"
100
101#define VBOX_VERSION VBOX_VERSION_MAJOR * 10000 \
102 + VBOX_VERSION_MINOR * 100
103#define VBOX_NAME "VBoxVideo"
104#define VBOX_DRIVER_NAME "vboxvideo"
105
106#define VBOX_VIDEO_MAJOR VBOX_VERSION_MAJOR
107#define VBOX_VIDEO_MINOR VBOX_VERSION_MINOR
108
109#define VBOX_VIDEO_MIN_SIZE 64
110#define VBOX_VIDEO_MAX_VIRTUAL (INT16_MAX - 1)
111
112#define VBOXPTR(p) ((VBOXPtr)((p)->driverPrivate))
113
114/** Helper to work round different ways of getting the root window in different
115 * server versions. */
116#if defined(XORG_VERSION_CURRENT) && XORG_VERSION_CURRENT < 70000000 \
117 && XORG_VERSION_CURRENT >= 10900000
118# define ROOT_WINDOW(pScrn) screenInfo.screens[(pScrn)->scrnIndex]->root
119#else
120# define ROOT_WINDOW(pScrn) WindowTable[(pScrn)->scrnIndex]
121#endif
122
123/** Structure containing all virtual monitor-specific information. */
124struct VBoxScreen
125{
126 /** Position information for each virtual screen for the purposes of
127 * sending dirty rectangle information to the right one. */
128 RTRECT2 aScreenLocation;
129 /** Is this CRTC enabled or in DPMS off state? */
130 Bool fPowerOn;
131#ifdef VBOXVIDEO_13
132 /** The virtual crtcs. */
133 struct _xf86Crtc *paCrtcs;
134 /** The virtual outputs, logically not distinct from crtcs. */
135 struct _xf86Output *paOutputs;
136#endif
137 /** Offsets of VBVA buffers in video RAM */
138 uint32_t aoffVBVABuffer;
139 /** Context information about the VBVA buffers for each screen */
140 struct VBVABUFFERCONTEXT aVbvaCtx;
141 /** The current preferred resolution for the screen */
142 RTRECTSIZE aPreferredSize;
143 /** The current preferred location for the screen. */
144 RTPOINT aPreferredLocation;
145 /** Has this screen been enabled by the host? */
146 Bool afConnected;
147 /** Does this screen have a preferred location? */
148 Bool afHaveLocation;
149};
150
151typedef struct VBOXRec
152{
153 EntityInfoPtr pEnt;
154#ifdef PCIACCESS
155 struct pci_device *pciInfo;
156#else
157 pciVideoPtr pciInfo;
158 PCITAG pciTag;
159#endif
160 void *base;
161 /** The amount of VRAM available for use as a framebuffer */
162 unsigned long cbFBMax;
163 /** The size of the framebuffer and the VBVA buffers at the end of it. */
164 unsigned long cbView;
165 /** Whether the pre-X-server mode was a VBE mode */
166 Bool fSavedVBEMode;
167 /** Paramters of the saved pre-X-server VBE mode, invalid if there is none
168 */
169 uint16_t cSavedWidth, cSavedHeight, cSavedPitch, cSavedBPP, fSavedFlags;
170 CloseScreenProcPtr CloseScreen;
171 /** Default X server procedure for enabling and disabling framebuffer access */
172 xf86EnableDisableFBAccessProc *EnableDisableFBAccess;
173 OptionInfoPtr Options;
174 /** @todo we never actually free this */
175 xf86CursorInfoPtr pCurs;
176 /** Do we currently want to use the host cursor? */
177 Bool fUseHardwareCursor;
178 /** Number of screens attached */
179 uint32_t cScreens;
180 /** Information about each virtual screen. */
181 struct VBoxScreen *pScreens;
182 /** Can we get mode hint and cursor integration information from HGSMI? */
183 Bool fHaveHGSMIModeHints;
184 /** Does the host support the screen blanking flag? */
185 Bool fHostHasScreenBlankingFlag;
186 /** Array of structures for receiving mode hints. */
187 VBVAMODEHINT *paVBVAModeHints;
188#ifdef VBOXVIDEO_13
189# ifdef RT_OS_LINUX
190 /** Input device file descriptor for getting ACPI hot-plug events. */
191 int fdACPIDevices;
192 /** Input handler handle for ACPI hot-plug listener. */
193 void *hACPIEventHandler;
194# endif
195#endif
196 /** HGSMI guest heap context */
197 HGSMIGUESTCOMMANDCONTEXT guestCtx;
198 /** Unrestricted horizontal resolution flag. */
199 Bool fAnyX;
200} VBOXRec, *VBOXPtr;
201
202/* helpers.c */
203extern void vbvxMsg(const char *pszFormat, ...);
204extern void vbvxMsgV(const char *pszFormat, va_list args);
205extern void vbvxAbortServer(void);
206extern VBOXPtr vbvxGetRec(ScrnInfoPtr pScrn);
207#define VBOXGetRec vbvxGetRec /* Temporary */
208extern int vbvxGetIntegerPropery(ScrnInfoPtr pScrn, char *pszName, size_t *pcData, int32_t **ppaData);
209extern void vbvxSetIntegerPropery(ScrnInfoPtr pScrn, char *pszName, size_t cData, int32_t *paData, Bool fSendEvent);
210extern void vbvxReprobeCursor(ScrnInfoPtr pScrn);
211
212/* setmode.c */
213
214/** Structure describing the virtual frame buffer. It starts at the beginning
215 * of the video RAM. */
216struct vbvxFrameBuffer {
217 /** X offset of first screen in frame buffer. */
218 int x0;
219 /** Y offset of first screen in frame buffer. */
220 int y0;
221 /** Frame buffer virtual width. */
222 unsigned cWidth;
223 /** Frame buffer virtual height. */
224 unsigned cHeight;
225 /** Bits per pixel. */
226 unsigned cBPP;
227};
228
229extern void vbvxClearVRAM(ScrnInfoPtr pScrn, size_t cbOldSize, size_t cbNewSize);
230extern void vbvxSetMode(ScrnInfoPtr pScrn, unsigned cDisplay, unsigned cWidth, unsigned cHeight, int x, int y, Bool fEnabled,
231 Bool fConnected, struct vbvxFrameBuffer *pFrameBuffer);
232extern void vbvxSetSolarisMouseRange(int width, int height);
233
234/* pointer.h */
235extern Bool vbvxCursorInit(ScreenPtr pScreen);
236extern void vbvxCursorTerm(VBOXPtr pVBox);
237
238/* vbva.c */
239extern void vbvxHandleDirtyRect(ScrnInfoPtr pScrn, int iRects, BoxPtr aRects);
240extern void vbvxSetUpHGSMIHeapInGuest(VBOXPtr pVBox, uint32_t cbVRAM);
241extern Bool vboxEnableVbva(ScrnInfoPtr pScrn);
242extern void vboxDisableVbva(ScrnInfoPtr pScrn);
243
244/* getmode.c */
245extern void vboxAddModes(ScrnInfoPtr pScrn);
246extern void VBoxInitialiseSizeHints(ScrnInfoPtr pScrn);
247extern void vbvxReadSizesAndCursorIntegrationFromProperties(ScrnInfoPtr pScrn, Bool *pfNeedUpdate);
248extern void vbvxReadSizesAndCursorIntegrationFromHGSMI(ScrnInfoPtr pScrn, Bool *pfNeedUpdate);
249extern void vbvxSetUpLinuxACPI(ScreenPtr pScreen);
250extern void vbvxCleanUpLinuxACPI(ScreenPtr pScreen);
251
252/* EDID generation */
253#ifdef VBOXVIDEO_13
254extern Bool VBOXEDIDSet(struct _xf86Output *output, DisplayModePtr pmode);
255#endif
256
257#endif /* _VBOXVIDEO_H_ */
258
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