VirtualBox

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

Last change on this file since 34400 was 34400, checked in by vboxsync, 14 years ago

Additions/x11/vboxvideo: revert harmless but unintended overcommit

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 8.1 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/Hardware/VBoxVideoVBE.h>
97#include <VBox/VMMDev.h>
98
99/* All drivers should typically include these */
100#include "xf86.h"
101#include "xf86_OSproc.h"
102#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 6
103# include "xf86Resources.h"
104#endif
105
106#ifndef NO_ANSIC
107/* All drivers need this */
108# include "xf86_ansic.h"
109#endif
110
111#include "compiler.h"
112
113#ifndef PCIACCESS
114/* Drivers for PCI hardware need this */
115# include "xf86PciInfo.h"
116/* Drivers that need to access the PCI config space directly need this */
117# include "xf86Pci.h"
118#endif
119
120#include "vgaHW.h"
121
122/* VBE/DDC support */
123#include "vbe.h"
124
125/* ShadowFB support */
126#include "shadowfb.h"
127
128/* Dga definitions */
129#include "dgaproc.h"
130
131#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 6
132# include "xf86RAC.h"
133#endif
134
135#include "fb.h"
136
137#define VBOX_VERSION 4000 /* Why? */
138#include "xf86Cursor.h"
139#define VBOX_NAME "VBoxVideo"
140#define VBOX_DRIVER_NAME "vboxvideo"
141
142#ifdef VBOX_DRI
143/* DRI support */
144#define _XF86DRI_SERVER_
145/* Hack to work around a libdrm header which is broken on Solaris */
146#define u_int64_t uint64_t
147/* Get rid of a warning due to a broken header file */
148enum drm_bo_type { DRM_BO_TYPE };
149#include "dri.h"
150#undef u_int64_t
151#include "sarea.h"
152#include "GL/glxint.h"
153#include "GL/glxtokens.h"
154
155/* For some reason this is not in the header files. */
156extern void GlxSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs,
157 void **configprivs);
158#endif
159
160#define VBOX_VIDEO_MAJOR 1
161#define VBOX_VIDEO_MINOR 0
162#define VBOX_DRM_DRIVER_NAME "vboxvideo" /* For now, as this driver is basically a stub. */
163#define VBOX_DRI_DRIVER_NAME "vboxvideo" /* For starters. */
164#define VBOX_MAX_DRAWABLES 256 /* At random. */
165
166#define VBOXPTR(p) ((VBOXPtr)((p)->driverPrivate))
167
168/*XXX*/
169
170typedef struct _VBOXRec
171{
172 vbeInfoPtr pVbe; /** @todo do the VBE bits ourselves? */
173 EntityInfoPtr pEnt;
174#ifdef PCIACCESS
175 struct pci_device *pciInfo;
176 struct pci_device *vmmDevInfo;
177#else
178 pciVideoPtr pciInfo;
179 PCITAG pciTag;
180#endif
181 unsigned long mapSize; /* video memory */
182 void *base;
183 CARD8 *state, *pstate; /* SVGA state */
184 int statePage, stateSize, stateMode;
185 CARD32 *savedPal;
186 CARD8 *fonts;
187 vgaRegRec vgaRegs; /* Space for saving VGA information */
188 CloseScreenProcPtr CloseScreen;
189 /** Default X server procedure for enabling and disabling framebuffer access */
190 xf86EnableDisableFBAccessProc *EnableDisableFBAccess;
191 /** Is access to the framebuffer currently allowed? */
192 Bool accessEnabled;
193 OptionInfoPtr Options;
194 /** @todo we never actually free this */
195 xf86CursorInfoPtr pCurs;
196 Bool useDevice;
197 Bool forceSWCursor;
198 /** Do we know that the guest can handle absolute co-ordinates? */
199 Bool guestCanAbsolute;
200 /** Are we currently switched to a virtual terminal? If so, it is not
201 * safe to touch the hardware. */
202 Bool vtSwitch;
203 Bool useVbva;
204 int viewportX, viewportY;
205 VMMDevMemory *pVMMDevMemory;
206 VBVAMEMORY *pVbvaMemory;
207 Bool fAnyX; /* Unrestricted horizontal resolution flag. */
208#ifdef VBOX_DRI
209 Bool useDRI;
210 int cVisualConfigs;
211 __GLXvisualConfig *pVisualConfigs;
212 DRIInfoRec *pDRIInfo;
213 int drmFD;
214#endif
215} VBOXRec, *VBOXPtr;
216
217extern Bool vbox_init(int scrnIndex, VBOXPtr pVBox);
218extern Bool vbox_cursor_init (ScreenPtr pScreen);
219extern Bool vbox_open (ScrnInfoPtr pScrn, ScreenPtr pScreen, VBOXPtr pVBox);
220extern void vbox_close (ScrnInfoPtr pScrn, VBOXPtr pVBox);
221extern Bool vbox_device_available(VBOXPtr pVBox);
222
223extern Bool vboxEnableVbva(ScrnInfoPtr pScrn);
224extern Bool vboxDisableVbva(ScrnInfoPtr pScrn);
225
226extern Bool vboxEnableGraphicsCap(VBOXPtr pVBox);
227extern Bool vboxDisableGraphicsCap(VBOXPtr pVBox);
228extern Bool vboxGuestIsSeamless(ScrnInfoPtr pScrn);
229
230extern Bool vboxGetDisplayChangeRequest(ScrnInfoPtr pScrn, uint32_t *pcx,
231 uint32_t *pcy, uint32_t *pcBits,
232 uint32_t *piDisplay);
233extern Bool vboxHostLikesVideoMode(ScrnInfoPtr pScrn, uint32_t cx, uint32_t cy, uint32_t cBits);
234extern Bool vboxSaveVideoMode(ScrnInfoPtr pScrn, uint32_t cx, uint32_t cy, uint32_t cBits);
235extern Bool vboxRetrieveVideoMode(ScrnInfoPtr pScrn, uint32_t *pcx, uint32_t *pcy, uint32_t *pcBits);
236extern void vboxGetPreferredMode(ScrnInfoPtr pScrn, uint32_t *pcx,
237 uint32_t *pcy, uint32_t *pcBits);
238extern void vboxWriteHostModes(ScrnInfoPtr pScrn, DisplayModePtr pCurrent);
239extern void vboxAddModes(ScrnInfoPtr pScrn, uint32_t cxInit,
240 uint32_t cyInit);
241
242/* DRI stuff */
243extern Bool VBOXDRIScreenInit(int scrnIndex, ScreenPtr pScreen, VBOXPtr pVBox);
244extern Bool VBOXDRIFinishScreenInit(ScreenPtr pScreen);
245extern void VBOXDRIUpdateStride(ScrnInfoPtr pScrn, VBOXPtr pVBox);
246extern void VBOXDRICloseScreen(ScreenPtr pScreen, VBOXPtr pVBox);
247
248#endif /* _VBOXVIDEO_H_ */
249
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