VirtualBox

source: vbox/trunk/src/VBox/Devices/Graphics/DevVGA.h@ 69047

Last change on this file since 69047 was 69047, checked in by vboxsync, 7 years ago

DevVGA+VGABIOS: eliminate defines (VBE_NEW_DYN_LIST and VRAM_SIZE_FIX) which are always there, since the other path is long obsolete

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 26.3 KB
Line 
1/* $Id: DevVGA.h 69047 2017-10-11 16:24:38Z vboxsync $ */
2/** @file
3 * DevVGA - VBox VGA/VESA device, internal header.
4 */
5
6/*
7 * Copyright (C) 2006-2016 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#ifdef VBOX
47/** The default amount of VRAM. */
48# define VGA_VRAM_DEFAULT (_4M)
49/** The maximum amount of VRAM. Limited by VBOX_MAX_ALLOC_PAGE_COUNT. */
50# define VGA_VRAM_MAX (256 * _1M)
51/** The minimum amount of VRAM. */
52# define VGA_VRAM_MIN (_1M)
53#endif
54
55#include <VBoxVideoVBE.h>
56
57#ifdef VBOX_WITH_HGSMI
58# include "HGSMI/HGSMIHost.h"
59#endif /* VBOX_WITH_HGSMI */
60#include "DevVGASavedState.h"
61
62#ifdef VBOX_WITH_VMSVGA
63# include "DevVGA-SVGA.h"
64#endif
65
66#include <iprt/list.h>
67
68#define MSR_COLOR_EMULATION 0x01
69#define MSR_PAGE_SELECT 0x20
70
71#define ST01_V_RETRACE 0x08
72#define ST01_DISP_ENABLE 0x01
73
74/* bochs VBE support */
75#define CONFIG_BOCHS_VBE
76
77#ifdef CONFIG_BOCHS_VBE
78
79/* Cross reference with <VBoxVideoVBE.h> */
80#define VBE_DISPI_INDEX_NB_SAVED 0xb /* Number of saved registers (vbe_regs array) */
81#define VBE_DISPI_INDEX_NB 0xc /* Total number of VBE registers */
82
83#define VGA_STATE_COMMON_BOCHS_VBE \
84 uint16_t vbe_index; \
85 uint16_t vbe_regs[VBE_DISPI_INDEX_NB]; \
86 uint16_t alignment[3]; /* pad to 64 bits */ \
87 uint32_t vbe_start_addr; \
88 uint32_t vbe_line_offset; \
89 uint32_t vbe_bank_max;
90
91#else
92
93#define VGA_STATE_COMMON_BOCHS_VBE
94
95#endif /* !CONFIG_BOCHS_VBE */
96
97#define CH_ATTR_SIZE (160 * 100)
98#define VGA_MAX_HEIGHT VBE_DISPI_MAX_YRES
99
100typedef struct vga_retrace_s {
101 unsigned frame_cclks; /* Character clocks per frame. */
102 unsigned frame_ns; /* Frame duration in ns. */
103 unsigned cclk_ns; /* Character clock duration in ns. */
104 unsigned vb_start; /* Vertical blanking start (scanline). */
105 unsigned vb_end; /* Vertical blanking end (scanline). */
106 unsigned vb_end_ns; /* Vertical blanking end time (length) in ns. */
107 unsigned vs_start; /* Vertical sync start (scanline). */
108 unsigned vs_end; /* Vertical sync end (scanline). */
109 unsigned vs_start_ns; /* Vertical sync start time in ns. */
110 unsigned vs_end_ns; /* Vertical sync end time in ns. */
111 unsigned h_total; /* Horizontal total (cclks per scanline). */
112 unsigned h_total_ns; /* Scanline duration in ns. */
113 unsigned hb_start; /* Horizontal blanking start (cclk). */
114 unsigned hb_end; /* Horizontal blanking end (cclk). */
115 unsigned hb_end_ns; /* Horizontal blanking end time (length) in ns. */
116 unsigned v_freq_hz; /* Vertical refresh rate to emulate. */
117} vga_retrace_s;
118
119#ifndef VBOX
120#define VGA_STATE_COMMON \
121 uint8_t *vram_ptr; \
122 unsigned long vram_offset; \
123 unsigned int vram_size; \
124 uint32_t latch; \
125 uint8_t sr_index; \
126 uint8_t sr[256]; \
127 uint8_t gr_index; \
128 uint8_t gr[256]; \
129 uint8_t ar_index; \
130 uint8_t ar[21]; \
131 int ar_flip_flop; \
132 uint8_t cr_index; \
133 uint8_t cr[256]; /* CRT registers */ \
134 uint8_t msr; /* Misc Output Register */ \
135 uint8_t fcr; /* Feature Control Register */ \
136 uint8_t st00; /* status 0 */ \
137 uint8_t st01; /* status 1 */ \
138 uint8_t dac_state; \
139 uint8_t dac_sub_index; \
140 uint8_t dac_read_index; \
141 uint8_t dac_write_index; \
142 uint8_t dac_cache[3]; /* used when writing */ \
143 uint8_t palette[768]; \
144 int32_t bank_offset; \
145 int (*get_bpp)(struct VGAState *s); \
146 void (*get_offsets)(struct VGAState *s, \
147 uint32_t *pline_offset, \
148 uint32_t *pstart_addr, \
149 uint32_t *pline_compare); \
150 void (*get_resolution)(struct VGAState *s, \
151 int *pwidth, \
152 int *pheight); \
153 VGA_STATE_COMMON_BOCHS_VBE \
154 /* display refresh support */ \
155 DisplayState *ds; \
156 uint32_t font_offsets[2]; \
157 int graphic_mode; \
158 uint8_t shift_control; \
159 uint8_t double_scan; \
160 uint32_t line_offset; \
161 uint32_t line_compare; \
162 uint32_t start_addr; \
163 uint32_t plane_updated; \
164 uint8_t last_cw, last_ch; \
165 uint32_t last_width, last_height; /* in chars or pixels */ \
166 uint32_t last_scr_width, last_scr_height; /* in pixels */ \
167 uint8_t cursor_start, cursor_end; \
168 uint32_t cursor_offset; \
169 unsigned int (*rgb_to_pixel)(unsigned int r, \
170 unsigned int g, unsigned b); \
171 /* hardware mouse cursor support */ \
172 uint32_t invalidated_y_table[VGA_MAX_HEIGHT / 32]; \
173 void (*cursor_invalidate)(struct VGAState *s); \
174 void (*cursor_draw_line)(struct VGAState *s, uint8_t *d, int y); \
175 /* tell for each page if it has been updated since the last time */ \
176 uint32_t last_palette[256]; \
177 uint32_t last_ch_attr[CH_ATTR_SIZE]; /* XXX: make it dynamic */
178
179#else /* VBOX */
180
181/* bird: Since we've changed types, reordered members, done alignment
182 paddings and more, VGA_STATE_COMMON was added directly to the
183 struct to make it more readable and easier to handle. */
184
185struct VGAState;
186typedef int FNGETBPP(struct VGAState *s);
187typedef void FNGETOFFSETS(struct VGAState *s, uint32_t *pline_offset, uint32_t *pstart_addr, uint32_t *pline_compare);
188typedef void FNGETRESOLUTION(struct VGAState *s, int *pwidth, int *pheight);
189typedef unsigned int FNRGBTOPIXEL(unsigned int r, unsigned int g, unsigned b);
190typedef void FNCURSORINVALIDATE(struct VGAState *s);
191typedef void FNCURSORDRAWLINE(struct VGAState *s, uint8_t *d, int y);
192
193#endif /* VBOX */
194
195#ifdef VBOX_WITH_VDMA
196typedef struct VBOXVDMAHOST *PVBOXVDMAHOST;
197#endif
198
199#ifdef VBOX_WITH_VIDEOHWACCEL
200#define VBOX_VHWA_MAX_PENDING_COMMANDS 1000
201
202typedef struct _VBOX_VHWA_PENDINGCMD
203{
204 RTLISTNODE Node;
205 PVBOXVHWACMD pCommand;
206} VBOX_VHWA_PENDINGCMD;
207#endif
208
209
210typedef struct VGAState {
211#ifndef VBOX
212 VGA_STATE_COMMON
213#else /* VBOX */
214 R3PTRTYPE(uint8_t *) vram_ptrR3;
215 R3PTRTYPE(FNGETBPP *) get_bpp;
216 R3PTRTYPE(FNGETOFFSETS *) get_offsets;
217 R3PTRTYPE(FNGETRESOLUTION *) get_resolution;
218 R3PTRTYPE(FNRGBTOPIXEL *) rgb_to_pixel;
219 R3PTRTYPE(FNCURSORINVALIDATE *) cursor_invalidate;
220 R3PTRTYPE(FNCURSORDRAWLINE *) cursor_draw_line;
221 RTR3PTR R3PtrCmnAlignment;
222 uint32_t vram_size;
223 uint32_t latch;
224 uint8_t sr_index;
225 uint8_t sr[256];
226 uint8_t gr_index;
227 uint8_t gr[256];
228 uint8_t ar_index;
229 uint8_t ar[21];
230 int32_t ar_flip_flop;
231 uint8_t cr_index;
232 uint8_t cr[256]; /* CRT registers */
233 uint8_t msr; /* Misc Output Register */
234 uint8_t fcr; /* Feature Control Register */
235 uint8_t st00; /* status 0 */
236 uint8_t st01; /* status 1 */
237 uint8_t dac_state;
238 uint8_t dac_sub_index;
239 uint8_t dac_read_index;
240 uint8_t dac_write_index;
241 uint8_t dac_cache[3]; /* used when writing */
242 uint8_t palette[768];
243 int32_t bank_offset;
244 VGA_STATE_COMMON_BOCHS_VBE
245 /* display refresh support */
246 uint32_t font_offsets[2];
247 int32_t graphic_mode;
248 uint8_t shift_control;
249 uint8_t double_scan;
250 uint8_t padding1[2];
251 uint32_t line_offset;
252 uint32_t vga_addr_mask;
253 uint32_t padding1a;
254 uint32_t line_compare;
255 uint32_t start_addr;
256 uint32_t plane_updated;
257 uint8_t last_cw, last_ch, padding2[2];
258 uint32_t last_width, last_height; /* in chars or pixels */
259 uint32_t last_scr_width, last_scr_height; /* in pixels */
260 uint32_t last_bpp;
261 uint8_t cursor_start, cursor_end;
262 bool last_cur_blink, last_chr_blink;
263 uint32_t cursor_offset;
264 /* hardware mouse cursor support */
265 uint32_t invalidated_y_table[VGA_MAX_HEIGHT / 32];
266 /* tell for each page if it has been updated since the last time */
267 uint32_t last_palette[256];
268 uint32_t last_ch_attr[CH_ATTR_SIZE]; /* XXX: make it dynamic */
269
270 /** end-of-common-state-marker */
271 uint32_t u32Marker;
272
273 /** Pointer to the device instance - RC Ptr. */
274 PPDMDEVINSRC pDevInsRC;
275 /** Pointer to the GC vram mapping. */
276 RCPTRTYPE(uint8_t *) vram_ptrRC;
277 uint32_t Padding1;
278
279 /** Pointer to the device instance - R3 Ptr. */
280 PPDMDEVINSR3 pDevInsR3;
281# ifdef VBOX_WITH_HGSMI
282 R3PTRTYPE(PHGSMIINSTANCE) pHGSMI;
283# endif
284# ifdef VBOX_WITH_VDMA
285 R3PTRTYPE(PVBOXVDMAHOST) pVdma;
286# endif
287 /** LUN\#0: The display port base interface. */
288 PDMIBASE IBase;
289 /** LUN\#0: The display port interface. */
290 PDMIDISPLAYPORT IPort;
291# if defined(VBOX_WITH_HGSMI) && (defined(VBOX_WITH_VIDEOHWACCEL) || defined(VBOX_WITH_CRHGSMI))
292 /** LUN\#0: VBVA callbacks interface */
293 PDMIDISPLAYVBVACALLBACKS IVBVACallbacks;
294# else
295 RTR3PTR Padding2;
296# endif
297 /** Status LUN: Leds interface. */
298 PDMILEDPORTS ILeds;
299
300 /** Pointer to base interface of the driver. */
301 R3PTRTYPE(PPDMIBASE) pDrvBase;
302 /** Pointer to display connector interface of the driver. */
303 R3PTRTYPE(PPDMIDISPLAYCONNECTOR) pDrv;
304
305 /** Status LUN: Partner of ILeds. */
306 R3PTRTYPE(PPDMILEDCONNECTORS) pLedsConnector;
307
308 /** Refresh timer handle - HC. */
309 PTMTIMERR3 RefreshTimer;
310
311 /** Pointer to the device instance - R0 Ptr. */
312 PPDMDEVINSR0 pDevInsR0;
313 /** The R0 vram pointer... */
314 R0PTRTYPE(uint8_t *) vram_ptrR0;
315
316# ifdef VBOX_WITH_VMSVGA
317 VMSVGAState svga;
318# endif
319
320 /** The number of monitors. */
321 uint32_t cMonitors;
322 /** Current refresh timer interval. */
323 uint32_t cMilliesRefreshInterval;
324 /** Bitmap tracking dirty pages. */
325 uint32_t au32DirtyBitmap[VGA_VRAM_MAX / PAGE_SIZE / 32];
326
327 /** Flag indicating that there are dirty bits. This is used to optimize the handler resetting. */
328 bool fHasDirtyBits;
329 /** LFB was updated flag. */
330 bool fLFBUpdated;
331 /** Indicates if the GC extensions are enabled or not. */
332 bool fGCEnabled;
333 /** Indicates if the R0 extensions are enabled or not. */
334 bool fR0Enabled;
335 /** Flag indicating that the VGA memory in the 0xa0000-0xbffff region has been remapped to allow direct access. */
336 bool fRemappedVGA;
337 /** Whether to render the guest VRAM to the framebuffer memory. False only for some LFB modes. */
338 bool fRenderVRAM;
339# ifdef VBOX_WITH_VMSVGA
340 /* Whether the SVGA emulation is enabled or not. */
341 bool fVMSVGAEnabled;
342 bool Padding4[1+4];
343# else
344 bool Padding4[2+4];
345# endif
346
347 /** Physical access type for the linear frame buffer dirty page tracking. */
348 PGMPHYSHANDLERTYPE hLfbAccessHandlerType;
349
350 /** The physical address the VRAM was assigned. */
351 RTGCPHYS GCPhysVRAM;
352 /** The critical section protect the instance data. */
353 PDMCRITSECT CritSect;
354 /** The PCI device. */
355 PDMPCIDEV Dev;
356
357 STAMPROFILE StatRZMemoryRead;
358 STAMPROFILE StatR3MemoryRead;
359 STAMPROFILE StatRZMemoryWrite;
360 STAMPROFILE StatR3MemoryWrite;
361 STAMCOUNTER StatMapPage; /**< Counts IOMMMIOMapMMIO2Page calls. */
362 STAMCOUNTER StatUpdateDisp; /**< Counts vgaPortUpdateDisplay calls. */
363
364 /* Keep track of ring 0 latched accesses to the VGA MMIO memory. */
365 uint64_t u64LastLatchedAccess;
366 uint32_t cLatchAccesses;
367 uint16_t uMaskLatchAccess;
368 uint16_t iMask;
369
370# ifdef VBE_BYTEWISE_IO
371 /** VBE read/write data/index flags */
372 uint8_t fReadVBEData;
373 uint8_t fWriteVBEData;
374 uint8_t fReadVBEIndex;
375 uint8_t fWriteVBEIndex;
376 /** VBE write data/index one byte buffer */
377 uint8_t cbWriteVBEData;
378 uint8_t cbWriteVBEIndex;
379 /** VBE Extra Data write address one byte buffer */
380 uint8_t cbWriteVBEExtraAddress;
381 uint8_t Padding5;
382# endif
383
384 /** Retrace emulation state */
385 bool fRealRetrace;
386 bool Padding6[HC_ARCH_BITS == 64 ? 7 : 3];
387 vga_retrace_s retrace_state;
388
389 /** The VBE BIOS extra data. */
390 R3PTRTYPE(uint8_t *) pbVBEExtraData;
391 /** The size of the VBE BIOS extra data. */
392 uint16_t cbVBEExtraData;
393 /** The VBE BIOS current memory address. */
394 uint16_t u16VBEExtraAddress;
395 uint16_t Padding7[2];
396
397 /** The BIOS logo data. */
398 R3PTRTYPE(uint8_t *) pbLogo;
399 /** The name of the logo file. */
400 R3PTRTYPE(char *) pszLogoFile;
401 /** Bitmap image data. */
402 R3PTRTYPE(uint8_t *) pbLogoBitmap;
403 /** Current logo data offset. */
404 uint32_t offLogoData;
405 /** The size of the BIOS logo data. */
406 uint32_t cbLogo;
407 /** Current logo command. */
408 uint16_t LogoCommand;
409 /** Bitmap width. */
410 uint16_t cxLogo;
411 /** Bitmap height. */
412 uint16_t cyLogo;
413 /** Bitmap planes. */
414 uint16_t cLogoPlanes;
415 /** Bitmap depth. */
416 uint16_t cLogoBits;
417 /** Bitmap compression. */
418 uint16_t LogoCompression;
419 /** Bitmap colors used. */
420 uint16_t cLogoUsedColors;
421 /** Palette size. */
422 uint16_t cLogoPalEntries;
423 /** Clear screen flag. */
424 uint8_t fLogoClearScreen;
425 bool fBootMenuInverse;
426 uint8_t Padding8[6];
427 /** Palette data. */
428 uint32_t au32LogoPalette[256];
429
430 /** The VGA BIOS ROM data. */
431 R3PTRTYPE(uint8_t *) pbVgaBios;
432 /** The size of the VGA BIOS ROM. */
433 uint64_t cbVgaBios;
434 /** The name of the VGA BIOS ROM file. */
435 R3PTRTYPE(char *) pszVgaBiosFile;
436# if HC_ARCH_BITS == 32
437 uint32_t Padding9;
438# endif
439
440# ifdef VBOX_WITH_HGSMI
441 /** Base port in the assigned PCI I/O space. */
442 RTIOPORT IOPortBase;
443# ifdef VBOX_WITH_WDDM
444 uint8_t Padding10[2];
445 /** Specifies guest driver caps, i.e. whether it can handle IRQs from the
446 * adapter, the way it can handle async HGSMI command completion, etc. */
447 uint32_t fGuestCaps;
448 uint32_t fScanLineCfg;
449 uint32_t fHostCursorCapabilities;
450# else
451 uint8_t Padding11[14];
452# endif
453
454 /** The critical section serializes the HGSMI IRQ setting/clearing. */
455 PDMCRITSECT CritSectIRQ;
456 /** VBVARaiseIRQ flags which were set when the guest was still processing previous IRQ. */
457 uint32_t fu32PendingGuestFlags;
458 uint32_t Padding12;
459# endif /* VBOX_WITH_HGSMI */
460
461 PDMLED Led3D;
462
463 struct {
464 volatile uint32_t cPending;
465 uint32_t Padding1;
466 union
467 {
468 RTLISTNODE PendingList;
469 /* make sure the structure sized cross different contexts correctly */
470 struct
471 {
472 R3PTRTYPE(void *) dummy1;
473 R3PTRTYPE(void *) dummy2;
474 } dummy;
475 };
476 } pendingVhwaCommands;
477#endif /* VBOX */
478} VGAState;
479#ifdef VBOX
480/** VGA state. */
481typedef VGAState VGASTATE;
482/** Pointer to the VGA state. */
483typedef VGASTATE *PVGASTATE;
484AssertCompileMemberAlignment(VGASTATE, bank_offset, 8);
485AssertCompileMemberAlignment(VGASTATE, font_offsets, 8);
486AssertCompileMemberAlignment(VGASTATE, last_ch_attr, 8);
487AssertCompileMemberAlignment(VGASTATE, u32Marker, 8);
488#endif
489
490/**
491 * VBE Bios Extra Data structure.
492 * @remark duplicated in vbe.h.
493 */
494typedef struct VBEHeader
495{
496 /** Signature (VBEHEADER_MAGIC). */
497 uint16_t u16Signature;
498 /** Data size. */
499 uint16_t cbData;
500} VBEHeader;
501
502/** VBE Extra Data. */
503typedef VBEHeader VBEHEADER;
504/** Pointer to the VBE Extra Data. */
505typedef VBEHEADER *PVBEHEADER;
506
507/** The value of the VBEHEADER::u16Signature field.
508 * @remark duplicated in vbe.h. */
509#define VBEHEADER_MAGIC 0x77CC
510
511/** The extra port which is used to read the mode list.
512 * @remark duplicated in vbe.h. */
513#define VBE_EXTRA_PORT 0x3b6
514
515/** The extra port which is used for debug printf.
516 * @remark duplicated in vbe.h. */
517#define VBE_PRINTF_PORT 0x3b7
518
519#if !defined(VBOX) || defined(IN_RING3)
520static inline int c6_to_8(int v)
521{
522 int b;
523 v &= 0x3f;
524 b = v & 1;
525 return (v << 2) | (b << 1) | b;
526}
527#endif /* !VBOX || IN_RING3 */
528
529
530#ifdef VBOX_WITH_HGSMI
531int VBVAInit (PVGASTATE pVGAState);
532void VBVADestroy (PVGASTATE pVGAState);
533int VBVAUpdateDisplay (PVGASTATE pVGAState);
534void VBVAReset (PVGASTATE pVGAState);
535void VBVAPause (PVGASTATE pVGAState, bool fPause);
536void VBVAOnVBEChanged(PVGASTATE pVGAState);
537void VBVAOnResume(PVGASTATE pThis);
538
539bool VBVAIsPaused(PVGASTATE pVGAState);
540bool VBVAIsEnabled(PVGASTATE pVGAState);
541
542void VBVARaiseIrq(PVGASTATE pVGAState, uint32_t fFlags);
543
544int VBVAInfoView(PVGASTATE pVGAState, const VBVAINFOVIEW *pView);
545int VBVAInfoScreen(PVGASTATE pVGAState, const VBVAINFOSCREEN *pScreen);
546int VBVAGetInfoViewAndScreen(PVGASTATE pVGAState, uint32_t u32ViewIndex, VBVAINFOVIEW *pView, VBVAINFOSCREEN *pScreen);
547
548/* @return host-guest flags that were set on reset
549 * this allows the caller to make further cleaning when needed,
550 * e.g. reset the IRQ */
551uint32_t HGSMIReset(PHGSMIINSTANCE pIns);
552
553# ifdef VBOX_WITH_VIDEOHWACCEL
554DECLCALLBACK(int) vbvaVHWACommandCompleteAsync(PPDMIDISPLAYVBVACALLBACKS pInterface, PVBOXVHWACMD pCmd);
555int vbvaVHWAConstruct(PVGASTATE pVGAState);
556int vbvaVHWAReset(PVGASTATE pVGAState);
557
558void vbvaTimerCb(PVGASTATE pVGAState);
559
560int vboxVBVASaveStatePrep(PPDMDEVINS pDevIns);
561int vboxVBVASaveStateDone(PPDMDEVINS pDevIns);
562# endif
563
564#ifdef VBOX_WITH_HGSMI
565#define PPDMIDISPLAYVBVACALLBACKS_2_PVGASTATE(_pcb) ( (PVGASTATE)((uint8_t *)(_pcb) - RT_OFFSETOF(VGASTATE, IVBVACallbacks)) )
566#endif
567
568# ifdef VBOX_WITH_CRHGSMI
569DECLCALLBACK(int) vboxVDMACrHgsmiCommandCompleteAsync(PPDMIDISPLAYVBVACALLBACKS pInterface,
570 PVBOXVDMACMD_CHROMIUM_CMD pCmd, int rc);
571DECLCALLBACK(int) vboxVDMACrHgsmiControlCompleteAsync(PPDMIDISPLAYVBVACALLBACKS pInterface,
572 PVBOXVDMACMD_CHROMIUM_CTL pCmd, int rc);
573DECLCALLBACK(int) vboxCmdVBVACmdHostCtl(PPDMIDISPLAYVBVACALLBACKS pInterface,
574 struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd,
575 PFNCRCTLCOMPLETION pfnCompletion,
576 void *pvCompletion);
577DECLCALLBACK(int) vboxCmdVBVACmdHostCtlSync(PPDMIDISPLAYVBVACALLBACKS pInterface,
578 struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd);
579# endif
580
581int vboxVBVASaveStateExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM);
582int vboxVBVALoadStateExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t u32Version);
583int vboxVBVALoadStateDone(PPDMDEVINS pDevIns);
584
585DECLCALLBACK(int) vgaUpdateDisplayAll(PVGASTATE pThis, bool fFailOnResize);
586DECLCALLBACK(int) vbvaPortSendModeHint(PPDMIDISPLAYPORT pInterface, uint32_t cx,
587 uint32_t cy, uint32_t cBPP,
588 uint32_t cDisplay, uint32_t dx,
589 uint32_t dy, uint32_t fEnabled,
590 uint32_t fNotifyGuest);
591DECLCALLBACK(void) vbvaPortReportHostCursorCapabilities(PPDMIDISPLAYPORT pInterface, uint32_t fCapabilitiesAdded,
592 uint32_t fCapabilitiesRemoved);
593DECLCALLBACK(void) vbvaPortReportHostCursorPosition(PPDMIDISPLAYPORT pInterface, uint32_t x, uint32_t y);
594
595# ifdef VBOX_WITH_VDMA
596typedef struct VBOXVDMAHOST *PVBOXVDMAHOST;
597int vboxVDMAConstruct(PVGASTATE pVGAState, uint32_t cPipeElements);
598int vboxVDMADestruct(PVBOXVDMAHOST pVdma);
599int vboxVDMAReset(PVBOXVDMAHOST pVdma);
600void vboxVDMAControl(PVBOXVDMAHOST pVdma, PVBOXVDMA_CTL pCmd, uint32_t cbCmd);
601void vboxVDMACommand(PVBOXVDMAHOST pVdma, PVBOXVDMACBUF_DR pCmd, uint32_t cbCmd);
602int vboxVDMASaveStateExecPrep(struct VBOXVDMAHOST *pVdma);
603int vboxVDMASaveStateExecDone(struct VBOXVDMAHOST *pVdma);
604int vboxVDMASaveStateExecPerform(struct VBOXVDMAHOST *pVdma, PSSMHANDLE pSSM);
605int vboxVDMASaveLoadExecPerform(struct VBOXVDMAHOST *pVdma, PSSMHANDLE pSSM, uint32_t u32Version);
606int vboxVDMASaveLoadDone(struct VBOXVDMAHOST *pVdma);
607# endif /* VBOX_WITH_VDMA */
608
609# ifdef VBOX_WITH_CRHGSMI
610int vboxCmdVBVACmdSubmit(PVGASTATE pVGAState);
611int vboxCmdVBVACmdFlush(PVGASTATE pVGAState);
612void vboxCmdVBVACmdTimer(PVGASTATE pVGAState);
613int vboxCmdVBVACmdCtl(PVGASTATE pVGAState, VBOXCMDVBVA_CTL *pCtl, uint32_t cbCtl);
614bool vboxCmdVBVAIsEnabled(PVGASTATE pVGAState);
615# endif /* VBOX_WITH_CRHGSMI */
616#endif /* VBOX_WITH_HGSMI */
617
618# ifdef VBOX_WITH_VMSVGA
619int vgaR3RegisterVRAMHandler(PVGASTATE pVGAState, uint64_t cbFrameBuffer);
620int vgaR3UnregisterVRAMHandler(PVGASTATE pVGAState);
621int vgaR3UpdateDisplay(PVGASTATE pVGAState, unsigned xStart, unsigned yStart, unsigned width, unsigned height);
622# endif
623
624#ifndef VBOX
625void vga_common_init(VGAState *s, DisplayState *ds, uint8_t *vga_ram_base,
626 unsigned long vga_ram_offset, int vga_ram_size);
627uint32_t vga_mem_readb(void *opaque, target_phys_addr_t addr);
628void vga_mem_writeb(void *opaque, target_phys_addr_t addr, uint32_t val);
629void vga_invalidate_scanlines(VGAState *s, int y1, int y2);
630
631void vga_draw_cursor_line_8(uint8_t *d1, const uint8_t *src1,
632 int poffset, int w,
633 unsigned int color0, unsigned int color1,
634 unsigned int color_xor);
635void vga_draw_cursor_line_16(uint8_t *d1, const uint8_t *src1,
636 int poffset, int w,
637 unsigned int color0, unsigned int color1,
638 unsigned int color_xor);
639void vga_draw_cursor_line_32(uint8_t *d1, const uint8_t *src1,
640 int poffset, int w,
641 unsigned int color0, unsigned int color1,
642 unsigned int color_xor);
643
644extern const uint8_t sr_mask[8];
645extern const uint8_t gr_mask[16];
646#endif /* !VBOX */
647
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette