VirtualBox

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

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

DevVGA+VGABIOS: Eliminate the redundant header file parts, using one file for DevVGA and the VGA BIOS. The new central header contains more than just private defines right now, but since no one else but the device and firmware wants to use this, there's no point in splitting this up further.

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