VirtualBox

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

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

Additions/x11/vboxvideo: vboxvideo part of dynamic resizing for older X.Org Additions

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 8.7 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 <[email protected]>
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
95#endif /* !DEBUG */
96
97#define BOOL_STR(a) ((a) ? "TRUE" : "FALSE")
98
99#include <VBox/VMMDev.h>
100
101/* All drivers should typically include these */
102#include "xf86.h"
103#include "xf86_OSproc.h"
104#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 6
105# include "xf86Resources.h"
106#endif
107
108#ifndef NO_ANSIC
109/* All drivers need this */
110# include "xf86_ansic.h"
111#endif
112
113#include "compiler.h"
114
115#ifndef PCIACCESS
116/* Drivers for PCI hardware need this */
117# include "xf86PciInfo.h"
118/* Drivers that need to access the PCI config space directly need this */
119# include "xf86Pci.h"
120#endif
121
122#include "vgaHW.h"
123
124/* VBE/DDC support */
125#include "vbe.h"
126
127/* ShadowFB support */
128#include "shadowfb.h"
129
130/* VBox video related defines */
131
132#define VBE_DISPI_IOPORT_INDEX 0x01CE
133#define VBE_DISPI_IOPORT_DATA 0x01CF
134#define VBE_DISPI_INDEX_ID 0x0
135#define VBE_DISPI_INDEX_XRES 0x1
136#define VBE_DISPI_INDEX_YRES 0x2
137#define VBE_DISPI_INDEX_BPP 0x3
138#define VBE_DISPI_INDEX_ENABLE 0x4
139#define VBE_DISPI_INDEX_VIRT_WIDTH 0x6
140#define VBE_DISPI_INDEX_VIRT_HEIGHT 0x7
141#define VBE_DISPI_ID2 0xB0C2
142#define VBE_DISPI_DISABLED 0x00
143#define VBE_DISPI_ENABLED 0x01
144#define VBE_DISPI_LFB_ENABLED 0x40
145
146/* Dga definitions */
147#include "dgaproc.h"
148
149#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 6
150# include "xf86RAC.h"
151#endif
152
153#include "fb.h"
154
155#define VBOX_VERSION 4000 /* Why? */
156#include "xf86Cursor.h"
157#define VBOX_NAME "VBoxVideo"
158#define VBOX_DRIVER_NAME "vboxvideo"
159
160#ifdef VBOX_DRI
161/* DRI support */
162#define _XF86DRI_SERVER_
163/* Hack to work around a libdrm header which is broken on Solaris */
164#define u_int64_t uint64_t
165/* Get rid of a warning due to a broken header file */
166enum drm_bo_type { DRM_BO_TYPE };
167#include "dri.h"
168#undef u_int64_t
169#include "sarea.h"
170#include "GL/glxint.h"
171#include "GL/glxtokens.h"
172
173/* For some reason this is not in the header files. */
174extern void GlxSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs,
175 void **configprivs);
176#endif
177
178#define VBOX_VIDEO_MAJOR 1
179#define VBOX_VIDEO_MINOR 0
180#define VBOX_DRM_DRIVER_NAME "vboxvideo" /* For now, as this driver is basically a stub. */
181#define VBOX_DRI_DRIVER_NAME "vboxvideo" /* For starters. */
182#define VBOX_MAX_DRAWABLES 256 /* At random. */
183
184#define VBOXPTR(p) ((VBOXPtr)((p)->driverPrivate))
185
186/*XXX*/
187
188typedef struct _VBOXRec
189{
190 vbeInfoPtr pVbe;
191 EntityInfoPtr pEnt;
192 VbeInfoBlock *vbeInfo;
193#ifdef PCIACCESS
194 struct pci_device *pciInfo;
195 struct pci_device *vmmDevInfo;
196#else
197 pciVideoPtr pciInfo;
198 PCITAG pciTag;
199#endif
200 CARD16 maxBytesPerScanline;
201 unsigned long mapPhys, mapOff, mapSize; /* video memory */
202 void *base, *VGAbase;
203 CARD8 *state, *pstate; /* SVGA state */
204 int statePage, stateSize, stateMode;
205 CARD32 *savedPal;
206 CARD8 *fonts;
207 vgaRegRec vgaRegs; /* Space for saving VGA information */
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 /** The width of the last resolution set, used to avoid resetting modes */
216 int cLastWidth;
217 /** The height of the last resolution set */
218 int cLastHeight;
219 VMMDevReqMousePointer *reqp;
220 xf86CursorInfoPtr pCurs;
221 size_t pointerHeaderSize;
222 size_t pointerSize;
223 Bool useDevice;
224 Bool forceSWCursor;
225 /** Do we know that the guest mouse driver was loaded successfully? */
226 Bool mouseDriverLoaded;
227 /** Are we currently switched to a virtual terminal? If so, it is not
228 * safe to touch the hardware. */
229 Bool vtSwitch;
230 Bool useVbva;
231 int viewportX, viewportY;
232 VMMDevMemory *pVMMDevMemory;
233 VBVAMEMORY *pVbvaMemory;
234#ifdef VBOX_DRI
235 Bool useDRI;
236 int cVisualConfigs;
237 __GLXvisualConfig *pVisualConfigs;
238 DRIInfoRec *pDRIInfo;
239 int drmFD;
240#endif
241} VBOXRec, *VBOXPtr;
242
243extern Bool vbox_init(int scrnIndex, VBOXPtr pVBox);
244extern Bool vbox_cursor_init (ScreenPtr pScreen);
245extern Bool vbox_open (ScrnInfoPtr pScrn, ScreenPtr pScreen, VBOXPtr pVBox);
246extern void vbox_close (ScrnInfoPtr pScrn, VBOXPtr pVBox);
247extern Bool vbox_device_available(VBOXPtr pVBox);
248
249extern Bool vboxEnableVbva(ScrnInfoPtr pScrn);
250extern Bool vboxDisableVbva(ScrnInfoPtr pScrn);
251
252extern Bool vboxEnableGraphicsCap(VBOXPtr pVBox);
253extern Bool vboxDisableGraphicsCap(VBOXPtr pVBox);
254
255extern Bool vboxGetDisplayChangeRequest(ScrnInfoPtr pScrn, uint32_t *pcx,
256 uint32_t *pcy, uint32_t *pcBits,
257 uint32_t *piDisplay);
258
259extern Bool vboxHostLikesVideoMode(ScrnInfoPtr pScrn, uint32_t cx, uint32_t cy, uint32_t cBits);
260extern Bool vboxGuestIsSeamless(ScrnInfoPtr pScrn);
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);
263
264/* DRI stuff */
265extern Bool VBOXDRIScreenInit(int scrnIndex, ScreenPtr pScreen, VBOXPtr pVBox);
266extern Bool VBOXDRIFinishScreenInit(ScreenPtr pScreen);
267extern void VBOXDRIUpdateStride(ScrnInfoPtr pScrn, VBOXPtr pVBox);
268extern void VBOXDRICloseScreen(ScreenPtr pScreen, VBOXPtr pVBox);
269
270#endif /* _VBOXVIDEO_H_ */
271
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