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