VirtualBox

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

Last change on this file since 31252 was 28800, checked in by vboxsync, 15 years ago

Automated rebranding to Oracle copyright/license strings via filemuncher

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 8.8 KB
Line 
1/** @file
2 *
3 * VirtualBox X11 Additions graphics driver
4 */
5
6/*
7 * Copyright (C) 2006-2007 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#ifdef DEBUG
56
57#define TRACE_ENTRY() \
58do { \
59 xf86Msg(X_INFO, __PRETTY_FUNCTION__); \
60 xf86Msg(X_INFO, ": entering\n"); \
61} while(0)
62#define TRACE_EXIT() \
63do { \
64 xf86Msg(X_INFO, __PRETTY_FUNCTION__); \
65 xf86Msg(X_INFO, ": leaving\n"); \
66} while(0)
67#define TRACE_LOG(...) \
68do { \
69 xf86Msg(X_INFO, __PRETTY_FUNCTION__); \
70 xf86Msg(X_INFO, __VA_ARGS__); \
71} while(0)
72# define TRACE_LINE() do \
73{ \
74 ErrorF ("%s: line %d\n", __FUNCTION__, __LINE__); \
75 } while(0)
76# define XF86ASSERT(expr, out) \
77if (!(expr)) \
78{ \
79 ErrorF ("\nAssertion failed!\n\n"); \
80 ErrorF ("%s\n", #expr); \
81 ErrorF ("at %s (%s:%d)\n", __PRETTY_FUNCTION__, __FILE__, __LINE__); \
82 ErrorF out; \
83 FatalError("Aborting"); \
84}
85#else /* !DEBUG */
86
87#define TRACE_ENTRY() do { } while (0)
88#define TRACE_EXIT() do { } while (0)
89#define TRACE_LOG(...) do { } while (0)
90#define XF86ASSERT(expr, out) do { } while (0)
91
92#endif /* !DEBUG */
93
94#define BOOL_STR(a) ((a) ? "TRUE" : "FALSE")
95
96#include <VBox/VMMDev.h>
97
98/* All drivers should typically include these */
99#include "xf86.h"
100#include "xf86_OSproc.h"
101#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 6
102# include "xf86Resources.h"
103#endif
104
105#ifndef NO_ANSIC
106/* All drivers need this */
107# include "xf86_ansic.h"
108#endif
109
110#include "compiler.h"
111
112#ifndef PCIACCESS
113/* Drivers for PCI hardware need this */
114# include "xf86PciInfo.h"
115/* Drivers that need to access the PCI config space directly need this */
116# include "xf86Pci.h"
117#endif
118
119#include "vgaHW.h"
120
121/* VBE/DDC support */
122#include "vbe.h"
123
124/* ShadowFB support */
125#include "shadowfb.h"
126
127/* VBox video related defines */
128
129#define VBE_DISPI_IOPORT_INDEX 0x01CE
130#define VBE_DISPI_IOPORT_DATA 0x01CF
131#define VBE_DISPI_INDEX_ID 0x0
132#define VBE_DISPI_INDEX_XRES 0x1
133#define VBE_DISPI_INDEX_YRES 0x2
134#define VBE_DISPI_INDEX_BPP 0x3
135#define VBE_DISPI_INDEX_ENABLE 0x4
136#define VBE_DISPI_INDEX_VIRT_WIDTH 0x6
137#define VBE_DISPI_INDEX_VIRT_HEIGHT 0x7
138#define VBE_DISPI_ID2 0xB0C2
139#define VBE_DISPI_DISABLED 0x00
140#define VBE_DISPI_ENABLED 0x01
141#define VBE_DISPI_LFB_ENABLED 0x40
142
143/* Dga definitions */
144#include "dgaproc.h"
145
146#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 6
147# include "xf86RAC.h"
148#endif
149
150#include "fb.h"
151
152#define VBOX_VERSION 4000 /* Why? */
153#include "xf86Cursor.h"
154#define VBOX_NAME "VBoxVideo"
155#define VBOX_DRIVER_NAME "vboxvideo"
156
157#ifdef VBOX_DRI
158/* DRI support */
159#define _XF86DRI_SERVER_
160/* Hack to work around a libdrm header which is broken on Solaris */
161#define u_int64_t uint64_t
162/* Get rid of a warning due to a broken header file */
163enum drm_bo_type { DRM_BO_TYPE };
164#include "dri.h"
165#undef u_int64_t
166#include "sarea.h"
167#include "GL/glxint.h"
168#include "GL/glxtokens.h"
169
170/* For some reason this is not in the header files. */
171extern void GlxSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs,
172 void **configprivs);
173#endif
174
175#define VBOX_VIDEO_MAJOR 1
176#define VBOX_VIDEO_MINOR 0
177#define VBOX_DRM_DRIVER_NAME "vboxvideo" /* For now, as this driver is basically a stub. */
178#define VBOX_DRI_DRIVER_NAME "vboxvideo" /* For starters. */
179#define VBOX_MAX_DRAWABLES 256 /* At random. */
180
181#define VBOXPTR(p) ((VBOXPtr)((p)->driverPrivate))
182
183/*XXX*/
184
185typedef struct _VBOXRec
186{
187 vbeInfoPtr pVbe;
188 EntityInfoPtr pEnt;
189 VbeInfoBlock *vbeInfo;
190#ifdef PCIACCESS
191 struct pci_device *pciInfo;
192 struct pci_device *vmmDevInfo;
193#else
194 pciVideoPtr pciInfo;
195 PCITAG pciTag;
196#endif
197 CARD16 maxBytesPerScanline;
198 unsigned long mapPhys, mapOff, mapSize; /* video memory */
199 void *base, *VGAbase;
200 CARD8 *state, *pstate; /* SVGA state */
201 int statePage, stateSize, stateMode;
202 CARD32 *savedPal;
203 CARD8 *fonts;
204 vgaRegRec vgaRegs; /* Space for saving VGA information */
205 CloseScreenProcPtr CloseScreen;
206 /** Default X server procedure for enabling and disabling framebuffer access */
207 xf86EnableDisableFBAccessProc *EnableDisableFBAccess;
208 /** Is access to the framebuffer currently allowed? */
209 Bool accessEnabled;
210 OptionInfoPtr Options;
211 IOADDRESS ioBase;
212 /** The width of the last resolution set, used to avoid resetting modes */
213 int cLastWidth;
214 /** The height of the last resolution set */
215 int cLastHeight;
216 VMMDevReqMousePointer *reqp;
217 xf86CursorInfoPtr pCurs;
218 size_t pointerHeaderSize;
219 size_t pointerSize;
220 Bool useDevice;
221 Bool forceSWCursor;
222 /** Do we know that the guest can handle absolute co-ordinates? */
223 Bool guestCanAbsolute;
224 /** Are we currently switched to a virtual terminal? If so, it is not
225 * safe to touch the hardware. */
226 Bool vtSwitch;
227 Bool useVbva;
228 int viewportX, viewportY;
229 VMMDevMemory *pVMMDevMemory;
230 VBVAMEMORY *pVbvaMemory;
231#ifdef VBOX_DRI
232 Bool useDRI;
233 int cVisualConfigs;
234 __GLXvisualConfig *pVisualConfigs;
235 DRIInfoRec *pDRIInfo;
236 int drmFD;
237#endif
238} VBOXRec, *VBOXPtr;
239
240extern Bool vbox_init(int scrnIndex, VBOXPtr pVBox);
241extern Bool vbox_cursor_init (ScreenPtr pScreen);
242extern Bool vbox_open (ScrnInfoPtr pScrn, ScreenPtr pScreen, VBOXPtr pVBox);
243extern void vbox_close (ScrnInfoPtr pScrn, VBOXPtr pVBox);
244extern Bool vbox_device_available(VBOXPtr pVBox);
245
246extern Bool vboxEnableVbva(ScrnInfoPtr pScrn);
247extern Bool vboxDisableVbva(ScrnInfoPtr pScrn);
248
249extern Bool vboxEnableGraphicsCap(VBOXPtr pVBox);
250extern Bool vboxDisableGraphicsCap(VBOXPtr pVBox);
251extern Bool vboxGuestIsSeamless(ScrnInfoPtr pScrn);
252
253extern Bool vboxGetDisplayChangeRequest(ScrnInfoPtr pScrn, uint32_t *pcx,
254 uint32_t *pcy, uint32_t *pcBits,
255 uint32_t *piDisplay);
256extern Bool vboxHostLikesVideoMode(ScrnInfoPtr pScrn, uint32_t cx, uint32_t cy, uint32_t cBits);
257extern Bool vboxSaveVideoMode(ScrnInfoPtr pScrn, uint32_t cx, uint32_t cy, uint32_t cBits);
258extern Bool vboxRetrieveVideoMode(ScrnInfoPtr pScrn, uint32_t *pcx, uint32_t *pcy, uint32_t *pcBits);
259extern void vboxGetPreferredMode(ScrnInfoPtr pScrn, uint32_t *pcx,
260 uint32_t *pcy, uint32_t *pcBits);
261extern void vboxWriteHostModes(ScrnInfoPtr pScrn, DisplayModePtr pCurrent);
262extern void vboxAddModes(ScrnInfoPtr pScrn, uint32_t cxInit,
263 uint32_t cyInit);
264
265/* DRI stuff */
266extern Bool VBOXDRIScreenInit(int scrnIndex, ScreenPtr pScreen, VBOXPtr pVBox);
267extern Bool VBOXDRIFinishScreenInit(ScreenPtr pScreen);
268extern void VBOXDRIUpdateStride(ScrnInfoPtr pScrn, VBOXPtr pVBox);
269extern void VBOXDRICloseScreen(ScreenPtr pScreen, VBOXPtr pVBox);
270
271#endif /* _VBOXVIDEO_H_ */
272
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