VirtualBox

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

Last change on this file since 29776 was 29742, checked in by vboxsync, 15 years ago

wddm/2D: more impl (get caps + initialization working)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 38.2 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#define VBVA_INFO_CAPS 12 /* informs host about HGSMI caps. see _VBVACAPS below */
815
816/* host->guest commands */
817# define VBVAHG_EVENT 1
818# define VBVAHG_DISPLAY_CUSTOM 2
819#ifdef VBOXVDMA
820# define VBVAHG_SHGSMI_COMPLETION 3
821#endif
822
823# ifdef VBOX_WITH_VIDEOHWACCEL
824#define VBVAHG_DCUSTOM_VHWA_CMDCOMPLETE 1
825#pragma pack(1)
826typedef struct _VBVAHOSTCMDVHWACMDCOMPLETE
827{
828 uint32_t offCmd;
829}VBVAHOSTCMDVHWACMDCOMPLETE;
830#pragma pack()
831# endif /* # ifdef VBOX_WITH_VIDEOHWACCEL */
832
833#pragma pack(1)
834typedef enum
835{
836 VBVAHOSTCMD_OP_EVENT = 1,
837 VBVAHOSTCMD_OP_CUSTOM
838}VBVAHOSTCMD_OP_TYPE;
839
840typedef struct _VBVAHOSTCMDEVENT
841{
842 uint64_t pEvent;
843}VBVAHOSTCMDEVENT;
844
845
846typedef struct _VBVAHOSTCMD
847{
848 /* destination ID if >=0 specifies display index, otherwize the command is directed to the miniport */
849 int32_t iDstID;
850 int32_t customOpCode;
851 union
852 {
853 struct _VBVAHOSTCMD *pNext;
854 uint32_t offNext;
855 uint64_t Data; /* the body is 64-bit aligned */
856 } u;
857 char body[1];
858}VBVAHOSTCMD;
859
860#define VBVAHOSTCMD_SIZE(_size) (sizeof(VBVAHOSTCMD) + (_size))
861#define VBVAHOSTCMD_BODY(_pCmd, _tBody) ((_tBody*)(_pCmd)->body)
862#define VBVAHOSTCMD_HDR(_pBody) ((VBVAHOSTCMD*)(((uint8_t*)_pBody) - RT_OFFSETOF(VBVAHOSTCMD, body)))
863#define VBVAHOSTCMD_HDRSIZE (RT_OFFSETOF(VBVAHOSTCMD, body))
864
865#pragma pack()
866
867/* VBVACONF32::u32Index */
868#define VBOX_VBVA_CONF32_MONITOR_COUNT 0
869#define VBOX_VBVA_CONF32_HOST_HEAP_SIZE 1
870
871typedef struct _VBVACONF32
872{
873 uint32_t u32Index;
874 uint32_t u32Value;
875} VBVACONF32;
876
877typedef struct VBVAINFOVIEW
878{
879 /* Index of the screen, assigned by the guest. */
880 uint32_t u32ViewIndex;
881
882 /* The screen offset in VRAM, the framebuffer starts here. */
883 uint32_t u32ViewOffset;
884
885 /* The size of the VRAM memory that can be used for the view. */
886 uint32_t u32ViewSize;
887
888 /* The recommended maximum size of the VRAM memory for the screen. */
889 uint32_t u32MaxScreenSize;
890} VBVAINFOVIEW;
891
892typedef struct _VBVAINFOHEAP
893{
894 /* Absolute offset in VRAM of the start of the heap. */
895 uint32_t u32HeapOffset;
896
897 /* The size of the heap. */
898 uint32_t u32HeapSize;
899
900} VBVAINFOHEAP;
901
902typedef struct _VBVAFLUSH
903{
904 uint32_t u32Reserved;
905
906} VBVAFLUSH;
907
908/* VBVAINFOSCREEN::u8Flags */
909#define VBVA_SCREEN_F_NONE 0x0000
910#define VBVA_SCREEN_F_ACTIVE 0x0001
911
912typedef struct VBVAINFOSCREEN
913{
914 /* Which view contains the screen. */
915 uint32_t u32ViewIndex;
916
917 /* Physical X origin relative to the primary screen. */
918 int32_t i32OriginX;
919
920 /* Physical Y origin relative to the primary screen. */
921 int32_t i32OriginY;
922
923 /* Offset of visible framebuffer relative to the framebuffer start. */
924 uint32_t u32StartOffset;
925
926 /* The scan line size in bytes. */
927 uint32_t u32LineSize;
928
929 /* Width of the screen. */
930 uint32_t u32Width;
931
932 /* Height of the screen. */
933 uint32_t u32Height;
934
935 /* Color depth. */
936 uint16_t u16BitsPerPixel;
937
938 /* VBVA_SCREEN_F_* */
939 uint16_t u16Flags;
940} VBVAINFOSCREEN;
941
942
943/* VBVAENABLE::u32Flags */
944#define VBVA_F_NONE 0x00000000
945#define VBVA_F_ENABLE 0x00000001
946#define VBVA_F_DISABLE 0x00000002
947#ifdef VBOXWDDM_WITH_VBVA
948/* extended VBVA to be used with WDDM */
949#define VBVA_F_EXTENDED 0x00000004
950#endif
951
952typedef struct _VBVAENABLE
953{
954 uint32_t u32Flags;
955 uint32_t u32Offset;
956 int32_t i32Result;
957} VBVAENABLE;
958
959#ifdef VBOXWDDM_WITH_VBVA
960typedef struct _VBVAENABLE_EX
961{
962 VBVAENABLE Base;
963 uint32_t u32ScreenId;
964} VBVAENABLE_EX;
965#endif
966
967
968typedef struct _VBVAMOUSEPOINTERSHAPE
969{
970 /* The host result. */
971 int32_t i32Result;
972
973 /* VBOX_MOUSE_POINTER_* bit flags. */
974 uint32_t fu32Flags;
975
976 /* X coordinate of the hot spot. */
977 uint32_t u32HotX;
978
979 /* Y coordinate of the hot spot. */
980 uint32_t u32HotY;
981
982 /* Width of the pointer in pixels. */
983 uint32_t u32Width;
984
985 /* Height of the pointer in scanlines. */
986 uint32_t u32Height;
987
988 /* Pointer data.
989 *
990 ****
991 * The data consists of 1 bpp AND mask followed by 32 bpp XOR (color) mask.
992 *
993 * For pointers without alpha channel the XOR mask pixels are 32 bit values: (lsb)BGR0(msb).
994 * For pointers with alpha channel the XOR mask consists of (lsb)BGRA(msb) 32 bit values.
995 *
996 * Guest driver must create the AND mask for pointers with alpha channel, so if host does not
997 * support alpha, the pointer could be displayed as a normal color pointer. The AND mask can
998 * be constructed from alpha values. For example alpha value >= 0xf0 means bit 0 in the AND mask.
999 *
1000 * The AND mask is 1 bpp bitmap with byte aligned scanlines. Size of AND mask,
1001 * therefore, is cbAnd = (width + 7) / 8 * height. The padding bits at the
1002 * end of any scanline are undefined.
1003 *
1004 * The XOR mask follows the AND mask on the next 4 bytes aligned offset:
1005 * uint8_t *pXor = pAnd + (cbAnd + 3) & ~3
1006 * Bytes in the gap between the AND and the XOR mask are undefined.
1007 * XOR mask scanlines have no gap between them and size of XOR mask is:
1008 * cXor = width * 4 * height.
1009 ****
1010 *
1011 * Preallocate 4 bytes for accessing actual data as p->au8Data.
1012 */
1013 uint8_t au8Data[4];
1014
1015} VBVAMOUSEPOINTERSHAPE;
1016
1017/* the guest driver can handle asynch guest cmd completion by reading the command offset from io port */
1018#define VBVACAPS_COMPLETEGCMD_BY_IOREAD 0x00000001
1019/* the guest driver can handle video adapter IRQs */
1020#define VBVACAPS_IRQ 0x00000002
1021typedef struct _VBVACAPS
1022{
1023 int32_t rc;
1024 uint32_t fCaps;
1025} VBVACAPS;
1026
1027#pragma pack()
1028
1029#endif /* VBOX_WITH_HGSMI */
1030
1031#ifdef VBOXVDMA
1032# pragma pack(1)
1033
1034/*
1035 * VBOXSHGSMI made on top HGSMI and allows receiving notifications
1036 * about G->H command completion
1037 */
1038/* SHGSMI command header */
1039typedef struct VBOXSHGSMIHEADER
1040{
1041 uint64_t pvNext; /*<- completion processing queue */
1042 uint32_t fFlags; /*<- see VBOXSHGSMI_FLAG_XXX Flags */
1043 uint32_t cRefs; /*<- command referece count */
1044 uint64_t u64Info1; /*<- contents depends on the fFlags value */
1045 uint64_t u64Info2; /*<- contents depends on the fFlags value */
1046} VBOXSHGSMIHEADER, *PVBOXSHGSMIHEADER;
1047
1048/* the command processing was asynch, set by the host to indicate asynch command completion
1049 * must not be cleared once set, the command completion is performed by issuing a host->guest completion command
1050 * while keeping this flag unchanged */
1051#define VBOXSHGSMI_FLAG_HG_ASYNCH 0x00010000
1052///* if set - asynch completion is performed by issuing the event,
1053// * if cleared - asynch completion is performed by calling a callback */
1054//#define VBOXSHGSMI_FLAG_GH_ASYNCH_EVENT 0x00000001
1055/* issue interrupt on asynch completion, used for critical G->H commands,
1056 * i.e. for completion of which guest is waiting. */
1057#define VBOXSHGSMI_FLAG_GH_ASYNCH_IRQ 0x00000002
1058/* guest does not do any op on completion of this command,
1059 * the host may copy the command and indicate that it does not need the command anymore
1060 * by not setting VBOXSHGSMI_FLAG_HG_ASYNCH */
1061#define VBOXSHGSMI_FLAG_GH_ASYNCH_NOCOMPLETION 0x00000004
1062/* guest requires the command to be processed asynchronously,
1063 * not setting VBOXSHGSMI_FLAG_HG_ASYNCH by the host in this case is treated as command failure */
1064#define VBOXSHGSMI_FLAG_GH_ASYNCH_FORCE 0x00000008
1065/* force IRQ on cmd completion */
1066#define VBOXSHGSMI_FLAG_GH_ASYNCH_IRQ_FORCE 0x00000010
1067/* an IRQ-level callback is associated with the command */
1068#define VBOXSHGSMI_FLAG_GH_ASYNCH_CALLBACK_IRQ 0x00000020
1069/* guest expects this command to be completed synchronously */
1070#define VBOXSHGSMI_FLAG_GH_SYNCH 0x00000040
1071
1072DECLINLINE(uint8_t *) VBoxSHGSMIBufferData (const VBOXSHGSMIHEADER* pHeader)
1073{
1074 return (uint8_t *)pHeader + sizeof (VBOXSHGSMIHEADER);
1075}
1076
1077DECLINLINE(PVBOXSHGSMIHEADER) VBoxSHGSMIBufferHeader (const void *pvData)
1078{
1079 return (PVBOXSHGSMIHEADER)((uint8_t *)pvData - sizeof (VBOXSHGSMIHEADER));
1080}
1081
1082/* VDMA - Video DMA */
1083
1084/* VDMA Control API */
1085/* VBOXVDMA_CTL::u32Flags */
1086typedef enum
1087{
1088 VBOXVDMA_CTL_TYPE_NONE = 0,
1089 VBOXVDMA_CTL_TYPE_ENABLE,
1090 VBOXVDMA_CTL_TYPE_DISABLE,
1091 VBOXVDMA_CTL_TYPE_FLUSH
1092} VBOXVDMA_CTL_TYPE;
1093
1094typedef struct VBOXVDMA_CTL
1095{
1096 VBOXVDMA_CTL_TYPE enmCtl;
1097 uint32_t u32Offset;
1098 int32_t i32Result;
1099} VBOXVDMA_CTL, *PVBOXVDMA_CTL;
1100
1101typedef struct VBOXVDMA_RECTL
1102{
1103 int16_t left;
1104 int16_t top;
1105 uint16_t width;
1106 uint16_t height;
1107} VBOXVDMA_RECTL, *PVBOXVDMA_RECTL;
1108
1109typedef enum
1110{
1111 VBOXVDMA_PIXEL_FORMAT_UNKNOWN = 0,
1112 VBOXVDMA_PIXEL_FORMAT_R8G8B8 = 20,
1113 VBOXVDMA_PIXEL_FORMAT_A8R8G8B8 = 21,
1114 VBOXVDMA_PIXEL_FORMAT_X8R8G8B8 = 22,
1115 VBOXVDMA_PIXEL_FORMAT_R5G6B5 = 23,
1116 VBOXVDMA_PIXEL_FORMAT_X1R5G5B5 = 24,
1117 VBOXVDMA_PIXEL_FORMAT_A1R5G5B5 = 25,
1118 VBOXVDMA_PIXEL_FORMAT_A4R4G4B4 = 26,
1119 VBOXVDMA_PIXEL_FORMAT_R3G3B2 = 27,
1120 VBOXVDMA_PIXEL_FORMAT_A8 = 28,
1121 VBOXVDMA_PIXEL_FORMAT_A8R3G3B2 = 29,
1122 VBOXVDMA_PIXEL_FORMAT_X4R4G4B4 = 30,
1123 VBOXVDMA_PIXEL_FORMAT_A2B10G10R10 = 31,
1124 VBOXVDMA_PIXEL_FORMAT_A8B8G8R8 = 32,
1125 VBOXVDMA_PIXEL_FORMAT_X8B8G8R8 = 33,
1126 VBOXVDMA_PIXEL_FORMAT_G16R16 = 34,
1127 VBOXVDMA_PIXEL_FORMAT_A2R10G10B10 = 35,
1128 VBOXVDMA_PIXEL_FORMAT_A16B16G16R16 = 36,
1129 VBOXVDMA_PIXEL_FORMAT_A8P8 = 40,
1130 VBOXVDMA_PIXEL_FORMAT_P8 = 41,
1131 VBOXVDMA_PIXEL_FORMAT_L8 = 50,
1132 VBOXVDMA_PIXEL_FORMAT_A8L8 = 51,
1133 VBOXVDMA_PIXEL_FORMAT_A4L4 = 52,
1134 VBOXVDMA_PIXEL_FORMAT_V8U8 = 60,
1135 VBOXVDMA_PIXEL_FORMAT_L6V5U5 = 61,
1136 VBOXVDMA_PIXEL_FORMAT_X8L8V8U8 = 62,
1137 VBOXVDMA_PIXEL_FORMAT_Q8W8V8U8 = 63,
1138 VBOXVDMA_PIXEL_FORMAT_V16U16 = 64,
1139 VBOXVDMA_PIXEL_FORMAT_W11V11U10 = 65,
1140 VBOXVDMA_PIXEL_FORMAT_A2W10V10U10 = 67
1141} VBOXVDMA_PIXEL_FORMAT;
1142
1143typedef struct VBOXVDMA_SURF_DESC
1144{
1145 uint32_t width;
1146 uint32_t height;
1147 VBOXVDMA_PIXEL_FORMAT format;
1148 uint32_t bpp;
1149 uint32_t pitch;
1150 uint32_t fFlags;
1151} VBOXVDMA_SURF_DESC, *PVBOXVDMA_SURF_DESC;
1152
1153//typedef uint64_t VBOXVDMAPHADDRESS;
1154typedef uint64_t VBOXVDMASURFHANDLE;
1155
1156typedef uint64_t VBOXVIDEOOFFSET;
1157
1158#define VBOXVIDEOOFFSET_VOID ((VBOXVIDEOOFFSET)~0)
1159
1160typedef enum
1161{
1162 VBOXVDMACMD_TYPE_UNDEFINED = 0,
1163 VBOXVDMACMD_TYPE_DMA_PRESENT_BLT = 1,
1164 VBOXVDMACMD_TYPE_DMA_BPB_TRANSFER = 2,
1165 VBOXVDMACMD_TYPE_DMA_BPB_FILL = 3,
1166 VBOXVDMACMD_TYPE_DMA_PRESENT_SHADOW2PRIMARY = 4,
1167} VBOXVDMACMD_TYPE;
1168
1169/* region specified as a rectangle, otherwize it is a size of memory pointed to by phys address */
1170#define VBOXVDMAOPERAND_FLAGS_RECTL 0x1
1171/* Surface handle is valid */
1172#define VBOXVDMAOPERAND_FLAGS_PRIMARY 0x2
1173/* address is offset in VRAM */
1174#define VBOXVDMAOPERAND_FLAGS_VRAMOFFSET 0x4
1175
1176
1177/* VBOXVDMACBUF_DR::phBuf specifies offset in VRAM */
1178#define VBOXVDMACBUF_FLAG_BUF_VRAM_OFFSET 0x00000001
1179/* command buffer follows the VBOXVDMACBUF_DR in VRAM, VBOXVDMACBUF_DR::phBuf is ignored */
1180#define VBOXVDMACBUF_FLAG_BUF_FOLLOWS_DR 0x00000002
1181
1182/*
1183 * We can not submit the DMA command via VRAM since we do not have control over
1184 * DMA command buffer [de]allocation, i.e. we only control the buffer contents.
1185 * In other words the system may call one of our callbacks to fill a command buffer
1186 * with the necessary commands and then discard the buffer w/o any notification.
1187 *
1188 * We have only DMA command buffer physical address at submission time.
1189 *
1190 * so the only way is to */
1191typedef struct VBOXVDMACBUF_DR
1192{
1193 uint32_t fFlags;
1194 uint32_t cbBuf;
1195 uint32_t u32FenceId;
1196 /* RT_SUCCESS() - on success
1197 * VERR_INTERRUPTED - on preemption
1198 * VERR_xxx - on error */
1199 int32_t rc;
1200 uint64_t u64GuestContext;
1201 union
1202 {
1203 uint64_t phBuf;
1204 VBOXVIDEOOFFSET offVramBuf;
1205 } Location;
1206} VBOXVDMACBUF_DR, *PVBOXVDMACBUF_DR;
1207
1208#define VBOXVDMACBUF_DR_TAIL(_pCmd, _t) ( (_t*)(((uint8_t*)(_pCmd)) + sizeof (VBOXVDMACBUF_DR)) )
1209
1210typedef struct VBOXVDMACMD
1211{
1212 VBOXVDMACMD_TYPE enmType;
1213 uint32_t u32CmdSpecific;
1214} VBOXVDMACMD, *PVBOXVDMACMD;
1215
1216#define VBOXVDMACMD_HEADER_SIZE() sizeof (VBOXVDMACMD)
1217#define VBOXVDMACMD_SIZE_FROMBODYSIZE(_s) (VBOXVDMACMD_HEADER_SIZE() + (_s))
1218#define VBOXVDMACMD_SIZE(_t) (VBOXVDMACMD_SIZE_FROMBODYSIZE(sizeof (_t)))
1219#define VBOXVDMACMD_BODY(_pCmd, _t) ( (_t*)(((uint8_t*)(_pCmd)) + VBOXVDMACMD_HEADER_SIZE()) )
1220#define VBOXVDMACMD_BODY_FIELD_OFFSET(_ot, _t, _f) ( (_ot)( VBOXVDMACMD_BODY(0, uint8_t) + RT_OFFSETOF(_t, _f) ) )
1221
1222typedef struct VBOXVDMACMD_DMA_PRESENT_BLT
1223{
1224 VBOXVIDEOOFFSET offSrc;
1225 VBOXVIDEOOFFSET offDst;
1226 VBOXVDMA_SURF_DESC srcDesc;
1227 VBOXVDMA_SURF_DESC dstDesc;
1228 VBOXVDMA_RECTL srcRectl;
1229 VBOXVDMA_RECTL dstRectl;
1230 uint32_t u32Reserved;
1231 uint32_t cDstSubRects;
1232 VBOXVDMA_RECTL aDstSubRects[1];
1233} VBOXVDMACMD_DMA_PRESENT_BLT, *PVBOXVDMACMD_DMA_PRESENT_BLT;
1234
1235typedef struct VBOXVDMACMD_DMA_PRESENT_SHADOW2PRIMARY
1236{
1237 VBOXVDMA_RECTL Rect;
1238} VBOXVDMACMD_DMA_PRESENT_SHADOW2PRIMARY, *PVBOXVDMACMD_DMA_PRESENT_SHADOW2PRIMARY;
1239
1240typedef struct VBOXVDMACMD_DMA_BPB_TRANSFER
1241{
1242 uint32_t cbTransferSize;
1243 uint32_t offTransfer; /* <- applicable for offVramBuf, which always points to the surface start*/
1244 uint32_t fFlags;
1245 uint32_t u32Reserved;
1246 union
1247 {
1248 uint64_t phBuf;
1249 VBOXVIDEOOFFSET offVramBuf;
1250 } Src;
1251 union
1252 {
1253 uint64_t phBuf;
1254 VBOXVIDEOOFFSET offVramBuf;
1255 } Dst;
1256} VBOXVDMACMD_DMA_BPB_TRANSFER, *PVBOXVDMACMD_DMA_BPB_TRANSFER;
1257
1258typedef struct VBOXVDMACMD_DMA_BPB_FILL
1259{
1260 VBOXVIDEOOFFSET offSurf;
1261 uint32_t cbFillSize;
1262 uint32_t u32FillPattern;
1263} VBOXVDMACMD_DMA_BPB_FILL, *PVBOXVDMACMD_DMA_BPB_FILL;
1264
1265# pragma pack()
1266#endif /* #ifdef VBOXVDMA */
1267
1268#ifdef VBOXVDMA_WITH_VBVA
1269# pragma pack(1)
1270
1271typedef struct VBOXVDMAVBVACMD
1272{
1273 HGSMIOFFSET offCmd;
1274} VBOXVDMAVBVACMD;
1275
1276#pragma pack()
1277#endif
1278
1279#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