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