VirtualBox

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

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

Fix up header files for graphics hardware.
bugref:9017: Additions/x11: put vboxvideo into upstream X.Org

Make sure that all graphics hardware header files have svn Id tags to be
able to match X.Org files with VirtualBox revisions.

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