1 | /* $Id: DevVGA.h 34399 2010-11-26 16:30:44Z 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 | uint32_t cMonitors;
|
---|
283 | /** Current refresh timer interval. */
|
---|
284 | uint32_t cMilliesRefreshInterval;
|
---|
285 | /** Refresh timer handle - HC. */
|
---|
286 | PTMTIMERR3 RefreshTimer;
|
---|
287 |
|
---|
288 | /** Bitmap tracking dirty pages. */
|
---|
289 | uint32_t au32DirtyBitmap[VGA_VRAM_MAX / PAGE_SIZE / 32];
|
---|
290 | /** Pointer to vgaGCLFBAccessHandler(). */
|
---|
291 | RTRCPTR RCPtrLFBHandler;
|
---|
292 | /** Pointer to the device instance - RC Ptr. */
|
---|
293 | PPDMDEVINSRC pDevInsRC;
|
---|
294 | /** Pointer to the device instance - R3 Ptr. */
|
---|
295 | PPDMDEVINSR3 pDevInsR3;
|
---|
296 | /** Pointer to the device instance - R0 Ptr. */
|
---|
297 | PPDMDEVINSR0 pDevInsR0;
|
---|
298 |
|
---|
299 | /** The critical section. */
|
---|
300 | PDMCRITSECT lock;
|
---|
301 |
|
---|
302 | /** LUN\#0: The display port base interface. */
|
---|
303 | PDMIBASE IBase;
|
---|
304 | /** LUN\#0: The display port interface. */
|
---|
305 | PDMIDISPLAYPORT IPort;
|
---|
306 | #if defined(VBOX_WITH_HGSMI) && (defined(VBOX_WITH_VIDEOHWACCEL) || defined(VBOX_WITH_CRHGSMI))
|
---|
307 | /** LUN\#0: VBVA callbacks interface */
|
---|
308 | PDMIDISPLAYVBVACALLBACKS IVBVACallbacks;
|
---|
309 | #else
|
---|
310 | # if HC_ARCH_BITS == 32
|
---|
311 | uint32_t Padding3;
|
---|
312 | # endif
|
---|
313 | #endif
|
---|
314 | /** Pointer to base interface of the driver. */
|
---|
315 | R3PTRTYPE(PPDMIBASE) pDrvBase;
|
---|
316 | /** Pointer to display connector interface of the driver. */
|
---|
317 | R3PTRTYPE(PPDMIDISPLAYCONNECTOR) pDrv;
|
---|
318 |
|
---|
319 | /** The PCI device. */
|
---|
320 | PCIDEVICE Dev;
|
---|
321 |
|
---|
322 | STAMPROFILE StatRZMemoryRead;
|
---|
323 | STAMPROFILE StatR3MemoryRead;
|
---|
324 | STAMPROFILE StatRZMemoryWrite;
|
---|
325 | STAMPROFILE StatR3MemoryWrite;
|
---|
326 | STAMCOUNTER StatMapPage; /**< Counts IOMMMIOMapMMIO2Page calls. */
|
---|
327 | STAMCOUNTER StatUpdateDisp; /**< Counts vgaPortUpdateDisplay calls. */
|
---|
328 |
|
---|
329 | /* Keep track of ring 0 latched accesses to the VGA MMIO memory. */
|
---|
330 | uint64_t u64LastLatchedAccess;
|
---|
331 | uint32_t cLatchAccesses;
|
---|
332 | uint16_t uMaskLatchAccess;
|
---|
333 | uint16_t iMask;
|
---|
334 |
|
---|
335 | #ifdef VBE_BYTEWISE_IO
|
---|
336 | /** VBE read/write data/index flags */
|
---|
337 | uint8_t fReadVBEData;
|
---|
338 | uint8_t fWriteVBEData;
|
---|
339 | uint8_t fReadVBEIndex;
|
---|
340 | uint8_t fWriteVBEIndex;
|
---|
341 | /** VBE write data/index one byte buffer */
|
---|
342 | uint8_t cbWriteVBEData;
|
---|
343 | uint8_t cbWriteVBEIndex;
|
---|
344 | # ifdef VBE_NEW_DYN_LIST
|
---|
345 | /** VBE Extra Data write address one byte buffer */
|
---|
346 | uint8_t cbWriteVBEExtraAddress;
|
---|
347 | uint8_t Padding4;
|
---|
348 | # else
|
---|
349 | uint8_t Padding4[2];
|
---|
350 | # endif
|
---|
351 | #endif
|
---|
352 |
|
---|
353 | /** Retrace emulation state */
|
---|
354 | bool fRealRetrace;
|
---|
355 | bool Padding5[HC_ARCH_BITS == 64 ? 7 : 3];
|
---|
356 | vga_retrace_s retrace_state;
|
---|
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 Padding6[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 Padding7[7];
|
---|
396 | /** Palette data. */
|
---|
397 | uint32_t au32LogoPalette[256];
|
---|
398 | /** The VGA BIOS ROM data. */
|
---|
399 | R3PTRTYPE(uint8_t *) pu8VgaBios;
|
---|
400 | /** The size of the VGA BIOS ROM. */
|
---|
401 | uint64_t cbVgaBios;
|
---|
402 | /** The name of the VGA BIOS ROM file. */
|
---|
403 | R3PTRTYPE(char *) pszVgaBiosFile;
|
---|
404 | #endif /* VBOX */
|
---|
405 | #ifdef VBOX_WITH_HGSMI
|
---|
406 | /** Base port in the assigned PCI I/O space. */
|
---|
407 | RTIOPORT IOPortBase;
|
---|
408 | #ifdef VBOX_WITH_WDDM
|
---|
409 | uint8_t Padding8[2];
|
---|
410 | /* specifies guest driver caps, i.e. whether it can handle IRQs from the adapter,
|
---|
411 | * the way it can handle async HGSMI command completion, etc. */
|
---|
412 | uint32_t fGuestCaps;
|
---|
413 | #else
|
---|
414 | uint8_t Padding8[6];
|
---|
415 | #endif
|
---|
416 | #endif /* VBOX_WITH_HGSMI */
|
---|
417 | } VGAState;
|
---|
418 | #ifdef VBOX
|
---|
419 | /** VGA state. */
|
---|
420 | typedef VGAState VGASTATE;
|
---|
421 | /** Pointer to the VGA state. */
|
---|
422 | typedef VGASTATE *PVGASTATE;
|
---|
423 | #endif
|
---|
424 |
|
---|
425 | #ifdef VBE_NEW_DYN_LIST
|
---|
426 | /**
|
---|
427 | * VBE Bios Extra Data structure.
|
---|
428 | * @remark duplicated in vbe.h.
|
---|
429 | */
|
---|
430 | typedef struct VBEHeader
|
---|
431 | {
|
---|
432 | /** Signature (VBEHEADER_MAGIC). */
|
---|
433 | uint16_t u16Signature;
|
---|
434 | /** Data size. */
|
---|
435 | uint16_t cbData;
|
---|
436 | } VBEHeader;
|
---|
437 |
|
---|
438 | /** VBE Extra Data. */
|
---|
439 | typedef VBEHeader VBEHEADER;
|
---|
440 | /** Pointer to the VBE Extra Data. */
|
---|
441 | typedef VBEHEADER *PVBEHEADER;
|
---|
442 |
|
---|
443 | /** The value of the VBEHEADER::u16Signature field.
|
---|
444 | * @remark duplicated in vbe.h. */
|
---|
445 | #define VBEHEADER_MAGIC 0x77CC
|
---|
446 |
|
---|
447 | /** The extra port which is used to read the mode list.
|
---|
448 | * @remark duplicated in vbe.h. */
|
---|
449 | #define VBE_EXTRA_PORT 0x3b6
|
---|
450 |
|
---|
451 | /** The extra port which is used for debug printf.
|
---|
452 | * @remark duplicated in vbe.h. */
|
---|
453 | #define VBE_PRINTF_PORT 0x3b7
|
---|
454 |
|
---|
455 | #endif /* VBE_NEW_DYN_LIST */
|
---|
456 |
|
---|
457 | #if !defined(VBOX) || defined(IN_RING3)
|
---|
458 | static inline int c6_to_8(int v)
|
---|
459 | {
|
---|
460 | int b;
|
---|
461 | v &= 0x3f;
|
---|
462 | b = v & 1;
|
---|
463 | return (v << 2) | (b << 1) | b;
|
---|
464 | }
|
---|
465 | #endif /* !VBOX || IN_RING3 */
|
---|
466 |
|
---|
467 |
|
---|
468 | #ifdef VBOX_WITH_HGSMI
|
---|
469 | int VBVAInit (PVGASTATE pVGAState);
|
---|
470 | void VBVADestroy (PVGASTATE pVGAState);
|
---|
471 | int VBVAUpdateDisplay (PVGASTATE pVGAState);
|
---|
472 | void VBVAReset (PVGASTATE pVGAState);
|
---|
473 |
|
---|
474 | bool VBVAIsEnabled(PVGASTATE pVGAState);
|
---|
475 |
|
---|
476 | /* @return host-guest flags that were set on reset
|
---|
477 | * this allows the caller to make further cleaning when needed,
|
---|
478 | * e.g. reset the IRQ */
|
---|
479 | uint32_t HGSMIReset (PHGSMIINSTANCE pIns);
|
---|
480 |
|
---|
481 | # ifdef VBOX_WITH_VIDEOHWACCEL
|
---|
482 | int vbvaVHWACommandCompleteAsynch(PPDMIDISPLAYVBVACALLBACKS pInterface, PVBOXVHWACMD pCmd);
|
---|
483 | int vbvaVHWAConstruct (PVGASTATE pVGAState);
|
---|
484 | int vbvaVHWAReset (PVGASTATE pVGAState);
|
---|
485 |
|
---|
486 | int vboxVBVASaveStatePrep (PPDMDEVINS pDevIns, PSSMHANDLE pSSM);
|
---|
487 | int vboxVBVASaveStateDone (PPDMDEVINS pDevIns, PSSMHANDLE pSSM);
|
---|
488 | # endif
|
---|
489 |
|
---|
490 | #ifdef VBOX_WITH_HGSMI
|
---|
491 | #define PPDMIDISPLAYVBVACALLBACKS_2_PVGASTATE(_pcb) ( (PVGASTATE)((uint8_t *)(_pcb) - RT_OFFSETOF(VGASTATE, IVBVACallbacks)) )
|
---|
492 | #endif
|
---|
493 |
|
---|
494 | # ifdef VBOX_WITH_CRHGSMI
|
---|
495 | int vboxVDMACrHgsmiCommandCompleteAsync(PPDMIDISPLAYVBVACALLBACKS pInterface, PVBOXVDMACMD_CHROMIUM_CMD pCmd, int rc);
|
---|
496 | int vboxVDMACrHgsmiControlCompleteAsync(PPDMIDISPLAYVBVACALLBACKS pInterface, PVBOXVDMACMD_CHROMIUM_CTL pCmd, int rc);
|
---|
497 | # endif
|
---|
498 |
|
---|
499 | int vboxVBVASaveStateExec (PPDMDEVINS pDevIns, PSSMHANDLE pSSM);
|
---|
500 | int vboxVBVALoadStateExec (PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t u32Version);
|
---|
501 | int vboxVBVALoadStateDone (PPDMDEVINS pDevIns, PSSMHANDLE pSSM);
|
---|
502 |
|
---|
503 | # ifdef VBOX_WITH_VDMA
|
---|
504 | typedef struct VBOXVDMAHOST *PVBOXVDMAHOST;
|
---|
505 | int vboxVDMAConstruct(PVGASTATE pVGAState, uint32_t cPipeElements);
|
---|
506 | int vboxVDMADestruct(PVBOXVDMAHOST pVdma);
|
---|
507 | void vboxVDMAControl(PVBOXVDMAHOST pVdma, PVBOXVDMA_CTL pCmd);
|
---|
508 | void vboxVDMACommand(PVBOXVDMAHOST pVdma, PVBOXVDMACBUF_DR pCmd);
|
---|
509 | int vboxVDMASaveStateExecPrep(struct VBOXVDMAHOST *pVdma, PSSMHANDLE pSSM);
|
---|
510 | int vboxVDMASaveStateExecDone(struct VBOXVDMAHOST *pVdma, PSSMHANDLE pSSM);
|
---|
511 | # endif /* VBOX_WITH_VDMA */
|
---|
512 |
|
---|
513 | #endif /* VBOX_WITH_HGSMI */
|
---|
514 |
|
---|
515 | #ifndef VBOX
|
---|
516 | void vga_common_init(VGAState *s, DisplayState *ds, uint8_t *vga_ram_base,
|
---|
517 | unsigned long vga_ram_offset, int vga_ram_size);
|
---|
518 | uint32_t vga_mem_readb(void *opaque, target_phys_addr_t addr);
|
---|
519 | void vga_mem_writeb(void *opaque, target_phys_addr_t addr, uint32_t val);
|
---|
520 | void vga_invalidate_scanlines(VGAState *s, int y1, int y2);
|
---|
521 |
|
---|
522 | void vga_draw_cursor_line_8(uint8_t *d1, const uint8_t *src1,
|
---|
523 | int poffset, int w,
|
---|
524 | unsigned int color0, unsigned int color1,
|
---|
525 | unsigned int color_xor);
|
---|
526 | void vga_draw_cursor_line_16(uint8_t *d1, const uint8_t *src1,
|
---|
527 | int poffset, int w,
|
---|
528 | unsigned int color0, unsigned int color1,
|
---|
529 | unsigned int color_xor);
|
---|
530 | void vga_draw_cursor_line_32(uint8_t *d1, const uint8_t *src1,
|
---|
531 | int poffset, int w,
|
---|
532 | unsigned int color0, unsigned int color1,
|
---|
533 | unsigned int color_xor);
|
---|
534 |
|
---|
535 | extern const uint8_t sr_mask[8];
|
---|
536 | extern const uint8_t gr_mask[16];
|
---|
537 | #endif /* !VBOX */
|
---|
538 |
|
---|