VirtualBox

source: vbox/trunk/include/VBox/VBoxVideo.h@ 29567

Last change on this file since 29567 was 29488, checked in by vboxsync, 15 years ago

wddm: getcaps for d3d9, start impl 2D support

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 37.8 KB
Line 
1/** @file
2 * VirtualBox Video interface.
3 */
4
5/*
6 * Copyright (C) 2006 Oracle Corporation
7 *
8 * This file is part of VirtualBox Open Source Edition (OSE), as
9 * available from http://www.virtualbox.org. This file is free software;
10 * you can redistribute it and/or modify it under the terms of the GNU
11 * General Public License (GPL) as published by the Free Software
12 * Foundation, in version 2 as it comes in the "COPYING" file of the
13 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
15 *
16 * The contents of this file may alternatively be used under the terms
17 * of the Common Development and Distribution License Version 1.0
18 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
19 * VirtualBox OSE distribution, in which case the provisions of the
20 * CDDL are applicable instead of those of the GPL.
21 *
22 * You may elect to license modified versions of this file under the
23 * terms and conditions of either the GPL or the CDDL or both.
24 */
25
26#ifndef ___VBox_VBoxVideo_h
27#define ___VBox_VBoxVideo_h
28
29#include <iprt/cdefs.h>
30#include <iprt/types.h>
31
32#ifdef VBOX_WITH_HGSMI
33#include <VBox/VMMDev.h>
34#endif /* VBOX_WITH_HGSMI */
35
36/*
37 * The last 4096 bytes of the guest VRAM contains the generic info for all
38 * DualView chunks: sizes and offsets of chunks. This is filled by miniport.
39 *
40 * Last 4096 bytes of each chunk contain chunk specific data: framebuffer info,
41 * etc. This is used exclusively by the corresponding instance of a display driver.
42 *
43 * The VRAM layout:
44 * Last 4096 bytes - Adapter information area.
45 * 4096 bytes aligned miniport heap (value specified in the config rouded up).
46 * Slack - what left after dividing the VRAM.
47 * 4096 bytes aligned framebuffers:
48 * last 4096 bytes of each framebuffer is the display information area.
49 *
50 * The Virtual Graphics Adapter information in the guest VRAM is stored by the
51 * guest video driver using structures prepended by VBOXVIDEOINFOHDR.
52 *
53 * When the guest driver writes dword 0 to the VBE_DISPI_INDEX_VBOX_VIDEO
54 * the host starts to process the info. The first element at the start of
55 * the 4096 bytes region should be normally be a LINK that points to
56 * actual information chain. That way the guest driver can have some
57 * fixed layout of the information memory block and just rewrite
58 * the link to point to relevant memory chain.
59 *
60 * The processing stops at the END element.
61 *
62 * The host can access the memory only when the port IO is processed.
63 * All data that will be needed later must be copied from these 4096 bytes.
64 * But other VRAM can be used by host until the mode is disabled.
65 *
66 * The guest driver writes dword 0xffffffff to the VBE_DISPI_INDEX_VBOX_VIDEO
67 * to disable the mode.
68 *
69 * VBE_DISPI_INDEX_VBOX_VIDEO is used to read the configuration information
70 * from the host and issue commands to the host.
71 *
72 * The guest writes the VBE_DISPI_INDEX_VBOX_VIDEO index register, the the
73 * following operations with the VBE data register can be performed:
74 *
75 * Operation Result
76 * write 16 bit value NOP
77 * read 16 bit value count of monitors
78 * write 32 bit value sets the vbox command value and the command processed by the host
79 * read 32 bit value result of the last vbox command is returned
80 */
81
82#define VBOX_VIDEO_PRIMARY_SCREEN 0
83#define VBOX_VIDEO_NO_SCREEN ~0
84
85#define VBOX_VIDEO_MAX_SCREENS 64
86
87/* The size of the information. */
88#ifndef VBOX_WITH_HGSMI
89#define VBOX_VIDEO_ADAPTER_INFORMATION_SIZE 4096
90#define VBOX_VIDEO_DISPLAY_INFORMATION_SIZE 4096
91#else
92/*
93 * The minimum HGSMI heap size is PAGE_SIZE (4096 bytes) and is a restriction of the
94 * runtime heapsimple API. Use minimum 2 pages here, because the info area also may
95 * contain other data (for example HGSMIHOSTFLAGS structure).
96 */
97#ifdef VBOXWDDM
98# define VBVA_ADAPTER_INFORMATION_SIZE (64*_1K)
99#else
100#define VBVA_ADAPTER_INFORMATION_SIZE (16*_1K)
101#define VBVA_DISPLAY_INFORMATION_SIZE (64*_1K)
102#endif
103#define VBVA_MIN_BUFFER_SIZE (64*_1K)
104#endif /* VBOX_WITH_HGSMI */
105
106
107/* The value for port IO to let the adapter to interpret the adapter memory. */
108#define VBOX_VIDEO_DISABLE_ADAPTER_MEMORY 0xFFFFFFFF
109
110/* The value for port IO to let the adapter to interpret the adapter memory. */
111#define VBOX_VIDEO_INTERPRET_ADAPTER_MEMORY 0x00000000
112
113/* The value for port IO to let the adapter to interpret the display memory.
114 * The display number is encoded in low 16 bits.
115 */
116#define VBOX_VIDEO_INTERPRET_DISPLAY_MEMORY_BASE 0x00010000
117
118
119/* The end of the information. */
120#define VBOX_VIDEO_INFO_TYPE_END 0
121/* Instructs the host to fetch the next VBOXVIDEOINFOHDR at the given offset of VRAM. */
122#define VBOX_VIDEO_INFO_TYPE_LINK 1
123/* Information about a display memory position. */
124#define VBOX_VIDEO_INFO_TYPE_DISPLAY 2
125/* Information about a screen. */
126#define VBOX_VIDEO_INFO_TYPE_SCREEN 3
127/* Information about host notifications for the driver. */
128#define VBOX_VIDEO_INFO_TYPE_HOST_EVENTS 4
129/* Information about non-volatile guest VRAM heap. */
130#define VBOX_VIDEO_INFO_TYPE_NV_HEAP 5
131/* VBVA enable/disable. */
132#define VBOX_VIDEO_INFO_TYPE_VBVA_STATUS 6
133/* VBVA flush. */
134#define VBOX_VIDEO_INFO_TYPE_VBVA_FLUSH 7
135/* Query configuration value. */
136#define VBOX_VIDEO_INFO_TYPE_QUERY_CONF32 8
137
138
139#pragma pack(1)
140typedef struct _VBOXVIDEOINFOHDR
141{
142 uint8_t u8Type;
143 uint8_t u8Reserved;
144 uint16_t u16Length;
145} VBOXVIDEOINFOHDR;
146
147
148typedef struct _VBOXVIDEOINFOLINK
149{
150 /* Relative offset in VRAM */
151 int32_t i32Offset;
152} VBOXVIDEOINFOLINK;
153
154
155/* Resides in adapter info memory. Describes a display VRAM chunk. */
156typedef struct _VBOXVIDEOINFODISPLAY
157{
158 /* Index of the framebuffer assigned by guest. */
159 uint32_t u32Index;
160
161 /* Absolute offset in VRAM of the framebuffer to be displayed on the monitor. */
162 uint32_t u32Offset;
163
164 /* The size of the memory that can be used for the screen. */
165 uint32_t u32FramebufferSize;
166
167 /* The size of the memory that is used for the Display information.
168 * The information is at u32Offset + u32FramebufferSize
169 */
170 uint32_t u32InformationSize;
171
172} VBOXVIDEOINFODISPLAY;
173
174
175/* Resides in display info area, describes the current video mode. */
176#define VBOX_VIDEO_INFO_SCREEN_F_NONE 0x00
177#define VBOX_VIDEO_INFO_SCREEN_F_ACTIVE 0x01
178
179typedef struct _VBOXVIDEOINFOSCREEN
180{
181 /* Physical X origin relative to the primary screen. */
182 int32_t xOrigin;
183
184 /* Physical Y origin relative to the primary screen. */
185 int32_t yOrigin;
186
187 /* The scan line size in bytes. */
188 uint32_t u32LineSize;
189
190 /* Width of the screen. */
191 uint16_t u16Width;
192
193 /* Height of the screen. */
194 uint16_t u16Height;
195
196 /* Color depth. */
197 uint8_t bitsPerPixel;
198
199 /* VBOX_VIDEO_INFO_SCREEN_F_* */
200 uint8_t u8Flags;
201} VBOXVIDEOINFOSCREEN;
202
203/* The guest initializes the structure to 0. The positions of the structure in the
204 * display info area must not be changed, host will update the structure. Guest checks
205 * the events and modifies the structure as a response to host.
206 */
207#define VBOX_VIDEO_INFO_HOST_EVENTS_F_NONE 0x00000000
208#define VBOX_VIDEO_INFO_HOST_EVENTS_F_VRDP_RESET 0x00000080
209
210typedef struct _VBOXVIDEOINFOHOSTEVENTS
211{
212 /* Host events. */
213 uint32_t fu32Events;
214} VBOXVIDEOINFOHOSTEVENTS;
215
216/* Resides in adapter info memory. Describes the non-volatile VRAM heap. */
217typedef struct _VBOXVIDEOINFONVHEAP
218{
219 /* Absolute offset in VRAM of the start of the heap. */
220 uint32_t u32HeapOffset;
221
222 /* The size of the heap. */
223 uint32_t u32HeapSize;
224
225} VBOXVIDEOINFONVHEAP;
226
227/* Display information area. */
228typedef struct _VBOXVIDEOINFOVBVASTATUS
229{
230 /* Absolute offset in VRAM of the start of the VBVA QUEUE. 0 to disable VBVA. */
231 uint32_t u32QueueOffset;
232
233 /* The size of the VBVA QUEUE. 0 to disable VBVA. */
234 uint32_t u32QueueSize;
235
236} VBOXVIDEOINFOVBVASTATUS;
237
238typedef struct _VBOXVIDEOINFOVBVAFLUSH
239{
240 uint32_t u32DataStart;
241
242 uint32_t u32DataEnd;
243
244} VBOXVIDEOINFOVBVAFLUSH;
245
246#define VBOX_VIDEO_QCI32_MONITOR_COUNT 0
247#define VBOX_VIDEO_QCI32_OFFSCREEN_HEAP_SIZE 1
248
249typedef struct _VBOXVIDEOINFOQUERYCONF32
250{
251 uint32_t u32Index;
252
253 uint32_t u32Value;
254
255} VBOXVIDEOINFOQUERYCONF32;
256#pragma pack()
257
258# ifdef VBOX_WITH_VIDEOHWACCEL
259#pragma pack(1)
260
261#define VBOXVHWA_VERSION_MAJ 0
262#define VBOXVHWA_VERSION_MIN 0
263#define VBOXVHWA_VERSION_BLD 6
264#define VBOXVHWA_VERSION_RSV 0
265
266typedef enum
267{
268 VBOXVHWACMD_TYPE_SURF_CANCREATE = 1,
269 VBOXVHWACMD_TYPE_SURF_CREATE,
270 VBOXVHWACMD_TYPE_SURF_DESTROY,
271 VBOXVHWACMD_TYPE_SURF_LOCK,
272 VBOXVHWACMD_TYPE_SURF_UNLOCK,
273 VBOXVHWACMD_TYPE_SURF_BLT,
274 VBOXVHWACMD_TYPE_SURF_FLIP,
275 VBOXVHWACMD_TYPE_SURF_OVERLAY_UPDATE,
276 VBOXVHWACMD_TYPE_SURF_OVERLAY_SETPOSITION,
277 VBOXVHWACMD_TYPE_SURF_COLORKEY_SET,
278 VBOXVHWACMD_TYPE_QUERY_INFO1,
279 VBOXVHWACMD_TYPE_QUERY_INFO2,
280 VBOXVHWACMD_TYPE_ENABLE,
281 VBOXVHWACMD_TYPE_DISABLE,
282 VBOXVHWACMD_TYPE_HH_CONSTRUCT,
283 VBOXVHWACMD_TYPE_HH_RESET
284} VBOXVHWACMD_TYPE;
285
286/* the command processing was asynch, set by the host to indicate asynch command completion
287 * must not be cleared once set, the command completion is performed by issuing a host->guest completion command
288 * while keeping this flag unchanged */
289#define VBOXVHWACMD_FLAG_HG_ASYNCH 0x00010000
290/* asynch completion is performed by issuing the event */
291#define VBOXVHWACMD_FLAG_GH_ASYNCH_EVENT 0x00000001
292/* issue interrupt on asynch completion */
293#define VBOXVHWACMD_FLAG_GH_ASYNCH_IRQ 0x00000002
294/* 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
295 * by setting the VBOXVHWACMD_FLAG_HG_ASYNCH_RETURNED flag */
296#define VBOXVHWACMD_FLAG_GH_ASYNCH_NOCOMPLETION 0x00000004
297/* the host has copied the VBOXVHWACMD_FLAG_GH_ASYNCH_NOCOMPLETION command and returned it to the guest */
298#define VBOXVHWACMD_FLAG_HG_ASYNCH_RETURNED 0x00020000
299/* this is the host->host cmd, i.e. a configuration command posted by the host to the framebuffer */
300#define VBOXVHWACMD_FLAG_HH_CMD 0x10000000
301
302typedef struct _VBOXVHWACMD
303{
304 VBOXVHWACMD_TYPE enmCmd; /* command type */
305 volatile int32_t rc; /* command result */
306 int32_t iDisplay; /* display index */
307 volatile int32_t Flags; /* ored VBOXVHWACMD_FLAG_xxx values */
308 uint64_t GuestVBVAReserved1; /* field internally used by the guest VBVA cmd handling, must NOT be modified by clients */
309 uint64_t GuestVBVAReserved2; /* field internally used by the guest VBVA cmd handling, must NOT be modified by clients */
310 volatile uint32_t cRefs;
311 int32_t Reserved;
312 union
313 {
314 struct _VBOXVHWACMD *pNext;
315 uint32_t offNext;
316 uint64_t Data; /* the body is 64-bit aligned */
317 } u;
318 char body[1];
319} VBOXVHWACMD;
320
321#define VBOXVHWACMD_HEADSIZE() (RT_OFFSETOF(VBOXVHWACMD, body))
322#define VBOXVHWACMD_SIZE_FROMBODYSIZE(_s) (VBOXVHWACMD_HEADSIZE() + (_s))
323#define VBOXVHWACMD_SIZE(_tCmd) (VBOXVHWACMD_SIZE_FROMBODYSIZE(sizeof(_tCmd)))
324typedef unsigned int VBOXVHWACMD_LENGTH;
325typedef uint64_t VBOXVHWA_SURFHANDLE;
326#define VBOXVHWA_SURFHANDLE_INVALID 0
327#define VBOXVHWACMD_BODY(_p, _t) ((_t*)(_p)->body)
328#define VBOXVHWACMD_HEAD(_pb) ((VBOXVHWACMD*)((uint8_t *)(_pb) - RT_OFFSETOF(VBOXVHWACMD, body)))
329
330typedef struct _VBOXVHWA_RECTL
331{
332 int32_t left;
333 int32_t top;
334 int32_t right;
335 int32_t bottom;
336} VBOXVHWA_RECTL;
337
338typedef struct _VBOXVHWA_COLORKEY
339{
340 uint32_t low;
341 uint32_t high;
342} VBOXVHWA_COLORKEY;
343
344typedef struct _VBOXVHWA_PIXELFORMAT
345{
346 uint32_t flags;
347 uint32_t fourCC;
348 union
349 {
350 uint32_t rgbBitCount;
351 uint32_t yuvBitCount;
352 } c;
353
354 union
355 {
356 uint32_t rgbRBitMask;
357 uint32_t yuvYBitMask;
358 } m1;
359
360 union
361 {
362 uint32_t rgbGBitMask;
363 uint32_t yuvUBitMask;
364 } m2;
365
366 union
367 {
368 uint32_t rgbBBitMask;
369 uint32_t yuvVBitMask;
370 } m3;
371
372 union
373 {
374 uint32_t rgbABitMask;
375 } m4;
376
377 uint32_t Reserved;
378} VBOXVHWA_PIXELFORMAT;
379
380typedef struct _VBOXVHWA_SURFACEDESC
381{
382 uint32_t flags;
383 uint32_t height;
384 uint32_t width;
385 uint32_t pitch;
386 uint32_t sizeX;
387 uint32_t sizeY;
388 uint32_t cBackBuffers;
389 uint32_t Reserved;
390 VBOXVHWA_COLORKEY DstOverlayCK;
391 VBOXVHWA_COLORKEY DstBltCK;
392 VBOXVHWA_COLORKEY SrcOverlayCK;
393 VBOXVHWA_COLORKEY SrcBltCK;
394 VBOXVHWA_PIXELFORMAT PixelFormat;
395 uint32_t surfCaps;
396 uint32_t Reserved2;
397 VBOXVHWA_SURFHANDLE hSurf;
398 uint64_t offSurface;
399} VBOXVHWA_SURFACEDESC;
400
401typedef struct _VBOXVHWA_BLTFX
402{
403 uint32_t flags;
404 uint32_t rop;
405 uint32_t rotationOp;
406 uint32_t rotation;
407 uint32_t fillColor;
408 uint32_t Reserved;
409 VBOXVHWA_COLORKEY DstCK;
410 VBOXVHWA_COLORKEY SrcCK;
411} VBOXVHWA_BLTFX;
412
413typedef struct _VBOXVHWA_OVERLAYFX
414{
415 uint32_t flags;
416 uint32_t Reserved1;
417 uint32_t fxFlags;
418 uint32_t Reserved2;
419 VBOXVHWA_COLORKEY DstCK;
420 VBOXVHWA_COLORKEY SrcCK;
421} VBOXVHWA_OVERLAYFX;
422
423#define VBOXVHWA_CAPS_BLT 0x00000040
424#define VBOXVHWA_CAPS_BLTCOLORFILL 0x04000000
425#define VBOXVHWA_CAPS_BLTFOURCC 0x00000100
426#define VBOXVHWA_CAPS_BLTSTRETCH 0x00000200
427#define VBOXVHWA_CAPS_BLTQUEUE 0x00000080
428
429#define VBOXVHWA_CAPS_OVERLAY 0x00000800
430#define VBOXVHWA_CAPS_OVERLAYFOURCC 0x00002000
431#define VBOXVHWA_CAPS_OVERLAYSTRETCH 0x00004000
432#define VBOXVHWA_CAPS_OVERLAYCANTCLIP 0x00001000
433
434#define VBOXVHWA_CAPS_COLORKEY 0x00400000
435#define VBOXVHWA_CAPS_COLORKEYHWASSIST 0x01000000
436
437#define VBOXVHWA_SCAPS_BACKBUFFER 0x00000004
438#define VBOXVHWA_SCAPS_COMPLEX 0x00000008
439#define VBOXVHWA_SCAPS_FLIP 0x00000010
440#define VBOXVHWA_SCAPS_FRONTBUFFER 0x00000020
441#define VBOXVHWA_SCAPS_OFFSCREENPLAIN 0x00000040
442#define VBOXVHWA_SCAPS_OVERLAY 0x00000080
443#define VBOXVHWA_SCAPS_PRIMARYSURFACE 0x00000200
444#define VBOXVHWA_SCAPS_SYSTEMMEMORY 0x00000800
445#define VBOXVHWA_SCAPS_VIDEOMEMORY 0x00004000
446#define VBOXVHWA_SCAPS_VISIBLE 0x00008000
447#define VBOXVHWA_SCAPS_LOCALVIDMEM 0x10000000
448
449#define VBOXVHWA_PF_PALETTEINDEXED8 0x00000020
450#define VBOXVHWA_PF_RGB 0x00000040
451#define VBOXVHWA_PF_RGBTOYUV 0x00000100
452#define VBOXVHWA_PF_YUV 0x00000200
453#define VBOXVHWA_PF_FOURCC 0x00000004
454
455#define VBOXVHWA_LOCK_DISCARDCONTENTS 0x00002000
456
457#define VBOXVHWA_CFG_ENABLED 0x00000001
458
459#define VBOXVHWA_SD_BACKBUFFERCOUNT 0x00000020
460#define VBOXVHWA_SD_CAPS 0x00000001
461#define VBOXVHWA_SD_CKDESTBLT 0x00004000
462#define VBOXVHWA_SD_CKDESTOVERLAY 0x00002000
463#define VBOXVHWA_SD_CKSRCBLT 0x00010000
464#define VBOXVHWA_SD_CKSRCOVERLAY 0x00008000
465#define VBOXVHWA_SD_HEIGHT 0x00000002
466#define VBOXVHWA_SD_PITCH 0x00000008
467#define VBOXVHWA_SD_PIXELFORMAT 0x00001000
468//#define VBOXVHWA_SD_REFRESHRATE 0x00040000
469#define VBOXVHWA_SD_WIDTH 0x00000004
470
471#define VBOXVHWA_CKEYCAPS_DESTBLT 0x00000001
472#define VBOXVHWA_CKEYCAPS_DESTBLTCLRSPACE 0x00000002
473#define VBOXVHWA_CKEYCAPS_DESTBLTCLRSPACEYUV 0x00000004
474#define VBOXVHWA_CKEYCAPS_DESTBLTYUV 0x00000008
475#define VBOXVHWA_CKEYCAPS_DESTOVERLAY 0x00000010
476#define VBOXVHWA_CKEYCAPS_DESTOVERLAYCLRSPACE 0x00000020
477#define VBOXVHWA_CKEYCAPS_DESTOVERLAYCLRSPACEYUV 0x00000040
478#define VBOXVHWA_CKEYCAPS_DESTOVERLAYONEACTIVE 0x00000080
479#define VBOXVHWA_CKEYCAPS_DESTOVERLAYYUV 0x00000100
480#define VBOXVHWA_CKEYCAPS_SRCBLT 0x00000200
481#define VBOXVHWA_CKEYCAPS_SRCBLTCLRSPACE 0x00000400
482#define VBOXVHWA_CKEYCAPS_SRCBLTCLRSPACEYUV 0x00000800
483#define VBOXVHWA_CKEYCAPS_SRCBLTYUV 0x00001000
484#define VBOXVHWA_CKEYCAPS_SRCOVERLAY 0x00002000
485#define VBOXVHWA_CKEYCAPS_SRCOVERLAYCLRSPACE 0x00004000
486#define VBOXVHWA_CKEYCAPS_SRCOVERLAYCLRSPACEYUV 0x00008000
487#define VBOXVHWA_CKEYCAPS_SRCOVERLAYONEACTIVE 0x00010000
488#define VBOXVHWA_CKEYCAPS_SRCOVERLAYYUV 0x00020000
489#define VBOXVHWA_CKEYCAPS_NOCOSTOVERLAY 0x00040000
490
491#define VBOXVHWA_BLT_COLORFILL 0x00000400
492#define VBOXVHWA_BLT_DDFX 0x00000800
493#define VBOXVHWA_BLT_EXTENDED_FLAGS 0x40000000
494#define VBOXVHWA_BLT_EXTENDED_LINEAR_CONTENT 0x00000004
495#define VBOXVHWA_BLT_EXTENDED_PRESENTATION_STRETCHFACTOR 0x00000010
496#define VBOXVHWA_BLT_KEYDESTOVERRIDE 0x00004000
497#define VBOXVHWA_BLT_KEYSRCOVERRIDE 0x00010000
498#define VBOXVHWA_BLT_LAST_PRESENTATION 0x20000000
499#define VBOXVHWA_BLT_PRESENTATION 0x10000000
500#define VBOXVHWA_BLT_ROP 0x00020000
501
502
503#define VBOXVHWA_OVER_DDFX 0x00080000
504#define VBOXVHWA_OVER_HIDE 0x00000200
505#define VBOXVHWA_OVER_KEYDEST 0x00000400
506#define VBOXVHWA_OVER_KEYDESTOVERRIDE 0x00000800
507#define VBOXVHWA_OVER_KEYSRC 0x00001000
508#define VBOXVHWA_OVER_KEYSRCOVERRIDE 0x00002000
509#define VBOXVHWA_OVER_SHOW 0x00004000
510
511#define VBOXVHWA_CKEY_COLORSPACE 0x00000001
512#define VBOXVHWA_CKEY_DESTBLT 0x00000002
513#define VBOXVHWA_CKEY_DESTOVERLAY 0x00000004
514#define VBOXVHWA_CKEY_SRCBLT 0x00000008
515#define VBOXVHWA_CKEY_SRCOVERLAY 0x00000010
516
517#define VBOXVHWA_BLT_ARITHSTRETCHY 0x00000001
518#define VBOXVHWA_BLT_MIRRORLEFTRIGHT 0x00000002
519#define VBOXVHWA_BLT_MIRRORUPDOWN 0x00000004
520
521#define VBOXVHWA_OVERFX_ARITHSTRETCHY 0x00000001
522#define VBOXVHWA_OVERFX_MIRRORLEFTRIGHT 0x00000002
523#define VBOXVHWA_OVERFX_MIRRORUPDOWN 0x00000004
524
525#define VBOXVHWA_CAPS2_CANRENDERWINDOWED 0x00080000
526#define VBOXVHWA_CAPS2_WIDESURFACES 0x00001000
527#define VBOXVHWA_CAPS2_COPYFOURCC 0x00008000
528//#define VBOXVHWA_CAPS2_FLIPINTERVAL 0x00200000
529//#define VBOXVHWA_CAPS2_FLIPNOVSYNC 0x00400000
530
531
532#define VBOXVHWA_OFFSET64_VOID (UINT64_MAX)
533
534typedef struct _VBOXVHWA_VERSION
535{
536 uint32_t maj;
537 uint32_t min;
538 uint32_t bld;
539 uint32_t reserved;
540} VBOXVHWA_VERSION;
541
542#define VBOXVHWA_VERSION_INIT(_pv) do { \
543 (_pv)->maj = VBOXVHWA_VERSION_MAJ; \
544 (_pv)->min = VBOXVHWA_VERSION_MIN; \
545 (_pv)->bld = VBOXVHWA_VERSION_BLD; \
546 (_pv)->reserved = VBOXVHWA_VERSION_RSV; \
547 } while(0)
548
549typedef struct _VBOXVHWACMD_QUERYINFO1
550{
551 union
552 {
553 struct
554 {
555 VBOXVHWA_VERSION guestVersion;
556 } in;
557
558 struct
559 {
560 uint32_t cfgFlags;
561 uint32_t caps;
562
563 uint32_t caps2;
564 uint32_t colorKeyCaps;
565
566 uint32_t stretchCaps;
567 uint32_t surfaceCaps;
568
569 uint32_t numOverlays;
570 uint32_t curOverlays;
571
572 uint32_t numFourCC;
573 uint32_t reserved;
574 } out;
575 } u;
576} VBOXVHWACMD_QUERYINFO1;
577
578typedef struct _VBOXVHWACMD_QUERYINFO2
579{
580 uint32_t numFourCC;
581 uint32_t FourCC[1];
582} VBOXVHWACMD_QUERYINFO2;
583
584#define VBOXVHWAINFO2_SIZE(_cFourCC) RT_OFFSETOF(VBOXVHWACMD_QUERYINFO2, FourCC[_cFourCC])
585
586typedef struct _VBOXVHWACMD_SURF_CANCREATE
587{
588 VBOXVHWA_SURFACEDESC SurfInfo;
589 union
590 {
591 struct
592 {
593 uint32_t bIsDifferentPixelFormat;
594 uint32_t Reserved;
595 } in;
596
597 struct
598 {
599 int32_t ErrInfo;
600 } out;
601 } u;
602} VBOXVHWACMD_SURF_CANCREATE;
603
604typedef struct _VBOXVHWACMD_SURF_CREATE
605{
606 VBOXVHWA_SURFACEDESC SurfInfo;
607} VBOXVHWACMD_SURF_CREATE;
608
609typedef struct _VBOXVHWACMD_SURF_DESTROY
610{
611 union
612 {
613 struct
614 {
615 VBOXVHWA_SURFHANDLE hSurf;
616 } in;
617 } u;
618} VBOXVHWACMD_SURF_DESTROY;
619
620typedef struct _VBOXVHWACMD_SURF_LOCK
621{
622 union
623 {
624 struct
625 {
626 VBOXVHWA_SURFHANDLE hSurf;
627 uint64_t offSurface;
628 uint32_t flags;
629 uint32_t rectValid;
630 VBOXVHWA_RECTL rect;
631 } in;
632 } u;
633} VBOXVHWACMD_SURF_LOCK;
634
635typedef struct _VBOXVHWACMD_SURF_UNLOCK
636{
637 union
638 {
639 struct
640 {
641 VBOXVHWA_SURFHANDLE hSurf;
642 uint32_t xUpdatedMemValid;
643 uint32_t reserved;
644 VBOXVHWA_RECTL xUpdatedMemRect;
645 } in;
646 } u;
647} VBOXVHWACMD_SURF_UNLOCK;
648
649typedef struct _VBOXVHWACMD_SURF_BLT
650{
651 uint64_t DstGuestSurfInfo;
652 uint64_t SrcGuestSurfInfo;
653 union
654 {
655 struct
656 {
657 VBOXVHWA_SURFHANDLE hDstSurf;
658 uint64_t offDstSurface;
659 VBOXVHWA_RECTL dstRect;
660 VBOXVHWA_SURFHANDLE hSrcSurf;
661 uint64_t offSrcSurface;
662 VBOXVHWA_RECTL srcRect;
663 uint32_t flags;
664 uint32_t xUpdatedSrcMemValid;
665 VBOXVHWA_BLTFX desc;
666 VBOXVHWA_RECTL xUpdatedSrcMemRect;
667 } in;
668 } u;
669} VBOXVHWACMD_SURF_BLT;
670
671typedef struct _VBOXVHWACMD_SURF_FLIP
672{
673 uint64_t TargGuestSurfInfo;
674 uint64_t CurrGuestSurfInfo;
675 union
676 {
677 struct
678 {
679 VBOXVHWA_SURFHANDLE hTargSurf;
680 uint64_t offTargSurface;
681 VBOXVHWA_SURFHANDLE hCurrSurf;
682 uint64_t offCurrSurface;
683 uint32_t flags;
684 uint32_t xUpdatedTargMemValid;
685 VBOXVHWA_RECTL xUpdatedTargMemRect;
686 } in;
687 } u;
688} VBOXVHWACMD_SURF_FLIP;
689
690typedef struct _VBOXVHWACMD_SURF_COLORKEY_SET
691{
692 union
693 {
694 struct
695 {
696 VBOXVHWA_SURFHANDLE hSurf;
697 uint64_t offSurface;
698 VBOXVHWA_COLORKEY CKey;
699 uint32_t flags;
700 uint32_t reserved;
701 } in;
702 } u;
703} VBOXVHWACMD_SURF_COLORKEY_SET;
704
705typedef struct _VBOXVHWACMD_SURF_OVERLAY_UPDATE
706{
707 union
708 {
709 struct
710 {
711 VBOXVHWA_SURFHANDLE hDstSurf;
712 uint64_t offDstSurface;
713 VBOXVHWA_RECTL dstRect;
714 VBOXVHWA_SURFHANDLE hSrcSurf;
715 uint64_t offSrcSurface;
716 VBOXVHWA_RECTL srcRect;
717 uint32_t flags;
718 uint32_t xUpdatedSrcMemValid;
719 VBOXVHWA_OVERLAYFX desc;
720 VBOXVHWA_RECTL xUpdatedSrcMemRect;
721 } in;
722 } u;
723}VBOXVHWACMD_SURF_OVERLAY_UPDATE;
724
725typedef struct _VBOXVHWACMD_SURF_OVERLAY_SETPOSITION
726{
727 union
728 {
729 struct
730 {
731 VBOXVHWA_SURFHANDLE hDstSurf;
732 uint64_t offDstSurface;
733 VBOXVHWA_SURFHANDLE hSrcSurf;
734 uint64_t offSrcSurface;
735 uint32_t xPos;
736 uint32_t yPos;
737 uint32_t flags;
738 uint32_t reserved;
739 } in;
740 } u;
741} VBOXVHWACMD_SURF_OVERLAY_SETPOSITION;
742
743typedef struct _VBOXVHWACMD_HH_CONSTRUCT
744{
745 void *pVM;
746 /* VRAM info for the backend to be able to properly translate VRAM offsets */
747 void *pvVRAM;
748 uint32_t cbVRAM;
749} VBOXVHWACMD_HH_CONSTRUCT;
750
751typedef DECLCALLBACK(void) FNVBOXVHWA_HH_CALLBACK(void*);
752typedef FNVBOXVHWA_HH_CALLBACK *PFNVBOXVHWA_HH_CALLBACK;
753
754#define VBOXVHWA_HH_CALLBACK_SET(_pCmd, _pfn, _parg) \
755 do { \
756 (_pCmd)->GuestVBVAReserved1 = (uint64_t)(uintptr_t)(_pfn); \
757 (_pCmd)->GuestVBVAReserved2 = (uint64_t)(uintptr_t)(_parg); \
758 }while(0)
759
760#define VBOXVHWA_HH_CALLBACK_GET(_pCmd) ((PFNVBOXVHWA_HH_CALLBACK)(_pCmd)->GuestVBVAReserved1)
761#define VBOXVHWA_HH_CALLBACK_GET_ARG(_pCmd) ((void*)(_pCmd)->GuestVBVAReserved2)
762
763#pragma pack()
764# endif /* #ifdef VBOX_WITH_VIDEOHWACCEL */
765
766#ifdef VBOX_WITH_HGSMI
767
768/* All structures are without alignment. */
769#pragma pack(1)
770
771typedef struct VBVAHOSTFLAGS
772{
773 uint32_t u32HostEvents;
774 uint32_t u32SupportedOrders;
775} VBVAHOSTFLAGS;
776
777typedef struct _VBVABUFFER
778{
779 VBVAHOSTFLAGS hostFlags;
780
781 /* The offset where the data start in the buffer. */
782 uint32_t off32Data;
783 /* The offset where next data must be placed in the buffer. */
784 uint32_t off32Free;
785
786 /* The queue of record descriptions. */
787 VBVARECORD aRecords[VBVA_MAX_RECORDS];
788 uint32_t indexRecordFirst;
789 uint32_t indexRecordFree;
790
791 /* Space to leave free in the buffer when large partial records are transferred. */
792 uint32_t cbPartialWriteThreshold;
793
794 uint32_t cbData;
795 uint8_t au8Data[1]; /* variable size for the rest of the VBVABUFFER area in VRAM. */
796} VBVABUFFER;
797
798/* guest->host commands */
799#define VBVA_QUERY_CONF32 1
800#define VBVA_SET_CONF32 2
801#define VBVA_INFO_VIEW 3
802#define VBVA_INFO_HEAP 4
803#define VBVA_FLUSH 5
804#define VBVA_INFO_SCREEN 6
805#define VBVA_ENABLE 7
806#define VBVA_MOUSE_POINTER_SHAPE 8
807#ifdef VBOX_WITH_VIDEOHWACCEL
808# define VBVA_VHWA_CMD 9
809#endif /* # ifdef VBOX_WITH_VIDEOHWACCEL */
810#ifdef VBOXVDMA
811# define VBVA_VDMA_CTL 10 /* setup G<->H DMA channel info */
812# define VBVA_VDMA_CMD 11 /* G->H DMA command */
813#endif
814
815/* host->guest commands */
816# define VBVAHG_EVENT 1
817# define VBVAHG_DISPLAY_CUSTOM 2
818#ifdef VBOXVDMA
819# define VBVAHG_SHGSMI_COMPLETION 3
820#endif
821
822# ifdef VBOX_WITH_VIDEOHWACCEL
823#define VBVAHG_DCUSTOM_VHWA_CMDCOMPLETE 1
824#pragma pack(1)
825typedef struct _VBVAHOSTCMDVHWACMDCOMPLETE
826{
827 uint32_t offCmd;
828}VBVAHOSTCMDVHWACMDCOMPLETE;
829#pragma pack()
830# endif /* # ifdef VBOX_WITH_VIDEOHWACCEL */
831
832#pragma pack(1)
833typedef enum
834{
835 VBVAHOSTCMD_OP_EVENT = 1,
836 VBVAHOSTCMD_OP_CUSTOM
837}VBVAHOSTCMD_OP_TYPE;
838
839typedef struct _VBVAHOSTCMDEVENT
840{
841 uint64_t pEvent;
842}VBVAHOSTCMDEVENT;
843
844
845typedef struct _VBVAHOSTCMD
846{
847 /* destination ID if >=0 specifies display index, otherwize the command is directed to the miniport */
848 int32_t iDstID;
849 int32_t customOpCode;
850 union
851 {
852 struct _VBVAHOSTCMD *pNext;
853 uint32_t offNext;
854 uint64_t Data; /* the body is 64-bit aligned */
855 } u;
856 char body[1];
857}VBVAHOSTCMD;
858
859#define VBVAHOSTCMD_SIZE(_size) (sizeof(VBVAHOSTCMD) + (_size))
860#define VBVAHOSTCMD_BODY(_pCmd, _tBody) ((_tBody*)(_pCmd)->body)
861#define VBVAHOSTCMD_HDR(_pBody) ((VBVAHOSTCMD*)(((uint8_t*)_pBody) - RT_OFFSETOF(VBVAHOSTCMD, body)))
862#define VBVAHOSTCMD_HDRSIZE (RT_OFFSETOF(VBVAHOSTCMD, body))
863
864#pragma pack()
865
866/* VBVACONF32::u32Index */
867#define VBOX_VBVA_CONF32_MONITOR_COUNT 0
868#define VBOX_VBVA_CONF32_HOST_HEAP_SIZE 1
869
870typedef struct _VBVACONF32
871{
872 uint32_t u32Index;
873 uint32_t u32Value;
874} VBVACONF32;
875
876typedef struct VBVAINFOVIEW
877{
878 /* Index of the screen, assigned by the guest. */
879 uint32_t u32ViewIndex;
880
881 /* The screen offset in VRAM, the framebuffer starts here. */
882 uint32_t u32ViewOffset;
883
884 /* The size of the VRAM memory that can be used for the view. */
885 uint32_t u32ViewSize;
886
887 /* The recommended maximum size of the VRAM memory for the screen. */
888 uint32_t u32MaxScreenSize;
889} VBVAINFOVIEW;
890
891typedef struct _VBVAINFOHEAP
892{
893 /* Absolute offset in VRAM of the start of the heap. */
894 uint32_t u32HeapOffset;
895
896 /* The size of the heap. */
897 uint32_t u32HeapSize;
898
899} VBVAINFOHEAP;
900
901typedef struct _VBVAFLUSH
902{
903 uint32_t u32Reserved;
904
905} VBVAFLUSH;
906
907/* VBVAINFOSCREEN::u8Flags */
908#define VBVA_SCREEN_F_NONE 0x0000
909#define VBVA_SCREEN_F_ACTIVE 0x0001
910
911typedef struct VBVAINFOSCREEN
912{
913 /* Which view contains the screen. */
914 uint32_t u32ViewIndex;
915
916 /* Physical X origin relative to the primary screen. */
917 int32_t i32OriginX;
918
919 /* Physical Y origin relative to the primary screen. */
920 int32_t i32OriginY;
921
922 /* Offset of visible framebuffer relative to the framebuffer start. */
923 uint32_t u32StartOffset;
924
925 /* The scan line size in bytes. */
926 uint32_t u32LineSize;
927
928 /* Width of the screen. */
929 uint32_t u32Width;
930
931 /* Height of the screen. */
932 uint32_t u32Height;
933
934 /* Color depth. */
935 uint16_t u16BitsPerPixel;
936
937 /* VBVA_SCREEN_F_* */
938 uint16_t u16Flags;
939} VBVAINFOSCREEN;
940
941
942/* VBVAENABLE::u32Flags */
943#define VBVA_F_NONE 0x00000000
944#define VBVA_F_ENABLE 0x00000001
945#define VBVA_F_DISABLE 0x00000002
946#ifdef VBOXWDDM_WITH_VBVA
947/* extended VBVA to be used with WDDM */
948#define VBVA_F_EXTENDED 0x00000004
949#endif
950
951typedef struct _VBVAENABLE
952{
953 uint32_t u32Flags;
954 uint32_t u32Offset;
955 int32_t i32Result;
956} VBVAENABLE;
957
958#ifdef VBOXWDDM_WITH_VBVA
959typedef struct _VBVAENABLE_EX
960{
961 VBVAENABLE Base;
962 uint32_t u32ScreenId;
963} VBVAENABLE_EX;
964#endif
965
966
967typedef struct _VBVAMOUSEPOINTERSHAPE
968{
969 /* The host result. */
970 int32_t i32Result;
971
972 /* VBOX_MOUSE_POINTER_* bit flags. */
973 uint32_t fu32Flags;
974
975 /* X coordinate of the hot spot. */
976 uint32_t u32HotX;
977
978 /* Y coordinate of the hot spot. */
979 uint32_t u32HotY;
980
981 /* Width of the pointer in pixels. */
982 uint32_t u32Width;
983
984 /* Height of the pointer in scanlines. */
985 uint32_t u32Height;
986
987 /* Pointer data.
988 *
989 ****
990 * The data consists of 1 bpp AND mask followed by 32 bpp XOR (color) mask.
991 *
992 * For pointers without alpha channel the XOR mask pixels are 32 bit values: (lsb)BGR0(msb).
993 * For pointers with alpha channel the XOR mask consists of (lsb)BGRA(msb) 32 bit values.
994 *
995 * Guest driver must create the AND mask for pointers with alpha channel, so if host does not
996 * support alpha, the pointer could be displayed as a normal color pointer. The AND mask can
997 * be constructed from alpha values. For example alpha value >= 0xf0 means bit 0 in the AND mask.
998 *
999 * The AND mask is 1 bpp bitmap with byte aligned scanlines. Size of AND mask,
1000 * therefore, is cbAnd = (width + 7) / 8 * height. The padding bits at the
1001 * end of any scanline are undefined.
1002 *
1003 * The XOR mask follows the AND mask on the next 4 bytes aligned offset:
1004 * uint8_t *pXor = pAnd + (cbAnd + 3) & ~3
1005 * Bytes in the gap between the AND and the XOR mask are undefined.
1006 * XOR mask scanlines have no gap between them and size of XOR mask is:
1007 * cXor = width * 4 * height.
1008 ****
1009 *
1010 * Preallocate 4 bytes for accessing actual data as p->au8Data.
1011 */
1012 uint8_t au8Data[4];
1013
1014} VBVAMOUSEPOINTERSHAPE;
1015
1016#pragma pack()
1017
1018#endif /* VBOX_WITH_HGSMI */
1019
1020#ifdef VBOXVDMA
1021# pragma pack(1)
1022
1023/*
1024 * VBOXSHGSMI made on top HGSMI and allows receiving notifications
1025 * about G->H command completion
1026 */
1027/* SHGSMI command header */
1028typedef struct VBOXSHGSMIHEADER
1029{
1030 uint64_t pvNext; /*<- completion processing queue */
1031 uint32_t fFlags; /*<- see VBOXSHGSMI_FLAG_XXX Flags */
1032 uint32_t cRefs; /*<- command referece count */
1033 uint64_t u64Info1; /*<- contents depends on the fFlags value */
1034 uint64_t u64Info2; /*<- contents depends on the fFlags value */
1035} VBOXSHGSMIHEADER, *PVBOXSHGSMIHEADER;
1036
1037/* the command processing was asynch, set by the host to indicate asynch command completion
1038 * must not be cleared once set, the command completion is performed by issuing a host->guest completion command
1039 * while keeping this flag unchanged */
1040#define VBOXSHGSMI_FLAG_HG_ASYNCH 0x00010000
1041///* if set - asynch completion is performed by issuing the event,
1042// * if cleared - asynch completion is performed by calling a callback */
1043//#define VBOXSHGSMI_FLAG_GH_ASYNCH_EVENT 0x00000001
1044/* issue interrupt on asynch completion, used for critical G->H commands,
1045 * i.e. for completion of which guest is waiting. */
1046#define VBOXSHGSMI_FLAG_GH_ASYNCH_IRQ 0x00000002
1047/* guest does not do any op on completion of this command,
1048 * the host may copy the command and indicate that it does not need the command anymore
1049 * by not setting VBOXSHGSMI_FLAG_HG_ASYNCH */
1050#define VBOXSHGSMI_FLAG_GH_ASYNCH_NOCOMPLETION 0x00000004
1051/* guest requires the command to be processed asynchronously,
1052 * not setting VBOXSHGSMI_FLAG_HG_ASYNCH by the host in this case is treated as command failure */
1053#define VBOXSHGSMI_FLAG_GH_ASYNCH_FORCE 0x00000008
1054/* force IRQ on cmd completion */
1055#define VBOXSHGSMI_FLAG_GH_ASYNCH_IRQ_FORCE 0x00000010
1056/* an IRQ-level callback is associated with the command */
1057#define VBOXSHGSMI_FLAG_GH_ASYNCH_CALLBACK_IRQ 0x00000020
1058/* guest expects this command to be completed synchronously */
1059#define VBOXSHGSMI_FLAG_GH_SYNCH 0x00000040
1060
1061DECLINLINE(uint8_t *) VBoxSHGSMIBufferData (const VBOXSHGSMIHEADER* pHeader)
1062{
1063 return (uint8_t *)pHeader + sizeof (VBOXSHGSMIHEADER);
1064}
1065
1066DECLINLINE(PVBOXSHGSMIHEADER) VBoxSHGSMIBufferHeader (const void *pvData)
1067{
1068 return (PVBOXSHGSMIHEADER)((uint8_t *)pvData - sizeof (VBOXSHGSMIHEADER));
1069}
1070
1071/* VDMA - Video DMA */
1072
1073/* VDMA Control API */
1074/* VBOXVDMA_CTL::u32Flags */
1075typedef enum
1076{
1077 VBOXVDMA_CTL_TYPE_NONE = 0,
1078 VBOXVDMA_CTL_TYPE_ENABLE,
1079 VBOXVDMA_CTL_TYPE_DISABLE,
1080 VBOXVDMA_CTL_TYPE_FLUSH
1081} VBOXVDMA_CTL_TYPE;
1082
1083typedef struct VBOXVDMA_CTL
1084{
1085 VBOXVDMA_CTL_TYPE enmCtl;
1086 uint32_t u32Offset;
1087 int32_t i32Result;
1088} VBOXVDMA_CTL, *PVBOXVDMA_CTL;
1089
1090typedef struct VBOXVDMA_RECTL
1091{
1092 int16_t left;
1093 int16_t top;
1094 uint16_t width;
1095 uint16_t height;
1096} VBOXVDMA_RECTL, *PVBOXVDMA_RECTL;
1097
1098typedef enum
1099{
1100 VBOXVDMA_PIXEL_FORMAT_UNKNOWN = 0,
1101 VBOXVDMA_PIXEL_FORMAT_R8G8B8 = 20,
1102 VBOXVDMA_PIXEL_FORMAT_A8R8G8B8 = 21,
1103 VBOXVDMA_PIXEL_FORMAT_X8R8G8B8 = 22,
1104 VBOXVDMA_PIXEL_FORMAT_R5G6B5 = 23,
1105 VBOXVDMA_PIXEL_FORMAT_X1R5G5B5 = 24,
1106 VBOXVDMA_PIXEL_FORMAT_A1R5G5B5 = 25,
1107 VBOXVDMA_PIXEL_FORMAT_A4R4G4B4 = 26,
1108 VBOXVDMA_PIXEL_FORMAT_R3G3B2 = 27,
1109 VBOXVDMA_PIXEL_FORMAT_A8 = 28,
1110 VBOXVDMA_PIXEL_FORMAT_A8R3G3B2 = 29,
1111 VBOXVDMA_PIXEL_FORMAT_X4R4G4B4 = 30,
1112 VBOXVDMA_PIXEL_FORMAT_A2B10G10R10 = 31,
1113 VBOXVDMA_PIXEL_FORMAT_A8B8G8R8 = 32,
1114 VBOXVDMA_PIXEL_FORMAT_X8B8G8R8 = 33,
1115 VBOXVDMA_PIXEL_FORMAT_G16R16 = 34,
1116 VBOXVDMA_PIXEL_FORMAT_A2R10G10B10 = 35,
1117 VBOXVDMA_PIXEL_FORMAT_A16B16G16R16 = 36,
1118 VBOXVDMA_PIXEL_FORMAT_A8P8 = 40,
1119 VBOXVDMA_PIXEL_FORMAT_P8 = 41,
1120 VBOXVDMA_PIXEL_FORMAT_L8 = 50,
1121 VBOXVDMA_PIXEL_FORMAT_A8L8 = 51,
1122 VBOXVDMA_PIXEL_FORMAT_A4L4 = 52,
1123 VBOXVDMA_PIXEL_FORMAT_V8U8 = 60,
1124 VBOXVDMA_PIXEL_FORMAT_L6V5U5 = 61,
1125 VBOXVDMA_PIXEL_FORMAT_X8L8V8U8 = 62,
1126 VBOXVDMA_PIXEL_FORMAT_Q8W8V8U8 = 63,
1127 VBOXVDMA_PIXEL_FORMAT_V16U16 = 64,
1128 VBOXVDMA_PIXEL_FORMAT_W11V11U10 = 65,
1129 VBOXVDMA_PIXEL_FORMAT_A2W10V10U10 = 67
1130} VBOXVDMA_PIXEL_FORMAT;
1131
1132typedef struct VBOXVDMA_SURF_DESC
1133{
1134 uint32_t width;
1135 uint32_t height;
1136 VBOXVDMA_PIXEL_FORMAT format;
1137 uint32_t bpp;
1138 uint32_t pitch;
1139 uint32_t fFlags;
1140} VBOXVDMA_SURF_DESC, *PVBOXVDMA_SURF_DESC;
1141
1142//typedef uint64_t VBOXVDMAPHADDRESS;
1143typedef uint64_t VBOXVDMASURFHANDLE;
1144
1145typedef uint64_t VBOXVIDEOOFFSET;
1146
1147#define VBOXVIDEOOFFSET_VOID ((VBOXVIDEOOFFSET)~0)
1148
1149typedef enum
1150{
1151 VBOXVDMACMD_TYPE_UNDEFINED = 0,
1152 VBOXVDMACMD_TYPE_DMA_PRESENT_BLT = 1,
1153 VBOXVDMACMD_TYPE_DMA_BPB_TRANSFER = 2,
1154 VBOXVDMACMD_TYPE_DMA_BPB_FILL = 3,
1155 VBOXVDMACMD_TYPE_DMA_PRESENT_SHADOW2PRIMARY = 4,
1156} VBOXVDMACMD_TYPE;
1157
1158/* region specified as a rectangle, otherwize it is a size of memory pointed to by phys address */
1159#define VBOXVDMAOPERAND_FLAGS_RECTL 0x1
1160/* Surface handle is valid */
1161#define VBOXVDMAOPERAND_FLAGS_PRIMARY 0x2
1162/* address is offset in VRAM */
1163#define VBOXVDMAOPERAND_FLAGS_VRAMOFFSET 0x4
1164
1165
1166/* VBOXVDMACBUF_DR::phBuf specifies offset in VRAM */
1167#define VBOXVDMACBUF_FLAG_BUF_VRAM_OFFSET 0x00000001
1168/* command buffer follows the VBOXVDMACBUF_DR in VRAM, VBOXVDMACBUF_DR::phBuf is ignored */
1169#define VBOXVDMACBUF_FLAG_BUF_FOLLOWS_DR 0x00000002
1170
1171/*
1172 * We can not submit the DMA command via VRAM since we do not have control over
1173 * DMA command buffer [de]allocation, i.e. we only control the buffer contents.
1174 * In other words the system may call one of our callbacks to fill a command buffer
1175 * with the necessary commands and then discard the buffer w/o any notification.
1176 *
1177 * We have only DMA command buffer physical address at submission time.
1178 *
1179 * so the only way is to */
1180typedef struct VBOXVDMACBUF_DR
1181{
1182 uint32_t fFlags;
1183 uint32_t cbBuf;
1184 uint32_t u32FenceId;
1185 /* RT_SUCCESS() - on success
1186 * VERR_INTERRUPTED - on preemption
1187 * VERR_xxx - on error */
1188 int32_t rc;
1189 uint64_t u64GuestContext;
1190 union
1191 {
1192 uint64_t phBuf;
1193 VBOXVIDEOOFFSET offVramBuf;
1194 } Location;
1195} VBOXVDMACBUF_DR, *PVBOXVDMACBUF_DR;
1196
1197#define VBOXVDMACBUF_DR_TAIL(_pCmd, _t) ( (_t*)(((uint8_t*)(_pCmd)) + sizeof (VBOXVDMACBUF_DR)) )
1198
1199typedef struct VBOXVDMACMD
1200{
1201 VBOXVDMACMD_TYPE enmType;
1202 uint32_t u32CmdSpecific;
1203} VBOXVDMACMD, *PVBOXVDMACMD;
1204
1205#define VBOXVDMACMD_HEADER_SIZE() sizeof (VBOXVDMACMD)
1206#define VBOXVDMACMD_SIZE_FROMBODYSIZE(_s) (VBOXVDMACMD_HEADER_SIZE() + (_s))
1207#define VBOXVDMACMD_SIZE(_t) (VBOXVDMACMD_SIZE_FROMBODYSIZE(sizeof (_t)))
1208#define VBOXVDMACMD_BODY(_pCmd, _t) ( (_t*)(((uint8_t*)(_pCmd)) + VBOXVDMACMD_HEADER_SIZE()) )
1209#define VBOXVDMACMD_BODY_FIELD_OFFSET(_ot, _t, _f) ( (_ot)( VBOXVDMACMD_BODY(0, uint8_t) + RT_OFFSETOF(_t, _f) ) )
1210
1211typedef struct VBOXVDMACMD_DMA_PRESENT_BLT
1212{
1213 VBOXVIDEOOFFSET offSrc;
1214 VBOXVIDEOOFFSET offDst;
1215 VBOXVDMA_SURF_DESC srcDesc;
1216 VBOXVDMA_SURF_DESC dstDesc;
1217 VBOXVDMA_RECTL srcRectl;
1218 VBOXVDMA_RECTL dstRectl;
1219 uint32_t u32Reserved;
1220 uint32_t cDstSubRects;
1221 VBOXVDMA_RECTL aDstSubRects[1];
1222} VBOXVDMACMD_DMA_PRESENT_BLT, *PVBOXVDMACMD_DMA_PRESENT_BLT;
1223
1224typedef struct VBOXVDMACMD_DMA_PRESENT_SHADOW2PRIMARY
1225{
1226 VBOXVDMA_RECTL Rect;
1227} VBOXVDMACMD_DMA_PRESENT_SHADOW2PRIMARY, *PVBOXVDMACMD_DMA_PRESENT_SHADOW2PRIMARY;
1228
1229typedef struct VBOXVDMACMD_DMA_BPB_TRANSFER
1230{
1231 uint32_t cbTransferSize;
1232 uint32_t offTransfer; /* <- applicable for offVramBuf, which always points to the surface start*/
1233 uint32_t fFlags;
1234 uint32_t u32Reserved;
1235 union
1236 {
1237 uint64_t phBuf;
1238 VBOXVIDEOOFFSET offVramBuf;
1239 } Src;
1240 union
1241 {
1242 uint64_t phBuf;
1243 VBOXVIDEOOFFSET offVramBuf;
1244 } Dst;
1245} VBOXVDMACMD_DMA_BPB_TRANSFER, *PVBOXVDMACMD_DMA_BPB_TRANSFER;
1246
1247typedef struct VBOXVDMACMD_DMA_BPB_FILL
1248{
1249 VBOXVIDEOOFFSET offSurf;
1250 uint32_t cbFillSize;
1251 uint32_t u32FillPattern;
1252} VBOXVDMACMD_DMA_BPB_FILL, *PVBOXVDMACMD_DMA_BPB_FILL;
1253
1254# pragma pack()
1255#endif /* #ifdef VBOXVDMA */
1256
1257#ifdef VBOXVDMA_WITH_VBVA
1258# pragma pack(1)
1259
1260typedef struct VBOXVDMAVBVACMD
1261{
1262 HGSMIOFFSET offCmd;
1263} VBOXVDMAVBVACMD;
1264
1265#pragma pack()
1266#endif
1267
1268#endif
Note: See TracBrowser for help on using the repository browser.

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