VirtualBox

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

Last change on this file since 70301 was 70075, checked in by vboxsync, 7 years ago

Devices/Graphics, Main, FE/Qt: add plumbing for sending cursor position events.
bugref:9038: FE/Qt: better handle mouse cursor when toggling integration
The Linux and X11 graphics driver sends notification when the guest cursor
position changes. This could be used by the front-end to switch back to
pointer capturing without requiring that the guest draw the cursor, which
often results in artifacts. This change adds the necessary plumbing between
the graphics device and the user interface.

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