VirtualBox

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

Last change on this file since 25240 was 22149, checked in by vboxsync, 15 years ago

Additions/x11/vboxvideo: applied patch by Lubomir Rintel to make vboxvideo build on the X.Org 1.7 pre-release

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