VirtualBox

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

Last change on this file since 27709 was 27596, checked in by vboxsync, 15 years ago

Additions/x11/vboxvideo: cleanup in vboxvideo_70 and recheck video mode list on mouse pointer reloads to give VBoxClient a more discreet way of poking the driver

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 9.0 KB
Line 
1/** @file
2 *
3 * VirtualBox X11 Additions graphics driver
4 */
5
6/*
7 * Copyright (C) 2006-2007 Sun Microsystems, Inc.
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 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
18 * Clara, CA 95054 USA or visit http://www.sun.com if you need
19 * additional information or have any questions.
20 * --------------------------------------------------------------------
21 *
22 * This code is based on:
23 *
24 * X11 VESA driver
25 *
26 * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com)
27 *
28 * Permission is hereby granted, free of charge, to any person obtaining a
29 * copy of this software and associated documentation files (the "Software"),
30 * to deal in the Software without restriction, including without limitation
31 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
32 * and/or sell copies of the Software, and to permit persons to whom the
33 * Software is furnished to do so, subject to the following conditions:
34 *
35 * The above copyright notice and this permission notice shall be included in
36 * all copies or substantial portions of the Software.
37 *
38 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
39 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
40 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
41 * CONECTIVA LINUX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
42 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
43 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
44 * SOFTWARE.
45 *
46 * Except as contained in this notice, the name of Conectiva Linux shall
47 * not be used in advertising or otherwise to promote the sale, use or other
48 * dealings in this Software without prior written authorization from
49 * Conectiva Linux.
50 *
51 * Authors: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
52 *
53 * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.h,v 1.9 2001/05/04 19:05:49 dawes Exp $
54 */
55
56#ifndef _VBOXVIDEO_H_
57#define _VBOXVIDEO_H_
58
59#ifdef DEBUG
60
61#define TRACE_ENTRY() \
62do { \
63 xf86Msg(X_INFO, __PRETTY_FUNCTION__); \
64 xf86Msg(X_INFO, ": entering\n"); \
65} while(0)
66#define TRACE_EXIT() \
67do { \
68 xf86Msg(X_INFO, __PRETTY_FUNCTION__); \
69 xf86Msg(X_INFO, ": leaving\n"); \
70} while(0)
71#define TRACE_LOG(...) \
72do { \
73 xf86Msg(X_INFO, __PRETTY_FUNCTION__); \
74 xf86Msg(X_INFO, __VA_ARGS__); \
75} while(0)
76# define TRACE_LINE() do \
77{ \
78 ErrorF ("%s: line %d\n", __FUNCTION__, __LINE__); \
79 } while(0)
80# define XF86ASSERT(expr, out) \
81if (!(expr)) \
82{ \
83 ErrorF ("\nAssertion failed!\n\n"); \
84 ErrorF ("%s\n", #expr); \
85 ErrorF ("at %s (%s:%d)\n", __PRETTY_FUNCTION__, __FILE__, __LINE__); \
86 ErrorF out; \
87 FatalError("Aborting"); \
88}
89#else /* !DEBUG */
90
91#define TRACE_ENTRY() do { } while (0)
92#define TRACE_EXIT() do { } while (0)
93#define TRACE_LOG(...) do { } while (0)
94#define XF86ASSERT(expr, out) do { } while (0)
95
96#endif /* !DEBUG */
97
98#define BOOL_STR(a) ((a) ? "TRUE" : "FALSE")
99
100#include <VBox/VMMDev.h>
101
102/* All drivers should typically include these */
103#include "xf86.h"
104#include "xf86_OSproc.h"
105#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 6
106# include "xf86Resources.h"
107#endif
108
109#ifndef NO_ANSIC
110/* All drivers need this */
111# include "xf86_ansic.h"
112#endif
113
114#include "compiler.h"
115
116#ifndef PCIACCESS
117/* Drivers for PCI hardware need this */
118# include "xf86PciInfo.h"
119/* Drivers that need to access the PCI config space directly need this */
120# include "xf86Pci.h"
121#endif
122
123#include "vgaHW.h"
124
125/* VBE/DDC support */
126#include "vbe.h"
127
128/* ShadowFB support */
129#include "shadowfb.h"
130
131/* VBox video related defines */
132
133#define VBE_DISPI_IOPORT_INDEX 0x01CE
134#define VBE_DISPI_IOPORT_DATA 0x01CF
135#define VBE_DISPI_INDEX_ID 0x0
136#define VBE_DISPI_INDEX_XRES 0x1
137#define VBE_DISPI_INDEX_YRES 0x2
138#define VBE_DISPI_INDEX_BPP 0x3
139#define VBE_DISPI_INDEX_ENABLE 0x4
140#define VBE_DISPI_INDEX_VIRT_WIDTH 0x6
141#define VBE_DISPI_INDEX_VIRT_HEIGHT 0x7
142#define VBE_DISPI_ID2 0xB0C2
143#define VBE_DISPI_DISABLED 0x00
144#define VBE_DISPI_ENABLED 0x01
145#define VBE_DISPI_LFB_ENABLED 0x40
146
147/* Dga definitions */
148#include "dgaproc.h"
149
150#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 6
151# include "xf86RAC.h"
152#endif
153
154#include "fb.h"
155
156#define VBOX_VERSION 4000 /* Why? */
157#include "xf86Cursor.h"
158#define VBOX_NAME "VBoxVideo"
159#define VBOX_DRIVER_NAME "vboxvideo"
160
161#ifdef VBOX_DRI
162/* DRI support */
163#define _XF86DRI_SERVER_
164/* Hack to work around a libdrm header which is broken on Solaris */
165#define u_int64_t uint64_t
166/* Get rid of a warning due to a broken header file */
167enum drm_bo_type { DRM_BO_TYPE };
168#include "dri.h"
169#undef u_int64_t
170#include "sarea.h"
171#include "GL/glxint.h"
172#include "GL/glxtokens.h"
173
174/* For some reason this is not in the header files. */
175extern void GlxSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs,
176 void **configprivs);
177#endif
178
179#define VBOX_VIDEO_MAJOR 1
180#define VBOX_VIDEO_MINOR 0
181#define VBOX_DRM_DRIVER_NAME "vboxvideo" /* For now, as this driver is basically a stub. */
182#define VBOX_DRI_DRIVER_NAME "vboxvideo" /* For starters. */
183#define VBOX_MAX_DRAWABLES 256 /* At random. */
184
185#define VBOXPTR(p) ((VBOXPtr)((p)->driverPrivate))
186
187/*XXX*/
188
189typedef struct _VBOXRec
190{
191 vbeInfoPtr pVbe;
192 EntityInfoPtr pEnt;
193 VbeInfoBlock *vbeInfo;
194#ifdef PCIACCESS
195 struct pci_device *pciInfo;
196 struct pci_device *vmmDevInfo;
197#else
198 pciVideoPtr pciInfo;
199 PCITAG pciTag;
200#endif
201 CARD16 maxBytesPerScanline;
202 unsigned long mapPhys, mapOff, mapSize; /* video memory */
203 void *base, *VGAbase;
204 CARD8 *state, *pstate; /* SVGA state */
205 int statePage, stateSize, stateMode;
206 CARD32 *savedPal;
207 CARD8 *fonts;
208 vgaRegRec vgaRegs; /* Space for saving VGA information */
209 CloseScreenProcPtr CloseScreen;
210 /** Default X server procedure for enabling and disabling framebuffer access */
211 xf86EnableDisableFBAccessProc *EnableDisableFBAccess;
212 /** Is access to the framebuffer currently allowed? */
213 Bool accessEnabled;
214 OptionInfoPtr Options;
215 IOADDRESS ioBase;
216 /** The width of the last resolution set, used to avoid resetting modes */
217 int cLastWidth;
218 /** The height of the last resolution set */
219 int cLastHeight;
220 VMMDevReqMousePointer *reqp;
221 xf86CursorInfoPtr pCurs;
222 size_t pointerHeaderSize;
223 size_t pointerSize;
224 Bool useDevice;
225 Bool forceSWCursor;
226 /** Do we know that the guest mouse driver was loaded successfully? */
227 Bool mouseDriverLoaded;
228 /** Are we currently switched to a virtual terminal? If so, it is not
229 * safe to touch the hardware. */
230 Bool vtSwitch;
231 Bool useVbva;
232 int viewportX, viewportY;
233 VMMDevMemory *pVMMDevMemory;
234 VBVAMEMORY *pVbvaMemory;
235#ifdef VBOX_DRI
236 Bool useDRI;
237 int cVisualConfigs;
238 __GLXvisualConfig *pVisualConfigs;
239 DRIInfoRec *pDRIInfo;
240 int drmFD;
241#endif
242} VBOXRec, *VBOXPtr;
243
244extern Bool vbox_init(int scrnIndex, VBOXPtr pVBox);
245extern Bool vbox_cursor_init (ScreenPtr pScreen);
246extern Bool vbox_open (ScrnInfoPtr pScrn, ScreenPtr pScreen, VBOXPtr pVBox);
247extern void vbox_close (ScrnInfoPtr pScrn, VBOXPtr pVBox);
248extern Bool vbox_device_available(VBOXPtr pVBox);
249
250extern Bool vboxEnableVbva(ScrnInfoPtr pScrn);
251extern Bool vboxDisableVbva(ScrnInfoPtr pScrn);
252
253extern Bool vboxEnableGraphicsCap(VBOXPtr pVBox);
254extern Bool vboxDisableGraphicsCap(VBOXPtr pVBox);
255extern Bool vboxGuestIsSeamless(ScrnInfoPtr pScrn);
256
257extern Bool vboxGetDisplayChangeRequest(ScrnInfoPtr pScrn, uint32_t *pcx,
258 uint32_t *pcy, uint32_t *pcBits,
259 uint32_t *piDisplay);
260extern Bool vboxHostLikesVideoMode(ScrnInfoPtr pScrn, uint32_t cx, uint32_t cy, uint32_t cBits);
261extern Bool vboxSaveVideoMode(ScrnInfoPtr pScrn, uint32_t cx, uint32_t cy, uint32_t cBits);
262extern Bool vboxRetrieveVideoMode(ScrnInfoPtr pScrn, uint32_t *pcx, uint32_t *pcy, uint32_t *pcBits);
263extern void vboxGetPreferredMode(ScrnInfoPtr pScrn, uint32_t *pcx,
264 uint32_t *pcy, uint32_t *pcBits);
265extern void vboxWriteHostModes(ScrnInfoPtr pScrn, DisplayModePtr pCurrent);
266extern void vboxAddModes(ScrnInfoPtr pScrn, uint32_t cxInit,
267 uint32_t cyInit);
268
269/* DRI stuff */
270extern Bool VBOXDRIScreenInit(int scrnIndex, ScreenPtr pScreen, VBOXPtr pVBox);
271extern Bool VBOXDRIFinishScreenInit(ScreenPtr pScreen);
272extern void VBOXDRIUpdateStride(ScrnInfoPtr pScrn, VBOXPtr pVBox);
273extern void VBOXDRICloseScreen(ScreenPtr pScreen, VBOXPtr pVBox);
274
275#endif /* _VBOXVIDEO_H_ */
276
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