VirtualBox

source: vbox/trunk/include/VBox/Graphics/VBoxVideo.h@ 74869

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

Graphics/VBoxVideo.h: make official that calling VBVA enable updates the screen.
bugref:9235: No screenshot for Linux VM
In the Linux Additions we make use of the fact that calling VBVA enable when
VBVA is already enabled causes the screen to update completely. This is an
implementation detail, but it is easy to do on the host side, so make it
official by way of a comment in the right header file.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 68.2 KB
Line 
1/* $Id: VBoxVideo.h 74622 2018-10-05 06:25:19Z vboxsync $ */
2/** @file
3 * VirtualBox Video interface.
4 */
5
6/*
7 * Copyright (C) 2006-2017 Oracle Corporation
8 *
9 * Permission is hereby granted, free of charge, to any person
10 * obtaining a copy of this software and associated documentation
11 * files (the "Software"), to deal in the Software without
12 * restriction, including without limitation the rights to use,
13 * copy, modify, merge, publish, distribute, sublicense, and/or sell
14 * copies of the Software, and to permit persons to whom the
15 * Software is furnished to do so, subject to the following
16 * conditions:
17 *
18 * The above copyright notice and this permission notice shall be
19 * included in all copies or substantial portions of the Software.
20 *
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
23 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
25 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
26 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
27 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
28 * OTHER DEALINGS IN THE SOFTWARE.
29 */
30
31#ifndef ___VBox_Graphics_VBoxVideo_h
32#define ___VBox_Graphics_VBoxVideo_h
33
34#include "VBoxVideoIPRT.h"
35
36/* this should be in sync with monitorCount <xsd:maxInclusive value="64"/> in src/VBox/Main/xml/VirtualBox-settings-common.xsd */
37#define VBOX_VIDEO_MAX_SCREENS 64
38
39/*
40 * The last 4096 bytes of the guest VRAM contains the generic info for all
41 * DualView chunks: sizes and offsets of chunks. This is filled by miniport.
42 *
43 * Last 4096 bytes of each chunk contain chunk specific data: framebuffer info,
44 * etc. This is used exclusively by the corresponding instance of a display driver.
45 *
46 * The VRAM layout:
47 * Last 4096 bytes - Adapter information area.
48 * 4096 bytes aligned miniport heap (value specified in the config rouded up).
49 * Slack - what left after dividing the VRAM.
50 * 4096 bytes aligned framebuffers:
51 * last 4096 bytes of each framebuffer is the display information area.
52 *
53 * The Virtual Graphics Adapter information in the guest VRAM is stored by the
54 * guest video driver using structures prepended by VBOXVIDEOINFOHDR.
55 *
56 * When the guest driver writes dword 0 to the VBE_DISPI_INDEX_VBOX_VIDEO
57 * the host starts to process the info. The first element at the start of
58 * the 4096 bytes region should be normally be a LINK that points to
59 * actual information chain. That way the guest driver can have some
60 * fixed layout of the information memory block and just rewrite
61 * the link to point to relevant memory chain.
62 *
63 * The processing stops at the END element.
64 *
65 * The host can access the memory only when the port IO is processed.
66 * All data that will be needed later must be copied from these 4096 bytes.
67 * But other VRAM can be used by host until the mode is disabled.
68 *
69 * The guest driver writes dword 0xffffffff to the VBE_DISPI_INDEX_VBOX_VIDEO
70 * to disable the mode.
71 *
72 * VBE_DISPI_INDEX_VBOX_VIDEO is used to read the configuration information
73 * from the host and issue commands to the host.
74 *
75 * The guest writes the VBE_DISPI_INDEX_VBOX_VIDEO index register, the the
76 * following operations with the VBE data register can be performed:
77 *
78 * Operation Result
79 * write 16 bit value NOP
80 * read 16 bit value count of monitors
81 * write 32 bit value sets the vbox command value and the command processed by the host
82 * read 32 bit value result of the last vbox command is returned
83 */
84
85#define VBOX_VIDEO_PRIMARY_SCREEN 0
86#define VBOX_VIDEO_NO_SCREEN ~0
87
88/**
89 * VBVA command header.
90 *
91 * @todo Where does this fit in?
92 */
93typedef struct VBVACMDHDR
94{
95 /** Coordinates of affected rectangle. */
96 int16_t x;
97 int16_t y;
98 uint16_t w;
99 uint16_t h;
100} VBVACMDHDR;
101AssertCompileSize(VBVACMDHDR, 8);
102
103/** @name VBVA ring defines.
104 *
105 * The VBVA ring buffer is suitable for transferring large (< 2GB) amount of
106 * data. For example big bitmaps which do not fit to the buffer.
107 *
108 * Guest starts writing to the buffer by initializing a record entry in the
109 * aRecords queue. VBVA_F_RECORD_PARTIAL indicates that the record is being
110 * written. As data is written to the ring buffer, the guest increases off32End
111 * for the record.
112 *
113 * The host reads the aRecords on flushes and processes all completed records.
114 * When host encounters situation when only a partial record presents and
115 * cbRecord & ~VBVA_F_RECORD_PARTIAL >= VBVA_RING_BUFFER_SIZE -
116 * VBVA_RING_BUFFER_THRESHOLD, the host fetched all record data and updates
117 * off32Head. After that on each flush the host continues fetching the data
118 * until the record is completed.
119 *
120 */
121#define VBVA_RING_BUFFER_SIZE (_4M - _1K)
122#define VBVA_RING_BUFFER_THRESHOLD (4 * _1K)
123
124#define VBVA_MAX_RECORDS (64)
125
126#define VBVA_F_MODE_ENABLED UINT32_C(0x00000001)
127#define VBVA_F_MODE_VRDP UINT32_C(0x00000002)
128#define VBVA_F_MODE_VRDP_RESET UINT32_C(0x00000004)
129#define VBVA_F_MODE_VRDP_ORDER_MASK UINT32_C(0x00000008)
130
131#define VBVA_F_STATE_PROCESSING UINT32_C(0x00010000)
132
133#define VBVA_F_RECORD_PARTIAL UINT32_C(0x80000000)
134
135/**
136 * VBVA record.
137 */
138typedef struct VBVARECORD
139{
140 /** The length of the record. Changed by guest. */
141 uint32_t cbRecord;
142} VBVARECORD;
143AssertCompileSize(VBVARECORD, 4);
144
145/* The size of the information. */
146/*
147 * The minimum HGSMI heap size is PAGE_SIZE (4096 bytes) and is a restriction of the
148 * runtime heapsimple API. Use minimum 2 pages here, because the info area also may
149 * contain other data (for example HGSMIHOSTFLAGS structure).
150 */
151#ifndef VBOX_XPDM_MINIPORT
152# define VBVA_ADAPTER_INFORMATION_SIZE (64*_1K)
153#else
154#define VBVA_ADAPTER_INFORMATION_SIZE (16*_1K)
155#define VBVA_DISPLAY_INFORMATION_SIZE (64*_1K)
156#endif
157#define VBVA_MIN_BUFFER_SIZE (64*_1K)
158
159
160/* The value for port IO to let the adapter to interpret the adapter memory. */
161#define VBOX_VIDEO_DISABLE_ADAPTER_MEMORY 0xFFFFFFFF
162
163/* The value for port IO to let the adapter to interpret the adapter memory. */
164#define VBOX_VIDEO_INTERPRET_ADAPTER_MEMORY 0x00000000
165
166/* The value for port IO to let the adapter to interpret the display memory.
167 * The display number is encoded in low 16 bits.
168 */
169#define VBOX_VIDEO_INTERPRET_DISPLAY_MEMORY_BASE 0x00010000
170
171
172/* The end of the information. */
173#define VBOX_VIDEO_INFO_TYPE_END 0
174/* Instructs the host to fetch the next VBOXVIDEOINFOHDR at the given offset of VRAM. */
175#define VBOX_VIDEO_INFO_TYPE_LINK 1
176/* Information about a display memory position. */
177#define VBOX_VIDEO_INFO_TYPE_DISPLAY 2
178/* Information about a screen. */
179#define VBOX_VIDEO_INFO_TYPE_SCREEN 3
180/* Information about host notifications for the driver. */
181#define VBOX_VIDEO_INFO_TYPE_HOST_EVENTS 4
182/* Information about non-volatile guest VRAM heap. */
183#define VBOX_VIDEO_INFO_TYPE_NV_HEAP 5
184/* VBVA enable/disable. */
185#define VBOX_VIDEO_INFO_TYPE_VBVA_STATUS 6
186/* VBVA flush. */
187#define VBOX_VIDEO_INFO_TYPE_VBVA_FLUSH 7
188/* Query configuration value. */
189#define VBOX_VIDEO_INFO_TYPE_QUERY_CONF32 8
190
191
192#pragma pack(1)
193typedef struct VBOXVIDEOINFOHDR
194{
195 uint8_t u8Type;
196 uint8_t u8Reserved;
197 uint16_t u16Length;
198} VBOXVIDEOINFOHDR;
199
200
201typedef struct VBOXVIDEOINFOLINK
202{
203 /* Relative offset in VRAM */
204 int32_t i32Offset;
205} VBOXVIDEOINFOLINK;
206
207
208/* Resides in adapter info memory. Describes a display VRAM chunk. */
209typedef struct VBOXVIDEOINFODISPLAY
210{
211 /* Index of the framebuffer assigned by guest. */
212 uint32_t u32Index;
213
214 /* Absolute offset in VRAM of the framebuffer to be displayed on the monitor. */
215 uint32_t u32Offset;
216
217 /* The size of the memory that can be used for the screen. */
218 uint32_t u32FramebufferSize;
219
220 /* The size of the memory that is used for the Display information.
221 * The information is at u32Offset + u32FramebufferSize
222 */
223 uint32_t u32InformationSize;
224
225} VBOXVIDEOINFODISPLAY;
226
227
228/* Resides in display info area, describes the current video mode. */
229#define VBOX_VIDEO_INFO_SCREEN_F_NONE 0x00
230#define VBOX_VIDEO_INFO_SCREEN_F_ACTIVE 0x01
231
232typedef struct VBOXVIDEOINFOSCREEN
233{
234 /* Physical X origin relative to the primary screen. */
235 int32_t xOrigin;
236
237 /* Physical Y origin relative to the primary screen. */
238 int32_t yOrigin;
239
240 /* The scan line size in bytes. */
241 uint32_t u32LineSize;
242
243 /* Width of the screen. */
244 uint16_t u16Width;
245
246 /* Height of the screen. */
247 uint16_t u16Height;
248
249 /* Color depth. */
250 uint8_t bitsPerPixel;
251
252 /* VBOX_VIDEO_INFO_SCREEN_F_* */
253 uint8_t u8Flags;
254} VBOXVIDEOINFOSCREEN;
255
256/* The guest initializes the structure to 0. The positions of the structure in the
257 * display info area must not be changed, host will update the structure. Guest checks
258 * the events and modifies the structure as a response to host.
259 */
260#define VBOX_VIDEO_INFO_HOST_EVENTS_F_NONE 0x00000000
261#define VBOX_VIDEO_INFO_HOST_EVENTS_F_VRDP_RESET 0x00000080
262
263typedef struct VBOXVIDEOINFOHOSTEVENTS
264{
265 /* Host events. */
266 uint32_t fu32Events;
267} VBOXVIDEOINFOHOSTEVENTS;
268
269/* Resides in adapter info memory. Describes the non-volatile VRAM heap. */
270typedef struct VBOXVIDEOINFONVHEAP
271{
272 /* Absolute offset in VRAM of the start of the heap. */
273 uint32_t u32HeapOffset;
274
275 /* The size of the heap. */
276 uint32_t u32HeapSize;
277
278} VBOXVIDEOINFONVHEAP;
279
280/* Display information area. */
281typedef struct VBOXVIDEOINFOVBVASTATUS
282{
283 /* Absolute offset in VRAM of the start of the VBVA QUEUE. 0 to disable VBVA. */
284 uint32_t u32QueueOffset;
285
286 /* The size of the VBVA QUEUE. 0 to disable VBVA. */
287 uint32_t u32QueueSize;
288
289} VBOXVIDEOINFOVBVASTATUS;
290
291typedef struct VBOXVIDEOINFOVBVAFLUSH
292{
293 uint32_t u32DataStart;
294
295 uint32_t u32DataEnd;
296
297} VBOXVIDEOINFOVBVAFLUSH;
298
299#define VBOX_VIDEO_QCI32_MONITOR_COUNT 0
300#define VBOX_VIDEO_QCI32_OFFSCREEN_HEAP_SIZE 1
301
302typedef struct VBOXVIDEOINFOQUERYCONF32
303{
304 uint32_t u32Index;
305
306 uint32_t u32Value;
307
308} VBOXVIDEOINFOQUERYCONF32;
309#pragma pack()
310
311#ifdef VBOX_WITH_VIDEOHWACCEL
312#pragma pack(1)
313
314#define VBOXVHWA_VERSION_MAJ 0
315#define VBOXVHWA_VERSION_MIN 0
316#define VBOXVHWA_VERSION_BLD 6
317#define VBOXVHWA_VERSION_RSV 0
318
319typedef enum
320{
321 VBOXVHWACMD_TYPE_SURF_CANCREATE = 1,
322 VBOXVHWACMD_TYPE_SURF_CREATE,
323 VBOXVHWACMD_TYPE_SURF_DESTROY,
324 VBOXVHWACMD_TYPE_SURF_LOCK,
325 VBOXVHWACMD_TYPE_SURF_UNLOCK,
326 VBOXVHWACMD_TYPE_SURF_BLT,
327 VBOXVHWACMD_TYPE_SURF_FLIP,
328 VBOXVHWACMD_TYPE_SURF_OVERLAY_UPDATE,
329 VBOXVHWACMD_TYPE_SURF_OVERLAY_SETPOSITION,
330 VBOXVHWACMD_TYPE_SURF_COLORKEY_SET,
331 VBOXVHWACMD_TYPE_QUERY_INFO1,
332 VBOXVHWACMD_TYPE_QUERY_INFO2,
333 VBOXVHWACMD_TYPE_ENABLE,
334 VBOXVHWACMD_TYPE_DISABLE,
335 VBOXVHWACMD_TYPE_HH_CONSTRUCT,
336 VBOXVHWACMD_TYPE_HH_RESET
337#ifdef VBOX_WITH_WDDM
338 , VBOXVHWACMD_TYPE_SURF_GETINFO
339 , VBOXVHWACMD_TYPE_SURF_COLORFILL
340#endif
341 , VBOXVHWACMD_TYPE_HH_DISABLE
342 , VBOXVHWACMD_TYPE_HH_ENABLE
343 , VBOXVHWACMD_TYPE_HH_SAVESTATE_SAVEBEGIN
344 , VBOXVHWACMD_TYPE_HH_SAVESTATE_SAVEEND
345 , VBOXVHWACMD_TYPE_HH_SAVESTATE_SAVEPERFORM
346 , VBOXVHWACMD_TYPE_HH_SAVESTATE_LOADPERFORM
347} VBOXVHWACMD_TYPE;
348
349/** The command processing was asynch, set by the host to indicate asynch
350 * command completion. Must not be cleared once set, the command completion is
351 * performed by issuing a host->guest completion command while keeping this
352 * flag unchanged */
353#define VBOXVHWACMD_FLAG_HG_ASYNCH UINT32_C(0x00010000)
354/** asynch completion is performed by issuing the event */
355#define VBOXVHWACMD_FLAG_GH_ASYNCH_EVENT UINT32_C(0x00000001)
356/** issue interrupt on asynch completion */
357#define VBOXVHWACMD_FLAG_GH_ASYNCH_IRQ UINT32_C(0x00000002)
358/** Guest does not do any op on completion of this command, the host may copy
359 * the command and indicate that it does not need the command anymore
360 * by setting the VBOXVHWACMD_FLAG_HG_ASYNCH_RETURNED flag */
361#define VBOXVHWACMD_FLAG_GH_ASYNCH_NOCOMPLETION UINT32_C(0x00000004)
362/** the host has copied the VBOXVHWACMD_FLAG_GH_ASYNCH_NOCOMPLETION command and returned it to the guest */
363#define VBOXVHWACMD_FLAG_HG_ASYNCH_RETURNED UINT32_C(0x00020000)
364/** this is the host->host cmd, i.e. a configuration command posted by the host to the framebuffer */
365#define VBOXVHWACMD_FLAG_HH_CMD UINT32_C(0x10000000)
366
367typedef struct VBOXVHWACMD
368{
369 VBOXVHWACMD_TYPE enmCmd; /**< command type */
370 volatile int32_t rc; /**< command result */
371 int32_t iDisplay; /**< display index */
372 volatile int32_t Flags; /**< ORed VBOXVHWACMD_FLAG_xxx values */
373 uint64_t GuestVBVAReserved1; /**< field internally used by the guest VBVA cmd handling, must NOT be modified by clients */
374 uint64_t GuestVBVAReserved2; /**< field internally used by the guest VBVA cmd handling, must NOT be modified by clients */
375 volatile uint32_t cRefs;
376 int32_t Reserved;
377 union
378 {
379 struct VBOXVHWACMD *pNext;
380 uint32_t offNext;
381 uint64_t Data; /**< the body is 64-bit aligned */
382 } u;
383 char body[1];
384} VBOXVHWACMD;
385
386#define VBOXVHWACMD_HEADSIZE() (RT_OFFSETOF(VBOXVHWACMD, body))
387#define VBOXVHWACMD_SIZE_FROMBODYSIZE(a_cbBody) (VBOXVHWACMD_HEADSIZE() + (a_cbBody))
388#define VBOXVHWACMD_SIZE(a_tTypeCmd) (VBOXVHWACMD_SIZE_FROMBODYSIZE(sizeof(a_tTypeCmd)))
389typedef unsigned int VBOXVHWACMD_LENGTH;
390typedef uint64_t VBOXVHWA_SURFHANDLE;
391#define VBOXVHWA_SURFHANDLE_INVALID UINT64_C(0)
392#define VBOXVHWACMD_BODY(a_pHdr, a_TypeBody) ( (a_TypeBody RT_UNTRUSTED_VOLATILE_HSTGST *)&(a_pHdr)->body[0] )
393#if !defined(IN_GUEST) && defined(IN_RING3)
394# define VBOXVHWACMD_BODY_HOST_HEAP(a_pHdr, a_TypeBody) ( (a_TypeBody *)&(a_pHdr)->body[0] )
395#endif
396#define VBOXVHWACMD_HEAD(a_pBody)\
397 ( (VBOXVHWACMD RT_UNTRUSTED_VOLATILE_HSTGST *)((uint8_t *)(a_pBody) - RT_OFFSETOF(VBOXVHWACMD, body)))
398
399typedef struct VBOXVHWA_RECTL
400{
401 int32_t left;
402 int32_t top;
403 int32_t right;
404 int32_t bottom;
405} VBOXVHWA_RECTL;
406
407typedef struct VBOXVHWA_COLORKEY
408{
409 uint32_t low;
410 uint32_t high;
411} VBOXVHWA_COLORKEY;
412
413typedef struct VBOXVHWA_PIXELFORMAT
414{
415 uint32_t flags;
416 uint32_t fourCC;
417 union
418 {
419 uint32_t rgbBitCount;
420 uint32_t yuvBitCount;
421 } c;
422
423 union
424 {
425 uint32_t rgbRBitMask;
426 uint32_t yuvYBitMask;
427 } m1;
428
429 union
430 {
431 uint32_t rgbGBitMask;
432 uint32_t yuvUBitMask;
433 } m2;
434
435 union
436 {
437 uint32_t rgbBBitMask;
438 uint32_t yuvVBitMask;
439 } m3;
440
441 union
442 {
443 uint32_t rgbABitMask;
444 } m4;
445
446 uint32_t Reserved;
447} VBOXVHWA_PIXELFORMAT;
448
449typedef struct VBOXVHWA_SURFACEDESC
450{
451 uint32_t flags;
452 uint32_t height;
453 uint32_t width;
454 uint32_t pitch;
455 uint32_t sizeX;
456 uint32_t sizeY;
457 uint32_t cBackBuffers;
458 uint32_t Reserved;
459 VBOXVHWA_COLORKEY DstOverlayCK;
460 VBOXVHWA_COLORKEY DstBltCK;
461 VBOXVHWA_COLORKEY SrcOverlayCK;
462 VBOXVHWA_COLORKEY SrcBltCK;
463 VBOXVHWA_PIXELFORMAT PixelFormat;
464 uint32_t surfCaps;
465 uint32_t Reserved2;
466 VBOXVHWA_SURFHANDLE hSurf;
467 uint64_t offSurface;
468} VBOXVHWA_SURFACEDESC;
469
470typedef struct VBOXVHWA_BLTFX
471{
472 uint32_t flags;
473 uint32_t rop;
474 uint32_t rotationOp;
475 uint32_t rotation;
476 uint32_t fillColor;
477 uint32_t Reserved;
478 VBOXVHWA_COLORKEY DstCK;
479 VBOXVHWA_COLORKEY SrcCK;
480} VBOXVHWA_BLTFX;
481
482typedef struct VBOXVHWA_OVERLAYFX
483{
484 uint32_t flags;
485 uint32_t Reserved1;
486 uint32_t fxFlags;
487 uint32_t Reserved2;
488 VBOXVHWA_COLORKEY DstCK;
489 VBOXVHWA_COLORKEY SrcCK;
490} VBOXVHWA_OVERLAYFX;
491
492#define VBOXVHWA_CAPS_BLT 0x00000040
493#define VBOXVHWA_CAPS_BLTCOLORFILL 0x04000000
494#define VBOXVHWA_CAPS_BLTFOURCC 0x00000100
495#define VBOXVHWA_CAPS_BLTSTRETCH 0x00000200
496#define VBOXVHWA_CAPS_BLTQUEUE 0x00000080
497
498#define VBOXVHWA_CAPS_OVERLAY 0x00000800
499#define VBOXVHWA_CAPS_OVERLAYFOURCC 0x00002000
500#define VBOXVHWA_CAPS_OVERLAYSTRETCH 0x00004000
501#define VBOXVHWA_CAPS_OVERLAYCANTCLIP 0x00001000
502
503#define VBOXVHWA_CAPS_COLORKEY 0x00400000
504#define VBOXVHWA_CAPS_COLORKEYHWASSIST 0x01000000
505
506#define VBOXVHWA_SCAPS_BACKBUFFER 0x00000004
507#define VBOXVHWA_SCAPS_COMPLEX 0x00000008
508#define VBOXVHWA_SCAPS_FLIP 0x00000010
509#define VBOXVHWA_SCAPS_FRONTBUFFER 0x00000020
510#define VBOXVHWA_SCAPS_OFFSCREENPLAIN 0x00000040
511#define VBOXVHWA_SCAPS_OVERLAY 0x00000080
512#define VBOXVHWA_SCAPS_PRIMARYSURFACE 0x00000200
513#define VBOXVHWA_SCAPS_SYSTEMMEMORY 0x00000800
514#define VBOXVHWA_SCAPS_VIDEOMEMORY 0x00004000
515#define VBOXVHWA_SCAPS_VISIBLE 0x00008000
516#define VBOXVHWA_SCAPS_LOCALVIDMEM 0x10000000
517
518#define VBOXVHWA_PF_PALETTEINDEXED8 0x00000020
519#define VBOXVHWA_PF_RGB 0x00000040
520#define VBOXVHWA_PF_RGBTOYUV 0x00000100
521#define VBOXVHWA_PF_YUV 0x00000200
522#define VBOXVHWA_PF_FOURCC 0x00000004
523
524#define VBOXVHWA_LOCK_DISCARDCONTENTS 0x00002000
525
526#define VBOXVHWA_CFG_ENABLED 0x00000001
527
528#define VBOXVHWA_SD_BACKBUFFERCOUNT 0x00000020
529#define VBOXVHWA_SD_CAPS 0x00000001
530#define VBOXVHWA_SD_CKDESTBLT 0x00004000
531#define VBOXVHWA_SD_CKDESTOVERLAY 0x00002000
532#define VBOXVHWA_SD_CKSRCBLT 0x00010000
533#define VBOXVHWA_SD_CKSRCOVERLAY 0x00008000
534#define VBOXVHWA_SD_HEIGHT 0x00000002
535#define VBOXVHWA_SD_PITCH 0x00000008
536#define VBOXVHWA_SD_PIXELFORMAT 0x00001000
537/*#define VBOXVHWA_SD_REFRESHRATE 0x00040000*/
538#define VBOXVHWA_SD_WIDTH 0x00000004
539
540#define VBOXVHWA_CKEYCAPS_DESTBLT 0x00000001
541#define VBOXVHWA_CKEYCAPS_DESTBLTCLRSPACE 0x00000002
542#define VBOXVHWA_CKEYCAPS_DESTBLTCLRSPACEYUV 0x00000004
543#define VBOXVHWA_CKEYCAPS_DESTBLTYUV 0x00000008
544#define VBOXVHWA_CKEYCAPS_DESTOVERLAY 0x00000010
545#define VBOXVHWA_CKEYCAPS_DESTOVERLAYCLRSPACE 0x00000020
546#define VBOXVHWA_CKEYCAPS_DESTOVERLAYCLRSPACEYUV 0x00000040
547#define VBOXVHWA_CKEYCAPS_DESTOVERLAYONEACTIVE 0x00000080
548#define VBOXVHWA_CKEYCAPS_DESTOVERLAYYUV 0x00000100
549#define VBOXVHWA_CKEYCAPS_SRCBLT 0x00000200
550#define VBOXVHWA_CKEYCAPS_SRCBLTCLRSPACE 0x00000400
551#define VBOXVHWA_CKEYCAPS_SRCBLTCLRSPACEYUV 0x00000800
552#define VBOXVHWA_CKEYCAPS_SRCBLTYUV 0x00001000
553#define VBOXVHWA_CKEYCAPS_SRCOVERLAY 0x00002000
554#define VBOXVHWA_CKEYCAPS_SRCOVERLAYCLRSPACE 0x00004000
555#define VBOXVHWA_CKEYCAPS_SRCOVERLAYCLRSPACEYUV 0x00008000
556#define VBOXVHWA_CKEYCAPS_SRCOVERLAYONEACTIVE 0x00010000
557#define VBOXVHWA_CKEYCAPS_SRCOVERLAYYUV 0x00020000
558#define VBOXVHWA_CKEYCAPS_NOCOSTOVERLAY 0x00040000
559
560#define VBOXVHWA_BLT_COLORFILL 0x00000400
561#define VBOXVHWA_BLT_DDFX 0x00000800
562#define VBOXVHWA_BLT_EXTENDED_FLAGS 0x40000000
563#define VBOXVHWA_BLT_EXTENDED_LINEAR_CONTENT 0x00000004
564#define VBOXVHWA_BLT_EXTENDED_PRESENTATION_STRETCHFACTOR 0x00000010
565#define VBOXVHWA_BLT_KEYDESTOVERRIDE 0x00004000
566#define VBOXVHWA_BLT_KEYSRCOVERRIDE 0x00010000
567#define VBOXVHWA_BLT_LAST_PRESENTATION 0x20000000
568#define VBOXVHWA_BLT_PRESENTATION 0x10000000
569#define VBOXVHWA_BLT_ROP 0x00020000
570
571
572#define VBOXVHWA_OVER_DDFX 0x00080000
573#define VBOXVHWA_OVER_HIDE 0x00000200
574#define VBOXVHWA_OVER_KEYDEST 0x00000400
575#define VBOXVHWA_OVER_KEYDESTOVERRIDE 0x00000800
576#define VBOXVHWA_OVER_KEYSRC 0x00001000
577#define VBOXVHWA_OVER_KEYSRCOVERRIDE 0x00002000
578#define VBOXVHWA_OVER_SHOW 0x00004000
579
580#define VBOXVHWA_CKEY_COLORSPACE 0x00000001
581#define VBOXVHWA_CKEY_DESTBLT 0x00000002
582#define VBOXVHWA_CKEY_DESTOVERLAY 0x00000004
583#define VBOXVHWA_CKEY_SRCBLT 0x00000008
584#define VBOXVHWA_CKEY_SRCOVERLAY 0x00000010
585
586#define VBOXVHWA_BLT_ARITHSTRETCHY 0x00000001
587#define VBOXVHWA_BLT_MIRRORLEFTRIGHT 0x00000002
588#define VBOXVHWA_BLT_MIRRORUPDOWN 0x00000004
589
590#define VBOXVHWA_OVERFX_ARITHSTRETCHY 0x00000001
591#define VBOXVHWA_OVERFX_MIRRORLEFTRIGHT 0x00000002
592#define VBOXVHWA_OVERFX_MIRRORUPDOWN 0x00000004
593
594#define VBOXVHWA_CAPS2_CANRENDERWINDOWED 0x00080000
595#define VBOXVHWA_CAPS2_WIDESURFACES 0x00001000
596#define VBOXVHWA_CAPS2_COPYFOURCC 0x00008000
597/*#define VBOXVHWA_CAPS2_FLIPINTERVAL 0x00200000*/
598/*#define VBOXVHWA_CAPS2_FLIPNOVSYNC 0x00400000*/
599
600
601#define VBOXVHWA_OFFSET64_VOID (UINT64_MAX)
602
603typedef struct VBOXVHWA_VERSION
604{
605 uint32_t maj;
606 uint32_t min;
607 uint32_t bld;
608 uint32_t reserved;
609} VBOXVHWA_VERSION;
610
611#define VBOXVHWA_VERSION_INIT(_pv) do { \
612 (_pv)->maj = VBOXVHWA_VERSION_MAJ; \
613 (_pv)->min = VBOXVHWA_VERSION_MIN; \
614 (_pv)->bld = VBOXVHWA_VERSION_BLD; \
615 (_pv)->reserved = VBOXVHWA_VERSION_RSV; \
616 } while(0)
617
618typedef struct VBOXVHWACMD_QUERYINFO1
619{
620 union
621 {
622 struct
623 {
624 VBOXVHWA_VERSION guestVersion;
625 } in;
626
627 struct
628 {
629 uint32_t cfgFlags;
630 uint32_t caps;
631
632 uint32_t caps2;
633 uint32_t colorKeyCaps;
634
635 uint32_t stretchCaps;
636 uint32_t surfaceCaps;
637
638 uint32_t numOverlays;
639 uint32_t curOverlays;
640
641 uint32_t numFourCC;
642 uint32_t reserved;
643 } out;
644 } u;
645} VBOXVHWACMD_QUERYINFO1;
646
647typedef struct VBOXVHWACMD_QUERYINFO2
648{
649 uint32_t numFourCC;
650 uint32_t FourCC[1];
651} VBOXVHWACMD_QUERYINFO2;
652
653#define VBOXVHWAINFO2_SIZE(_cFourCC) RT_UOFFSETOF_DYN(VBOXVHWACMD_QUERYINFO2, FourCC[_cFourCC])
654
655typedef struct VBOXVHWACMD_SURF_CANCREATE
656{
657 VBOXVHWA_SURFACEDESC SurfInfo;
658 union
659 {
660 struct
661 {
662 uint32_t bIsDifferentPixelFormat;
663 uint32_t Reserved;
664 } in;
665
666 struct
667 {
668 int32_t ErrInfo;
669 } out;
670 } u;
671} VBOXVHWACMD_SURF_CANCREATE;
672
673typedef struct VBOXVHWACMD_SURF_CREATE
674{
675 VBOXVHWA_SURFACEDESC SurfInfo;
676} VBOXVHWACMD_SURF_CREATE;
677
678#ifdef VBOX_WITH_WDDM
679typedef struct VBOXVHWACMD_SURF_GETINFO
680{
681 VBOXVHWA_SURFACEDESC SurfInfo;
682} VBOXVHWACMD_SURF_GETINFO;
683#endif
684
685typedef struct VBOXVHWACMD_SURF_DESTROY
686{
687 union
688 {
689 struct
690 {
691 VBOXVHWA_SURFHANDLE hSurf;
692 } in;
693 } u;
694} VBOXVHWACMD_SURF_DESTROY;
695
696typedef struct VBOXVHWACMD_SURF_LOCK
697{
698 union
699 {
700 struct
701 {
702 VBOXVHWA_SURFHANDLE hSurf;
703 uint64_t offSurface;
704 uint32_t flags;
705 uint32_t rectValid;
706 VBOXVHWA_RECTL rect;
707 } in;
708 } u;
709} VBOXVHWACMD_SURF_LOCK;
710
711typedef struct VBOXVHWACMD_SURF_UNLOCK
712{
713 union
714 {
715 struct
716 {
717 VBOXVHWA_SURFHANDLE hSurf;
718 uint32_t xUpdatedMemValid;
719 uint32_t reserved;
720 VBOXVHWA_RECTL xUpdatedMemRect;
721 } in;
722 } u;
723} VBOXVHWACMD_SURF_UNLOCK;
724
725typedef struct VBOXVHWACMD_SURF_BLT
726{
727 uint64_t DstGuestSurfInfo;
728 uint64_t SrcGuestSurfInfo;
729 union
730 {
731 struct
732 {
733 VBOXVHWA_SURFHANDLE hDstSurf;
734 uint64_t offDstSurface;
735 VBOXVHWA_RECTL dstRect;
736 VBOXVHWA_SURFHANDLE hSrcSurf;
737 uint64_t offSrcSurface;
738 VBOXVHWA_RECTL srcRect;
739 uint32_t flags;
740 uint32_t xUpdatedSrcMemValid;
741 VBOXVHWA_BLTFX desc;
742 VBOXVHWA_RECTL xUpdatedSrcMemRect;
743 } in;
744 } u;
745} VBOXVHWACMD_SURF_BLT;
746
747#ifdef VBOX_WITH_WDDM
748typedef struct VBOXVHWACMD_SURF_COLORFILL
749{
750 union
751 {
752 struct
753 {
754 VBOXVHWA_SURFHANDLE hSurf;
755 uint64_t offSurface;
756 uint32_t u32Reserved;
757 uint32_t cRects;
758 VBOXVHWA_RECTL aRects[1];
759 } in;
760 } u;
761} VBOXVHWACMD_SURF_COLORFILL;
762#endif
763
764typedef struct VBOXVHWACMD_SURF_FLIP
765{
766 uint64_t TargGuestSurfInfo;
767 uint64_t CurrGuestSurfInfo;
768 union
769 {
770 struct
771 {
772 VBOXVHWA_SURFHANDLE hTargSurf;
773 uint64_t offTargSurface;
774 VBOXVHWA_SURFHANDLE hCurrSurf;
775 uint64_t offCurrSurface;
776 uint32_t flags;
777 uint32_t xUpdatedTargMemValid;
778 VBOXVHWA_RECTL xUpdatedTargMemRect;
779 } in;
780 } u;
781} VBOXVHWACMD_SURF_FLIP;
782
783typedef struct VBOXVHWACMD_SURF_COLORKEY_SET
784{
785 union
786 {
787 struct
788 {
789 VBOXVHWA_SURFHANDLE hSurf;
790 uint64_t offSurface;
791 VBOXVHWA_COLORKEY CKey;
792 uint32_t flags;
793 uint32_t reserved;
794 } in;
795 } u;
796} VBOXVHWACMD_SURF_COLORKEY_SET;
797
798#define VBOXVHWACMD_SURF_OVERLAY_UPDATE_F_SRCMEMRECT 0x00000001
799#define VBOXVHWACMD_SURF_OVERLAY_UPDATE_F_DSTMEMRECT 0x00000002
800
801typedef struct VBOXVHWACMD_SURF_OVERLAY_UPDATE
802{
803 union
804 {
805 struct
806 {
807 VBOXVHWA_SURFHANDLE hDstSurf;
808 uint64_t offDstSurface;
809 VBOXVHWA_RECTL dstRect;
810 VBOXVHWA_SURFHANDLE hSrcSurf;
811 uint64_t offSrcSurface;
812 VBOXVHWA_RECTL srcRect;
813 uint32_t flags;
814 uint32_t xFlags;
815 VBOXVHWA_OVERLAYFX desc;
816 VBOXVHWA_RECTL xUpdatedSrcMemRect;
817 VBOXVHWA_RECTL xUpdatedDstMemRect;
818 } in;
819 } u;
820}VBOXVHWACMD_SURF_OVERLAY_UPDATE;
821
822typedef struct VBOXVHWACMD_SURF_OVERLAY_SETPOSITION
823{
824 union
825 {
826 struct
827 {
828 VBOXVHWA_SURFHANDLE hDstSurf;
829 uint64_t offDstSurface;
830 VBOXVHWA_SURFHANDLE hSrcSurf;
831 uint64_t offSrcSurface;
832 uint32_t xPos;
833 uint32_t yPos;
834 uint32_t flags;
835 uint32_t reserved;
836 } in;
837 } u;
838} VBOXVHWACMD_SURF_OVERLAY_SETPOSITION;
839
840typedef struct VBOXVHWACMD_HH_CONSTRUCT
841{
842 void *pVM;
843 /* VRAM info for the backend to be able to properly translate VRAM offsets */
844 void *pvVRAM;
845 uint32_t cbVRAM;
846} VBOXVHWACMD_HH_CONSTRUCT;
847
848typedef struct VBOXVHWACMD_HH_SAVESTATE_SAVEPERFORM
849{
850 struct SSMHANDLE * pSSM;
851} VBOXVHWACMD_HH_SAVESTATE_SAVEPERFORM;
852
853typedef struct VBOXVHWACMD_HH_SAVESTATE_LOADPERFORM
854{
855 struct SSMHANDLE * pSSM;
856} VBOXVHWACMD_HH_SAVESTATE_LOADPERFORM;
857
858typedef DECLCALLBACK(void) FNVBOXVHWA_HH_CALLBACK(void*);
859typedef FNVBOXVHWA_HH_CALLBACK *PFNVBOXVHWA_HH_CALLBACK;
860
861#define VBOXVHWA_HH_CALLBACK_SET(_pCmd, _pfn, _parg) \
862 do { \
863 (_pCmd)->GuestVBVAReserved1 = (uint64_t)(uintptr_t)(_pfn); \
864 (_pCmd)->GuestVBVAReserved2 = (uint64_t)(uintptr_t)(_parg); \
865 }while(0)
866
867#define VBOXVHWA_HH_CALLBACK_GET(_pCmd) ((PFNVBOXVHWA_HH_CALLBACK)(_pCmd)->GuestVBVAReserved1)
868#define VBOXVHWA_HH_CALLBACK_GET_ARG(_pCmd) ((void*)(_pCmd)->GuestVBVAReserved2)
869
870#pragma pack()
871#endif /* #ifdef VBOX_WITH_VIDEOHWACCEL */
872
873/* All structures are without alignment. */
874#pragma pack(1)
875
876typedef struct VBVAHOSTFLAGS
877{
878 uint32_t u32HostEvents;
879 uint32_t u32SupportedOrders;
880} VBVAHOSTFLAGS;
881
882typedef struct VBVABUFFER
883{
884 VBVAHOSTFLAGS hostFlags;
885
886 /* The offset where the data start in the buffer. */
887 uint32_t off32Data;
888 /* The offset where next data must be placed in the buffer. */
889 uint32_t off32Free;
890
891 /* The queue of record descriptions. */
892 VBVARECORD aRecords[VBVA_MAX_RECORDS];
893 uint32_t indexRecordFirst;
894 uint32_t indexRecordFree;
895
896 /* Space to leave free in the buffer when large partial records are transferred. */
897 uint32_t cbPartialWriteThreshold;
898
899 uint32_t cbData;
900 uint8_t au8Data[1]; /* variable size for the rest of the VBVABUFFER area in VRAM. */
901} VBVABUFFER;
902
903#define VBVA_MAX_RECORD_SIZE (128*_1M)
904
905/* guest->host commands */
906#define VBVA_QUERY_CONF32 1
907#define VBVA_SET_CONF32 2
908#define VBVA_INFO_VIEW 3
909#define VBVA_INFO_HEAP 4
910#define VBVA_FLUSH 5
911#define VBVA_INFO_SCREEN 6
912/** Enables or disables VBVA. Enabling VBVA without disabling it before
913 * causes a complete screen update. */
914#define VBVA_ENABLE 7
915#define VBVA_MOUSE_POINTER_SHAPE 8
916#ifdef VBOX_WITH_VIDEOHWACCEL
917# define VBVA_VHWA_CMD 9
918#endif /* # ifdef VBOX_WITH_VIDEOHWACCEL */
919#ifdef VBOX_WITH_VDMA
920# define VBVA_VDMA_CTL 10 /* setup G<->H DMA channel info */
921# define VBVA_VDMA_CMD 11 /* G->H DMA command */
922#endif
923#define VBVA_INFO_CAPS 12 /* informs host about HGSMI caps. see VBVACAPS below */
924#define VBVA_SCANLINE_CFG 13 /* configures scanline, see VBVASCANLINECFG below */
925#define VBVA_SCANLINE_INFO 14 /* requests scanline info, see VBVASCANLINEINFO below */
926#define VBVA_CMDVBVA_SUBMIT 16 /* inform host about VBVA Command submission */
927#define VBVA_CMDVBVA_FLUSH 17 /* inform host about VBVA Command submission */
928#define VBVA_CMDVBVA_CTL 18 /* G->H DMA command */
929#define VBVA_QUERY_MODE_HINTS 19 /* Query most recent mode hints sent. */
930/** Report the guest virtual desktop position and size for mapping host and
931 * guest pointer positions. */
932#define VBVA_REPORT_INPUT_MAPPING 20
933/** Report the guest cursor position and query the host position. */
934#define VBVA_CURSOR_POSITION 21
935
936/* host->guest commands */
937#define VBVAHG_EVENT 1
938#define VBVAHG_DISPLAY_CUSTOM 2
939#ifdef VBOX_WITH_VDMA
940#define VBVAHG_SHGSMI_COMPLETION 3
941#endif
942
943#ifdef VBOX_WITH_VIDEOHWACCEL
944#define VBVAHG_DCUSTOM_VHWA_CMDCOMPLETE 1
945#pragma pack(1)
946typedef struct VBVAHOSTCMDVHWACMDCOMPLETE
947{
948 uint32_t offCmd;
949}VBVAHOSTCMDVHWACMDCOMPLETE;
950#pragma pack()
951#endif /* # ifdef VBOX_WITH_VIDEOHWACCEL */
952
953#pragma pack(1)
954typedef enum
955{
956 VBVAHOSTCMD_OP_EVENT = 1,
957 VBVAHOSTCMD_OP_CUSTOM
958}VBVAHOSTCMD_OP_TYPE;
959
960typedef struct VBVAHOSTCMDEVENT
961{
962 uint64_t pEvent;
963}VBVAHOSTCMDEVENT;
964
965
966typedef struct VBVAHOSTCMD
967{
968 /* destination ID if >=0 specifies display index, otherwize the command is directed to the miniport */
969 int32_t iDstID;
970 int32_t customOpCode;
971 union
972 {
973 struct VBVAHOSTCMD *pNext;
974 uint32_t offNext;
975 uint64_t Data; /* the body is 64-bit aligned */
976 } u;
977 char body[1];
978} VBVAHOSTCMD;
979
980#define VBVAHOSTCMD_SIZE(a_cb) (sizeof(VBVAHOSTCMD) + (a_cb))
981#define VBVAHOSTCMD_BODY(a_pCmd, a_TypeBody) ((a_TypeBody RT_UNTRUSTED_VOLATILE_HSTGST *)&(a_pCmd)->body[0])
982#define VBVAHOSTCMD_HDR(a_pBody) \
983 ( (VBVAHOSTCMD RT_UNTRUSTED_VOLATILE_HSTGST *)( (uint8_t *)(a_pBody) - RT_OFFSETOF(VBVAHOSTCMD, body)) )
984#define VBVAHOSTCMD_HDRSIZE (RT_OFFSETOF(VBVAHOSTCMD, body))
985
986#pragma pack()
987
988/* VBVACONF32::u32Index */
989#define VBOX_VBVA_CONF32_MONITOR_COUNT 0
990#define VBOX_VBVA_CONF32_HOST_HEAP_SIZE 1
991/** Returns VINF_SUCCESS if the host can report mode hints via VBVA.
992 * Set value to VERR_NOT_SUPPORTED before calling. */
993#define VBOX_VBVA_CONF32_MODE_HINT_REPORTING 2
994/** Returns VINF_SUCCESS if the host can report guest cursor enabled status via
995 * VBVA. Set value to VERR_NOT_SUPPORTED before calling. */
996#define VBOX_VBVA_CONF32_GUEST_CURSOR_REPORTING 3
997/** Returns the currently available host cursor capabilities. Available if
998 * VBVACONF32::VBOX_VBVA_CONF32_GUEST_CURSOR_REPORTING returns success.
999 * @see VMMDevReqMouseStatus::mouseFeatures. */
1000#define VBOX_VBVA_CONF32_CURSOR_CAPABILITIES 4
1001/** Returns the supported flags in VBVAINFOSCREEN::u8Flags. */
1002#define VBOX_VBVA_CONF32_SCREEN_FLAGS 5
1003/** Returns the max size of VBVA record. */
1004#define VBOX_VBVA_CONF32_MAX_RECORD_SIZE 6
1005
1006typedef struct VBVACONF32
1007{
1008 uint32_t u32Index;
1009 uint32_t u32Value;
1010} VBVACONF32;
1011
1012/** Reserved for historical reasons. */
1013#define VBOX_VBVA_CURSOR_CAPABILITY_RESERVED0 RT_BIT(0)
1014/** Guest cursor capability: can the host show a hardware cursor at the host
1015 * pointer location? */
1016#define VBOX_VBVA_CURSOR_CAPABILITY_HARDWARE RT_BIT(1)
1017/** Reserved for historical reasons. */
1018#define VBOX_VBVA_CURSOR_CAPABILITY_RESERVED2 RT_BIT(2)
1019/** Reserved for historical reasons. Must always be unset. */
1020#define VBOX_VBVA_CURSOR_CAPABILITY_RESERVED3 RT_BIT(3)
1021/** Reserved for historical reasons. */
1022#define VBOX_VBVA_CURSOR_CAPABILITY_RESERVED4 RT_BIT(4)
1023/** Reserved for historical reasons. */
1024#define VBOX_VBVA_CURSOR_CAPABILITY_RESERVED5 RT_BIT(5)
1025
1026typedef struct VBVAINFOVIEW
1027{
1028 /* Index of the screen, assigned by the guest. */
1029 uint32_t u32ViewIndex;
1030
1031 /* The screen offset in VRAM, the framebuffer starts here. */
1032 uint32_t u32ViewOffset;
1033
1034 /* The size of the VRAM memory that can be used for the view. */
1035 uint32_t u32ViewSize;
1036
1037 /* The recommended maximum size of the VRAM memory for the screen. */
1038 uint32_t u32MaxScreenSize;
1039} VBVAINFOVIEW;
1040
1041typedef struct VBVAINFOHEAP
1042{
1043 /* Absolute offset in VRAM of the start of the heap. */
1044 uint32_t u32HeapOffset;
1045
1046 /* The size of the heap. */
1047 uint32_t u32HeapSize;
1048
1049} VBVAINFOHEAP;
1050
1051typedef struct VBVAFLUSH
1052{
1053 uint32_t u32Reserved;
1054
1055} VBVAFLUSH;
1056
1057typedef struct VBVACMDVBVASUBMIT
1058{
1059 uint32_t u32Reserved;
1060} VBVACMDVBVASUBMIT;
1061
1062/* flush is requested because due to guest command buffer overflow */
1063#define VBVACMDVBVAFLUSH_F_GUEST_BUFFER_OVERFLOW 1
1064
1065typedef struct VBVACMDVBVAFLUSH
1066{
1067 uint32_t u32Flags;
1068} VBVACMDVBVAFLUSH;
1069
1070
1071/* VBVAINFOSCREEN::u8Flags */
1072#define VBVA_SCREEN_F_NONE 0x0000
1073#define VBVA_SCREEN_F_ACTIVE 0x0001
1074/** The virtual monitor has been disabled by the guest and should be removed
1075 * by the host and ignored for purposes of pointer position calculation. */
1076#define VBVA_SCREEN_F_DISABLED 0x0002
1077/** The virtual monitor has been blanked by the guest and should be blacked
1078 * out by the host using width, height, etc values from the VBVAINFOSCREEN request. */
1079#define VBVA_SCREEN_F_BLANK 0x0004
1080/** The virtual monitor has been blanked by the guest and should be blacked
1081 * out by the host using the previous mode values for width. height, etc. */
1082#define VBVA_SCREEN_F_BLANK2 0x0008
1083
1084typedef struct VBVAINFOSCREEN
1085{
1086 /* Which view contains the screen. */
1087 uint32_t u32ViewIndex;
1088
1089 /* Physical X origin relative to the primary screen. */
1090 int32_t i32OriginX;
1091
1092 /* Physical Y origin relative to the primary screen. */
1093 int32_t i32OriginY;
1094
1095 /* Offset of visible framebuffer relative to the framebuffer start. */
1096 uint32_t u32StartOffset;
1097
1098 /* The scan line size in bytes. */
1099 uint32_t u32LineSize;
1100
1101 /* Width of the screen. */
1102 uint32_t u32Width;
1103
1104 /* Height of the screen. */
1105 uint32_t u32Height;
1106
1107 /* Color depth. */
1108 uint16_t u16BitsPerPixel;
1109
1110 /* VBVA_SCREEN_F_* */
1111 uint16_t u16Flags;
1112} VBVAINFOSCREEN;
1113
1114
1115/* VBVAENABLE::u32Flags */
1116#define VBVA_F_NONE 0x00000000
1117#define VBVA_F_ENABLE 0x00000001
1118#define VBVA_F_DISABLE 0x00000002
1119/* extended VBVA to be used with WDDM */
1120#define VBVA_F_EXTENDED 0x00000004
1121/* vbva offset is absolute VRAM offset */
1122#define VBVA_F_ABSOFFSET 0x00000008
1123
1124typedef struct VBVAENABLE
1125{
1126 uint32_t u32Flags;
1127 uint32_t u32Offset;
1128 int32_t i32Result;
1129} VBVAENABLE;
1130
1131typedef struct VBVAENABLE_EX
1132{
1133 VBVAENABLE Base;
1134 uint32_t u32ScreenId;
1135} VBVAENABLE_EX;
1136
1137
1138typedef struct VBVAMOUSEPOINTERSHAPE
1139{
1140 /* The host result. */
1141 int32_t i32Result;
1142
1143 /* VBOX_MOUSE_POINTER_* bit flags. */
1144 uint32_t fu32Flags;
1145
1146 /* X coordinate of the hot spot. */
1147 uint32_t u32HotX;
1148
1149 /* Y coordinate of the hot spot. */
1150 uint32_t u32HotY;
1151
1152 /* Width of the pointer in pixels. */
1153 uint32_t u32Width;
1154
1155 /* Height of the pointer in scanlines. */
1156 uint32_t u32Height;
1157
1158 /* Pointer data.
1159 *
1160 ****
1161 * The data consists of 1 bpp AND mask followed by 32 bpp XOR (color) mask.
1162 *
1163 * For pointers without alpha channel the XOR mask pixels are 32 bit values: (lsb)BGR0(msb).
1164 * For pointers with alpha channel the XOR mask consists of (lsb)BGRA(msb) 32 bit values.
1165 *
1166 * Guest driver must create the AND mask for pointers with alpha channel, so if host does not
1167 * support alpha, the pointer could be displayed as a normal color pointer. The AND mask can
1168 * be constructed from alpha values. For example alpha value >= 0xf0 means bit 0 in the AND mask.
1169 *
1170 * The AND mask is 1 bpp bitmap with byte aligned scanlines. Size of AND mask,
1171 * therefore, is cbAnd = (width + 7) / 8 * height. The padding bits at the
1172 * end of any scanline are undefined.
1173 *
1174 * The XOR mask follows the AND mask on the next 4 bytes aligned offset:
1175 * uint8_t *pXor = pAnd + (cbAnd + 3) & ~3
1176 * Bytes in the gap between the AND and the XOR mask are undefined.
1177 * XOR mask scanlines have no gap between them and size of XOR mask is:
1178 * cXor = width * 4 * height.
1179 ****
1180 *
1181 * Preallocate 4 bytes for accessing actual data as p->au8Data.
1182 */
1183 uint8_t au8Data[4];
1184
1185} VBVAMOUSEPOINTERSHAPE;
1186
1187/** @name VBVAMOUSEPOINTERSHAPE::fu32Flags
1188 * @note The VBOX_MOUSE_POINTER_* flags are used in the guest video driver,
1189 * values must be <= 0x8000 and must not be changed. (try make more sense
1190 * of this, please).
1191 * @{
1192 */
1193/** pointer is visible */
1194#define VBOX_MOUSE_POINTER_VISIBLE (0x0001)
1195/** pointer has alpha channel */
1196#define VBOX_MOUSE_POINTER_ALPHA (0x0002)
1197/** pointerData contains new pointer shape */
1198#define VBOX_MOUSE_POINTER_SHAPE (0x0004)
1199/** @} */
1200
1201/* the guest driver can handle asynch guest cmd completion by reading the command offset from io port */
1202#define VBVACAPS_COMPLETEGCMD_BY_IOREAD 0x00000001
1203/* the guest driver can handle video adapter IRQs */
1204#define VBVACAPS_IRQ 0x00000002
1205/** The guest can read video mode hints sent via VBVA. */
1206#define VBVACAPS_VIDEO_MODE_HINTS 0x00000004
1207/** The guest can switch to a software cursor on demand. */
1208#define VBVACAPS_DISABLE_CURSOR_INTEGRATION 0x00000008
1209/** The guest does not depend on host handling the VBE registers. */
1210#define VBVACAPS_USE_VBVA_ONLY 0x00000010
1211typedef struct VBVACAPS
1212{
1213 int32_t rc;
1214 uint32_t fCaps;
1215} VBVACAPS;
1216
1217/* makes graphics device generate IRQ on VSYNC */
1218#define VBVASCANLINECFG_ENABLE_VSYNC_IRQ 0x00000001
1219/* guest driver may request the current scanline */
1220#define VBVASCANLINECFG_ENABLE_SCANLINE_INFO 0x00000002
1221/* request the current refresh period, returned in u32RefreshPeriodMs */
1222#define VBVASCANLINECFG_QUERY_REFRESH_PERIOD 0x00000004
1223/* set new refresh period specified in u32RefreshPeriodMs.
1224 * if used with VBVASCANLINECFG_QUERY_REFRESH_PERIOD,
1225 * u32RefreshPeriodMs is set to the previous refresh period on return */
1226#define VBVASCANLINECFG_SET_REFRESH_PERIOD 0x00000008
1227
1228typedef struct VBVASCANLINECFG
1229{
1230 int32_t rc;
1231 uint32_t fFlags;
1232 uint32_t u32RefreshPeriodMs;
1233 uint32_t u32Reserved;
1234} VBVASCANLINECFG;
1235
1236typedef struct VBVASCANLINEINFO
1237{
1238 int32_t rc;
1239 uint32_t u32ScreenId;
1240 uint32_t u32InVBlank;
1241 uint32_t u32ScanLine;
1242} VBVASCANLINEINFO;
1243
1244/** Query the most recent mode hints received from the host. */
1245typedef struct VBVAQUERYMODEHINTS
1246{
1247 /** The maximum number of screens to return hints for. */
1248 uint16_t cHintsQueried;
1249 /** The size of the mode hint structures directly following this one. */
1250 uint16_t cbHintStructureGuest;
1251 /** The return code for the operation. Initialise to VERR_NOT_SUPPORTED. */
1252 int32_t rc;
1253} VBVAQUERYMODEHINTS;
1254
1255/** Structure in which a mode hint is returned. The guest allocates an array
1256 * of these immediately after the VBVAQUERYMODEHINTS structure. To accomodate
1257 * future extensions, the VBVAQUERYMODEHINTS structure specifies the size of
1258 * the VBVAMODEHINT structures allocated by the guest, and the host only fills
1259 * out structure elements which fit into that size. The host should fill any
1260 * unused members (e.g. dx, dy) or structure space on the end with ~0. The
1261 * whole structure can legally be set to ~0 to skip a screen. */
1262typedef struct VBVAMODEHINT
1263{
1264 uint32_t magic;
1265 uint32_t cx;
1266 uint32_t cy;
1267 uint32_t cBPP; /* Which has never been used... */
1268 uint32_t cDisplay;
1269 uint32_t dx; /**< X offset into the virtual frame-buffer. */
1270 uint32_t dy; /**< Y offset into the virtual frame-buffer. */
1271 uint32_t fEnabled; /* Not fFlags. Add new members for new flags. */
1272} VBVAMODEHINT;
1273
1274#define VBVAMODEHINT_MAGIC UINT32_C(0x0801add9)
1275
1276/** Report the rectangle relative to which absolute pointer events should be
1277 * expressed. This information remains valid until the next VBVA resize event
1278 * for any screen, at which time it is reset to the bounding rectangle of all
1279 * virtual screens and must be re-set.
1280 * @see VBVA_REPORT_INPUT_MAPPING. */
1281typedef struct VBVAREPORTINPUTMAPPING
1282{
1283 int32_t x; /**< Upper left X co-ordinate relative to the first screen. */
1284 int32_t y; /**< Upper left Y co-ordinate relative to the first screen. */
1285 uint32_t cx; /**< Rectangle width. */
1286 uint32_t cy; /**< Rectangle height. */
1287} VBVAREPORTINPUTMAPPING;
1288
1289/** Report the guest cursor position and query the host one. The host may wish
1290 * to use the guest information to re-position its own cursor, particularly
1291 * when the cursor is captured and the guest does not support switching to a
1292 * software cursor. After every mode switch the guest must signal that it
1293 * supports sending position information by sending an event with
1294 * @a fReportPosition set to false.
1295 * @see VBVA_CURSOR_POSITION */
1296typedef struct VBVACURSORPOSITION
1297{
1298 uint32_t fReportPosition; /**< Are we reporting a position? */
1299 uint32_t x; /**< Guest cursor X position */
1300 uint32_t y; /**< Guest cursor Y position */
1301} VBVACURSORPOSITION;
1302
1303#pragma pack()
1304
1305typedef uint64_t VBOXVIDEOOFFSET;
1306
1307#define VBOXVIDEOOFFSET_VOID ((VBOXVIDEOOFFSET)~0)
1308
1309#pragma pack(1)
1310
1311/*
1312 * VBOXSHGSMI made on top HGSMI and allows receiving notifications
1313 * about G->H command completion
1314 */
1315/* SHGSMI command header */
1316typedef struct VBOXSHGSMIHEADER
1317{
1318 uint64_t pvNext; /*<- completion processing queue */
1319 uint32_t fFlags; /*<- see VBOXSHGSMI_FLAG_XXX Flags */
1320 uint32_t cRefs; /*<- command referece count */
1321 uint64_t u64Info1; /*<- contents depends on the fFlags value */
1322 uint64_t u64Info2; /*<- contents depends on the fFlags value */
1323} VBOXSHGSMIHEADER, *PVBOXSHGSMIHEADER;
1324
1325typedef enum
1326{
1327 VBOXVDMACMD_TYPE_UNDEFINED = 0,
1328 VBOXVDMACMD_TYPE_DMA_PRESENT_BLT = 1,
1329 VBOXVDMACMD_TYPE_DMA_BPB_TRANSFER,
1330 VBOXVDMACMD_TYPE_DMA_BPB_FILL,
1331 VBOXVDMACMD_TYPE_DMA_PRESENT_SHADOW2PRIMARY,
1332 VBOXVDMACMD_TYPE_DMA_PRESENT_CLRFILL,
1333 VBOXVDMACMD_TYPE_DMA_PRESENT_FLIP,
1334 VBOXVDMACMD_TYPE_DMA_NOP,
1335 VBOXVDMACMD_TYPE_CHROMIUM_CMD, /* chromium cmd */
1336 VBOXVDMACMD_TYPE_DMA_BPB_TRANSFER_VRAMSYS,
1337 VBOXVDMACMD_TYPE_CHILD_STATUS_IRQ /* make the device notify child (monitor) state change IRQ */
1338} VBOXVDMACMD_TYPE;
1339
1340#pragma pack()
1341
1342/* the command processing was asynch, set by the host to indicate asynch command completion
1343 * must not be cleared once set, the command completion is performed by issuing a host->guest completion command
1344 * while keeping this flag unchanged */
1345#define VBOXSHGSMI_FLAG_HG_ASYNCH 0x00010000
1346#if 0
1347/* if set - asynch completion is performed by issuing the event,
1348 * if cleared - asynch completion is performed by calling a callback */
1349#define VBOXSHGSMI_FLAG_GH_ASYNCH_EVENT 0x00000001
1350#endif
1351/* issue interrupt on asynch completion, used for critical G->H commands,
1352 * i.e. for completion of which guest is waiting. */
1353#define VBOXSHGSMI_FLAG_GH_ASYNCH_IRQ 0x00000002
1354/* guest does not do any op on completion of this command,
1355 * the host may copy the command and indicate that it does not need the command anymore
1356 * by not setting VBOXSHGSMI_FLAG_HG_ASYNCH */
1357#define VBOXSHGSMI_FLAG_GH_ASYNCH_NOCOMPLETION 0x00000004
1358/* guest requires the command to be processed asynchronously,
1359 * not setting VBOXSHGSMI_FLAG_HG_ASYNCH by the host in this case is treated as command failure */
1360#define VBOXSHGSMI_FLAG_GH_ASYNCH_FORCE 0x00000008
1361/* force IRQ on cmd completion */
1362#define VBOXSHGSMI_FLAG_GH_ASYNCH_IRQ_FORCE 0x00000010
1363/* an IRQ-level callback is associated with the command */
1364#define VBOXSHGSMI_FLAG_GH_ASYNCH_CALLBACK_IRQ 0x00000020
1365/* guest expects this command to be completed synchronously */
1366#define VBOXSHGSMI_FLAG_GH_SYNCH 0x00000040
1367
1368
1369DECLINLINE(uint8_t RT_UNTRUSTED_VOLATILE_GUEST *)
1370VBoxSHGSMIBufferData(const VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_GUEST *pHeader)
1371{
1372 return (uint8_t RT_UNTRUSTED_VOLATILE_GUEST *)pHeader + sizeof(VBOXSHGSMIHEADER);
1373}
1374
1375#define VBoxSHGSMIBufferHeaderSize() (sizeof(VBOXSHGSMIHEADER))
1376
1377DECLINLINE(VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_GUEST *) VBoxSHGSMIBufferHeader(const void RT_UNTRUSTED_VOLATILE_GUEST *pvData)
1378{
1379 return (VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_GUEST *)((uintptr_t)pvData - sizeof(VBOXSHGSMIHEADER));
1380}
1381
1382#ifdef VBOX_WITH_VDMA
1383# pragma pack(1)
1384
1385/* VDMA - Video DMA */
1386
1387/* VDMA Control API */
1388/* VBOXVDMA_CTL::u32Flags */
1389typedef enum
1390{
1391 VBOXVDMA_CTL_TYPE_NONE = 0,
1392 VBOXVDMA_CTL_TYPE_ENABLE,
1393 VBOXVDMA_CTL_TYPE_DISABLE,
1394 VBOXVDMA_CTL_TYPE_FLUSH,
1395 VBOXVDMA_CTL_TYPE_WATCHDOG,
1396 VBOXVDMA_CTL_TYPE_END
1397} VBOXVDMA_CTL_TYPE;
1398
1399typedef struct VBOXVDMA_CTL
1400{
1401 VBOXVDMA_CTL_TYPE enmCtl;
1402 uint32_t u32Offset;
1403 int32_t i32Result;
1404} VBOXVDMA_CTL;
1405
1406typedef struct VBOXVDMA_RECTL
1407{
1408 int16_t left;
1409 int16_t top;
1410 uint16_t width;
1411 uint16_t height;
1412} VBOXVDMA_RECTL, *PVBOXVDMA_RECTL;
1413
1414typedef enum
1415{
1416 VBOXVDMA_PIXEL_FORMAT_UNKNOWN = 0,
1417 VBOXVDMA_PIXEL_FORMAT_R8G8B8 = 20,
1418 VBOXVDMA_PIXEL_FORMAT_A8R8G8B8 = 21,
1419 VBOXVDMA_PIXEL_FORMAT_X8R8G8B8 = 22,
1420 VBOXVDMA_PIXEL_FORMAT_R5G6B5 = 23,
1421 VBOXVDMA_PIXEL_FORMAT_X1R5G5B5 = 24,
1422 VBOXVDMA_PIXEL_FORMAT_A1R5G5B5 = 25,
1423 VBOXVDMA_PIXEL_FORMAT_A4R4G4B4 = 26,
1424 VBOXVDMA_PIXEL_FORMAT_R3G3B2 = 27,
1425 VBOXVDMA_PIXEL_FORMAT_A8 = 28,
1426 VBOXVDMA_PIXEL_FORMAT_A8R3G3B2 = 29,
1427 VBOXVDMA_PIXEL_FORMAT_X4R4G4B4 = 30,
1428 VBOXVDMA_PIXEL_FORMAT_A2B10G10R10 = 31,
1429 VBOXVDMA_PIXEL_FORMAT_A8B8G8R8 = 32,
1430 VBOXVDMA_PIXEL_FORMAT_X8B8G8R8 = 33,
1431 VBOXVDMA_PIXEL_FORMAT_G16R16 = 34,
1432 VBOXVDMA_PIXEL_FORMAT_A2R10G10B10 = 35,
1433 VBOXVDMA_PIXEL_FORMAT_A16B16G16R16 = 36,
1434 VBOXVDMA_PIXEL_FORMAT_A8P8 = 40,
1435 VBOXVDMA_PIXEL_FORMAT_P8 = 41,
1436 VBOXVDMA_PIXEL_FORMAT_L8 = 50,
1437 VBOXVDMA_PIXEL_FORMAT_A8L8 = 51,
1438 VBOXVDMA_PIXEL_FORMAT_A4L4 = 52,
1439 VBOXVDMA_PIXEL_FORMAT_V8U8 = 60,
1440 VBOXVDMA_PIXEL_FORMAT_L6V5U5 = 61,
1441 VBOXVDMA_PIXEL_FORMAT_X8L8V8U8 = 62,
1442 VBOXVDMA_PIXEL_FORMAT_Q8W8V8U8 = 63,
1443 VBOXVDMA_PIXEL_FORMAT_V16U16 = 64,
1444 VBOXVDMA_PIXEL_FORMAT_W11V11U10 = 65,
1445 VBOXVDMA_PIXEL_FORMAT_A2W10V10U10 = 67
1446} VBOXVDMA_PIXEL_FORMAT;
1447
1448typedef struct VBOXVDMA_SURF_DESC
1449{
1450 uint32_t width;
1451 uint32_t height;
1452 VBOXVDMA_PIXEL_FORMAT format;
1453 uint32_t bpp;
1454 uint32_t pitch;
1455 uint32_t fFlags;
1456} VBOXVDMA_SURF_DESC, *PVBOXVDMA_SURF_DESC;
1457
1458/*typedef uint64_t VBOXVDMAPHADDRESS;*/
1459typedef uint64_t VBOXVDMASURFHANDLE;
1460
1461/* region specified as a rectangle, otherwize it is a size of memory pointed to by phys address */
1462#define VBOXVDMAOPERAND_FLAGS_RECTL 0x1
1463/* Surface handle is valid */
1464#define VBOXVDMAOPERAND_FLAGS_PRIMARY 0x2
1465/* address is offset in VRAM */
1466#define VBOXVDMAOPERAND_FLAGS_VRAMOFFSET 0x4
1467
1468
1469/* VBOXVDMACBUF_DR::phBuf specifies offset in VRAM */
1470#define VBOXVDMACBUF_FLAG_BUF_VRAM_OFFSET 0x00000001
1471/* command buffer follows the VBOXVDMACBUF_DR in VRAM, VBOXVDMACBUF_DR::phBuf is ignored */
1472#define VBOXVDMACBUF_FLAG_BUF_FOLLOWS_DR 0x00000002
1473
1474/**
1475 * We can not submit the DMA command via VRAM since we do not have control over
1476 * DMA command buffer [de]allocation, i.e. we only control the buffer contents.
1477 * In other words the system may call one of our callbacks to fill a command buffer
1478 * with the necessary commands and then discard the buffer w/o any notification.
1479 *
1480 * We have only DMA command buffer physical address at submission time.
1481 *
1482 * so the only way is to */
1483typedef struct VBOXVDMACBUF_DR
1484{
1485 uint16_t fFlags;
1486 uint16_t cbBuf;
1487 /* RT_SUCCESS() - on success
1488 * VERR_INTERRUPTED - on preemption
1489 * VERR_xxx - on error */
1490 int32_t rc;
1491 union
1492 {
1493 uint64_t phBuf;
1494 VBOXVIDEOOFFSET offVramBuf;
1495 } Location;
1496 uint64_t aGuestData[7];
1497} VBOXVDMACBUF_DR, *PVBOXVDMACBUF_DR;
1498
1499#define VBOXVDMACBUF_DR_TAIL(a_pCmd, a_TailType) \
1500 ( (a_TailType RT_UNTRUSTED_VOLATILE_HSTGST *)( ((uint8_t*)(a_pCmd)) + sizeof(VBOXVDMACBUF_DR)) )
1501#define VBOXVDMACBUF_DR_FROM_TAIL(a_pCmd) \
1502 ( (VBOXVDMACBUF_DR RT_UNTRUSTED_VOLATILE_HSTGST *)( ((uint8_t*)(a_pCmd)) - sizeof(VBOXVDMACBUF_DR)) )
1503
1504typedef struct VBOXVDMACMD
1505{
1506 VBOXVDMACMD_TYPE enmType;
1507 uint32_t u32CmdSpecific;
1508} VBOXVDMACMD;
1509
1510#define VBOXVDMACMD_HEADER_SIZE() sizeof(VBOXVDMACMD)
1511#define VBOXVDMACMD_SIZE_FROMBODYSIZE(_s) ((uint32_t)(VBOXVDMACMD_HEADER_SIZE() + (_s)))
1512#define VBOXVDMACMD_SIZE(_t) (VBOXVDMACMD_SIZE_FROMBODYSIZE(sizeof(_t)))
1513#define VBOXVDMACMD_BODY(a_pCmd, a_TypeBody) \
1514 ( (a_TypeBody RT_UNTRUSTED_VOLATILE_HSTGST *)( ((uint8_t *)(a_pCmd)) + VBOXVDMACMD_HEADER_SIZE()) )
1515#define VBOXVDMACMD_BODY_SIZE(_s) ( (_s) - VBOXVDMACMD_HEADER_SIZE() )
1516#define VBOXVDMACMD_FROM_BODY(a_pBody) \
1517 ( (VBOXVDMACMD RT_UNTRUSTED_VOLATILE_HSTGST *)( ((uint8_t *)(a_pBody)) - VBOXVDMACMD_HEADER_SIZE()) )
1518#define VBOXVDMACMD_BODY_FIELD_OFFSET(_ot, _t, _f) ( (_ot)(uintptr_t)( VBOXVDMACMD_BODY(0, uint8_t) + RT_UOFFSETOF_DYN(_t, _f) ) )
1519
1520typedef struct VBOXVDMACMD_DMA_PRESENT_BLT
1521{
1522 VBOXVIDEOOFFSET offSrc;
1523 VBOXVIDEOOFFSET offDst;
1524 VBOXVDMA_SURF_DESC srcDesc;
1525 VBOXVDMA_SURF_DESC dstDesc;
1526 VBOXVDMA_RECTL srcRectl;
1527 VBOXVDMA_RECTL dstRectl;
1528 uint32_t u32Reserved;
1529 uint32_t cDstSubRects;
1530 VBOXVDMA_RECTL aDstSubRects[1];
1531} VBOXVDMACMD_DMA_PRESENT_BLT, *PVBOXVDMACMD_DMA_PRESENT_BLT;
1532
1533typedef struct VBOXVDMACMD_DMA_PRESENT_SHADOW2PRIMARY
1534{
1535 VBOXVDMA_RECTL Rect;
1536} VBOXVDMACMD_DMA_PRESENT_SHADOW2PRIMARY, *PVBOXVDMACMD_DMA_PRESENT_SHADOW2PRIMARY;
1537
1538
1539#define VBOXVDMACMD_DMA_BPB_TRANSFER_F_SRC_VRAMOFFSET 0x00000001
1540#define VBOXVDMACMD_DMA_BPB_TRANSFER_F_DST_VRAMOFFSET 0x00000002
1541
1542typedef struct VBOXVDMACMD_DMA_BPB_TRANSFER
1543{
1544 uint32_t cbTransferSize;
1545 uint32_t fFlags;
1546 union
1547 {
1548 uint64_t phBuf;
1549 VBOXVIDEOOFFSET offVramBuf;
1550 } Src;
1551 union
1552 {
1553 uint64_t phBuf;
1554 VBOXVIDEOOFFSET offVramBuf;
1555 } Dst;
1556} VBOXVDMACMD_DMA_BPB_TRANSFER, *PVBOXVDMACMD_DMA_BPB_TRANSFER;
1557
1558#define VBOXVDMACMD_SYSMEMEL_F_PAGELIST 0x00000001
1559
1560typedef struct VBOXVDMACMD_SYSMEMEL
1561{
1562 uint32_t cPages;
1563 uint32_t fFlags;
1564 uint64_t phBuf[1];
1565} VBOXVDMACMD_SYSMEMEL, *PVBOXVDMACMD_SYSMEMEL;
1566
1567#define VBOXVDMACMD_SYSMEMEL_NEXT(_pEl) ( ((_pEl)->fFlags & VBOXVDMACMD_SYSMEMEL_F_PAGELIST) \
1568 ? ((PVBOXVDMACMD_SYSMEMEL)(((uint8_t*)(_pEl)) + RT_UOFFSETOF_DYN(VBOXVDMACMD_SYSMEMEL, phBuf[(_pEl)->cPages]))) \
1569 : ((_pEl) + 1) )
1570
1571#define VBOXVDMACMD_DMA_BPB_TRANSFER_VRAMSYS_SYS2VRAM 0x00000001
1572
1573typedef struct VBOXVDMACMD_DMA_BPB_TRANSFER_VRAMSYS
1574{
1575 uint32_t cTransferPages;
1576 uint32_t fFlags;
1577 VBOXVIDEOOFFSET offVramBuf;
1578 VBOXVDMACMD_SYSMEMEL FirstEl;
1579} VBOXVDMACMD_DMA_BPB_TRANSFER_VRAMSYS, *PVBOXVDMACMD_DMA_BPB_TRANSFER_VRAMSYS;
1580
1581typedef struct VBOXVDMACMD_DMA_BPB_FILL
1582{
1583 VBOXVIDEOOFFSET offSurf;
1584 uint32_t cbFillSize;
1585 uint32_t u32FillPattern;
1586} VBOXVDMACMD_DMA_BPB_FILL, *PVBOXVDMACMD_DMA_BPB_FILL;
1587
1588#define VBOXVDMA_CHILD_STATUS_F_CONNECTED 0x01
1589#define VBOXVDMA_CHILD_STATUS_F_DISCONNECTED 0x02
1590#define VBOXVDMA_CHILD_STATUS_F_ROTATED 0x04
1591
1592typedef struct VBOXVDMA_CHILD_STATUS
1593{
1594 uint32_t iChild;
1595 uint8_t fFlags;
1596 uint8_t u8RotationAngle;
1597 uint16_t u16Reserved;
1598} VBOXVDMA_CHILD_STATUS, *PVBOXVDMA_CHILD_STATUS;
1599
1600/* apply the aInfos are applied to all targets, the iTarget is ignored */
1601#define VBOXVDMACMD_CHILD_STATUS_IRQ_F_APPLY_TO_ALL 0x00000001
1602
1603typedef struct VBOXVDMACMD_CHILD_STATUS_IRQ
1604{
1605 uint32_t cInfos;
1606 uint32_t fFlags;
1607 VBOXVDMA_CHILD_STATUS aInfos[1];
1608} VBOXVDMACMD_CHILD_STATUS_IRQ, *PVBOXVDMACMD_CHILD_STATUS_IRQ;
1609
1610# pragma pack()
1611#endif /* #ifdef VBOX_WITH_VDMA */
1612
1613#pragma pack(1)
1614typedef struct VBOXVDMACMD_CHROMIUM_BUFFER
1615{
1616 VBOXVIDEOOFFSET offBuffer;
1617 uint32_t cbBuffer;
1618 uint32_t u32GuestData;
1619 uint64_t u64GuestData;
1620} VBOXVDMACMD_CHROMIUM_BUFFER, *PVBOXVDMACMD_CHROMIUM_BUFFER;
1621
1622typedef struct VBOXVDMACMD_CHROMIUM_CMD
1623{
1624 uint32_t cBuffers;
1625 uint32_t u32Reserved;
1626 VBOXVDMACMD_CHROMIUM_BUFFER aBuffers[1];
1627} VBOXVDMACMD_CHROMIUM_CMD, *PVBOXVDMACMD_CHROMIUM_CMD;
1628
1629typedef enum
1630{
1631 VBOXVDMACMD_CHROMIUM_CTL_TYPE_UNKNOWN = 0,
1632 VBOXVDMACMD_CHROMIUM_CTL_TYPE_CRHGSMI_SETUP,
1633 VBOXVDMACMD_CHROMIUM_CTL_TYPE_SAVESTATE_BEGIN,
1634 VBOXVDMACMD_CHROMIUM_CTL_TYPE_SAVESTATE_END,
1635 VBOXVDMACMD_CHROMIUM_CTL_TYPE_CRHGSMI_SETUP_MAINCB,
1636 VBOXVDMACMD_CHROMIUM_CTL_TYPE_CRCONNECT,
1637 VBOXVDMACMD_CHROMIUM_CTL_TYPE_SIZEHACK = 0x7fffffff
1638} VBOXVDMACMD_CHROMIUM_CTL_TYPE;
1639
1640typedef struct VBOXVDMACMD_CHROMIUM_CTL
1641{
1642 VBOXVDMACMD_CHROMIUM_CTL_TYPE enmType;
1643 uint32_t cbCmd;
1644} VBOXVDMACMD_CHROMIUM_CTL, *PVBOXVDMACMD_CHROMIUM_CTL;
1645
1646
1647typedef struct PDMIDISPLAYVBVACALLBACKS *HCRHGSMICMDCOMPLETION;
1648typedef DECLCALLBACK(int) FNCRHGSMICMDCOMPLETION(HCRHGSMICMDCOMPLETION hCompletion, PVBOXVDMACMD_CHROMIUM_CMD pCmd, int rc);
1649typedef FNCRHGSMICMDCOMPLETION *PFNCRHGSMICMDCOMPLETION;
1650
1651/* tells whether 3D backend has some 3D overlay data displayed */
1652typedef DECLCALLBACK(bool) FNCROGLHASDATA(void);
1653typedef FNCROGLHASDATA *PFNCROGLHASDATA;
1654
1655/* same as PFNCROGLHASDATA, but for specific screen */
1656typedef DECLCALLBACK(bool) FNCROGLHASDATAFORSCREEN(uint32_t i32ScreenID);
1657typedef FNCROGLHASDATAFORSCREEN *PFNCROGLHASDATAFORSCREEN;
1658
1659/* callbacks chrogl gives to main */
1660typedef struct CR_MAIN_INTERFACE
1661{
1662 PFNCROGLHASDATA pfnHasData;
1663 PFNCROGLHASDATAFORSCREEN pfnHasDataForScreen;
1664} CR_MAIN_INTERFACE;
1665
1666typedef struct VBOXVDMACMD_CHROMIUM_CTL_CRHGSMI_SETUP_MAINCB
1667{
1668 VBOXVDMACMD_CHROMIUM_CTL Hdr;
1669 /*in*/
1670 HCRHGSMICMDCOMPLETION hCompletion;
1671 PFNCRHGSMICMDCOMPLETION pfnCompletion;
1672 /*out*/
1673 CR_MAIN_INTERFACE MainInterface;
1674} VBOXVDMACMD_CHROMIUM_CTL_CRHGSMI_SETUP_MAINCB, *PVBOXVDMACMD_CHROMIUM_CTL_CRHGSMI_SETUP_MAINCB;
1675
1676typedef struct VBOXCRCON_SERVER *HVBOXCRCON_SERVER;
1677typedef struct PDMIDISPLAYVBVACALLBACKS* HVBOXCRCON_CLIENT;
1678
1679typedef struct VBOXCRCON_3DRGN_CLIENT* HVBOXCRCON_3DRGN_CLIENT;
1680typedef struct VBOXCRCON_3DRGN_ASYNCCLIENT* HVBOXCRCON_3DRGN_ASYNCCLIENT;
1681
1682/* server callbacks */
1683/* submit chromium cmd */
1684typedef DECLCALLBACK(int) FNVBOXCRCON_SVR_CRCMD(HVBOXCRCON_SERVER hServer, PVBOXVDMACMD_CHROMIUM_CMD pCmd, uint32_t cbCmd);
1685typedef FNVBOXCRCON_SVR_CRCMD *PFNVBOXCRCON_SVR_CRCMD;
1686
1687/* submit chromium control cmd */
1688typedef DECLCALLBACK(int) FNVBOXCRCON_SVR_CRCTL(HVBOXCRCON_SERVER hServer, PVBOXVDMACMD_CHROMIUM_CTL pCtl, uint32_t cbCmd);
1689typedef FNVBOXCRCON_SVR_CRCTL *PFNVBOXCRCON_SVR_CRCTL;
1690
1691/* request 3D data.
1692 * The protocol is the following:
1693 * 1. if there is no 3D data displayed on screen, returns VINF_EOF immediately w/o calling any PFNVBOXCRCON_3DRGN_XXX callbacks
1694 * 2. otherwise calls PFNVBOXCRCON_3DRGN_ONSUBMIT, submits the "regions get" request to the CrOpenGL server to process it asynchronously and returns VINF_SUCCESS
1695 * 2.a on "regions get" request processing calls PFNVBOXCRCON_3DRGN_BEGIN,
1696 * 2.b then PFNVBOXCRCON_3DRGN_REPORT zero or more times for each 3D region,
1697 * 2.c and then PFNVBOXCRCON_3DRGN_END
1698 * 3. returns VERR_XXX code on failure
1699 * */
1700typedef DECLCALLBACK(int) FNVBOXCRCON_SVR_3DRGN_GET(HVBOXCRCON_SERVER hServer, HVBOXCRCON_3DRGN_CLIENT hRgnClient, uint32_t idScreen);
1701typedef FNVBOXCRCON_SVR_3DRGN_GET *PFNVBOXCRCON_SVR_3DRGN_GET;
1702
1703/* 3D Regions Client callbacks */
1704/* called from the PFNVBOXCRCON_SVR_3DRGN_GET callback in case server has 3D data and is going to process the request asynchronously,
1705 * see comments for PFNVBOXCRCON_SVR_3DRGN_GET above */
1706typedef DECLCALLBACK(int) FNVBOXCRCON_3DRGN_ONSUBMIT(HVBOXCRCON_3DRGN_CLIENT hRgnClient, uint32_t idScreen, HVBOXCRCON_3DRGN_ASYNCCLIENT *phRgnAsyncClient);
1707typedef FNVBOXCRCON_3DRGN_ONSUBMIT *PFNVBOXCRCON_3DRGN_ONSUBMIT;
1708
1709/* called from the "regions get" command processing thread, to indicate that the "regions get" is started.
1710 * see comments for PFNVBOXCRCON_SVR_3DRGN_GET above */
1711typedef DECLCALLBACK(int) FNVBOXCRCON_3DRGN_BEGIN(HVBOXCRCON_3DRGN_ASYNCCLIENT hRgnAsyncClient, uint32_t idScreen);
1712typedef FNVBOXCRCON_3DRGN_BEGIN *PFNVBOXCRCON_3DRGN_BEGIN;
1713
1714/* called from the "regions get" command processing thread, to report a 3D region.
1715 * see comments for PFNVBOXCRCON_SVR_3DRGN_GET above */
1716typedef DECLCALLBACK(int) FNVBOXCRCON_3DRGN_REPORT(HVBOXCRCON_3DRGN_ASYNCCLIENT hRgnAsyncClient, uint32_t idScreen, void *pvData, uint32_t cbStride, const RTRECT *pRect);
1717typedef FNVBOXCRCON_3DRGN_REPORT *PFNVBOXCRCON_3DRGN_REPORT;
1718
1719/* called from the "regions get" command processing thread, to indicate that the "regions get" is completed.
1720 * see comments for PFNVBOXCRCON_SVR_3DRGN_GET above */
1721typedef DECLCALLBACK(int) FNVBOXCRCON_3DRGN_END(HVBOXCRCON_3DRGN_ASYNCCLIENT hRgnAsyncClient, uint32_t idScreen);
1722typedef FNVBOXCRCON_3DRGN_END *PFNVBOXCRCON_3DRGN_END;
1723
1724
1725/* client callbacks */
1726/* complete chromium cmd */
1727typedef DECLCALLBACK(int) FNVBOXCRCON_CLT_CRCTL_COMPLETE(HVBOXCRCON_CLIENT hClient, PVBOXVDMACMD_CHROMIUM_CTL pCtl, int rc);
1728typedef FNVBOXCRCON_CLT_CRCTL_COMPLETE *PFNVBOXCRCON_CLT_CRCTL_COMPLETE;
1729
1730/* complete chromium control cmd */
1731typedef DECLCALLBACK(int) FNVBOXCRCON_CLT_CRCMD_COMPLETE(HVBOXCRCON_CLIENT hClient, PVBOXVDMACMD_CHROMIUM_CMD pCmd, int rc);
1732typedef FNVBOXCRCON_CLT_CRCMD_COMPLETE *PFNVBOXCRCON_CLT_CRCMD_COMPLETE;
1733
1734typedef struct VBOXCRCON_SERVER_CALLBACKS
1735{
1736 HVBOXCRCON_SERVER hServer;
1737 PFNVBOXCRCON_SVR_CRCMD pfnCrCmd;
1738 PFNVBOXCRCON_SVR_CRCTL pfnCrCtl;
1739 PFNVBOXCRCON_SVR_3DRGN_GET pfn3DRgnGet;
1740} VBOXCRCON_SERVER_CALLBACKS, *PVBOXCRCON_SERVER_CALLBACKS;
1741
1742typedef struct VBOXCRCON_CLIENT_CALLBACKS
1743{
1744 HVBOXCRCON_CLIENT hClient;
1745 PFNVBOXCRCON_CLT_CRCMD_COMPLETE pfnCrCmdComplete;
1746 PFNVBOXCRCON_CLT_CRCTL_COMPLETE pfnCrCtlComplete;
1747 PFNVBOXCRCON_3DRGN_ONSUBMIT pfn3DRgnOnSubmit;
1748 PFNVBOXCRCON_3DRGN_BEGIN pfn3DRgnBegin;
1749 PFNVBOXCRCON_3DRGN_REPORT pfn3DRgnReport;
1750 PFNVBOXCRCON_3DRGN_END pfn3DRgnEnd;
1751} VBOXCRCON_CLIENT_CALLBACKS, *PVBOXCRCON_CLIENT_CALLBACKS;
1752
1753/* issued by Main to establish connection between Main and CrOpenGL service */
1754typedef struct VBOXVDMACMD_CHROMIUM_CTL_CRCONNECT
1755{
1756 VBOXVDMACMD_CHROMIUM_CTL Hdr;
1757 /*input (filled by Client) :*/
1758 /*class VMMDev*/void *pVMMDev;
1759 VBOXCRCON_CLIENT_CALLBACKS ClientCallbacks;
1760 /*output (filled by Server) :*/
1761 VBOXCRCON_SERVER_CALLBACKS ServerCallbacks;
1762} VBOXVDMACMD_CHROMIUM_CTL_CRCONNECT, *PVBOXVDMACMD_CHROMIUM_CTL_CRCONNECT;
1763
1764/* ring command buffer dr */
1765#define VBOXCMDVBVA_STATE_SUBMITTED 1
1766#define VBOXCMDVBVA_STATE_CANCELLED 2
1767#define VBOXCMDVBVA_STATE_IN_PROGRESS 3
1768/* the "completed" state is signalled via the ring buffer values */
1769
1770/* CrHgsmi command */
1771#define VBOXCMDVBVA_OPTYPE_CRCMD 1
1772/* blit command that does blitting of allocations identified by VRAM offset or host id
1773 * for VRAM-offset ones the size and format are same as primary */
1774#define VBOXCMDVBVA_OPTYPE_BLT 2
1775/* flip */
1776#define VBOXCMDVBVA_OPTYPE_FLIP 3
1777/* ColorFill */
1778#define VBOXCMDVBVA_OPTYPE_CLRFILL 4
1779/* allocation paging transfer request */
1780#define VBOXCMDVBVA_OPTYPE_PAGING_TRANSFER 5
1781/* allocation paging fill request */
1782#define VBOXCMDVBVA_OPTYPE_PAGING_FILL 6
1783/* same as VBOXCMDVBVA_OPTYPE_NOP, but contains VBOXCMDVBVA_HDR data */
1784#define VBOXCMDVBVA_OPTYPE_NOPCMD 7
1785/* actual command is stored in guest system memory */
1786#define VBOXCMDVBVA_OPTYPE_SYSMEMCMD 8
1787/* complex command - i.e. can contain multiple commands
1788 * i.e. the VBOXCMDVBVA_OPTYPE_COMPLEXCMD VBOXCMDVBVA_HDR is followed
1789 * by one or more VBOXCMDVBVA_HDR commands.
1790 * Each command's size is specified in it's VBOXCMDVBVA_HDR's u32FenceID field */
1791#define VBOXCMDVBVA_OPTYPE_COMPLEXCMD 9
1792
1793/* nop - is a one-bit command. The buffer size to skip is determined by VBVA buffer size */
1794#define VBOXCMDVBVA_OPTYPE_NOP 0x80
1795
1796/* u8Flags flags */
1797/* transfer from RAM to Allocation */
1798#define VBOXCMDVBVA_OPF_PAGING_TRANSFER_IN 0x80
1799
1800#define VBOXCMDVBVA_OPF_BLT_TYPE_SAMEDIM_A8R8G8B8 0
1801#define VBOXCMDVBVA_OPF_BLT_TYPE_GENERIC_A8R8G8B8 1
1802#define VBOXCMDVBVA_OPF_BLT_TYPE_OFFPRIMSZFMT_OR_ID 2
1803
1804#define VBOXCMDVBVA_OPF_BLT_TYPE_MASK 3
1805
1806
1807#define VBOXCMDVBVA_OPF_CLRFILL_TYPE_GENERIC_A8R8G8B8 0
1808
1809#define VBOXCMDVBVA_OPF_CLRFILL_TYPE_MASK 1
1810
1811
1812/* blit direction is from first operand to second */
1813#define VBOXCMDVBVA_OPF_BLT_DIR_IN_2 0x10
1814/* operand 1 contains host id */
1815#define VBOXCMDVBVA_OPF_OPERAND1_ISID 0x20
1816/* operand 2 contains host id */
1817#define VBOXCMDVBVA_OPF_OPERAND2_ISID 0x40
1818/* primary hint id is src */
1819#define VBOXCMDVBVA_OPF_PRIMARY_HINT_SRC 0x80
1820
1821/* trying to make the header as small as possible,
1822 * we'd have pretty few op codes actually, so 8bit is quite enough,
1823 * we will be able to extend it in any way. */
1824typedef struct VBOXCMDVBVA_HDR
1825{
1826 /* one VBOXCMDVBVA_OPTYPE_XXX, except NOP, see comments above */
1827 uint8_t u8OpCode;
1828 /* command-specific
1829 * VBOXCMDVBVA_OPTYPE_CRCMD - must be null
1830 * VBOXCMDVBVA_OPTYPE_BLT - OR-ed VBOXCMDVBVA_OPF_ALLOC_XXX flags
1831 * VBOXCMDVBVA_OPTYPE_PAGING_TRANSFER - must be null
1832 * VBOXCMDVBVA_OPTYPE_PAGING_FILL - must be null
1833 * VBOXCMDVBVA_OPTYPE_NOPCMD - must be null
1834 * VBOXCMDVBVA_OPTYPE_NOP - not applicable (as the entire VBOXCMDVBVA_HDR is not valid) */
1835 uint8_t u8Flags;
1836 /* one of VBOXCMDVBVA_STATE_XXX*/
1837 volatile uint8_t u8State;
1838 union
1839 {
1840 /* result, 0 on success, otherwise contains the failure code TBD */
1841 int8_t i8Result;
1842 uint8_t u8PrimaryID;
1843 } u;
1844 union
1845 {
1846 /* complex command (VBOXCMDVBVA_OPTYPE_COMPLEXCMD) element data */
1847 struct
1848 {
1849 /* command length */
1850 uint16_t u16CbCmdHost;
1851 /* guest-specific data, host expects it to be NULL */
1852 uint16_t u16CbCmdGuest;
1853 } complexCmdEl;
1854 /* DXGK DDI fence ID */
1855 uint32_t u32FenceID;
1856 } u2;
1857} VBOXCMDVBVA_HDR;
1858
1859typedef uint32_t VBOXCMDVBVAOFFSET;
1860typedef uint64_t VBOXCMDVBVAPHADDR;
1861typedef uint32_t VBOXCMDVBVAPAGEIDX;
1862
1863typedef struct VBOXCMDVBVA_CRCMD_BUFFER
1864{
1865 uint32_t cbBuffer;
1866 VBOXCMDVBVAOFFSET offBuffer;
1867} VBOXCMDVBVA_CRCMD_BUFFER;
1868
1869typedef struct VBOXCMDVBVA_CRCMD_CMD
1870{
1871 uint32_t cBuffers;
1872 VBOXCMDVBVA_CRCMD_BUFFER aBuffers[1];
1873} VBOXCMDVBVA_CRCMD_CMD;
1874
1875typedef struct VBOXCMDVBVA_CRCMD
1876{
1877 VBOXCMDVBVA_HDR Hdr;
1878 VBOXCMDVBVA_CRCMD_CMD Cmd;
1879} VBOXCMDVBVA_CRCMD;
1880
1881typedef struct VBOXCMDVBVA_ALLOCINFO
1882{
1883 union
1884 {
1885 VBOXCMDVBVAOFFSET offVRAM;
1886 uint32_t id;
1887 } u;
1888} VBOXCMDVBVA_ALLOCINFO;
1889
1890typedef struct VBOXCMDVBVA_ALLOCDESC
1891{
1892 VBOXCMDVBVA_ALLOCINFO Info;
1893 uint16_t u16Width;
1894 uint16_t u16Height;
1895} VBOXCMDVBVA_ALLOCDESC;
1896
1897typedef struct VBOXCMDVBVA_RECT
1898{
1899 /** Coordinates of affected rectangle. */
1900 int16_t xLeft;
1901 int16_t yTop;
1902 int16_t xRight;
1903 int16_t yBottom;
1904} VBOXCMDVBVA_RECT;
1905
1906typedef struct VBOXCMDVBVA_POINT
1907{
1908 int16_t x;
1909 int16_t y;
1910} VBOXCMDVBVA_POINT;
1911
1912typedef struct VBOXCMDVBVA_BLT_HDR
1913{
1914 VBOXCMDVBVA_HDR Hdr;
1915 VBOXCMDVBVA_POINT Pos;
1916} VBOXCMDVBVA_BLT_HDR;
1917
1918typedef struct VBOXCMDVBVA_BLT_PRIMARY
1919{
1920 VBOXCMDVBVA_BLT_HDR Hdr;
1921 VBOXCMDVBVA_ALLOCINFO alloc;
1922 /* the rects count is determined from the command size */
1923 VBOXCMDVBVA_RECT aRects[1];
1924} VBOXCMDVBVA_BLT_PRIMARY;
1925
1926typedef struct VBOXCMDVBVA_BLT_PRIMARY_GENERIC_A8R8G8B8
1927{
1928 VBOXCMDVBVA_BLT_HDR Hdr;
1929 VBOXCMDVBVA_ALLOCDESC alloc;
1930 /* the rects count is determined from the command size */
1931 VBOXCMDVBVA_RECT aRects[1];
1932} VBOXCMDVBVA_BLT_PRIMARY_GENERIC_A8R8G8B8;
1933
1934typedef struct VBOXCMDVBVA_BLT_OFFPRIMSZFMT_OR_ID
1935{
1936 VBOXCMDVBVA_BLT_HDR Hdr;
1937 VBOXCMDVBVA_ALLOCINFO alloc;
1938 uint32_t id;
1939 /* the rects count is determined from the command size */
1940 VBOXCMDVBVA_RECT aRects[1];
1941} VBOXCMDVBVA_BLT_OFFPRIMSZFMT_OR_ID;
1942
1943typedef struct VBOXCMDVBVA_BLT_SAMEDIM_A8R8G8B8
1944{
1945 VBOXCMDVBVA_BLT_HDR Hdr;
1946 VBOXCMDVBVA_ALLOCDESC alloc1;
1947 VBOXCMDVBVA_ALLOCINFO info2;
1948 /* the rects count is determined from the command size */
1949 VBOXCMDVBVA_RECT aRects[1];
1950} VBOXCMDVBVA_BLT_SAMEDIM_A8R8G8B8;
1951
1952typedef struct VBOXCMDVBVA_BLT_GENERIC_A8R8G8B8
1953{
1954 VBOXCMDVBVA_BLT_HDR Hdr;
1955 VBOXCMDVBVA_ALLOCDESC alloc1;
1956 VBOXCMDVBVA_ALLOCDESC alloc2;
1957 /* the rects count is determined from the command size */
1958 VBOXCMDVBVA_RECT aRects[1];
1959} VBOXCMDVBVA_BLT_GENERIC_A8R8G8B8;
1960
1961#define VBOXCMDVBVA_SIZEOF_BLTSTRUCT_MAX (sizeof (VBOXCMDVBVA_BLT_GENERIC_A8R8G8B8))
1962
1963typedef struct VBOXCMDVBVA_FLIP
1964{
1965 VBOXCMDVBVA_HDR Hdr;
1966 VBOXCMDVBVA_ALLOCINFO src;
1967 VBOXCMDVBVA_RECT aRects[1];
1968} VBOXCMDVBVA_FLIP;
1969
1970#define VBOXCMDVBVA_SIZEOF_FLIPSTRUCT_MIN (RT_OFFSETOF(VBOXCMDVBVA_FLIP, aRects))
1971
1972typedef struct VBOXCMDVBVA_CLRFILL_HDR
1973{
1974 VBOXCMDVBVA_HDR Hdr;
1975 uint32_t u32Color;
1976} VBOXCMDVBVA_CLRFILL_HDR;
1977
1978typedef struct VBOXCMDVBVA_CLRFILL_PRIMARY
1979{
1980 VBOXCMDVBVA_CLRFILL_HDR Hdr;
1981 VBOXCMDVBVA_RECT aRects[1];
1982} VBOXCMDVBVA_CLRFILL_PRIMARY;
1983
1984typedef struct VBOXCMDVBVA_CLRFILL_GENERIC_A8R8G8B8
1985{
1986 VBOXCMDVBVA_CLRFILL_HDR Hdr;
1987 VBOXCMDVBVA_ALLOCDESC dst;
1988 VBOXCMDVBVA_RECT aRects[1];
1989} VBOXCMDVBVA_CLRFILL_GENERIC_A8R8G8B8;
1990
1991#define VBOXCMDVBVA_SIZEOF_CLRFILLSTRUCT_MAX (sizeof (VBOXCMDVBVA_CLRFILL_GENERIC_A8R8G8B8))
1992
1993#if 0
1994#define VBOXCMDVBVA_SYSMEMEL_CPAGES_MAX 0x1000
1995
1996typedef struct VBOXCMDVBVA_SYSMEMEL
1997{
1998 uint32_t cPagesAfterFirst : 12;
1999 uint32_t iPage1 : 20;
2000 uint32_t iPage2;
2001} VBOXCMDVBVA_SYSMEMEL;
2002#endif
2003
2004typedef struct VBOXCMDVBVA_PAGING_TRANSFER_DATA
2005{
2006 /* for now can only contain offVRAM.
2007 * paging transfer can NOT be initiated for allocations having host 3D object (hostID) associated */
2008 VBOXCMDVBVA_ALLOCINFO Alloc;
2009 VBOXCMDVBVAPAGEIDX aPageNumbers[1];
2010} VBOXCMDVBVA_PAGING_TRANSFER_DATA;
2011
2012typedef struct VBOXCMDVBVA_PAGING_TRANSFER
2013{
2014 VBOXCMDVBVA_HDR Hdr;
2015 VBOXCMDVBVA_PAGING_TRANSFER_DATA Data;
2016} VBOXCMDVBVA_PAGING_TRANSFER;
2017
2018typedef struct VBOXCMDVBVA_PAGING_FILL
2019{
2020 VBOXCMDVBVA_HDR Hdr;
2021 uint32_t u32CbFill;
2022 uint32_t u32Pattern;
2023 /* paging transfer can NOT be initiated for allocations having host 3D object (hostID) associated */
2024 VBOXCMDVBVAOFFSET offVRAM;
2025} VBOXCMDVBVA_PAGING_FILL;
2026
2027typedef struct VBOXCMDVBVA_SYSMEMCMD
2028{
2029 VBOXCMDVBVA_HDR Hdr;
2030 VBOXCMDVBVAPHADDR phCmd;
2031} VBOXCMDVBVA_SYSMEMCMD;
2032
2033#define VBOXCMDVBVACTL_TYPE_ENABLE 1
2034#define VBOXCMDVBVACTL_TYPE_3DCTL 2
2035#define VBOXCMDVBVACTL_TYPE_RESIZE 3
2036
2037typedef struct VBOXCMDVBVA_CTL
2038{
2039 uint32_t u32Type;
2040 int32_t i32Result;
2041} VBOXCMDVBVA_CTL;
2042
2043typedef struct VBOXCMDVBVA_CTL_ENABLE
2044{
2045 VBOXCMDVBVA_CTL Hdr;
2046 VBVAENABLE Enable;
2047} VBOXCMDVBVA_CTL_ENABLE;
2048
2049#define VBOXCMDVBVA_SCREENMAP_SIZE(_elType) ((VBOX_VIDEO_MAX_SCREENS + sizeof (_elType) - 1) / sizeof (_elType))
2050#define VBOXCMDVBVA_SCREENMAP_DECL(_elType, _name) _elType _name[VBOXCMDVBVA_SCREENMAP_SIZE(_elType)]
2051
2052typedef struct VBOXCMDVBVA_RESIZE_ENTRY
2053{
2054 VBVAINFOSCREEN Screen;
2055 VBOXCMDVBVA_SCREENMAP_DECL(uint32_t, aTargetMap);
2056} VBOXCMDVBVA_RESIZE_ENTRY;
2057
2058typedef struct VBOXCMDVBVA_RESIZE
2059{
2060 VBOXCMDVBVA_RESIZE_ENTRY aEntries[1];
2061} VBOXCMDVBVA_RESIZE;
2062
2063typedef struct VBOXCMDVBVA_CTL_RESIZE
2064{
2065 VBOXCMDVBVA_CTL Hdr;
2066 VBOXCMDVBVA_RESIZE Resize;
2067} VBOXCMDVBVA_CTL_RESIZE;
2068
2069#define VBOXCMDVBVA3DCTL_TYPE_CONNECT 1
2070#define VBOXCMDVBVA3DCTL_TYPE_DISCONNECT 2
2071#define VBOXCMDVBVA3DCTL_TYPE_CMD 3
2072
2073typedef struct VBOXCMDVBVA_3DCTL
2074{
2075 uint32_t u32Type;
2076 uint32_t u32CmdClientId;
2077} VBOXCMDVBVA_3DCTL;
2078
2079typedef struct VBOXCMDVBVA_3DCTL_CONNECT
2080{
2081 VBOXCMDVBVA_3DCTL Hdr;
2082 uint32_t u32MajorVersion;
2083 uint32_t u32MinorVersion;
2084 uint64_t u64Pid;
2085} VBOXCMDVBVA_3DCTL_CONNECT;
2086
2087typedef struct VBOXCMDVBVA_3DCTL_CMD
2088{
2089 VBOXCMDVBVA_3DCTL Hdr;
2090 VBOXCMDVBVA_HDR Cmd;
2091} VBOXCMDVBVA_3DCTL_CMD;
2092
2093typedef struct VBOXCMDVBVA_CTL_3DCTL_CMD
2094{
2095 VBOXCMDVBVA_CTL Hdr;
2096 VBOXCMDVBVA_3DCTL_CMD Cmd;
2097} VBOXCMDVBVA_CTL_3DCTL_CMD;
2098
2099typedef struct VBOXCMDVBVA_CTL_3DCTL_CONNECT
2100{
2101 VBOXCMDVBVA_CTL Hdr;
2102 VBOXCMDVBVA_3DCTL_CONNECT Connect;
2103} VBOXCMDVBVA_CTL_3DCTL_CONNECT;
2104
2105typedef struct VBOXCMDVBVA_CTL_3DCTL
2106{
2107 VBOXCMDVBVA_CTL Hdr;
2108 VBOXCMDVBVA_3DCTL Ctl;
2109} VBOXCMDVBVA_CTL_3DCTL;
2110
2111#pragma pack()
2112
2113
2114#ifdef VBOXVDMA_WITH_VBVA
2115# pragma pack(1)
2116
2117typedef struct VBOXVDMAVBVACMD
2118{
2119 HGSMIOFFSET offCmd;
2120} VBOXVDMAVBVACMD;
2121
2122#pragma pack()
2123#endif
2124
2125#endif
2126
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