2 * VirtualBox Video interface.
6 * Copyright (C) 2006-2016 Oracle Corporation
8 * This file is part of VirtualBox Open Source Edition (OSE), as
9 * available from http://www.virtualbox.org. This file is free software;
10 * you can redistribute it and/or modify it under the terms of the GNU
11 * General Public License (GPL) as published by the Free Software
12 * Foundation, in version 2 as it comes in the "COPYING" file of the
13 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 * The contents of this file may alternatively be used under the terms
17 * of the Common Development and Distribution License Version 1.0
18 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
19 * VirtualBox OSE distribution, in which case the provisions of the
20 * CDDL are applicable instead of those of the GPL.
22 * You may elect to license modified versions of this file under the
23 * terms and conditions of either the GPL or the CDDL or both.
26 #ifndef ___VBox_VBoxVideo_h
27 #define ___VBox_VBoxVideo_h
29 #include <VBox/VMMDev.h>
30 #include <VBox/Hardware/VBoxVideoVBE.h>
32 #include <iprt/cdefs.h>
33 #include <iprt/types.h>
36 * The last 4096 bytes of the guest VRAM contains the generic info for all
37 * DualView chunks: sizes and offsets of chunks. This is filled by miniport.
39 * Last 4096 bytes of each chunk contain chunk specific data: framebuffer info,
40 * etc. This is used exclusively by the corresponding instance of a display driver.
43 * Last 4096 bytes - Adapter information area.
44 * 4096 bytes aligned miniport heap (value specified in the config rouded up).
45 * Slack - what left after dividing the VRAM.
46 * 4096 bytes aligned framebuffers:
47 * last 4096 bytes of each framebuffer is the display information area.
49 * The Virtual Graphics Adapter information in the guest VRAM is stored by the
50 * guest video driver using structures prepended by VBOXVIDEOINFOHDR.
52 * When the guest driver writes dword 0 to the VBE_DISPI_INDEX_VBOX_VIDEO
53 * the host starts to process the info. The first element at the start of
54 * the 4096 bytes region should be normally be a LINK that points to
55 * actual information chain. That way the guest driver can have some
56 * fixed layout of the information memory block and just rewrite
57 * the link to point to relevant memory chain.
59 * The processing stops at the END element.
61 * The host can access the memory only when the port IO is processed.
62 * All data that will be needed later must be copied from these 4096 bytes.
63 * But other VRAM can be used by host until the mode is disabled.
65 * The guest driver writes dword 0xffffffff to the VBE_DISPI_INDEX_VBOX_VIDEO
66 * to disable the mode.
68 * VBE_DISPI_INDEX_VBOX_VIDEO is used to read the configuration information
69 * from the host and issue commands to the host.
71 * The guest writes the VBE_DISPI_INDEX_VBOX_VIDEO index register, the the
72 * following operations with the VBE data register can be performed:
75 * write 16 bit value NOP
76 * read 16 bit value count of monitors
77 * write 32 bit value sets the vbox command value and the command processed by the host
78 * read 32 bit value result of the last vbox command is returned
81 #define VBOX_VIDEO_PRIMARY_SCREEN 0
82 #define VBOX_VIDEO_NO_SCREEN ~0
84 /* The size of the information. */
86 * The minimum HGSMI heap size is PAGE_SIZE (4096 bytes) and is a restriction of the
87 * runtime heapsimple API. Use minimum 2 pages here, because the info area also may
88 * contain other data (for example HGSMIHOSTFLAGS structure).
90 #ifndef VBOX_XPDM_MINIPORT
91 # define VBVA_ADAPTER_INFORMATION_SIZE (64*_1K)
93 #define VBVA_ADAPTER_INFORMATION_SIZE (16*_1K)
94 #define VBVA_DISPLAY_INFORMATION_SIZE (64*_1K)
96 #define VBVA_MIN_BUFFER_SIZE (64*_1K)
99 /* The value for port IO to let the adapter to interpret the adapter memory. */
100 #define VBOX_VIDEO_DISABLE_ADAPTER_MEMORY 0xFFFFFFFF
102 /* The value for port IO to let the adapter to interpret the adapter memory. */
103 #define VBOX_VIDEO_INTERPRET_ADAPTER_MEMORY 0x00000000
105 /* The value for port IO to let the adapter to interpret the display memory.
106 * The display number is encoded in low 16 bits.
108 #define VBOX_VIDEO_INTERPRET_DISPLAY_MEMORY_BASE 0x00010000
111 /* The end of the information. */
112 #define VBOX_VIDEO_INFO_TYPE_END 0
113 /* Instructs the host to fetch the next VBOXVIDEOINFOHDR at the given offset of VRAM. */
114 #define VBOX_VIDEO_INFO_TYPE_LINK 1
115 /* Information about a display memory position. */
116 #define VBOX_VIDEO_INFO_TYPE_DISPLAY 2
117 /* Information about a screen. */
118 #define VBOX_VIDEO_INFO_TYPE_SCREEN 3
119 /* Information about host notifications for the driver. */
120 #define VBOX_VIDEO_INFO_TYPE_HOST_EVENTS 4
121 /* Information about non-volatile guest VRAM heap. */
122 #define VBOX_VIDEO_INFO_TYPE_NV_HEAP 5
123 /* VBVA enable/disable. */
124 #define VBOX_VIDEO_INFO_TYPE_VBVA_STATUS 6
126 #define VBOX_VIDEO_INFO_TYPE_VBVA_FLUSH 7
127 /* Query configuration value. */
128 #define VBOX_VIDEO_INFO_TYPE_QUERY_CONF32 8
132 typedef struct VBOXVIDEOINFOHDR
140 typedef struct VBOXVIDEOINFOLINK
142 /* Relative offset in VRAM */
147 /* Resides in adapter info memory. Describes a display VRAM chunk. */
148 typedef struct VBOXVIDEOINFODISPLAY
150 /* Index of the framebuffer assigned by guest. */
153 /* Absolute offset in VRAM of the framebuffer to be displayed on the monitor. */
156 /* The size of the memory that can be used for the screen. */
157 uint32_t u32FramebufferSize
;
159 /* The size of the memory that is used for the Display information.
160 * The information is at u32Offset + u32FramebufferSize
162 uint32_t u32InformationSize
;
164 } VBOXVIDEOINFODISPLAY
;
167 /* Resides in display info area, describes the current video mode. */
168 #define VBOX_VIDEO_INFO_SCREEN_F_NONE 0x00
169 #define VBOX_VIDEO_INFO_SCREEN_F_ACTIVE 0x01
171 typedef struct VBOXVIDEOINFOSCREEN
173 /* Physical X origin relative to the primary screen. */
176 /* Physical Y origin relative to the primary screen. */
179 /* The scan line size in bytes. */
180 uint32_t u32LineSize
;
182 /* Width of the screen. */
185 /* Height of the screen. */
189 uint8_t bitsPerPixel
;
191 /* VBOX_VIDEO_INFO_SCREEN_F_* */
193 } VBOXVIDEOINFOSCREEN
;
195 /* The guest initializes the structure to 0. The positions of the structure in the
196 * display info area must not be changed, host will update the structure. Guest checks
197 * the events and modifies the structure as a response to host.
199 #define VBOX_VIDEO_INFO_HOST_EVENTS_F_NONE 0x00000000
200 #define VBOX_VIDEO_INFO_HOST_EVENTS_F_VRDP_RESET 0x00000080
202 typedef struct VBOXVIDEOINFOHOSTEVENTS
206 } VBOXVIDEOINFOHOSTEVENTS
;
208 /* Resides in adapter info memory. Describes the non-volatile VRAM heap. */
209 typedef struct VBOXVIDEOINFONVHEAP
211 /* Absolute offset in VRAM of the start of the heap. */
212 uint32_t u32HeapOffset
;
214 /* The size of the heap. */
215 uint32_t u32HeapSize
;
217 } VBOXVIDEOINFONVHEAP
;
219 /* Display information area. */
220 typedef struct VBOXVIDEOINFOVBVASTATUS
222 /* Absolute offset in VRAM of the start of the VBVA QUEUE. 0 to disable VBVA. */
223 uint32_t u32QueueOffset
;
225 /* The size of the VBVA QUEUE. 0 to disable VBVA. */
226 uint32_t u32QueueSize
;
228 } VBOXVIDEOINFOVBVASTATUS
;
230 typedef struct VBOXVIDEOINFOVBVAFLUSH
232 uint32_t u32DataStart
;
236 } VBOXVIDEOINFOVBVAFLUSH
;
238 #define VBOX_VIDEO_QCI32_MONITOR_COUNT 0
239 #define VBOX_VIDEO_QCI32_OFFSCREEN_HEAP_SIZE 1
241 typedef struct VBOXVIDEOINFOQUERYCONF32
247 } VBOXVIDEOINFOQUERYCONF32
;
250 #ifdef VBOX_WITH_VIDEOHWACCEL
253 #define VBOXVHWA_VERSION_MAJ 0
254 #define VBOXVHWA_VERSION_MIN 0
255 #define VBOXVHWA_VERSION_BLD 6
256 #define VBOXVHWA_VERSION_RSV 0
260 VBOXVHWACMD_TYPE_SURF_CANCREATE
= 1,
261 VBOXVHWACMD_TYPE_SURF_CREATE
,
262 VBOXVHWACMD_TYPE_SURF_DESTROY
,
263 VBOXVHWACMD_TYPE_SURF_LOCK
,
264 VBOXVHWACMD_TYPE_SURF_UNLOCK
,
265 VBOXVHWACMD_TYPE_SURF_BLT
,
266 VBOXVHWACMD_TYPE_SURF_FLIP
,
267 VBOXVHWACMD_TYPE_SURF_OVERLAY_UPDATE
,
268 VBOXVHWACMD_TYPE_SURF_OVERLAY_SETPOSITION
,
269 VBOXVHWACMD_TYPE_SURF_COLORKEY_SET
,
270 VBOXVHWACMD_TYPE_QUERY_INFO1
,
271 VBOXVHWACMD_TYPE_QUERY_INFO2
,
272 VBOXVHWACMD_TYPE_ENABLE
,
273 VBOXVHWACMD_TYPE_DISABLE
,
274 VBOXVHWACMD_TYPE_HH_CONSTRUCT
,
275 VBOXVHWACMD_TYPE_HH_RESET
276 #ifdef VBOX_WITH_WDDM
277 , VBOXVHWACMD_TYPE_SURF_GETINFO
278 , VBOXVHWACMD_TYPE_SURF_COLORFILL
280 , VBOXVHWACMD_TYPE_HH_DISABLE
281 , VBOXVHWACMD_TYPE_HH_ENABLE
282 , VBOXVHWACMD_TYPE_HH_SAVESTATE_SAVEBEGIN
283 , VBOXVHWACMD_TYPE_HH_SAVESTATE_SAVEEND
284 , VBOXVHWACMD_TYPE_HH_SAVESTATE_SAVEPERFORM
285 , VBOXVHWACMD_TYPE_HH_SAVESTATE_LOADPERFORM
288 /* the command processing was asynch, set by the host to indicate asynch command completion
289 * must not be cleared once set, the command completion is performed by issuing a host->guest completion command
290 * while keeping this flag unchanged */
291 #define VBOXVHWACMD_FLAG_HG_ASYNCH 0x00010000
292 /* asynch completion is performed by issuing the event */
293 #define VBOXVHWACMD_FLAG_GH_ASYNCH_EVENT 0x00000001
294 /* issue interrupt on asynch completion */
295 #define VBOXVHWACMD_FLAG_GH_ASYNCH_IRQ 0x00000002
296 /* guest does not do any op on completion of this command, the host may copy the command and indicate that it does not need the command anymore
297 * by setting the VBOXVHWACMD_FLAG_HG_ASYNCH_RETURNED flag */
298 #define VBOXVHWACMD_FLAG_GH_ASYNCH_NOCOMPLETION 0x00000004
299 /* the host has copied the VBOXVHWACMD_FLAG_GH_ASYNCH_NOCOMPLETION command and returned it to the guest */
300 #define VBOXVHWACMD_FLAG_HG_ASYNCH_RETURNED 0x00020000
301 /* this is the host->host cmd, i.e. a configuration command posted by the host to the framebuffer */
302 #define VBOXVHWACMD_FLAG_HH_CMD 0x10000000
304 typedef struct VBOXVHWACMD
306 VBOXVHWACMD_TYPE enmCmd
; /* command type */
307 volatile int32_t rc
; /* command result */
308 int32_t iDisplay
; /* display index */
309 volatile int32_t Flags
; /* ored VBOXVHWACMD_FLAG_xxx values */
310 uint64_t GuestVBVAReserved1
; /* field internally used by the guest VBVA cmd handling, must NOT be modified by clients */
311 uint64_t GuestVBVAReserved2
; /* field internally used by the guest VBVA cmd handling, must NOT be modified by clients */
312 volatile uint32_t cRefs
;
316 struct VBOXVHWACMD
*pNext
;
318 uint64_t Data
; /* the body is 64-bit aligned */
323 #define VBOXVHWACMD_HEADSIZE() (RT_OFFSETOF(VBOXVHWACMD, body))
324 #define VBOXVHWACMD_SIZE_FROMBODYSIZE(_s) (VBOXVHWACMD_HEADSIZE() + (_s))
325 #define VBOXVHWACMD_SIZE(_tCmd) (VBOXVHWACMD_SIZE_FROMBODYSIZE(sizeof(_tCmd)))
326 typedef unsigned int VBOXVHWACMD_LENGTH
;
327 typedef uint64_t VBOXVHWA_SURFHANDLE
;
328 #define VBOXVHWA_SURFHANDLE_INVALID 0ULL
329 #define VBOXVHWACMD_BODY(_p, _t) ((_t*)(_p)->body)
330 #define VBOXVHWACMD_HEAD(_pb) ((VBOXVHWACMD*)((uint8_t *)(_pb) - RT_OFFSETOF(VBOXVHWACMD, body)))
332 typedef struct VBOXVHWA_RECTL
340 typedef struct VBOXVHWA_COLORKEY
346 typedef struct VBOXVHWA_PIXELFORMAT
352 uint32_t rgbBitCount
;
353 uint32_t yuvBitCount
;
358 uint32_t rgbRBitMask
;
359 uint32_t yuvYBitMask
;
364 uint32_t rgbGBitMask
;
365 uint32_t yuvUBitMask
;
370 uint32_t rgbBBitMask
;
371 uint32_t yuvVBitMask
;
376 uint32_t rgbABitMask
;
380 } VBOXVHWA_PIXELFORMAT
;
382 typedef struct VBOXVHWA_SURFACEDESC
390 uint32_t cBackBuffers
;
392 VBOXVHWA_COLORKEY DstOverlayCK
;
393 VBOXVHWA_COLORKEY DstBltCK
;
394 VBOXVHWA_COLORKEY SrcOverlayCK
;
395 VBOXVHWA_COLORKEY SrcBltCK
;
396 VBOXVHWA_PIXELFORMAT PixelFormat
;
399 VBOXVHWA_SURFHANDLE hSurf
;
401 } VBOXVHWA_SURFACEDESC
;
403 typedef struct VBOXVHWA_BLTFX
411 VBOXVHWA_COLORKEY DstCK
;
412 VBOXVHWA_COLORKEY SrcCK
;
415 typedef struct VBOXVHWA_OVERLAYFX
421 VBOXVHWA_COLORKEY DstCK
;
422 VBOXVHWA_COLORKEY SrcCK
;
423 } VBOXVHWA_OVERLAYFX
;
425 #define VBOXVHWA_CAPS_BLT 0x00000040
426 #define VBOXVHWA_CAPS_BLTCOLORFILL 0x04000000
427 #define VBOXVHWA_CAPS_BLTFOURCC 0x00000100
428 #define VBOXVHWA_CAPS_BLTSTRETCH 0x00000200
429 #define VBOXVHWA_CAPS_BLTQUEUE 0x00000080
431 #define VBOXVHWA_CAPS_OVERLAY 0x00000800
432 #define VBOXVHWA_CAPS_OVERLAYFOURCC 0x00002000
433 #define VBOXVHWA_CAPS_OVERLAYSTRETCH 0x00004000
434 #define VBOXVHWA_CAPS_OVERLAYCANTCLIP 0x00001000
436 #define VBOXVHWA_CAPS_COLORKEY 0x00400000
437 #define VBOXVHWA_CAPS_COLORKEYHWASSIST 0x01000000
439 #define VBOXVHWA_SCAPS_BACKBUFFER 0x00000004
440 #define VBOXVHWA_SCAPS_COMPLEX 0x00000008
441 #define VBOXVHWA_SCAPS_FLIP 0x00000010
442 #define VBOXVHWA_SCAPS_FRONTBUFFER 0x00000020
443 #define VBOXVHWA_SCAPS_OFFSCREENPLAIN 0x00000040
444 #define VBOXVHWA_SCAPS_OVERLAY 0x00000080
445 #define VBOXVHWA_SCAPS_PRIMARYSURFACE 0x00000200
446 #define VBOXVHWA_SCAPS_SYSTEMMEMORY 0x00000800
447 #define VBOXVHWA_SCAPS_VIDEOMEMORY 0x00004000
448 #define VBOXVHWA_SCAPS_VISIBLE 0x00008000
449 #define VBOXVHWA_SCAPS_LOCALVIDMEM 0x10000000
451 #define VBOXVHWA_PF_PALETTEINDEXED8 0x00000020
452 #define VBOXVHWA_PF_RGB 0x00000040
453 #define VBOXVHWA_PF_RGBTOYUV 0x00000100
454 #define VBOXVHWA_PF_YUV 0x00000200
455 #define VBOXVHWA_PF_FOURCC 0x00000004
457 #define VBOXVHWA_LOCK_DISCARDCONTENTS 0x00002000
459 #define VBOXVHWA_CFG_ENABLED 0x00000001
461 #define VBOXVHWA_SD_BACKBUFFERCOUNT 0x00000020
462 #define VBOXVHWA_SD_CAPS 0x00000001
463 #define VBOXVHWA_SD_CKDESTBLT 0x00004000
464 #define VBOXVHWA_SD_CKDESTOVERLAY 0x00002000
465 #define VBOXVHWA_SD_CKSRCBLT 0x00010000
466 #define VBOXVHWA_SD_CKSRCOVERLAY 0x00008000
467 #define VBOXVHWA_SD_HEIGHT 0x00000002
468 #define VBOXVHWA_SD_PITCH 0x00000008
469 #define VBOXVHWA_SD_PIXELFORMAT 0x00001000
470 /*#define VBOXVHWA_SD_REFRESHRATE 0x00040000*/
471 #define VBOXVHWA_SD_WIDTH 0x00000004
473 #define VBOXVHWA_CKEYCAPS_DESTBLT 0x00000001
474 #define VBOXVHWA_CKEYCAPS_DESTBLTCLRSPACE 0x00000002
475 #define VBOXVHWA_CKEYCAPS_DESTBLTCLRSPACEYUV 0x00000004
476 #define VBOXVHWA_CKEYCAPS_DESTBLTYUV 0x00000008
477 #define VBOXVHWA_CKEYCAPS_DESTOVERLAY 0x00000010
478 #define VBOXVHWA_CKEYCAPS_DESTOVERLAYCLRSPACE 0x00000020
479 #define VBOXVHWA_CKEYCAPS_DESTOVERLAYCLRSPACEYUV 0x00000040
480 #define VBOXVHWA_CKEYCAPS_DESTOVERLAYONEACTIVE 0x00000080
481 #define VBOXVHWA_CKEYCAPS_DESTOVERLAYYUV 0x00000100
482 #define VBOXVHWA_CKEYCAPS_SRCBLT 0x00000200
483 #define VBOXVHWA_CKEYCAPS_SRCBLTCLRSPACE 0x00000400
484 #define VBOXVHWA_CKEYCAPS_SRCBLTCLRSPACEYUV 0x00000800
485 #define VBOXVHWA_CKEYCAPS_SRCBLTYUV 0x00001000
486 #define VBOXVHWA_CKEYCAPS_SRCOVERLAY 0x00002000
487 #define VBOXVHWA_CKEYCAPS_SRCOVERLAYCLRSPACE 0x00004000
488 #define VBOXVHWA_CKEYCAPS_SRCOVERLAYCLRSPACEYUV 0x00008000
489 #define VBOXVHWA_CKEYCAPS_SRCOVERLAYONEACTIVE 0x00010000
490 #define VBOXVHWA_CKEYCAPS_SRCOVERLAYYUV 0x00020000
491 #define VBOXVHWA_CKEYCAPS_NOCOSTOVERLAY 0x00040000
493 #define VBOXVHWA_BLT_COLORFILL 0x00000400
494 #define VBOXVHWA_BLT_DDFX 0x00000800
495 #define VBOXVHWA_BLT_EXTENDED_FLAGS 0x40000000
496 #define VBOXVHWA_BLT_EXTENDED_LINEAR_CONTENT 0x00000004
497 #define VBOXVHWA_BLT_EXTENDED_PRESENTATION_STRETCHFACTOR 0x00000010
498 #define VBOXVHWA_BLT_KEYDESTOVERRIDE 0x00004000
499 #define VBOXVHWA_BLT_KEYSRCOVERRIDE 0x00010000
500 #define VBOXVHWA_BLT_LAST_PRESENTATION 0x20000000
501 #define VBOXVHWA_BLT_PRESENTATION 0x10000000
502 #define VBOXVHWA_BLT_ROP 0x00020000
505 #define VBOXVHWA_OVER_DDFX 0x00080000
506 #define VBOXVHWA_OVER_HIDE 0x00000200
507 #define VBOXVHWA_OVER_KEYDEST 0x00000400
508 #define VBOXVHWA_OVER_KEYDESTOVERRIDE 0x00000800
509 #define VBOXVHWA_OVER_KEYSRC 0x00001000
510 #define VBOXVHWA_OVER_KEYSRCOVERRIDE 0x00002000
511 #define VBOXVHWA_OVER_SHOW 0x00004000
513 #define VBOXVHWA_CKEY_COLORSPACE 0x00000001
514 #define VBOXVHWA_CKEY_DESTBLT 0x00000002
515 #define VBOXVHWA_CKEY_DESTOVERLAY 0x00000004
516 #define VBOXVHWA_CKEY_SRCBLT 0x00000008
517 #define VBOXVHWA_CKEY_SRCOVERLAY 0x00000010
519 #define VBOXVHWA_BLT_ARITHSTRETCHY 0x00000001
520 #define VBOXVHWA_BLT_MIRRORLEFTRIGHT 0x00000002
521 #define VBOXVHWA_BLT_MIRRORUPDOWN 0x00000004
523 #define VBOXVHWA_OVERFX_ARITHSTRETCHY 0x00000001
524 #define VBOXVHWA_OVERFX_MIRRORLEFTRIGHT 0x00000002
525 #define VBOXVHWA_OVERFX_MIRRORUPDOWN 0x00000004
527 #define VBOXVHWA_CAPS2_CANRENDERWINDOWED 0x00080000
528 #define VBOXVHWA_CAPS2_WIDESURFACES 0x00001000
529 #define VBOXVHWA_CAPS2_COPYFOURCC 0x00008000
530 /*#define VBOXVHWA_CAPS2_FLIPINTERVAL 0x00200000*/
531 /*#define VBOXVHWA_CAPS2_FLIPNOVSYNC 0x00400000*/
534 #define VBOXVHWA_OFFSET64_VOID (UINT64_MAX)
536 typedef struct VBOXVHWA_VERSION
544 #define VBOXVHWA_VERSION_INIT(_pv) do { \
545 (_pv)->maj = VBOXVHWA_VERSION_MAJ; \
546 (_pv)->min = VBOXVHWA_VERSION_MIN; \
547 (_pv)->bld = VBOXVHWA_VERSION_BLD; \
548 (_pv)->reserved = VBOXVHWA_VERSION_RSV; \
551 typedef struct VBOXVHWACMD_QUERYINFO1
557 VBOXVHWA_VERSION guestVersion
;
566 uint32_t colorKeyCaps
;
568 uint32_t stretchCaps
;
569 uint32_t surfaceCaps
;
571 uint32_t numOverlays
;
572 uint32_t curOverlays
;
578 } VBOXVHWACMD_QUERYINFO1
;
580 typedef struct VBOXVHWACMD_QUERYINFO2
584 } VBOXVHWACMD_QUERYINFO2
;
586 #define VBOXVHWAINFO2_SIZE(_cFourCC) RT_OFFSETOF(VBOXVHWACMD_QUERYINFO2, FourCC[_cFourCC])
588 typedef struct VBOXVHWACMD_SURF_CANCREATE
590 VBOXVHWA_SURFACEDESC SurfInfo
;
595 uint32_t bIsDifferentPixelFormat
;
604 } VBOXVHWACMD_SURF_CANCREATE
;
606 typedef struct VBOXVHWACMD_SURF_CREATE
608 VBOXVHWA_SURFACEDESC SurfInfo
;
609 } VBOXVHWACMD_SURF_CREATE
;
611 #ifdef VBOX_WITH_WDDM
612 typedef struct VBOXVHWACMD_SURF_GETINFO
614 VBOXVHWA_SURFACEDESC SurfInfo
;
615 } VBOXVHWACMD_SURF_GETINFO
;
618 typedef struct VBOXVHWACMD_SURF_DESTROY
624 VBOXVHWA_SURFHANDLE hSurf
;
627 } VBOXVHWACMD_SURF_DESTROY
;
629 typedef struct VBOXVHWACMD_SURF_LOCK
635 VBOXVHWA_SURFHANDLE hSurf
;
642 } VBOXVHWACMD_SURF_LOCK
;
644 typedef struct VBOXVHWACMD_SURF_UNLOCK
650 VBOXVHWA_SURFHANDLE hSurf
;
651 uint32_t xUpdatedMemValid
;
653 VBOXVHWA_RECTL xUpdatedMemRect
;
656 } VBOXVHWACMD_SURF_UNLOCK
;
658 typedef struct VBOXVHWACMD_SURF_BLT
660 uint64_t DstGuestSurfInfo
;
661 uint64_t SrcGuestSurfInfo
;
666 VBOXVHWA_SURFHANDLE hDstSurf
;
667 uint64_t offDstSurface
;
668 VBOXVHWA_RECTL dstRect
;
669 VBOXVHWA_SURFHANDLE hSrcSurf
;
670 uint64_t offSrcSurface
;
671 VBOXVHWA_RECTL srcRect
;
673 uint32_t xUpdatedSrcMemValid
;
675 VBOXVHWA_RECTL xUpdatedSrcMemRect
;
678 } VBOXVHWACMD_SURF_BLT
;
680 #ifdef VBOX_WITH_WDDM
681 typedef struct VBOXVHWACMD_SURF_COLORFILL
687 VBOXVHWA_SURFHANDLE hSurf
;
689 uint32_t u32Reserved
;
691 VBOXVHWA_RECTL aRects
[1];
694 } VBOXVHWACMD_SURF_COLORFILL
;
697 typedef struct VBOXVHWACMD_SURF_FLIP
699 uint64_t TargGuestSurfInfo
;
700 uint64_t CurrGuestSurfInfo
;
705 VBOXVHWA_SURFHANDLE hTargSurf
;
706 uint64_t offTargSurface
;
707 VBOXVHWA_SURFHANDLE hCurrSurf
;
708 uint64_t offCurrSurface
;
710 uint32_t xUpdatedTargMemValid
;
711 VBOXVHWA_RECTL xUpdatedTargMemRect
;
714 } VBOXVHWACMD_SURF_FLIP
;
716 typedef struct VBOXVHWACMD_SURF_COLORKEY_SET
722 VBOXVHWA_SURFHANDLE hSurf
;
724 VBOXVHWA_COLORKEY CKey
;
729 } VBOXVHWACMD_SURF_COLORKEY_SET
;
731 #define VBOXVHWACMD_SURF_OVERLAY_UPDATE_F_SRCMEMRECT 0x00000001
732 #define VBOXVHWACMD_SURF_OVERLAY_UPDATE_F_DSTMEMRECT 0x00000002
734 typedef struct VBOXVHWACMD_SURF_OVERLAY_UPDATE
740 VBOXVHWA_SURFHANDLE hDstSurf
;
741 uint64_t offDstSurface
;
742 VBOXVHWA_RECTL dstRect
;
743 VBOXVHWA_SURFHANDLE hSrcSurf
;
744 uint64_t offSrcSurface
;
745 VBOXVHWA_RECTL srcRect
;
748 VBOXVHWA_OVERLAYFX desc
;
749 VBOXVHWA_RECTL xUpdatedSrcMemRect
;
750 VBOXVHWA_RECTL xUpdatedDstMemRect
;
753 }VBOXVHWACMD_SURF_OVERLAY_UPDATE
;
755 typedef struct VBOXVHWACMD_SURF_OVERLAY_SETPOSITION
761 VBOXVHWA_SURFHANDLE hDstSurf
;
762 uint64_t offDstSurface
;
763 VBOXVHWA_SURFHANDLE hSrcSurf
;
764 uint64_t offSrcSurface
;
771 } VBOXVHWACMD_SURF_OVERLAY_SETPOSITION
;
773 typedef struct VBOXVHWACMD_HH_CONSTRUCT
776 /* VRAM info for the backend to be able to properly translate VRAM offsets */
779 } VBOXVHWACMD_HH_CONSTRUCT
;
781 typedef struct VBOXVHWACMD_HH_SAVESTATE_SAVEPERFORM
783 struct SSMHANDLE
* pSSM
;
784 } VBOXVHWACMD_HH_SAVESTATE_SAVEPERFORM
;
786 typedef struct VBOXVHWACMD_HH_SAVESTATE_LOADPERFORM
788 struct SSMHANDLE
* pSSM
;
789 } VBOXVHWACMD_HH_SAVESTATE_LOADPERFORM
;
791 typedef DECLCALLBACK(void) FNVBOXVHWA_HH_CALLBACK(void*);
792 typedef FNVBOXVHWA_HH_CALLBACK
*PFNVBOXVHWA_HH_CALLBACK
;
794 #define VBOXVHWA_HH_CALLBACK_SET(_pCmd, _pfn, _parg) \
796 (_pCmd)->GuestVBVAReserved1 = (uint64_t)(uintptr_t)(_pfn); \
797 (_pCmd)->GuestVBVAReserved2 = (uint64_t)(uintptr_t)(_parg); \
800 #define VBOXVHWA_HH_CALLBACK_GET(_pCmd) ((PFNVBOXVHWA_HH_CALLBACK)(_pCmd)->GuestVBVAReserved1)
801 #define VBOXVHWA_HH_CALLBACK_GET_ARG(_pCmd) ((void*)(_pCmd)->GuestVBVAReserved2)
804 #endif /* #ifdef VBOX_WITH_VIDEOHWACCEL */
806 /* All structures are without alignment. */
809 typedef struct VBVAHOSTFLAGS
811 uint32_t u32HostEvents
;
812 uint32_t u32SupportedOrders
;
815 typedef struct VBVABUFFER
817 VBVAHOSTFLAGS hostFlags
;
819 /* The offset where the data start in the buffer. */
821 /* The offset where next data must be placed in the buffer. */
824 /* The queue of record descriptions. */
825 VBVARECORD aRecords
[VBVA_MAX_RECORDS
];
826 uint32_t indexRecordFirst
;
827 uint32_t indexRecordFree
;
829 /* Space to leave free in the buffer when large partial records are transferred. */
830 uint32_t cbPartialWriteThreshold
;
833 uint8_t au8Data
[1]; /* variable size for the rest of the VBVABUFFER area in VRAM. */
836 #define VBVA_MAX_RECORD_SIZE (128*_1M)
838 /* guest->host commands */
839 #define VBVA_QUERY_CONF32 1
840 #define VBVA_SET_CONF32 2
841 #define VBVA_INFO_VIEW 3
842 #define VBVA_INFO_HEAP 4
844 #define VBVA_INFO_SCREEN 6
845 #define VBVA_ENABLE 7
846 #define VBVA_MOUSE_POINTER_SHAPE 8
847 #ifdef VBOX_WITH_VIDEOHWACCEL
848 # define VBVA_VHWA_CMD 9
849 #endif /* # ifdef VBOX_WITH_VIDEOHWACCEL */
850 #ifdef VBOX_WITH_VDMA
851 # define VBVA_VDMA_CTL 10 /* setup G<->H DMA channel info */
852 # define VBVA_VDMA_CMD 11 /* G->H DMA command */
854 #define VBVA_INFO_CAPS 12 /* informs host about HGSMI caps. see VBVACAPS below */
855 #define VBVA_SCANLINE_CFG 13 /* configures scanline, see VBVASCANLINECFG below */
856 #define VBVA_SCANLINE_INFO 14 /* requests scanline info, see VBVASCANLINEINFO below */
857 #define VBVA_CMDVBVA_SUBMIT 16 /* inform host about VBVA Command submission */
858 #define VBVA_CMDVBVA_FLUSH 17 /* inform host about VBVA Command submission */
859 #define VBVA_CMDVBVA_CTL 18 /* G->H DMA command */
860 #define VBVA_QUERY_MODE_HINTS 19 /* Query most recent mode hints sent. */
861 /** Report the guest virtual desktop position and size for mapping host and
862 * guest pointer positions. */
863 #define VBVA_REPORT_INPUT_MAPPING 20
864 /** Report the guest cursor position and query the host position. */
865 #define VBVA_CURSOR_POSITION 21
867 /* host->guest commands */
868 #define VBVAHG_EVENT 1
869 #define VBVAHG_DISPLAY_CUSTOM 2
870 #ifdef VBOX_WITH_VDMA
871 #define VBVAHG_SHGSMI_COMPLETION 3
874 #ifdef VBOX_WITH_VIDEOHWACCEL
875 #define VBVAHG_DCUSTOM_VHWA_CMDCOMPLETE 1
877 typedef struct VBVAHOSTCMDVHWACMDCOMPLETE
880 }VBVAHOSTCMDVHWACMDCOMPLETE
;
882 #endif /* # ifdef VBOX_WITH_VIDEOHWACCEL */
887 VBVAHOSTCMD_OP_EVENT
= 1,
888 VBVAHOSTCMD_OP_CUSTOM
889 }VBVAHOSTCMD_OP_TYPE
;
891 typedef struct VBVAHOSTCMDEVENT
897 typedef struct VBVAHOSTCMD
899 /* destination ID if >=0 specifies display index, otherwize the command is directed to the miniport */
901 int32_t customOpCode
;
904 struct VBVAHOSTCMD
*pNext
;
906 uint64_t Data
; /* the body is 64-bit aligned */
911 #define VBVAHOSTCMD_SIZE(_size) (sizeof(VBVAHOSTCMD) + (_size))
912 #define VBVAHOSTCMD_BODY(_pCmd, _tBody) ((_tBody*)(_pCmd)->body)
913 #define VBVAHOSTCMD_HDR(_pBody) ((VBVAHOSTCMD*)(((uint8_t*)_pBody) - RT_OFFSETOF(VBVAHOSTCMD, body)))
914 #define VBVAHOSTCMD_HDRSIZE (RT_OFFSETOF(VBVAHOSTCMD, body))
918 /* VBVACONF32::u32Index */
919 #define VBOX_VBVA_CONF32_MONITOR_COUNT 0
920 #define VBOX_VBVA_CONF32_HOST_HEAP_SIZE 1
921 /** Returns VINF_SUCCESS if the host can report mode hints via VBVA.
922 * Set value to VERR_NOT_SUPPORTED before calling. */
923 #define VBOX_VBVA_CONF32_MODE_HINT_REPORTING 2
924 /** Returns VINF_SUCCESS if the host can report guest cursor enabled status via
925 * VBVA. Set value to VERR_NOT_SUPPORTED before calling. */
926 #define VBOX_VBVA_CONF32_GUEST_CURSOR_REPORTING 3
927 /** Returns the currently available host cursor capabilities. Available if
928 * VBVACONF32::VBOX_VBVA_CONF32_GUEST_CURSOR_REPORTING returns success.
929 * @see VMMDevReqMouseStatus::mouseFeatures. */
930 #define VBOX_VBVA_CONF32_CURSOR_CAPABILITIES 4
931 /** Returns the supported flags in VBVAINFOSCREEN::u8Flags. */
932 #define VBOX_VBVA_CONF32_SCREEN_FLAGS 5
933 /** Returns the max size of VBVA record. */
934 #define VBOX_VBVA_CONF32_MAX_RECORD_SIZE 6
936 typedef struct VBVACONF32
942 typedef struct VBVAINFOVIEW
944 /* Index of the screen, assigned by the guest. */
945 uint32_t u32ViewIndex
;
947 /* The screen offset in VRAM, the framebuffer starts here. */
948 uint32_t u32ViewOffset
;
950 /* The size of the VRAM memory that can be used for the view. */
951 uint32_t u32ViewSize
;
953 /* The recommended maximum size of the VRAM memory for the screen. */
954 uint32_t u32MaxScreenSize
;
957 typedef struct VBVAINFOHEAP
959 /* Absolute offset in VRAM of the start of the heap. */
960 uint32_t u32HeapOffset
;
962 /* The size of the heap. */
963 uint32_t u32HeapSize
;
967 typedef struct VBVAFLUSH
969 uint32_t u32Reserved
;
973 typedef struct VBVACMDVBVASUBMIT
975 uint32_t u32Reserved
;
978 /* flush is requested because due to guest command buffer overflow */
979 #define VBVACMDVBVAFLUSH_F_GUEST_BUFFER_OVERFLOW 1
981 typedef struct VBVACMDVBVAFLUSH
987 /* VBVAINFOSCREEN::u8Flags */
988 #define VBVA_SCREEN_F_NONE 0x0000
989 #define VBVA_SCREEN_F_ACTIVE 0x0001
990 /** The virtual monitor has been disabled by the guest and should be removed
991 * by the host and ignored for purposes of pointer position calculation. */
992 #define VBVA_SCREEN_F_DISABLED 0x0002
993 /** The virtual monitor has been blanked by the guest and should be blacked
994 * out by the host. */
995 #define VBVA_SCREEN_F_BLANK 0x0004
996 /** The virtual monitor has been blanked by the guest and should be blacked
997 * out by the host using the previous mode values for width. height, etc. */
998 #define VBVA_SCREEN_F_BLANK2 0x0008
1000 typedef struct VBVAINFOSCREEN
1002 /* Which view contains the screen. */
1003 uint32_t u32ViewIndex
;
1005 /* Physical X origin relative to the primary screen. */
1008 /* Physical Y origin relative to the primary screen. */
1011 /* Offset of visible framebuffer relative to the framebuffer start. */
1012 uint32_t u32StartOffset
;
1014 /* The scan line size in bytes. */
1015 uint32_t u32LineSize
;
1017 /* Width of the screen. */
1020 /* Height of the screen. */
1024 uint16_t u16BitsPerPixel
;
1026 /* VBVA_SCREEN_F_* */
1031 /* VBVAENABLE::u32Flags */
1032 #define VBVA_F_NONE 0x00000000
1033 #define VBVA_F_ENABLE 0x00000001
1034 #define VBVA_F_DISABLE 0x00000002
1035 /* extended VBVA to be used with WDDM */
1036 #define VBVA_F_EXTENDED 0x00000004
1037 /* vbva offset is absolute VRAM offset */
1038 #define VBVA_F_ABSOFFSET 0x00000008
1040 typedef struct VBVAENABLE
1047 typedef struct VBVAENABLE_EX
1050 uint32_t u32ScreenId
;
1054 typedef struct VBVAMOUSEPOINTERSHAPE
1056 /* The host result. */
1059 /* VBOX_MOUSE_POINTER_* bit flags. */
1062 /* X coordinate of the hot spot. */
1065 /* Y coordinate of the hot spot. */
1068 /* Width of the pointer in pixels. */
1071 /* Height of the pointer in scanlines. */
1077 * The data consists of 1 bpp AND mask followed by 32 bpp XOR (color) mask.
1079 * For pointers without alpha channel the XOR mask pixels are 32 bit values: (lsb)BGR0(msb).
1080 * For pointers with alpha channel the XOR mask consists of (lsb)BGRA(msb) 32 bit values.
1082 * Guest driver must create the AND mask for pointers with alpha channel, so if host does not
1083 * support alpha, the pointer could be displayed as a normal color pointer. The AND mask can
1084 * be constructed from alpha values. For example alpha value >= 0xf0 means bit 0 in the AND mask.
1086 * The AND mask is 1 bpp bitmap with byte aligned scanlines. Size of AND mask,
1087 * therefore, is cbAnd = (width + 7) / 8 * height. The padding bits at the
1088 * end of any scanline are undefined.
1090 * The XOR mask follows the AND mask on the next 4 bytes aligned offset:
1091 * uint8_t *pXor = pAnd + (cbAnd + 3) & ~3
1092 * Bytes in the gap between the AND and the XOR mask are undefined.
1093 * XOR mask scanlines have no gap between them and size of XOR mask is:
1094 * cXor = width * 4 * height.
1097 * Preallocate 4 bytes for accessing actual data as p->au8Data.
1101 } VBVAMOUSEPOINTERSHAPE
;
1103 /* the guest driver can handle asynch guest cmd completion by reading the command offset from io port */
1104 #define VBVACAPS_COMPLETEGCMD_BY_IOREAD 0x00000001
1105 /* the guest driver can handle video adapter IRQs */
1106 #define VBVACAPS_IRQ 0x00000002
1107 /** The guest can read video mode hints sent via VBVA. */
1108 #define VBVACAPS_VIDEO_MODE_HINTS 0x00000004
1109 /** The guest can switch to a software cursor on demand. */
1110 #define VBVACAPS_DISABLE_CURSOR_INTEGRATION 0x00000008
1111 /** The guest does not depend on host handling the VBE registers. */
1112 #define VBVACAPS_USE_VBVA_ONLY 0x00000010
1113 typedef struct VBVACAPS
1119 /* makes graphics device generate IRQ on VSYNC */
1120 #define VBVASCANLINECFG_ENABLE_VSYNC_IRQ 0x00000001
1121 /* guest driver may request the current scanline */
1122 #define VBVASCANLINECFG_ENABLE_SCANLINE_INFO 0x00000002
1123 /* request the current refresh period, returned in u32RefreshPeriodMs */
1124 #define VBVASCANLINECFG_QUERY_REFRESH_PERIOD 0x00000004
1125 /* set new refresh period specified in u32RefreshPeriodMs.
1126 * if used with VBVASCANLINECFG_QUERY_REFRESH_PERIOD,
1127 * u32RefreshPeriodMs is set to the previous refresh period on return */
1128 #define VBVASCANLINECFG_SET_REFRESH_PERIOD 0x00000008
1130 typedef struct VBVASCANLINECFG
1134 uint32_t u32RefreshPeriodMs
;
1135 uint32_t u32Reserved
;
1138 typedef struct VBVASCANLINEINFO
1141 uint32_t u32ScreenId
;
1142 uint32_t u32InVBlank
;
1143 uint32_t u32ScanLine
;
1146 /** Query the most recent mode hints received from the host. */
1147 typedef struct VBVAQUERYMODEHINTS
1149 /** The maximum number of screens to return hints for. */
1150 uint16_t cHintsQueried
;
1151 /** The size of the mode hint structures directly following this one. */
1152 uint16_t cbHintStructureGuest
;
1153 /** The return code for the operation. Initialise to VERR_NOT_SUPPORTED. */
1155 } VBVAQUERYMODEHINTS
;
1157 /** Structure in which a mode hint is returned. The guest allocates an array
1158 * of these immediately after the VBVAQUERYMODEHINTS structure. To accomodate
1159 * future extensions, the VBVAQUERYMODEHINTS structure specifies the size of
1160 * the VBVAMODEHINT structures allocated by the guest, and the host only fills
1161 * out structure elements which fit into that size. The host should fill any
1162 * unused members (e.g. dx, dy) or structure space on the end with ~0. The
1163 * whole structure can legally be set to ~0 to skip a screen. */
1164 typedef struct VBVAMODEHINT
1169 uint32_t cBPP
; /* Which has never been used... */
1171 uint32_t dx
; /**< X offset into the virtual frame-buffer. */
1172 uint32_t dy
; /**< Y offset into the virtual frame-buffer. */
1173 uint32_t fEnabled
; /* Not fFlags. Add new members for new flags. */
1176 #define VBVAMODEHINT_MAGIC UINT32_C(0x0801add9)
1178 /** Report the rectangle relative to which absolute pointer events should be
1179 * expressed. This information remains valid until the next VBVA resize event
1180 * for any screen, at which time it is reset to the bounding rectangle of all
1181 * virtual screens and must be re-set.
1182 * @see VBVA_REPORT_INPUT_MAPPING. */
1183 typedef struct VBVAREPORTINPUTMAPPING
1185 int32_t x
; /**< Upper left X co-ordinate relative to the first screen. */
1186 int32_t y
; /**< Upper left Y co-ordinate relative to the first screen. */
1187 uint32_t cx
; /**< Rectangle width. */
1188 uint32_t cy
; /**< Rectangle height. */
1189 } VBVAREPORTINPUTMAPPING
;
1191 /** Report the guest cursor position and query the host one. The host may wish
1192 * to use the guest information to re-position its own cursor (though this is
1193 * currently unlikely).
1194 * @see VBVA_CURSOR_POSITION */
1195 typedef struct VBVACURSORPOSITION
1197 uint32_t fReportPosition
; /**< Are we reporting a position? */
1198 uint32_t x
; /**< Guest cursor X position */
1199 uint32_t y
; /**< Guest cursor Y position */
1200 } VBVACURSORPOSITION
;
1204 typedef uint64_t VBOXVIDEOOFFSET
;
1206 #define VBOXVIDEOOFFSET_VOID ((VBOXVIDEOOFFSET)~0)
1211 * VBOXSHGSMI made on top HGSMI and allows receiving notifications
1212 * about G->H command completion
1214 /* SHGSMI command header */
1215 typedef struct VBOXSHGSMIHEADER
1217 uint64_t pvNext
; /*<- completion processing queue */
1218 uint32_t fFlags
; /*<- see VBOXSHGSMI_FLAG_XXX Flags */
1219 uint32_t cRefs
; /*<- command referece count */
1220 uint64_t u64Info1
; /*<- contents depends on the fFlags value */
1221 uint64_t u64Info2
; /*<- contents depends on the fFlags value */
1222 } VBOXSHGSMIHEADER
, *PVBOXSHGSMIHEADER
;
1226 VBOXVDMACMD_TYPE_UNDEFINED
= 0,
1227 VBOXVDMACMD_TYPE_DMA_PRESENT_BLT
= 1,
1228 VBOXVDMACMD_TYPE_DMA_BPB_TRANSFER
,
1229 VBOXVDMACMD_TYPE_DMA_BPB_FILL
,
1230 VBOXVDMACMD_TYPE_DMA_PRESENT_SHADOW2PRIMARY
,
1231 VBOXVDMACMD_TYPE_DMA_PRESENT_CLRFILL
,
1232 VBOXVDMACMD_TYPE_DMA_PRESENT_FLIP
,
1233 VBOXVDMACMD_TYPE_DMA_NOP
,
1234 VBOXVDMACMD_TYPE_CHROMIUM_CMD
, /* chromium cmd */
1235 VBOXVDMACMD_TYPE_DMA_BPB_TRANSFER_VRAMSYS
,
1236 VBOXVDMACMD_TYPE_CHILD_STATUS_IRQ
/* make the device notify child (monitor) state change IRQ */
1241 /* the command processing was asynch, set by the host to indicate asynch command completion
1242 * must not be cleared once set, the command completion is performed by issuing a host->guest completion command
1243 * while keeping this flag unchanged */
1244 #define VBOXSHGSMI_FLAG_HG_ASYNCH 0x00010000
1246 /* if set - asynch completion is performed by issuing the event,
1247 * if cleared - asynch completion is performed by calling a callback */
1248 #define VBOXSHGSMI_FLAG_GH_ASYNCH_EVENT 0x00000001
1250 /* issue interrupt on asynch completion, used for critical G->H commands,
1251 * i.e. for completion of which guest is waiting. */
1252 #define VBOXSHGSMI_FLAG_GH_ASYNCH_IRQ 0x00000002
1253 /* guest does not do any op on completion of this command,
1254 * the host may copy the command and indicate that it does not need the command anymore
1255 * by not setting VBOXSHGSMI_FLAG_HG_ASYNCH */
1256 #define VBOXSHGSMI_FLAG_GH_ASYNCH_NOCOMPLETION 0x00000004
1257 /* guest requires the command to be processed asynchronously,
1258 * not setting VBOXSHGSMI_FLAG_HG_ASYNCH by the host in this case is treated as command failure */
1259 #define VBOXSHGSMI_FLAG_GH_ASYNCH_FORCE 0x00000008
1260 /* force IRQ on cmd completion */
1261 #define VBOXSHGSMI_FLAG_GH_ASYNCH_IRQ_FORCE 0x00000010
1262 /* an IRQ-level callback is associated with the command */
1263 #define VBOXSHGSMI_FLAG_GH_ASYNCH_CALLBACK_IRQ 0x00000020
1264 /* guest expects this command to be completed synchronously */
1265 #define VBOXSHGSMI_FLAG_GH_SYNCH 0x00000040
1268 DECLINLINE(uint8_t *) VBoxSHGSMIBufferData (const VBOXSHGSMIHEADER
* pHeader
)
1270 return (uint8_t *)pHeader
+ sizeof (VBOXSHGSMIHEADER
);
1273 #define VBoxSHGSMIBufferHeaderSize() (sizeof (VBOXSHGSMIHEADER))
1275 DECLINLINE(PVBOXSHGSMIHEADER
) VBoxSHGSMIBufferHeader (const void *pvData
)
1277 return (PVBOXSHGSMIHEADER
)((uint8_t *)pvData
- sizeof (VBOXSHGSMIHEADER
));
1280 #ifdef VBOX_WITH_VDMA
1283 /* VDMA - Video DMA */
1285 /* VDMA Control API */
1286 /* VBOXVDMA_CTL::u32Flags */
1289 VBOXVDMA_CTL_TYPE_NONE
= 0,
1290 VBOXVDMA_CTL_TYPE_ENABLE
,
1291 VBOXVDMA_CTL_TYPE_DISABLE
,
1292 VBOXVDMA_CTL_TYPE_FLUSH
,
1293 VBOXVDMA_CTL_TYPE_WATCHDOG
1294 } VBOXVDMA_CTL_TYPE
;
1296 typedef struct VBOXVDMA_CTL
1298 VBOXVDMA_CTL_TYPE enmCtl
;
1301 } VBOXVDMA_CTL
, *PVBOXVDMA_CTL
;
1303 typedef struct VBOXVDMA_RECTL
1309 } VBOXVDMA_RECTL
, *PVBOXVDMA_RECTL
;
1313 VBOXVDMA_PIXEL_FORMAT_UNKNOWN
= 0,
1314 VBOXVDMA_PIXEL_FORMAT_R8G8B8
= 20,
1315 VBOXVDMA_PIXEL_FORMAT_A8R8G8B8
= 21,
1316 VBOXVDMA_PIXEL_FORMAT_X8R8G8B8
= 22,
1317 VBOXVDMA_PIXEL_FORMAT_R5G6B5
= 23,
1318 VBOXVDMA_PIXEL_FORMAT_X1R5G5B5
= 24,
1319 VBOXVDMA_PIXEL_FORMAT_A1R5G5B5
= 25,
1320 VBOXVDMA_PIXEL_FORMAT_A4R4G4B4
= 26,
1321 VBOXVDMA_PIXEL_FORMAT_R3G3B2
= 27,
1322 VBOXVDMA_PIXEL_FORMAT_A8
= 28,
1323 VBOXVDMA_PIXEL_FORMAT_A8R3G3B2
= 29,
1324 VBOXVDMA_PIXEL_FORMAT_X4R4G4B4
= 30,
1325 VBOXVDMA_PIXEL_FORMAT_A2B10G10R10
= 31,
1326 VBOXVDMA_PIXEL_FORMAT_A8B8G8R8
= 32,
1327 VBOXVDMA_PIXEL_FORMAT_X8B8G8R8
= 33,
1328 VBOXVDMA_PIXEL_FORMAT_G16R16
= 34,
1329 VBOXVDMA_PIXEL_FORMAT_A2R10G10B10
= 35,
1330 VBOXVDMA_PIXEL_FORMAT_A16B16G16R16
= 36,
1331 VBOXVDMA_PIXEL_FORMAT_A8P8
= 40,
1332 VBOXVDMA_PIXEL_FORMAT_P8
= 41,
1333 VBOXVDMA_PIXEL_FORMAT_L8
= 50,
1334 VBOXVDMA_PIXEL_FORMAT_A8L8
= 51,
1335 VBOXVDMA_PIXEL_FORMAT_A4L4
= 52,
1336 VBOXVDMA_PIXEL_FORMAT_V8U8
= 60,
1337 VBOXVDMA_PIXEL_FORMAT_L6V5U5
= 61,
1338 VBOXVDMA_PIXEL_FORMAT_X8L8V8U8
= 62,
1339 VBOXVDMA_PIXEL_FORMAT_Q8W8V8U8
= 63,
1340 VBOXVDMA_PIXEL_FORMAT_V16U16
= 64,
1341 VBOXVDMA_PIXEL_FORMAT_W11V11U10
= 65,
1342 VBOXVDMA_PIXEL_FORMAT_A2W10V10U10
= 67
1343 } VBOXVDMA_PIXEL_FORMAT
;
1345 typedef struct VBOXVDMA_SURF_DESC
1349 VBOXVDMA_PIXEL_FORMAT format
;
1353 } VBOXVDMA_SURF_DESC
, *PVBOXVDMA_SURF_DESC
;
1355 /*typedef uint64_t VBOXVDMAPHADDRESS;*/
1356 typedef uint64_t VBOXVDMASURFHANDLE
;
1358 /* region specified as a rectangle, otherwize it is a size of memory pointed to by phys address */
1359 #define VBOXVDMAOPERAND_FLAGS_RECTL 0x1
1360 /* Surface handle is valid */
1361 #define VBOXVDMAOPERAND_FLAGS_PRIMARY 0x2
1362 /* address is offset in VRAM */
1363 #define VBOXVDMAOPERAND_FLAGS_VRAMOFFSET 0x4
1366 /* VBOXVDMACBUF_DR::phBuf specifies offset in VRAM */
1367 #define VBOXVDMACBUF_FLAG_BUF_VRAM_OFFSET 0x00000001
1368 /* command buffer follows the VBOXVDMACBUF_DR in VRAM, VBOXVDMACBUF_DR::phBuf is ignored */
1369 #define VBOXVDMACBUF_FLAG_BUF_FOLLOWS_DR 0x00000002
1372 * We can not submit the DMA command via VRAM since we do not have control over
1373 * DMA command buffer [de]allocation, i.e. we only control the buffer contents.
1374 * In other words the system may call one of our callbacks to fill a command buffer
1375 * with the necessary commands and then discard the buffer w/o any notification.
1377 * We have only DMA command buffer physical address at submission time.
1379 * so the only way is to */
1380 typedef struct VBOXVDMACBUF_DR
1384 /* RT_SUCCESS() - on success
1385 * VERR_INTERRUPTED - on preemption
1386 * VERR_xxx - on error */
1391 VBOXVIDEOOFFSET offVramBuf
;
1393 uint64_t aGuestData
[7];
1394 } VBOXVDMACBUF_DR
, *PVBOXVDMACBUF_DR
;
1396 #define VBOXVDMACBUF_DR_TAIL(_pCmd, _t) ( (_t*)(((uint8_t*)(_pCmd)) + sizeof (VBOXVDMACBUF_DR)) )
1397 #define VBOXVDMACBUF_DR_FROM_TAIL(_pCmd) ( (VBOXVDMACBUF_DR*)(((uint8_t*)(_pCmd)) - sizeof (VBOXVDMACBUF_DR)) )
1399 typedef struct VBOXVDMACMD
1401 VBOXVDMACMD_TYPE enmType
;
1402 uint32_t u32CmdSpecific
;
1403 } VBOXVDMACMD
, *PVBOXVDMACMD
;
1405 #define VBOXVDMACMD_HEADER_SIZE() sizeof (VBOXVDMACMD)
1406 #define VBOXVDMACMD_SIZE_FROMBODYSIZE(_s) (VBOXVDMACMD_HEADER_SIZE() + (_s))
1407 #define VBOXVDMACMD_SIZE(_t) (VBOXVDMACMD_SIZE_FROMBODYSIZE(sizeof (_t)))
1408 #define VBOXVDMACMD_BODY(_pCmd, _t) ( (_t*)(((uint8_t*)(_pCmd)) + VBOXVDMACMD_HEADER_SIZE()) )
1409 #define VBOXVDMACMD_BODY_SIZE(_s) ( (_s) - VBOXVDMACMD_HEADER_SIZE() )
1410 #define VBOXVDMACMD_FROM_BODY(_pCmd) ( (VBOXVDMACMD*)(((uint8_t*)(_pCmd)) - VBOXVDMACMD_HEADER_SIZE()) )
1411 #define VBOXVDMACMD_BODY_FIELD_OFFSET(_ot, _t, _f) ( (_ot)(uintptr_t)( VBOXVDMACMD_BODY(0, uint8_t) + RT_OFFSETOF(_t, _f) ) )
1413 typedef struct VBOXVDMACMD_DMA_PRESENT_BLT
1415 VBOXVIDEOOFFSET offSrc
;
1416 VBOXVIDEOOFFSET offDst
;
1417 VBOXVDMA_SURF_DESC srcDesc
;
1418 VBOXVDMA_SURF_DESC dstDesc
;
1419 VBOXVDMA_RECTL srcRectl
;
1420 VBOXVDMA_RECTL dstRectl
;
1421 uint32_t u32Reserved
;
1422 uint32_t cDstSubRects
;
1423 VBOXVDMA_RECTL aDstSubRects
[1];
1424 } VBOXVDMACMD_DMA_PRESENT_BLT
, *PVBOXVDMACMD_DMA_PRESENT_BLT
;
1426 typedef struct VBOXVDMACMD_DMA_PRESENT_SHADOW2PRIMARY
1428 VBOXVDMA_RECTL Rect
;
1429 } VBOXVDMACMD_DMA_PRESENT_SHADOW2PRIMARY
, *PVBOXVDMACMD_DMA_PRESENT_SHADOW2PRIMARY
;
1432 #define VBOXVDMACMD_DMA_BPB_TRANSFER_F_SRC_VRAMOFFSET 0x00000001
1433 #define VBOXVDMACMD_DMA_BPB_TRANSFER_F_DST_VRAMOFFSET 0x00000002
1435 typedef struct VBOXVDMACMD_DMA_BPB_TRANSFER
1437 uint32_t cbTransferSize
;
1442 VBOXVIDEOOFFSET offVramBuf
;
1447 VBOXVIDEOOFFSET offVramBuf
;
1449 } VBOXVDMACMD_DMA_BPB_TRANSFER
, *PVBOXVDMACMD_DMA_BPB_TRANSFER
;
1451 #define VBOXVDMACMD_SYSMEMEL_F_PAGELIST 0x00000001
1453 typedef struct VBOXVDMACMD_SYSMEMEL
1458 } VBOXVDMACMD_SYSMEMEL
, *PVBOXVDMACMD_SYSMEMEL
;
1460 #define VBOXVDMACMD_SYSMEMEL_NEXT(_pEl) (((_pEl)->fFlags & VBOXVDMACMD_SYSMEMEL_F_PAGELIST) ? \
1461 ((PVBOXVDMACMD_SYSMEMEL)(((uint8_t*)(_pEl))+RT_OFFSETOF(VBOXVDMACMD_SYSMEMEL, phBuf[(_pEl)->cPages]))) \
1465 #define VBOXVDMACMD_DMA_BPB_TRANSFER_VRAMSYS_SYS2VRAM 0x00000001
1467 typedef struct VBOXVDMACMD_DMA_BPB_TRANSFER_VRAMSYS
1469 uint32_t cTransferPages
;
1471 VBOXVIDEOOFFSET offVramBuf
;
1472 VBOXVDMACMD_SYSMEMEL FirstEl
;
1473 } VBOXVDMACMD_DMA_BPB_TRANSFER_VRAMSYS
, *PVBOXVDMACMD_DMA_BPB_TRANSFER_VRAMSYS
;
1475 typedef struct VBOXVDMACMD_DMA_BPB_FILL
1477 VBOXVIDEOOFFSET offSurf
;
1478 uint32_t cbFillSize
;
1479 uint32_t u32FillPattern
;
1480 } VBOXVDMACMD_DMA_BPB_FILL
, *PVBOXVDMACMD_DMA_BPB_FILL
;
1482 #define VBOXVDMA_CHILD_STATUS_F_CONNECTED 0x01
1483 #define VBOXVDMA_CHILD_STATUS_F_DISCONNECTED 0x02
1484 #define VBOXVDMA_CHILD_STATUS_F_ROTATED 0x04
1486 typedef struct VBOXVDMA_CHILD_STATUS
1490 uint8_t u8RotationAngle
;
1491 uint16_t u16Reserved
;
1492 } VBOXVDMA_CHILD_STATUS
, *PVBOXVDMA_CHILD_STATUS
;
1494 /* apply the aInfos are applied to all targets, the iTarget is ignored */
1495 #define VBOXVDMACMD_CHILD_STATUS_IRQ_F_APPLY_TO_ALL 0x00000001
1497 typedef struct VBOXVDMACMD_CHILD_STATUS_IRQ
1501 VBOXVDMA_CHILD_STATUS aInfos
[1];
1502 } VBOXVDMACMD_CHILD_STATUS_IRQ
, *PVBOXVDMACMD_CHILD_STATUS_IRQ
;
1505 #endif /* #ifdef VBOX_WITH_VDMA */
1508 typedef struct VBOXVDMACMD_CHROMIUM_BUFFER
1510 VBOXVIDEOOFFSET offBuffer
;
1512 uint32_t u32GuestData
;
1513 uint64_t u64GuestData
;
1514 } VBOXVDMACMD_CHROMIUM_BUFFER
, *PVBOXVDMACMD_CHROMIUM_BUFFER
;
1516 typedef struct VBOXVDMACMD_CHROMIUM_CMD
1519 uint32_t u32Reserved
;
1520 VBOXVDMACMD_CHROMIUM_BUFFER aBuffers
[1];
1521 } VBOXVDMACMD_CHROMIUM_CMD
, *PVBOXVDMACMD_CHROMIUM_CMD
;
1525 VBOXVDMACMD_CHROMIUM_CTL_TYPE_UNKNOWN
= 0,
1526 VBOXVDMACMD_CHROMIUM_CTL_TYPE_CRHGSMI_SETUP
,
1527 VBOXVDMACMD_CHROMIUM_CTL_TYPE_SAVESTATE_BEGIN
,
1528 VBOXVDMACMD_CHROMIUM_CTL_TYPE_SAVESTATE_END
,
1529 VBOXVDMACMD_CHROMIUM_CTL_TYPE_CRHGSMI_SETUP_MAINCB
,
1530 VBOXVDMACMD_CHROMIUM_CTL_TYPE_CRCONNECT
,
1531 VBOXVDMACMD_CHROMIUM_CTL_TYPE_SIZEHACK
= 0x7fffffff
1532 } VBOXVDMACMD_CHROMIUM_CTL_TYPE
;
1534 typedef struct VBOXVDMACMD_CHROMIUM_CTL
1536 VBOXVDMACMD_CHROMIUM_CTL_TYPE enmType
;
1538 } VBOXVDMACMD_CHROMIUM_CTL
, *PVBOXVDMACMD_CHROMIUM_CTL
;
1541 typedef struct PDMIDISPLAYVBVACALLBACKS
*HCRHGSMICMDCOMPLETION
;
1542 typedef DECLCALLBACK(int) FNCRHGSMICMDCOMPLETION(HCRHGSMICMDCOMPLETION hCompletion
, PVBOXVDMACMD_CHROMIUM_CMD pCmd
, int rc
);
1543 typedef FNCRHGSMICMDCOMPLETION
*PFNCRHGSMICMDCOMPLETION
;
1545 /* tells whether 3D backend has some 3D overlay data displayed */
1546 typedef DECLCALLBACK(bool) FNCROGLHASDATA(void);
1547 typedef FNCROGLHASDATA
*PFNCROGLHASDATA
;
1549 /* same as PFNCROGLHASDATA, but for specific screen */
1550 typedef DECLCALLBACK(bool) FNCROGLHASDATAFORSCREEN(uint32_t i32ScreenID
);
1551 typedef FNCROGLHASDATAFORSCREEN
*PFNCROGLHASDATAFORSCREEN
;
1553 /* callbacks chrogl gives to main */
1554 typedef struct CR_MAIN_INTERFACE
1556 PFNCROGLHASDATA pfnHasData
;
1557 PFNCROGLHASDATAFORSCREEN pfnHasDataForScreen
;
1558 } CR_MAIN_INTERFACE
;
1560 typedef struct VBOXVDMACMD_CHROMIUM_CTL_CRHGSMI_SETUP_MAINCB
1562 VBOXVDMACMD_CHROMIUM_CTL Hdr
;
1564 HCRHGSMICMDCOMPLETION hCompletion
;
1565 PFNCRHGSMICMDCOMPLETION pfnCompletion
;
1567 CR_MAIN_INTERFACE MainInterface
;
1568 } VBOXVDMACMD_CHROMIUM_CTL_CRHGSMI_SETUP_MAINCB
, *PVBOXVDMACMD_CHROMIUM_CTL_CRHGSMI_SETUP_MAINCB
;
1570 typedef struct VBOXCRCON_SERVER
*HVBOXCRCON_SERVER
;
1571 typedef struct PDMIDISPLAYVBVACALLBACKS
* HVBOXCRCON_CLIENT
;
1573 typedef struct VBOXCRCON_3DRGN_CLIENT
* HVBOXCRCON_3DRGN_CLIENT
;
1574 typedef struct VBOXCRCON_3DRGN_ASYNCCLIENT
* HVBOXCRCON_3DRGN_ASYNCCLIENT
;
1576 /* server callbacks */
1577 /* submit chromium cmd */
1578 typedef DECLCALLBACK(int) FNVBOXCRCON_SVR_CRCMD(HVBOXCRCON_SERVER hServer
, PVBOXVDMACMD_CHROMIUM_CMD pCmd
, uint32_t cbCmd
);
1579 typedef FNVBOXCRCON_SVR_CRCMD
*PFNVBOXCRCON_SVR_CRCMD
;
1581 /* submit chromium control cmd */
1582 typedef DECLCALLBACK(int) FNVBOXCRCON_SVR_CRCTL(HVBOXCRCON_SERVER hServer
, PVBOXVDMACMD_CHROMIUM_CTL pCtl
, uint32_t cbCmd
);
1583 typedef FNVBOXCRCON_SVR_CRCTL
*PFNVBOXCRCON_SVR_CRCTL
;
1586 * The protocol is the following:
1587 * 1. if there is no 3D data displayed on screen, returns VINF_EOF immediately w/o calling any PFNVBOXCRCON_3DRGN_XXX callbacks
1588 * 2. otherwise calls PFNVBOXCRCON_3DRGN_ONSUBMIT, submits the "regions get" request to the CrOpenGL server to process it asynchronously and returns VINF_SUCCESS
1589 * 2.a on "regions get" request processing calls PFNVBOXCRCON_3DRGN_BEGIN,
1590 * 2.b then PFNVBOXCRCON_3DRGN_REPORT zero or more times for each 3D region,
1591 * 2.c and then PFNVBOXCRCON_3DRGN_END
1592 * 3. returns VERR_XXX code on failure
1594 typedef DECLCALLBACK(int) FNVBOXCRCON_SVR_3DRGN_GET(HVBOXCRCON_SERVER hServer
, HVBOXCRCON_3DRGN_CLIENT hRgnClient
, uint32_t idScreen
);
1595 typedef FNVBOXCRCON_SVR_3DRGN_GET
*PFNVBOXCRCON_SVR_3DRGN_GET
;
1597 /* 3D Regions Client callbacks */
1598 /* called from the PFNVBOXCRCON_SVR_3DRGN_GET callback in case server has 3D data and is going to process the request asynchronously,
1599 * see comments for PFNVBOXCRCON_SVR_3DRGN_GET above */
1600 typedef DECLCALLBACK(int) FNVBOXCRCON_3DRGN_ONSUBMIT(HVBOXCRCON_3DRGN_CLIENT hRgnClient
, uint32_t idScreen
, HVBOXCRCON_3DRGN_ASYNCCLIENT
*phRgnAsyncClient
);
1601 typedef FNVBOXCRCON_3DRGN_ONSUBMIT
*PFNVBOXCRCON_3DRGN_ONSUBMIT
;
1603 /* called from the "regions get" command processing thread, to indicate that the "regions get" is started.
1604 * see comments for PFNVBOXCRCON_SVR_3DRGN_GET above */
1605 typedef DECLCALLBACK(int) FNVBOXCRCON_3DRGN_BEGIN(HVBOXCRCON_3DRGN_ASYNCCLIENT hRgnAsyncClient
, uint32_t idScreen
);
1606 typedef FNVBOXCRCON_3DRGN_BEGIN
*PFNVBOXCRCON_3DRGN_BEGIN
;
1608 /* called from the "regions get" command processing thread, to report a 3D region.
1609 * see comments for PFNVBOXCRCON_SVR_3DRGN_GET above */
1610 typedef DECLCALLBACK(int) FNVBOXCRCON_3DRGN_REPORT(HVBOXCRCON_3DRGN_ASYNCCLIENT hRgnAsyncClient
, uint32_t idScreen
, void *pvData
, uint32_t cbStride
, const RTRECT
*pRect
);
1611 typedef FNVBOXCRCON_3DRGN_REPORT
*PFNVBOXCRCON_3DRGN_REPORT
;
1613 /* called from the "regions get" command processing thread, to indicate that the "regions get" is completed.
1614 * see comments for PFNVBOXCRCON_SVR_3DRGN_GET above */
1615 typedef DECLCALLBACK(int) FNVBOXCRCON_3DRGN_END(HVBOXCRCON_3DRGN_ASYNCCLIENT hRgnAsyncClient
, uint32_t idScreen
);
1616 typedef FNVBOXCRCON_3DRGN_END
*PFNVBOXCRCON_3DRGN_END
;
1619 /* client callbacks */
1620 /* complete chromium cmd */
1621 typedef DECLCALLBACK(int) FNVBOXCRCON_CLT_CRCTL_COMPLETE(HVBOXCRCON_CLIENT hClient
, PVBOXVDMACMD_CHROMIUM_CTL pCtl
, int rc
);
1622 typedef FNVBOXCRCON_CLT_CRCTL_COMPLETE
*PFNVBOXCRCON_CLT_CRCTL_COMPLETE
;
1624 /* complete chromium control cmd */
1625 typedef DECLCALLBACK(int) FNVBOXCRCON_CLT_CRCMD_COMPLETE(HVBOXCRCON_CLIENT hClient
, PVBOXVDMACMD_CHROMIUM_CMD pCmd
, int rc
);
1626 typedef FNVBOXCRCON_CLT_CRCMD_COMPLETE
*PFNVBOXCRCON_CLT_CRCMD_COMPLETE
;
1628 typedef struct VBOXCRCON_SERVER_CALLBACKS
1630 HVBOXCRCON_SERVER hServer
;
1631 PFNVBOXCRCON_SVR_CRCMD pfnCrCmd
;
1632 PFNVBOXCRCON_SVR_CRCTL pfnCrCtl
;
1633 PFNVBOXCRCON_SVR_3DRGN_GET pfn3DRgnGet
;
1634 } VBOXCRCON_SERVER_CALLBACKS
, *PVBOXCRCON_SERVER_CALLBACKS
;
1636 typedef struct VBOXCRCON_CLIENT_CALLBACKS
1638 HVBOXCRCON_CLIENT hClient
;
1639 PFNVBOXCRCON_CLT_CRCMD_COMPLETE pfnCrCmdComplete
;
1640 PFNVBOXCRCON_CLT_CRCTL_COMPLETE pfnCrCtlComplete
;
1641 PFNVBOXCRCON_3DRGN_ONSUBMIT pfn3DRgnOnSubmit
;
1642 PFNVBOXCRCON_3DRGN_BEGIN pfn3DRgnBegin
;
1643 PFNVBOXCRCON_3DRGN_REPORT pfn3DRgnReport
;
1644 PFNVBOXCRCON_3DRGN_END pfn3DRgnEnd
;
1645 } VBOXCRCON_CLIENT_CALLBACKS
, *PVBOXCRCON_CLIENT_CALLBACKS
;
1647 /* issued by Main to establish connection between Main and CrOpenGL service */
1648 typedef struct VBOXVDMACMD_CHROMIUM_CTL_CRCONNECT
1650 VBOXVDMACMD_CHROMIUM_CTL Hdr
;
1651 /*input (filled by Client) :*/
1652 /*class VMMDev*/void *pVMMDev
;
1653 VBOXCRCON_CLIENT_CALLBACKS ClientCallbacks
;
1654 /*output (filled by Server) :*/
1655 VBOXCRCON_SERVER_CALLBACKS ServerCallbacks
;
1656 } VBOXVDMACMD_CHROMIUM_CTL_CRCONNECT
, *PVBOXVDMACMD_CHROMIUM_CTL_CRCONNECT
;
1658 /* ring command buffer dr */
1659 #define VBOXCMDVBVA_STATE_SUBMITTED 1
1660 #define VBOXCMDVBVA_STATE_CANCELLED 2
1661 #define VBOXCMDVBVA_STATE_IN_PROGRESS 3
1662 /* the "completed" state is signalled via the ring buffer values */
1664 /* CrHgsmi command */
1665 #define VBOXCMDVBVA_OPTYPE_CRCMD 1
1666 /* blit command that does blitting of allocations identified by VRAM offset or host id
1667 * for VRAM-offset ones the size and format are same as primary */
1668 #define VBOXCMDVBVA_OPTYPE_BLT 2
1670 #define VBOXCMDVBVA_OPTYPE_FLIP 3
1672 #define VBOXCMDVBVA_OPTYPE_CLRFILL 4
1673 /* allocation paging transfer request */
1674 #define VBOXCMDVBVA_OPTYPE_PAGING_TRANSFER 5
1675 /* allocation paging fill request */
1676 #define VBOXCMDVBVA_OPTYPE_PAGING_FILL 6
1677 /* same as VBOXCMDVBVA_OPTYPE_NOP, but contains VBOXCMDVBVA_HDR data */
1678 #define VBOXCMDVBVA_OPTYPE_NOPCMD 7
1679 /* actual command is stored in guest system memory */
1680 #define VBOXCMDVBVA_OPTYPE_SYSMEMCMD 8
1681 /* complex command - i.e. can contain multiple commands
1682 * i.e. the VBOXCMDVBVA_OPTYPE_COMPLEXCMD VBOXCMDVBVA_HDR is followed
1683 * by one or more VBOXCMDVBVA_HDR commands.
1684 * Each command's size is specified in it's VBOXCMDVBVA_HDR's u32FenceID field */
1685 #define VBOXCMDVBVA_OPTYPE_COMPLEXCMD 9
1687 /* nop - is a one-bit command. The buffer size to skip is determined by VBVA buffer size */
1688 #define VBOXCMDVBVA_OPTYPE_NOP 0x80
1691 /* transfer from RAM to Allocation */
1692 #define VBOXCMDVBVA_OPF_PAGING_TRANSFER_IN 0x80
1694 #define VBOXCMDVBVA_OPF_BLT_TYPE_SAMEDIM_A8R8G8B8 0
1695 #define VBOXCMDVBVA_OPF_BLT_TYPE_GENERIC_A8R8G8B8 1
1696 #define VBOXCMDVBVA_OPF_BLT_TYPE_OFFPRIMSZFMT_OR_ID 2
1698 #define VBOXCMDVBVA_OPF_BLT_TYPE_MASK 3
1701 #define VBOXCMDVBVA_OPF_CLRFILL_TYPE_GENERIC_A8R8G8B8 0
1703 #define VBOXCMDVBVA_OPF_CLRFILL_TYPE_MASK 1
1706 /* blit direction is from first operand to second */
1707 #define VBOXCMDVBVA_OPF_BLT_DIR_IN_2 0x10
1708 /* operand 1 contains host id */
1709 #define VBOXCMDVBVA_OPF_OPERAND1_ISID 0x20
1710 /* operand 2 contains host id */
1711 #define VBOXCMDVBVA_OPF_OPERAND2_ISID 0x40
1712 /* primary hint id is src */
1713 #define VBOXCMDVBVA_OPF_PRIMARY_HINT_SRC 0x80
1715 /* trying to make the header as small as possible,
1716 * we'd have pretty few op codes actually, so 8bit is quite enough,
1717 * we will be able to extend it in any way. */
1718 typedef struct VBOXCMDVBVA_HDR
1720 /* one VBOXCMDVBVA_OPTYPE_XXX, except NOP, see comments above */
1723 * VBOXCMDVBVA_OPTYPE_CRCMD - must be null
1724 * VBOXCMDVBVA_OPTYPE_BLT - OR-ed VBOXCMDVBVA_OPF_ALLOC_XXX flags
1725 * VBOXCMDVBVA_OPTYPE_PAGING_TRANSFER - must be null
1726 * VBOXCMDVBVA_OPTYPE_PAGING_FILL - must be null
1727 * VBOXCMDVBVA_OPTYPE_NOPCMD - must be null
1728 * VBOXCMDVBVA_OPTYPE_NOP - not applicable (as the entire VBOXCMDVBVA_HDR is not valid) */
1730 /* one of VBOXCMDVBVA_STATE_XXX*/
1731 volatile uint8_t u8State
;
1734 /* result, 0 on success, otherwise contains the failure code TBD */
1736 uint8_t u8PrimaryID
;
1740 /* complex command (VBOXCMDVBVA_OPTYPE_COMPLEXCMD) element data */
1743 /* command length */
1744 uint16_t u16CbCmdHost
;
1745 /* guest-specific data, host expects it to be NULL */
1746 uint16_t u16CbCmdGuest
;
1748 /* DXGK DDI fence ID */
1749 uint32_t u32FenceID
;
1753 typedef uint32_t VBOXCMDVBVAOFFSET
;
1754 typedef uint64_t VBOXCMDVBVAPHADDR
;
1755 typedef uint32_t VBOXCMDVBVAPAGEIDX
;
1757 typedef struct VBOXCMDVBVA_CRCMD_BUFFER
1760 VBOXCMDVBVAOFFSET offBuffer
;
1761 } VBOXCMDVBVA_CRCMD_BUFFER
;
1763 typedef struct VBOXCMDVBVA_CRCMD_CMD
1766 VBOXCMDVBVA_CRCMD_BUFFER aBuffers
[1];
1767 } VBOXCMDVBVA_CRCMD_CMD
;
1769 typedef struct VBOXCMDVBVA_CRCMD
1771 VBOXCMDVBVA_HDR Hdr
;
1772 VBOXCMDVBVA_CRCMD_CMD Cmd
;
1773 } VBOXCMDVBVA_CRCMD
;
1775 typedef struct VBOXCMDVBVA_ALLOCINFO
1779 VBOXCMDVBVAOFFSET offVRAM
;
1782 } VBOXCMDVBVA_ALLOCINFO
;
1784 typedef struct VBOXCMDVBVA_ALLOCDESC
1786 VBOXCMDVBVA_ALLOCINFO Info
;
1789 } VBOXCMDVBVA_ALLOCDESC
;
1791 typedef struct VBOXCMDVBVA_RECT
1793 /** Coordinates of affected rectangle. */
1800 typedef struct VBOXCMDVBVA_POINT
1804 } VBOXCMDVBVA_POINT
;
1806 typedef struct VBOXCMDVBVA_BLT_HDR
1808 VBOXCMDVBVA_HDR Hdr
;
1809 VBOXCMDVBVA_POINT Pos
;
1810 } VBOXCMDVBVA_BLT_HDR
;
1812 typedef struct VBOXCMDVBVA_BLT_PRIMARY
1814 VBOXCMDVBVA_BLT_HDR Hdr
;
1815 VBOXCMDVBVA_ALLOCINFO alloc
;
1816 /* the rects count is determined from the command size */
1817 VBOXCMDVBVA_RECT aRects
[1];
1818 } VBOXCMDVBVA_BLT_PRIMARY
;
1820 typedef struct VBOXCMDVBVA_BLT_PRIMARY_GENERIC_A8R8G8B8
1822 VBOXCMDVBVA_BLT_HDR Hdr
;
1823 VBOXCMDVBVA_ALLOCDESC alloc
;
1824 /* the rects count is determined from the command size */
1825 VBOXCMDVBVA_RECT aRects
[1];
1826 } VBOXCMDVBVA_BLT_PRIMARY_GENERIC_A8R8G8B8
;
1828 typedef struct VBOXCMDVBVA_BLT_OFFPRIMSZFMT_OR_ID
1830 VBOXCMDVBVA_BLT_HDR Hdr
;
1831 VBOXCMDVBVA_ALLOCINFO alloc
;
1833 /* the rects count is determined from the command size */
1834 VBOXCMDVBVA_RECT aRects
[1];
1835 } VBOXCMDVBVA_BLT_OFFPRIMSZFMT_OR_ID
;
1837 typedef struct VBOXCMDVBVA_BLT_SAMEDIM_A8R8G8B8
1839 VBOXCMDVBVA_BLT_HDR Hdr
;
1840 VBOXCMDVBVA_ALLOCDESC alloc1
;
1841 VBOXCMDVBVA_ALLOCINFO info2
;
1842 /* the rects count is determined from the command size */
1843 VBOXCMDVBVA_RECT aRects
[1];
1844 } VBOXCMDVBVA_BLT_SAMEDIM_A8R8G8B8
;
1846 typedef struct VBOXCMDVBVA_BLT_GENERIC_A8R8G8B8
1848 VBOXCMDVBVA_BLT_HDR Hdr
;
1849 VBOXCMDVBVA_ALLOCDESC alloc1
;
1850 VBOXCMDVBVA_ALLOCDESC alloc2
;
1851 /* the rects count is determined from the command size */
1852 VBOXCMDVBVA_RECT aRects
[1];
1853 } VBOXCMDVBVA_BLT_GENERIC_A8R8G8B8
;
1855 #define VBOXCMDVBVA_SIZEOF_BLTSTRUCT_MAX (sizeof (VBOXCMDVBVA_BLT_GENERIC_A8R8G8B8))
1857 typedef struct VBOXCMDVBVA_FLIP
1859 VBOXCMDVBVA_HDR Hdr
;
1860 VBOXCMDVBVA_ALLOCINFO src
;
1861 VBOXCMDVBVA_RECT aRects
[1];
1864 #define VBOXCMDVBVA_SIZEOF_FLIPSTRUCT_MIN (RT_OFFSETOF(VBOXCMDVBVA_FLIP, aRects))
1866 typedef struct VBOXCMDVBVA_CLRFILL_HDR
1868 VBOXCMDVBVA_HDR Hdr
;
1870 } VBOXCMDVBVA_CLRFILL_HDR
;
1872 typedef struct VBOXCMDVBVA_CLRFILL_PRIMARY
1874 VBOXCMDVBVA_CLRFILL_HDR Hdr
;
1875 VBOXCMDVBVA_RECT aRects
[1];
1876 } VBOXCMDVBVA_CLRFILL_PRIMARY
;
1878 typedef struct VBOXCMDVBVA_CLRFILL_GENERIC_A8R8G8B8
1880 VBOXCMDVBVA_CLRFILL_HDR Hdr
;
1881 VBOXCMDVBVA_ALLOCDESC dst
;
1882 VBOXCMDVBVA_RECT aRects
[1];
1883 } VBOXCMDVBVA_CLRFILL_GENERIC_A8R8G8B8
;
1885 #define VBOXCMDVBVA_SIZEOF_CLRFILLSTRUCT_MAX (sizeof (VBOXCMDVBVA_CLRFILL_GENERIC_A8R8G8B8))
1888 #define VBOXCMDVBVA_SYSMEMEL_CPAGES_MAX 0x1000
1890 typedef struct VBOXCMDVBVA_SYSMEMEL
1892 uint32_t cPagesAfterFirst
: 12;
1893 uint32_t iPage1
: 20;
1895 } VBOXCMDVBVA_SYSMEMEL
;
1898 typedef struct VBOXCMDVBVA_PAGING_TRANSFER_DATA
1900 /* for now can only contain offVRAM.
1901 * paging transfer can NOT be initiated for allocations having host 3D object (hostID) associated */
1902 VBOXCMDVBVA_ALLOCINFO Alloc
;
1903 VBOXCMDVBVAPAGEIDX aPageNumbers
[1];
1904 } VBOXCMDVBVA_PAGING_TRANSFER_DATA
;
1906 typedef struct VBOXCMDVBVA_PAGING_TRANSFER
1908 VBOXCMDVBVA_HDR Hdr
;
1909 VBOXCMDVBVA_PAGING_TRANSFER_DATA Data
;
1910 } VBOXCMDVBVA_PAGING_TRANSFER
;
1912 typedef struct VBOXCMDVBVA_PAGING_FILL
1914 VBOXCMDVBVA_HDR Hdr
;
1916 uint32_t u32Pattern
;
1917 /* paging transfer can NOT be initiated for allocations having host 3D object (hostID) associated */
1918 VBOXCMDVBVAOFFSET offVRAM
;
1919 } VBOXCMDVBVA_PAGING_FILL
;
1921 typedef struct VBOXCMDVBVA_SYSMEMCMD
1923 VBOXCMDVBVA_HDR Hdr
;
1924 VBOXCMDVBVAPHADDR phCmd
;
1925 } VBOXCMDVBVA_SYSMEMCMD
;
1927 #define VBOXCMDVBVACTL_TYPE_ENABLE 1
1928 #define VBOXCMDVBVACTL_TYPE_3DCTL 2
1929 #define VBOXCMDVBVACTL_TYPE_RESIZE 3
1931 typedef struct VBOXCMDVBVA_CTL
1937 typedef struct VBOXCMDVBVA_CTL_ENABLE
1939 VBOXCMDVBVA_CTL Hdr
;
1941 } VBOXCMDVBVA_CTL_ENABLE
;
1943 #define VBOXCMDVBVA_SCREENMAP_SIZE(_elType) ((VBOX_VIDEO_MAX_SCREENS + sizeof (_elType) - 1) / sizeof (_elType))
1944 #define VBOXCMDVBVA_SCREENMAP_DECL(_elType, _name) _elType _name[VBOXCMDVBVA_SCREENMAP_SIZE(_elType)]
1946 typedef struct VBOXCMDVBVA_RESIZE_ENTRY
1948 VBVAINFOSCREEN Screen
;
1949 VBOXCMDVBVA_SCREENMAP_DECL(uint32_t, aTargetMap
);
1950 } VBOXCMDVBVA_RESIZE_ENTRY
;
1952 typedef struct VBOXCMDVBVA_RESIZE
1954 VBOXCMDVBVA_RESIZE_ENTRY aEntries
[1];
1955 } VBOXCMDVBVA_RESIZE
;
1957 typedef struct VBOXCMDVBVA_CTL_RESIZE
1959 VBOXCMDVBVA_CTL Hdr
;
1960 VBOXCMDVBVA_RESIZE Resize
;
1961 } VBOXCMDVBVA_CTL_RESIZE
;
1963 #define VBOXCMDVBVA3DCTL_TYPE_CONNECT 1
1964 #define VBOXCMDVBVA3DCTL_TYPE_DISCONNECT 2
1965 #define VBOXCMDVBVA3DCTL_TYPE_CMD 3
1967 typedef struct VBOXCMDVBVA_3DCTL
1970 uint32_t u32CmdClientId
;
1971 } VBOXCMDVBVA_3DCTL
;
1973 typedef struct VBOXCMDVBVA_3DCTL_CONNECT
1975 VBOXCMDVBVA_3DCTL Hdr
;
1976 uint32_t u32MajorVersion
;
1977 uint32_t u32MinorVersion
;
1979 } VBOXCMDVBVA_3DCTL_CONNECT
;
1981 typedef struct VBOXCMDVBVA_3DCTL_CMD
1983 VBOXCMDVBVA_3DCTL Hdr
;
1984 VBOXCMDVBVA_HDR Cmd
;
1985 } VBOXCMDVBVA_3DCTL_CMD
;
1987 typedef struct VBOXCMDVBVA_CTL_3DCTL_CMD
1989 VBOXCMDVBVA_CTL Hdr
;
1990 VBOXCMDVBVA_3DCTL_CMD Cmd
;
1991 } VBOXCMDVBVA_CTL_3DCTL_CMD
;
1993 typedef struct VBOXCMDVBVA_CTL_3DCTL_CONNECT
1995 VBOXCMDVBVA_CTL Hdr
;
1996 VBOXCMDVBVA_3DCTL_CONNECT Connect
;
1997 } VBOXCMDVBVA_CTL_3DCTL_CONNECT
;
1999 typedef struct VBOXCMDVBVA_CTL_3DCTL
2001 VBOXCMDVBVA_CTL Hdr
;
2002 VBOXCMDVBVA_3DCTL Ctl
;
2003 } VBOXCMDVBVA_CTL_3DCTL
;
2008 #ifdef VBOXVDMA_WITH_VBVA
2011 typedef struct VBOXVDMAVBVACMD