VirtualBox

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

Last change on this file since 76519 was 76519, checked in by vboxsync, 6 years ago

Devices: Header guard fixing preps. bugref:9344

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