VirtualBox

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

Last change on this file since 60133 was 60133, checked in by vboxsync, 9 years ago

bugref:8288: Additions/x11: rework VBoxClient video mode hint handling: remove explicit ACPI code and left-over Vbgl calls in the user space graphics driver. We probe for screen changes on every X server wake-up, and the X server wakes up on ACPI events even without our handler.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 9.0 KB
Line 
1/* $Id: vboxvideo.h 60133 2016-03-22 09:47:02Z vboxsync $ */
2/** @file
3 * VirtualBox X11 Additions graphics driver
4 */
5
6/*
7 * Copyright (C) 2006-2013 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 <[email protected]>
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 <VBox/VBoxVideoGuest.h>
56#include <VBox/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 <VBox/Hardware/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#ifndef VBOXVIDEO_13
197 /** Has VBoxClient registered with us for setting video modes? */
198 bool fHaveVBoxClient;
199#endif
200 /** HGSMI guest heap context */
201 HGSMIGUESTCOMMANDCONTEXT guestCtx;
202 /** Unrestricted horizontal resolution flag. */
203 Bool fAnyX;
204} VBOXRec, *VBOXPtr;
205
206/* helpers.c */
207extern void vbvxMsg(const char *pszFormat, ...);
208extern void vbvxMsgV(const char *pszFormat, va_list args);
209extern void vbvxAbortServer(void);
210extern VBOXPtr vbvxGetRec(ScrnInfoPtr pScrn);
211#define VBOXGetRec vbvxGetRec /* Temporary */
212extern int vbvxGetIntegerPropery(ScrnInfoPtr pScrn, char *pszName, size_t *pcData, int32_t **ppaData);
213extern void vbvxSetIntegerPropery(ScrnInfoPtr pScrn, char *pszName, size_t cData, int32_t *paData, Bool fSendEvent);
214extern void vbvxReprobeCursor(ScrnInfoPtr pScrn);
215
216/* setmode.c */
217
218/** Structure describing the virtual frame buffer. It starts at the beginning
219 * of the video RAM. */
220struct vbvxFrameBuffer {
221 /** X offset of first screen in frame buffer. */
222 int x0;
223 /** Y offset of first screen in frame buffer. */
224 int y0;
225 /** Frame buffer virtual width. */
226 unsigned cWidth;
227 /** Frame buffer virtual height. */
228 unsigned cHeight;
229 /** Bits per pixel. */
230 unsigned cBPP;
231};
232
233extern void vbvxClearVRAM(ScrnInfoPtr pScrn, size_t cbOldSize, size_t cbNewSize);
234extern void vbvxSetMode(ScrnInfoPtr pScrn, unsigned cDisplay, unsigned cWidth, unsigned cHeight, int x, int y, bool fEnabled,
235 bool fConnected, struct vbvxFrameBuffer *pFrameBuffer);
236extern void vbvxSetSolarisMouseRange(int width, int height);
237
238/* pointer.h */
239extern Bool vbvxCursorInit(ScreenPtr pScreen);
240extern void vbvxCursorTerm(VBOXPtr pVBox);
241
242/* vbva.c */
243extern void vbvxHandleDirtyRect(ScrnInfoPtr pScrn, int iRects, BoxPtr aRects);
244extern void vbvxSetUpHGSMIHeapInGuest(VBOXPtr pVBox, uint32_t cbVRAM);
245extern Bool vboxEnableVbva(ScrnInfoPtr pScrn);
246extern void vboxDisableVbva(ScrnInfoPtr pScrn);
247
248/* getmode.c */
249extern void vboxAddModes(ScrnInfoPtr pScrn);
250extern void VBoxInitialiseSizeHints(ScrnInfoPtr pScrn);
251extern void vbvxReadSizesAndCursorIntegrationFromProperties(ScrnInfoPtr pScrn, bool *pfNeedUpdate);
252extern void vbvxReadSizesAndCursorIntegrationFromHGSMI(ScrnInfoPtr pScrn, bool *pfNeedUpdate);
253
254#endif /* _VBOXVIDEO_H_ */
255
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