VirtualBox

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

最後變更 在這個檔案從80331是 76585,由 vboxsync 提交於 6 年 前

*: scm --fix-header-guard-endif

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

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