VirtualBox

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

最後變更 在這個檔案從68672是 68657,由 vboxsync 提交於 7 年 前

Include compile fixes for VBox/HostServices/* - hope this doesn't mess up the drm include tricks...

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

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette