VirtualBox

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

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

Additions/x11/vboxvideo: Replace custom VBVXASSERT with IPRT assertion syntax.
bugref:9017: Additions/x11: put vboxvideo into upstream X.Org

At some point we started using custom assertion code in X.Org vboxvideo.
This change removes that and switches assertions in the code to use IPRT
assertions, albeit provided by our IPRT replacement header and not by IPRT
itself.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 7.9 KB
Line 
1/* $Id: vboxvideo.h 69080 2017-10-13 15:40: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#include <VBoxVideoVBE.h>
57
58#include "xf86.h"
59#include "xf86str.h"
60#include "xf86Cursor.h"
61
62#ifdef DEBUG
63
64#define TRACE_ENTRY() do { xf86ErrorF("%s: entering\n", __func__); } while(0)
65#define TRACE_EXIT() do { xf86ErrorF("%s: leaving\n", __func__); } while(0)
66#define TRACE_LINE() \
67 do { xf86ErrorF("%s: line\n", __func__, __LINE__); } while(0)
68#define TRACE_LOG(...) \
69do { \
70 xf86ErrorF("%s: ", __func__); \
71 xf86ErrorF(__VA_ARGS__); \
72} while(0)
73
74#else /* !DEBUG */
75
76#define TRACE_ENTRY() do { } while (0)
77#define TRACE_EXIT() do { } while (0)
78#define TRACE_LOG(...) do { } while (0)
79
80#endif /* !DEBUG */
81
82#define VBOX_VERSION VBOX_VERSION_MAJOR * 10000 \
83 + VBOX_VERSION_MINOR * 100
84#define VBOX_NAME "VBoxVideo"
85#define VBOX_DRIVER_NAME "vboxvideo"
86
87#define VBOX_VIDEO_MAJOR VBOX_VERSION_MAJOR
88#define VBOX_VIDEO_MINOR VBOX_VERSION_MINOR
89
90#define VBOX_VIDEO_MIN_SIZE 64
91#define VBOX_VIDEO_MAX_VIRTUAL (INT16_MAX - 1)
92
93#define VBOXPTR(p) ((VBOXPtr)((p)->driverPrivate))
94
95/** Helper to work round different ways of getting the root window in different
96 * server versions. */
97#if defined(XORG_VERSION_CURRENT) && XORG_VERSION_CURRENT < 70000000 \
98 && XORG_VERSION_CURRENT >= 10900000
99# define ROOT_WINDOW(pScrn) screenInfo.screens[(pScrn)->scrnIndex]->root
100#else
101# define ROOT_WINDOW(pScrn) WindowTable[(pScrn)->scrnIndex]
102#endif
103
104/** Structure containing all virtual monitor-specific information. */
105struct VBoxScreen
106{
107 /** Position information for each virtual screen for the purposes of
108 * sending dirty rectangle information to the right one. */
109 RTRECT2 aScreenLocation;
110 /** Is this CRTC enabled or in DPMS off state? */
111 Bool fPowerOn;
112#ifdef VBOXVIDEO_13
113 /** The virtual crtcs. */
114 struct _xf86Crtc *paCrtcs;
115 /** The virtual outputs, logically not distinct from crtcs. */
116 struct _xf86Output *paOutputs;
117#endif
118 /** Offsets of VBVA buffers in video RAM */
119 uint32_t aoffVBVABuffer;
120 /** Context information about the VBVA buffers for each screen */
121 struct VBVABUFFERCONTEXT aVbvaCtx;
122 /** The current preferred resolution for the screen */
123 RTRECTSIZE aPreferredSize;
124 /** The current preferred location for the screen. */
125 RTPOINT aPreferredLocation;
126 /** Has this screen been enabled by the host? */
127 Bool afConnected;
128 /** Does this screen have a preferred location? */
129 Bool afHaveLocation;
130};
131
132typedef struct VBOXRec
133{
134 EntityInfoPtr pEnt;
135#ifdef PCIACCESS
136 struct pci_device *pciInfo;
137#else
138 pciVideoPtr pciInfo;
139 PCITAG pciTag;
140#endif
141 void *base;
142 /** The amount of VRAM available for use as a framebuffer */
143 unsigned long cbFBMax;
144 /** The size of the framebuffer and the VBVA buffers at the end of it. */
145 unsigned long cbView;
146 /** Whether the pre-X-server mode was a VBE mode */
147 Bool fSavedVBEMode;
148 /** Paramters of the saved pre-X-server VBE mode, invalid if there is none
149 */
150 uint16_t cSavedWidth, cSavedHeight, cSavedPitch, cSavedBPP, fSavedFlags;
151 CloseScreenProcPtr CloseScreen;
152 /** Default X server procedure for enabling and disabling framebuffer access */
153 xf86EnableDisableFBAccessProc *EnableDisableFBAccess;
154 OptionInfoPtr Options;
155 /** @todo we never actually free this */
156 xf86CursorInfoPtr pCurs;
157 /** Do we currently want to use the host cursor? */
158 Bool fUseHardwareCursor;
159 /** Number of screens attached */
160 uint32_t cScreens;
161 /** Information about each virtual screen. */
162 struct VBoxScreen *pScreens;
163 /** Can we get mode hint and cursor integration information from HGSMI? */
164 Bool fHaveHGSMIModeHints;
165 /** Does the host support the screen blanking flag? */
166 Bool fHostHasScreenBlankingFlag;
167 /** Array of structures for receiving mode hints. */
168 VBVAMODEHINT *paVBVAModeHints;
169#ifdef VBOXVIDEO_13
170# ifdef RT_OS_LINUX
171 /** Input device file descriptor for getting ACPI hot-plug events. */
172 int fdACPIDevices;
173 /** Input handler handle for ACPI hot-plug listener. */
174 void *hACPIEventHandler;
175# endif
176#endif
177 /** HGSMI guest heap context */
178 HGSMIGUESTCOMMANDCONTEXT guestCtx;
179 /** Unrestricted horizontal resolution flag. */
180 Bool fAnyX;
181} VBOXRec, *VBOXPtr;
182
183#define VBOXGetRec(pScrn) ((VBOXPtr)(pScrn)->driverPrivate)
184
185/* setmode.c */
186
187/** Structure describing the virtual frame buffer. It starts at the beginning
188 * of the video RAM. */
189struct vbvxFrameBuffer {
190 /** X offset of first screen in frame buffer. */
191 int x0;
192 /** Y offset of first screen in frame buffer. */
193 int y0;
194 /** Frame buffer virtual width. */
195 unsigned cWidth;
196 /** Frame buffer virtual height. */
197 unsigned cHeight;
198 /** Bits per pixel. */
199 unsigned cBPP;
200};
201
202extern void vbvxClearVRAM(ScrnInfoPtr pScrn, size_t cbOldSize, size_t cbNewSize);
203extern void vbvxSetMode(ScrnInfoPtr pScrn, unsigned cDisplay, unsigned cWidth, unsigned cHeight, int x, int y, Bool fEnabled,
204 Bool fConnected, struct vbvxFrameBuffer *pFrameBuffer);
205extern void vbvxSetSolarisMouseRange(int width, int height);
206
207/* pointer.h */
208extern Bool vbvxCursorInit(ScreenPtr pScreen);
209extern void vbvxCursorTerm(VBOXPtr pVBox);
210
211/* vbva.c */
212extern void vbvxHandleDirtyRect(ScrnInfoPtr pScrn, int iRects, BoxPtr aRects);
213extern void vbvxSetUpHGSMIHeapInGuest(VBOXPtr pVBox, uint32_t cbVRAM);
214extern Bool vboxEnableVbva(ScrnInfoPtr pScrn);
215extern void vboxDisableVbva(ScrnInfoPtr pScrn);
216
217/* getmode.c */
218extern void vboxAddModes(ScrnInfoPtr pScrn);
219extern void VBoxInitialiseSizeHints(ScrnInfoPtr pScrn);
220extern void vbvxReadSizesAndCursorIntegrationFromProperties(ScrnInfoPtr pScrn, Bool *pfNeedUpdate);
221extern void vbvxReadSizesAndCursorIntegrationFromHGSMI(ScrnInfoPtr pScrn, Bool *pfNeedUpdate);
222extern void vbvxSetUpLinuxACPI(ScreenPtr pScreen);
223extern void vbvxCleanUpLinuxACPI(ScreenPtr pScreen);
224
225/* EDID generation */
226#ifdef VBOXVIDEO_13
227extern Bool VBOXEDIDSet(struct _xf86Output *output, DisplayModePtr pmode);
228#endif
229
230#endif /* _VBOXVIDEO_H_ */
231
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