1 | /** @file
|
---|
2 | *
|
---|
3 | * Linux Additions X11 graphics driver
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2007 innotek GmbH
|
---|
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�ar Pereira de Andrade <pcpa@conectiva.com.br>
|
---|
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 | #include <VBox/VBoxGuest.h>
|
---|
56 |
|
---|
57 | /* All drivers should typically include these */
|
---|
58 | #include "xf86.h"
|
---|
59 | #include "xf86_OSproc.h"
|
---|
60 | #include "xf86Resources.h"
|
---|
61 |
|
---|
62 | /* All drivers need this */
|
---|
63 | #include "xf86_ansic.h"
|
---|
64 |
|
---|
65 | #include "compiler.h"
|
---|
66 |
|
---|
67 | /* Drivers for PCI hardware need this */
|
---|
68 | #include "xf86PciInfo.h"
|
---|
69 |
|
---|
70 | #include "vgaHW.h"
|
---|
71 |
|
---|
72 | /* Drivers that need to access the PCI config space directly need this */
|
---|
73 | #include "xf86Pci.h"
|
---|
74 |
|
---|
75 | /* VBE/DDC support */
|
---|
76 | #include "vbe.h"
|
---|
77 | #ifdef XORG_7X
|
---|
78 | #include "vbeModes.h"
|
---|
79 | #endif
|
---|
80 | #include "xf86DDC.h"
|
---|
81 |
|
---|
82 | /* ShadowFB support */
|
---|
83 | #include "shadow.h"
|
---|
84 |
|
---|
85 | #include "shadowfb.h"
|
---|
86 |
|
---|
87 | /* VBox video related defines */
|
---|
88 |
|
---|
89 | #define VBE_DISPI_IOPORT_INDEX 0x01CE
|
---|
90 | #define VBE_DISPI_IOPORT_DATA 0x01CF
|
---|
91 | #define VBE_DISPI_INDEX_ID 0x0
|
---|
92 | #define VBE_DISPI_INDEX_XRES 0x1
|
---|
93 | #define VBE_DISPI_INDEX_YRES 0x2
|
---|
94 | #define VBE_DISPI_INDEX_BPP 0x3
|
---|
95 | #define VBE_DISPI_INDEX_ENABLE 0x4
|
---|
96 | #define VBE_DISPI_INDEX_VIRT_WIDTH 0x6
|
---|
97 | #define VBE_DISPI_INDEX_VIRT_HEIGHT 0x7
|
---|
98 | #define VBE_DISPI_ID2 0xB0C2
|
---|
99 | #define VBE_DISPI_DISABLED 0x00
|
---|
100 | #define VBE_DISPI_ENABLED 0x01
|
---|
101 | #define VBE_DISPI_LFB_ENABLED 0x40
|
---|
102 |
|
---|
103 | /* Int 10 support */
|
---|
104 | #include "xf86int10.h"
|
---|
105 |
|
---|
106 | /* bank switching */
|
---|
107 | #include "mibank.h"
|
---|
108 |
|
---|
109 | /* Dga definitions */
|
---|
110 | #include "dgaproc.h"
|
---|
111 |
|
---|
112 | #include "xf86Resources.h"
|
---|
113 | #include "xf86RAC.h"
|
---|
114 |
|
---|
115 | #include "xf1bpp.h"
|
---|
116 | #include "xf4bpp.h"
|
---|
117 | #include "fb.h"
|
---|
118 | #include "afb.h"
|
---|
119 | #include "mfb.h"
|
---|
120 | #ifndef XORG_7X
|
---|
121 | #include "cfb24_32.h"
|
---|
122 | #endif
|
---|
123 |
|
---|
124 | #define VBOX_VERSION 4000
|
---|
125 | #include "xf86Cursor.h"
|
---|
126 | #define VBOX_NAME "VBoxVideo"
|
---|
127 | #define VBOX_DRIVER_NAME "vboxvideo"
|
---|
128 |
|
---|
129 | /*XXX*/
|
---|
130 |
|
---|
131 | typedef struct _VBOXRec
|
---|
132 | {
|
---|
133 | vbeInfoPtr pVbe;
|
---|
134 | EntityInfoPtr pEnt;
|
---|
135 | VbeInfoBlock *vbeInfo;
|
---|
136 | pciVideoPtr pciInfo;
|
---|
137 | PCITAG pciTag;
|
---|
138 | CARD16 maxBytesPerScanline;
|
---|
139 | #ifdef XORG_7X
|
---|
140 | unsigned long mapPhys, mapOff;
|
---|
141 | int mapSize; /* video memory */
|
---|
142 | #else
|
---|
143 | int mapPhys, mapOff, mapSize; /* video memory */
|
---|
144 | #endif
|
---|
145 | void *base, *VGAbase;
|
---|
146 | CARD8 *state, *pstate; /* SVGA state */
|
---|
147 | int statePage, stateSize, stateMode;
|
---|
148 | CARD32 *savedPal;
|
---|
149 | CARD8 *fonts;
|
---|
150 | /* DGA info */
|
---|
151 | DGAModePtr pDGAMode;
|
---|
152 | int nDGAMode;
|
---|
153 | CloseScreenProcPtr CloseScreen;
|
---|
154 | OptionInfoPtr Options;
|
---|
155 | #ifdef XORG_7X
|
---|
156 | IOADDRESS ioBase;
|
---|
157 | #endif /* XORG_7X defined */
|
---|
158 | #ifndef RT_OS_SOLARIS
|
---|
159 | int vbox_fd;
|
---|
160 | #endif
|
---|
161 | VMMDevReqMousePointer *reqp;
|
---|
162 | xf86CursorInfoPtr pCurs;
|
---|
163 | Bool use_hw_cursor;
|
---|
164 | size_t set_pointer_shape_size;
|
---|
165 | Bool pointer_offscreen;
|
---|
166 | Bool useVbva;
|
---|
167 | VMMDevVideoAccelFlush *reqf;
|
---|
168 | VMMDevVideoAccelEnable *reqe;
|
---|
169 | VMMDevMemory *pVMMDevMemory;
|
---|
170 | VBVAMEMORY *pVbvaMemory;
|
---|
171 | } VBOXRec, *VBOXPtr;
|
---|
172 |
|
---|
173 | #ifndef XORG_7X
|
---|
174 | typedef struct _ModeInfoData {
|
---|
175 | int mode;
|
---|
176 | VbeModeInfoBlock *data;
|
---|
177 | VbeCRTCInfoBlock *block;
|
---|
178 | } ModeInfoData;
|
---|
179 | #endif
|
---|
180 |
|
---|
181 | Bool vbox_cursor_init (ScreenPtr pScreen);
|
---|
182 | Bool vbox_open (ScrnInfoPtr pScrn, ScreenPtr pScreen, VBOXPtr pVBOX);
|
---|
183 | void vbox_close (ScrnInfoPtr pScrn, VBOXPtr pVBOX);
|
---|
184 |
|
---|
185 | /**
|
---|
186 | * Inform VBox that we will supply it with dirty rectangle information.
|
---|
187 | * This function is intended to be called when an X virtual terminal is
|
---|
188 | * re-enabled. The dirty rectangle handler should be installed.
|
---|
189 | *
|
---|
190 | * @returns TRUE for success, FALSE for failure
|
---|
191 | * @param pScreen Pointer to a structure describing the X screen in use
|
---|
192 | */
|
---|
193 | extern Bool
|
---|
194 | vboxEnableVbva(ScrnInfoPtr pScrn);
|
---|
195 |
|
---|
196 | /**
|
---|
197 | * Inform VBox that we will stop supplying it with dirty rectangle
|
---|
198 | * information. This function is intended to be called when an X
|
---|
199 | * virtual terminal is disabled, or the X server is terminated.
|
---|
200 | *
|
---|
201 | * @returns TRUE for success, FALSE for failure
|
---|
202 | * @param pScreen Pointer to a structure describing the X screen in use
|
---|
203 | */
|
---|
204 | extern Bool
|
---|
205 | vboxDisableVbva(ScrnInfoPtr pScrn);
|
---|
206 |
|
---|
207 | #endif /* _VBOXVIDEO_H_ */
|
---|