VirtualBox

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

Last change on this file since 66506 was 66506, checked in by vboxsync, 8 years ago

bugref:8524: Additions/linux: play nicely with distribution-installed Additions
Based on a patch series by Hans de Goede/Red Hat with minor adjustments by Oracle.
Graphics: Add VBoxVideoIPRT.h header
Add a VBoxVideoIPRT.h header, this adds 2 versions of this file:
1) Generic include/VBox/Graphics/VBoxVideoIPRT.h which includes all the header

files needed by files shared with the linux drm driver

2) src/VBox/Additions/linux/drm/VBoxVideoIPRT.h, which replaces the generic

gfx-common.h when building the linux drm driver


The purpose of this is to eventually redefines various iprt and HGSMI bits
in the linux drm driver version to use more linux kernel infrastructure.

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