1 | /* $Id: DevVGA.h 25971 2010-01-22 12:54:19Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * DevVGA - VBox VGA/VESA device, internal header.
|
---|
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 | * QEMU internal VGA defines.
|
---|
25 | *
|
---|
26 | * Copyright (c) 2003-2004 Fabrice Bellard
|
---|
27 | *
|
---|
28 | * Permission is hereby granted, free of charge, to any person obtaining a copy
|
---|
29 | * of this software and associated documentation files (the "Software"), to deal
|
---|
30 | * in the Software without restriction, including without limitation the rights
|
---|
31 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
---|
32 | * copies of the Software, and to permit persons to whom the Software is
|
---|
33 | * 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 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
---|
42 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
---|
43 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
---|
44 | * THE SOFTWARE.
|
---|
45 | */
|
---|
46 |
|
---|
47 | #ifdef VBOX_WITH_HGSMI
|
---|
48 | # include "HGSMI/HGSMIHost.h"
|
---|
49 | #endif /* VBOX_WITH_HGSMI */
|
---|
50 | #include "DevVGASavedState.h"
|
---|
51 |
|
---|
52 | #define MSR_COLOR_EMULATION 0x01
|
---|
53 | #define MSR_PAGE_SELECT 0x20
|
---|
54 |
|
---|
55 | #define ST01_V_RETRACE 0x08
|
---|
56 | #define ST01_DISP_ENABLE 0x01
|
---|
57 |
|
---|
58 | /* bochs VBE support */
|
---|
59 | #define CONFIG_BOCHS_VBE
|
---|
60 |
|
---|
61 | #ifdef VBOX
|
---|
62 | #define VBE_DISPI_MAX_XRES 16384
|
---|
63 | #define VBE_DISPI_MAX_YRES 16384
|
---|
64 | #else
|
---|
65 | #define VBE_DISPI_MAX_XRES 1600
|
---|
66 | #define VBE_DISPI_MAX_YRES 1200
|
---|
67 | #endif
|
---|
68 | #define VBE_DISPI_MAX_BPP 32
|
---|
69 |
|
---|
70 | #define VBE_DISPI_INDEX_ID 0x0
|
---|
71 | #define VBE_DISPI_INDEX_XRES 0x1
|
---|
72 | #define VBE_DISPI_INDEX_YRES 0x2
|
---|
73 | #define VBE_DISPI_INDEX_BPP 0x3
|
---|
74 | #define VBE_DISPI_INDEX_ENABLE 0x4
|
---|
75 | #define VBE_DISPI_INDEX_BANK 0x5
|
---|
76 | #define VBE_DISPI_INDEX_VIRT_WIDTH 0x6
|
---|
77 | #define VBE_DISPI_INDEX_VIRT_HEIGHT 0x7
|
---|
78 | #define VBE_DISPI_INDEX_X_OFFSET 0x8
|
---|
79 | #define VBE_DISPI_INDEX_Y_OFFSET 0x9
|
---|
80 | #define VBE_DISPI_INDEX_VBOX_VIDEO 0xa
|
---|
81 | #define VBE_DISPI_INDEX_NB 0xb
|
---|
82 |
|
---|
83 | #define VBE_DISPI_ID0 0xB0C0
|
---|
84 | #define VBE_DISPI_ID1 0xB0C1
|
---|
85 | #define VBE_DISPI_ID2 0xB0C2
|
---|
86 | #define VBE_DISPI_ID3 0xB0C3
|
---|
87 | #define VBE_DISPI_ID4 0xB0C4
|
---|
88 |
|
---|
89 | #ifdef VBOX
|
---|
90 | /* The VBOX interface id. Indicates support for VBE_DISPI_INDEX_VBOX_VIDEO. */
|
---|
91 | #define VBE_DISPI_ID_VBOX_VIDEO 0xBE00
|
---|
92 | #ifdef VBOX_WITH_HGSMI
|
---|
93 | /* The VBOX interface id. Indicates support for VBVA shared memory interface. */
|
---|
94 | #define VBE_DISPI_ID_HGSMI 0xBE01
|
---|
95 | #endif /* VBOX_WITH_HGSMI */
|
---|
96 | #endif /* VBOX */
|
---|
97 |
|
---|
98 | #define VBE_DISPI_DISABLED 0x00
|
---|
99 | #define VBE_DISPI_ENABLED 0x01
|
---|
100 | #define VBE_DISPI_GETCAPS 0x02
|
---|
101 | #define VBE_DISPI_8BIT_DAC 0x20
|
---|
102 | #define VBE_DISPI_LFB_ENABLED 0x40
|
---|
103 | #define VBE_DISPI_NOCLEARMEM 0x80
|
---|
104 |
|
---|
105 | #define VBE_DISPI_LFB_PHYSICAL_ADDRESS 0xE0000000
|
---|
106 |
|
---|
107 | #ifdef CONFIG_BOCHS_VBE
|
---|
108 |
|
---|
109 | #define VGA_STATE_COMMON_BOCHS_VBE \
|
---|
110 | uint16_t vbe_index; \
|
---|
111 | uint16_t vbe_regs[VBE_DISPI_INDEX_NB]; \
|
---|
112 | uint32_t vbe_start_addr; \
|
---|
113 | uint32_t vbe_line_offset; \
|
---|
114 | uint32_t vbe_bank_max;
|
---|
115 |
|
---|
116 | #else
|
---|
117 |
|
---|
118 | #define VGA_STATE_COMMON_BOCHS_VBE
|
---|
119 |
|
---|
120 | #endif /* !CONFIG_BOCHS_VBE */
|
---|
121 |
|
---|
122 | #define CH_ATTR_SIZE (160 * 100)
|
---|
123 | #define VGA_MAX_HEIGHT VBE_DISPI_MAX_YRES
|
---|
124 |
|
---|
125 | #ifndef VBOX
|
---|
126 | #define VGA_STATE_COMMON \
|
---|
127 | uint8_t *vram_ptr; \
|
---|
128 | unsigned long vram_offset; \
|
---|
129 | unsigned int vram_size; \
|
---|
130 | uint32_t latch; \
|
---|
131 | uint8_t sr_index; \
|
---|
132 | uint8_t sr[256]; \
|
---|
133 | uint8_t gr_index; \
|
---|
134 | uint8_t gr[256]; \
|
---|
135 | uint8_t ar_index; \
|
---|
136 | uint8_t ar[21]; \
|
---|
137 | int ar_flip_flop; \
|
---|
138 | uint8_t cr_index; \
|
---|
139 | uint8_t cr[256]; /* CRT registers */ \
|
---|
140 | uint8_t msr; /* Misc Output Register */ \
|
---|
141 | uint8_t fcr; /* Feature Control Register */ \
|
---|
142 | uint8_t st00; /* status 0 */ \
|
---|
143 | uint8_t st01; /* status 1 */ \
|
---|
144 | uint8_t dac_state; \
|
---|
145 | uint8_t dac_sub_index; \
|
---|
146 | uint8_t dac_read_index; \
|
---|
147 | uint8_t dac_write_index; \
|
---|
148 | uint8_t dac_cache[3]; /* used when writing */ \
|
---|
149 | uint8_t palette[768]; \
|
---|
150 | int32_t bank_offset; \
|
---|
151 | int (*get_bpp)(struct VGAState *s); \
|
---|
152 | void (*get_offsets)(struct VGAState *s, \
|
---|
153 | uint32_t *pline_offset, \
|
---|
154 | uint32_t *pstart_addr, \
|
---|
155 | uint32_t *pline_compare); \
|
---|
156 | void (*get_resolution)(struct VGAState *s, \
|
---|
157 | int *pwidth, \
|
---|
158 | int *pheight); \
|
---|
159 | VGA_STATE_COMMON_BOCHS_VBE \
|
---|
160 | /* display refresh support */ \
|
---|
161 | DisplayState *ds; \
|
---|
162 | uint32_t font_offsets[2]; \
|
---|
163 | int graphic_mode; \
|
---|
164 | uint8_t shift_control; \
|
---|
165 | uint8_t double_scan; \
|
---|
166 | uint32_t line_offset; \
|
---|
167 | uint32_t line_compare; \
|
---|
168 | uint32_t start_addr; \
|
---|
169 | uint32_t plane_updated; \
|
---|
170 | uint8_t last_cw, last_ch; \
|
---|
171 | uint32_t last_width, last_height; /* in chars or pixels */ \
|
---|
172 | uint32_t last_scr_width, last_scr_height; /* in pixels */ \
|
---|
173 | uint8_t cursor_start, cursor_end; \
|
---|
174 | uint32_t cursor_offset; \
|
---|
175 | unsigned int (*rgb_to_pixel)(unsigned int r, \
|
---|
176 | unsigned int g, unsigned b); \
|
---|
177 | /* hardware mouse cursor support */ \
|
---|
178 | uint32_t invalidated_y_table[VGA_MAX_HEIGHT / 32]; \
|
---|
179 | void (*cursor_invalidate)(struct VGAState *s); \
|
---|
180 | void (*cursor_draw_line)(struct VGAState *s, uint8_t *d, int y); \
|
---|
181 | /* tell for each page if it has been updated since the last time */ \
|
---|
182 | uint32_t last_palette[256]; \
|
---|
183 | uint32_t last_ch_attr[CH_ATTR_SIZE]; /* XXX: make it dynamic */
|
---|
184 |
|
---|
185 | #else /* VBOX */
|
---|
186 |
|
---|
187 | struct VGAState;
|
---|
188 | typedef int FNGETBPP(struct VGAState *s);
|
---|
189 | typedef void FNGETOFFSETS(struct VGAState *s, uint32_t *pline_offset, uint32_t *pstart_addr, uint32_t *pline_compare);
|
---|
190 | typedef void FNGETRESOLUTION(struct VGAState *s, int *pwidth, int *pheight);
|
---|
191 | typedef unsigned int FNRGBTOPIXEL(unsigned int r, unsigned int g, unsigned b);
|
---|
192 | typedef void FNCURSORINVALIDATE(struct VGAState *s);
|
---|
193 | typedef void FNCURSORDRAWLINE(struct VGAState *s, uint8_t *d, int y);
|
---|
194 |
|
---|
195 | /* bird: vram_offset have been remove, function pointers declared external,
|
---|
196 | some type changes, and some padding have been added. */
|
---|
197 | #define VGA_STATE_COMMON \
|
---|
198 | R3PTRTYPE(uint8_t *) vram_ptrR3; \
|
---|
199 | uint32_t vram_size; \
|
---|
200 | uint32_t latch; \
|
---|
201 | uint8_t sr_index; \
|
---|
202 | uint8_t sr[256]; \
|
---|
203 | uint8_t gr_index; \
|
---|
204 | uint8_t gr[256]; \
|
---|
205 | uint8_t ar_index; \
|
---|
206 | uint8_t ar[21]; \
|
---|
207 | int32_t ar_flip_flop; \
|
---|
208 | uint8_t cr_index; \
|
---|
209 | uint8_t cr[256]; /* CRT registers */ \
|
---|
210 | uint8_t msr; /* Misc Output Register */ \
|
---|
211 | uint8_t fcr; /* Feature Control Register */ \
|
---|
212 | uint8_t st00; /* status 0 */ \
|
---|
213 | uint8_t st01; /* status 1 */ \
|
---|
214 | uint8_t dac_state; \
|
---|
215 | uint8_t dac_sub_index; \
|
---|
216 | uint8_t dac_read_index; \
|
---|
217 | uint8_t dac_write_index; \
|
---|
218 | uint8_t dac_cache[3]; /* used when writing */ \
|
---|
219 | uint8_t palette[768]; \
|
---|
220 | int32_t bank_offset; \
|
---|
221 | int32_t padding0; \
|
---|
222 | R3PTRTYPE(FNGETBPP *) get_bpp; \
|
---|
223 | R3PTRTYPE(FNGETOFFSETS *) get_offsets; \
|
---|
224 | R3PTRTYPE(FNGETRESOLUTION *) get_resolution; \
|
---|
225 | VGA_STATE_COMMON_BOCHS_VBE \
|
---|
226 | /* display refresh support */ \
|
---|
227 | uint32_t font_offsets[2]; \
|
---|
228 | int32_t graphic_mode; \
|
---|
229 | uint8_t shift_control; \
|
---|
230 | uint8_t double_scan; \
|
---|
231 | uint8_t padding1[2]; \
|
---|
232 | uint32_t line_offset; \
|
---|
233 | uint32_t line_compare; \
|
---|
234 | uint32_t start_addr; \
|
---|
235 | uint32_t plane_updated; \
|
---|
236 | uint8_t last_cw, last_ch, padding2[2]; \
|
---|
237 | uint32_t last_width, last_height; /* in chars or pixels */ \
|
---|
238 | uint32_t last_scr_width, last_scr_height; /* in pixels */ \
|
---|
239 | uint32_t last_bpp; \
|
---|
240 | uint8_t cursor_start, cursor_end, padding3[2]; \
|
---|
241 | uint32_t cursor_offset; \
|
---|
242 | uint32_t padding4; \
|
---|
243 | R3PTRTYPE(FNRGBTOPIXEL *) rgb_to_pixel; \
|
---|
244 | /* hardware mouse cursor support */ \
|
---|
245 | uint32_t invalidated_y_table[VGA_MAX_HEIGHT / 32]; \
|
---|
246 | R3PTRTYPE(FNCURSORINVALIDATE *) cursor_invalidate; \
|
---|
247 | R3PTRTYPE(FNCURSORDRAWLINE *) cursor_draw_line; \
|
---|
248 | /* tell for each page if it has been updated since the last time */ \
|
---|
249 | uint32_t last_palette[256]; \
|
---|
250 | uint32_t last_ch_attr[CH_ATTR_SIZE]; /* XXX: make it dynamic */
|
---|
251 |
|
---|
252 | #endif /* VBOX */
|
---|
253 |
|
---|
254 | typedef struct VGAState {
|
---|
255 | VGA_STATE_COMMON
|
---|
256 | #ifdef VBOX
|
---|
257 | /** end-of-common-state-marker */
|
---|
258 | uint32_t u32Marker;
|
---|
259 | /** The physical address the VRAM was assigned. */
|
---|
260 | RTGCPHYS32 GCPhysVRAM;
|
---|
261 | /** The R0 vram pointer... */
|
---|
262 | R0PTRTYPE(uint8_t *) vram_ptrR0;
|
---|
263 | /** Pointer to the GC vram mapping. */
|
---|
264 | RCPTRTYPE(uint8_t *) vram_ptrRC;
|
---|
265 | /** LFB was updated flag. */
|
---|
266 | bool fLFBUpdated;
|
---|
267 | /** Indicates if the GC extensions are enabled or not. */
|
---|
268 | bool fGCEnabled;
|
---|
269 | /** Indicates if the R0 extensions are enabled or not. */
|
---|
270 | bool fR0Enabled;
|
---|
271 | /** Flag indicating that there are dirty bits. This is used to optimize the handler resetting. */
|
---|
272 | bool fHasDirtyBits;
|
---|
273 | /** Flag indicating that the VGA memory in the 0xa0000-0xbffff region has been remapped to allow direct access. */
|
---|
274 | bool fRemappedVGA;
|
---|
275 | /** Whether to render the guest VRAM to the framebuffer memory. False only for some LFB modes. */
|
---|
276 | bool fRenderVRAM;
|
---|
277 | bool Padding1[2];
|
---|
278 |
|
---|
279 | uint32_t cMonitors;
|
---|
280 |
|
---|
281 | #ifdef VBOX_WITH_HGSMI
|
---|
282 | R3PTRTYPE(PHGSMIINSTANCE) pHGSMI;
|
---|
283 | #endif /* VBOX_WITH_HGSMI */
|
---|
284 |
|
---|
285 | /** Current refresh timer interval. */
|
---|
286 | uint32_t Padding2;
|
---|
287 | uint32_t cMilliesRefreshInterval;
|
---|
288 | /** Refresh timer handle - HC. */
|
---|
289 | PTMTIMERR3 RefreshTimer;
|
---|
290 |
|
---|
291 | /** Bitmap tracking dirty pages. */
|
---|
292 | uint32_t au32DirtyBitmap[VGA_VRAM_MAX / PAGE_SIZE / 32];
|
---|
293 | /** Pointer to vgaGCLFBAccessHandler(). */
|
---|
294 | RTRCPTR RCPtrLFBHandler;
|
---|
295 | /** Pointer to the device instance - RC Ptr. */
|
---|
296 | PPDMDEVINSRC pDevInsRC;
|
---|
297 | /** Pointer to the device instance - R3 Ptr. */
|
---|
298 | PPDMDEVINSR3 pDevInsR3;
|
---|
299 | /** Pointer to the device instance - R0 Ptr. */
|
---|
300 | PPDMDEVINSR0 pDevInsR0;
|
---|
301 |
|
---|
302 | /** The critical section. */
|
---|
303 | PDMCRITSECT lock;
|
---|
304 |
|
---|
305 | /** LUN\#0: The display port base interface. */
|
---|
306 | PDMIBASE Base;
|
---|
307 | /** LUN\#0: The display port interface. */
|
---|
308 | PDMIDISPLAYPORT Port;
|
---|
309 | # if HC_ARCH_BITS == 32
|
---|
310 | uint32_t Padding8;
|
---|
311 | # endif
|
---|
312 | #if defined(VBOX_WITH_HGSMI) && defined(VBOX_WITH_VIDEOHWACCEL)
|
---|
313 | /** LUN\#0: VBVA callbacks interface */
|
---|
314 | PDMIDISPLAYVBVACALLBACKS VBVACallbacks;
|
---|
315 | #else
|
---|
316 | # if HC_ARCH_BITS == 32
|
---|
317 | uint32_t Padding3;
|
---|
318 | # endif
|
---|
319 | #endif
|
---|
320 | /** Pointer to base interface of the driver. */
|
---|
321 | R3PTRTYPE(PPDMIBASE) pDrvBase;
|
---|
322 | /** Pointer to display connector interface of the driver. */
|
---|
323 | R3PTRTYPE(PPDMIDISPLAYCONNECTOR) pDrv;
|
---|
324 |
|
---|
325 | /** The PCI device. */
|
---|
326 | PCIDEVICE Dev;
|
---|
327 |
|
---|
328 | STAMPROFILE StatRZMemoryRead;
|
---|
329 | STAMPROFILE StatR3MemoryRead;
|
---|
330 | STAMPROFILE StatRZMemoryWrite;
|
---|
331 | STAMPROFILE StatR3MemoryWrite;
|
---|
332 | STAMCOUNTER StatMapPage; /**< Counts IOMMMIOMapMMIO2Page calls. */
|
---|
333 |
|
---|
334 | /* Keep track of ring 0 latched accesses to the VGA MMIO memory. */
|
---|
335 | uint64_t u64LastLatchedAccess;
|
---|
336 | uint32_t cLatchAccesses;
|
---|
337 | uint16_t uMaskLatchAccess;
|
---|
338 | uint16_t iMask;
|
---|
339 |
|
---|
340 | #ifdef VBE_BYTEWISE_IO
|
---|
341 | /** VBE read/write data/index flags */
|
---|
342 | uint8_t fReadVBEData;
|
---|
343 | uint8_t fWriteVBEData;
|
---|
344 | uint8_t fReadVBEIndex;
|
---|
345 | uint8_t fWriteVBEIndex;
|
---|
346 | /** VBE write data/index one byte buffer */
|
---|
347 | uint8_t cbWriteVBEData;
|
---|
348 | uint8_t cbWriteVBEIndex;
|
---|
349 | # ifdef VBE_NEW_DYN_LIST
|
---|
350 | /** VBE Extra Data write address one byte buffer */
|
---|
351 | uint8_t cbWriteVBEExtraAddress;
|
---|
352 | uint8_t Padding4;
|
---|
353 | # else
|
---|
354 | uint8_t Padding4[2];
|
---|
355 | # endif
|
---|
356 | #endif
|
---|
357 |
|
---|
358 | #ifdef VBE_NEW_DYN_LIST
|
---|
359 | /** The VBE BIOS extra data. */
|
---|
360 | R3PTRTYPE(uint8_t *) pu8VBEExtraData;
|
---|
361 | /** The size of the VBE BIOS extra data. */
|
---|
362 | uint16_t cbVBEExtraData;
|
---|
363 | /** The VBE BIOS current memory address. */
|
---|
364 | uint16_t u16VBEExtraAddress;
|
---|
365 | uint16_t Padding5[2];
|
---|
366 | #endif
|
---|
367 | /** Current logo data offset. */
|
---|
368 | uint32_t offLogoData;
|
---|
369 | /** The size of the BIOS logo data. */
|
---|
370 | uint32_t cbLogo;
|
---|
371 | /** The BIOS logo data. */
|
---|
372 | R3PTRTYPE(uint8_t *) pu8Logo;
|
---|
373 | /** The name of the logo file. */
|
---|
374 | R3PTRTYPE(char *) pszLogoFile;
|
---|
375 | /** Bitmap image data. */
|
---|
376 | R3PTRTYPE(uint8_t *) pu8LogoBitmap;
|
---|
377 | /** Current logo command. */
|
---|
378 | uint16_t LogoCommand;
|
---|
379 | /** Bitmap width. */
|
---|
380 | uint16_t cxLogo;
|
---|
381 | /** Bitmap height. */
|
---|
382 | uint16_t cyLogo;
|
---|
383 | /** Bitmap planes. */
|
---|
384 | uint16_t cLogoPlanes;
|
---|
385 | /** Bitmap depth. */
|
---|
386 | uint16_t cLogoBits;
|
---|
387 | /** Bitmap compression. */
|
---|
388 | uint16_t LogoCompression;
|
---|
389 | /** Bitmap colors used. */
|
---|
390 | uint16_t cLogoUsedColors;
|
---|
391 | /** Palette size. */
|
---|
392 | uint16_t cLogoPalEntries;
|
---|
393 | /** Clear screen flag. */
|
---|
394 | uint8_t fLogoClearScreen;
|
---|
395 | uint8_t Padding6[7];
|
---|
396 | /** Palette data. */
|
---|
397 | uint32_t au32LogoPalette[256];
|
---|
398 | #endif /* VBOX */
|
---|
399 | #ifdef VBOX_WITH_HGSMI
|
---|
400 | /** Base port in the assigned PCI I/O space. */
|
---|
401 | RTIOPORT IOPortBase;
|
---|
402 | uint8_t Padding7[6];
|
---|
403 | #endif /* VBOX_WITH_HGSMI */
|
---|
404 | } VGAState;
|
---|
405 | #ifdef VBOX
|
---|
406 | /** VGA state. */
|
---|
407 | typedef VGAState VGASTATE;
|
---|
408 | /** Pointer to the VGA state. */
|
---|
409 | typedef VGASTATE *PVGASTATE;
|
---|
410 | #endif
|
---|
411 |
|
---|
412 | #ifdef VBE_NEW_DYN_LIST
|
---|
413 | /**
|
---|
414 | * VBE Bios Extra Data structure.
|
---|
415 | * @remark duplicated in vbe.h.
|
---|
416 | */
|
---|
417 | typedef struct VBEHeader
|
---|
418 | {
|
---|
419 | /** Signature (VBEHEADER_MAGIC). */
|
---|
420 | uint16_t u16Signature;
|
---|
421 | /** Data size. */
|
---|
422 | uint16_t cbData;
|
---|
423 | } VBEHeader;
|
---|
424 |
|
---|
425 | /** VBE Extra Data. */
|
---|
426 | typedef VBEHeader VBEHEADER;
|
---|
427 | /** Pointer to the VBE Extra Data. */
|
---|
428 | typedef VBEHEADER *PVBEHEADER;
|
---|
429 |
|
---|
430 | /** The value of the VBEHEADER::u16Signature field.
|
---|
431 | * @remark duplicated in vbe.h. */
|
---|
432 | #define VBEHEADER_MAGIC 0x77CC
|
---|
433 |
|
---|
434 | /** The extra port which is used to read the mode list.
|
---|
435 | * @remark duplicated in vbe.h. */
|
---|
436 | #define VBE_EXTRA_PORT 0x3b6
|
---|
437 |
|
---|
438 | /** The extra port which is used for debug printf.
|
---|
439 | * @remark duplicated in vbe.h. */
|
---|
440 | #define VBE_PRINTF_PORT 0x3b7
|
---|
441 |
|
---|
442 | #endif /* VBE_NEW_DYN_LIST */
|
---|
443 |
|
---|
444 | #if !defined(VBOX) || defined(IN_RING3)
|
---|
445 | static inline int c6_to_8(int v)
|
---|
446 | {
|
---|
447 | int b;
|
---|
448 | v &= 0x3f;
|
---|
449 | b = v & 1;
|
---|
450 | return (v << 2) | (b << 1) | b;
|
---|
451 | }
|
---|
452 | #endif /* !VBOX || IN_RING3 */
|
---|
453 |
|
---|
454 |
|
---|
455 | #ifdef VBOX_WITH_HGSMI
|
---|
456 | int VBVAInit (PVGASTATE pVGAState);
|
---|
457 | void VBVADestroy (PVGASTATE pVGAState);
|
---|
458 | int VBVAUpdateDisplay (PVGASTATE pVGAState);
|
---|
459 | void VBVAReset (PVGASTATE pVGAState);
|
---|
460 | /* @return host-guest flags that were set on reset
|
---|
461 | * this allows the caller to make further cleaning when needed,
|
---|
462 | * e.g. reset the IRQ */
|
---|
463 | uint32_t HGSMIReset (PHGSMIINSTANCE pIns);
|
---|
464 |
|
---|
465 | # ifdef VBOX_WITH_VIDEOHWACCEL
|
---|
466 | int vbvaVHWACommandCompleteAsynch(PPDMIDISPLAYVBVACALLBACKS pInterface, PVBOXVHWACMD pCmd);
|
---|
467 | int vbvaVHWAConstruct (PVGASTATE pVGAState);
|
---|
468 | int vbvaVHWADisable (PVGASTATE pVGAState);
|
---|
469 | int vbvaVHWAReset (PVGASTATE pVGAState);
|
---|
470 |
|
---|
471 | int vboxVBVASaveStatePrep (PPDMDEVINS pDevIns, PSSMHANDLE pSSM);
|
---|
472 | # endif
|
---|
473 |
|
---|
474 | int vboxVBVASaveStateExec (PPDMDEVINS pDevIns, PSSMHANDLE pSSM);
|
---|
475 | int vboxVBVALoadStateExec (PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t u32Version);
|
---|
476 | int vboxVBVALoadStateDone (PPDMDEVINS pDevIns, PSSMHANDLE pSSM);
|
---|
477 |
|
---|
478 | #endif /* VBOX_WITH_HGSMI */
|
---|
479 |
|
---|
480 | #ifndef VBOX
|
---|
481 | void vga_common_init(VGAState *s, DisplayState *ds, uint8_t *vga_ram_base,
|
---|
482 | unsigned long vga_ram_offset, int vga_ram_size);
|
---|
483 | uint32_t vga_mem_readb(void *opaque, target_phys_addr_t addr);
|
---|
484 | void vga_mem_writeb(void *opaque, target_phys_addr_t addr, uint32_t val);
|
---|
485 | void vga_invalidate_scanlines(VGAState *s, int y1, int y2);
|
---|
486 |
|
---|
487 | void vga_draw_cursor_line_8(uint8_t *d1, const uint8_t *src1,
|
---|
488 | int poffset, int w,
|
---|
489 | unsigned int color0, unsigned int color1,
|
---|
490 | unsigned int color_xor);
|
---|
491 | void vga_draw_cursor_line_16(uint8_t *d1, const uint8_t *src1,
|
---|
492 | int poffset, int w,
|
---|
493 | unsigned int color0, unsigned int color1,
|
---|
494 | unsigned int color_xor);
|
---|
495 | void vga_draw_cursor_line_32(uint8_t *d1, const uint8_t *src1,
|
---|
496 | int poffset, int w,
|
---|
497 | unsigned int color0, unsigned int color1,
|
---|
498 | unsigned int color_xor);
|
---|
499 |
|
---|
500 | extern const uint8_t sr_mask[8];
|
---|
501 | extern const uint8_t gr_mask[16];
|
---|
502 | #endif /* !VBOX */
|
---|
503 |
|
---|