VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/Graphics/Video/common/wddm/VBoxMPIf.h@ 96407

Last change on this file since 96407 was 96407, checked in by vboxsync, 2 years ago

scm copyright and license note update

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 36.4 KB
Line 
1/* $Id: VBoxMPIf.h 96407 2022-08-22 17:43:14Z vboxsync $ */
2/** @file
3 * VBox WDDM Miniport driver.
4 *
5 * Contains base definitions of constants & structures used to control & perform
6 * rendering, such as DMA commands types, allocation types, escape codes, etc.
7 * used by both miniport & display drivers.
8 *
9 * The latter uses these and only these defs to communicate with the former
10 * by posting appropriate requests via D3D RT Krnl Svc accessing callbacks.
11 */
12
13/*
14 * Copyright (C) 2011-2022 Oracle and/or its affiliates.
15 *
16 * This file is part of VirtualBox base platform packages, as
17 * available from https://www.virtualbox.org.
18 *
19 * This program is free software; you can redistribute it and/or
20 * modify it under the terms of the GNU General Public License
21 * as published by the Free Software Foundation, in version 3 of the
22 * License.
23 *
24 * This program is distributed in the hope that it will be useful, but
25 * WITHOUT ANY WARRANTY; without even the implied warranty of
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
27 * General Public License for more details.
28 *
29 * You should have received a copy of the GNU General Public License
30 * along with this program; if not, see <https://www.gnu.org/licenses>.
31 *
32 * SPDX-License-Identifier: GPL-3.0-only
33 */
34
35#ifndef GA_INCLUDED_SRC_WINNT_Graphics_Video_common_wddm_VBoxMPIf_h
36#define GA_INCLUDED_SRC_WINNT_Graphics_Video_common_wddm_VBoxMPIf_h
37#ifndef RT_WITHOUT_PRAGMA_ONCE
38# pragma once
39#endif
40
41#include <VBoxVideo.h>
42#include "../../../../include/VBoxDisplay.h"
43#include "../VBoxVideoTools.h"
44#include <VBoxUhgsmi.h>
45#include <VBox/VBoxGuestCoreTypes.h> /* for VBGLIOCHGCMCALL */
46
47#if defined(VBOXWDDMDISP) || defined(VBOX_WDDM_MINIPORT)
48#include <VBoxGaTypes.h>
49#endif
50
51/* One would increase this whenever definitions in this file are changed */
52#define VBOXVIDEOIF_VERSION 22
53
54/** @todo VBOXVIDEO_HWTYPE probably needs to be in VBoxVideo.h */
55typedef enum VBOXVIDEO_HWTYPE
56{
57 VBOXVIDEO_HWTYPE_VBOX = 0,
58 VBOXVIDEO_HWTYPE_VMSVGA = 1,
59 VBOXVIDEO_HWTYPE_32BIT = 0x7fffffff
60} VBOXVIDEO_HWTYPE;
61AssertCompileSize(VBOXVIDEO_HWTYPE, 4);
62
63#define VBOXWDDM_NODE_ID_SYSTEM 0
64#define VBOXWDDM_NODE_ID_3D (VBOXWDDM_NODE_ID_SYSTEM)
65#define VBOXWDDM_NODE_ID_3D_KMT (VBOXWDDM_NODE_ID_3D)
66#define VBOXWDDM_NODE_ID_2D_VIDEO (VBOXWDDM_NODE_ID_3D_KMT + 1)
67#define VBOXWDDM_NUM_NODES (VBOXWDDM_NODE_ID_2D_VIDEO + 1)
68
69#define VBOXWDDM_ENGINE_ID_SYSTEM 0
70#if (VBOXWDDM_NODE_ID_3D == VBOXWDDM_NODE_ID_SYSTEM)
71# define VBOXWDDM_ENGINE_ID_3D (VBOXWDDM_ENGINE_ID_SYSTEM + 1)
72#else
73# define VBOXWDDM_ENGINE_ID_3D 0
74#endif
75#if (VBOXWDDM_NODE_ID_3D_KMT == VBOXWDDM_NODE_ID_3D)
76# define VBOXWDDM_ENGINE_ID_3D_KMT VBOXWDDM_ENGINE_ID_3D
77#else
78# define VBOXWDDM_ENGINE_ID_3D_KMT 0
79#endif
80#if (VBOXWDDM_NODE_ID_2D_VIDEO == VBOXWDDM_NODE_ID_3D)
81# define VBOXWDDM_ENGINE_ID_2D_VIDEO VBOXWDDM_ENGINE_ID_3D
82#else
83# define VBOXWDDM_ENGINE_ID_2D_VIDEO 0
84#endif
85
86
87#if defined(VBOX_WITH_VMSVGA3D_DX) || defined(VBOXWDDMDISP) || defined(VBOX_WDDM_MINIPORT) || defined(VBOXGL)
88/*
89 * Structures for the new D3D user mode driver.
90 */
91#pragma pack(1) /* VMSVGA structures are '__packed'. */
92#include <svga3d_reg.h>
93#pragma pack()
94#include <dxgiddi.h>
95
96/* D3DDDI_ALLOCATIONINFO::pPrivateDriverData */
97typedef enum VBOXDXALLOCATIONTYPE
98{
99 VBOXDXALLOCATIONTYPE_UNKNOWN = 0,
100 VBOXDXALLOCATIONTYPE_SURFACE = 1,
101 VBOXDXALLOCATIONTYPE_SHADERS = 2,
102 VBOXDXALLOCATIONTYPE_CO = 3,
103 VBOXDXALLOCATIONTYPE_MAX,
104 VBOXDXALLOCATIONTYPE_32BIT = 0xFFFFFFFF
105} VBOXDXALLOCATIONTYPE;
106
107/* Information for DxgkDdiCreateAllocation and for SVGA3dCmdDefine[GB]Surface. */
108typedef struct VBOXDXALLOCATIONDESC
109{
110 VBOXDXALLOCATIONTYPE enmAllocationType;
111 uint32_t cbAllocation;
112 struct
113 {
114 SVGA3dSurfaceAllFlags surfaceFlags;
115 SVGA3dSurfaceFormat format;
116 uint32 numMipLevels;
117 uint32 multisampleCount;
118 SVGA3dMSPattern multisamplePattern;
119 SVGA3dMSQualityLevel qualityLevel;
120 SVGA3dTextureFilter autogenFilter;
121 SVGA3dSize size;
122 uint32 arraySize;
123 uint32 bufferByteStride;
124 } surfaceInfo;
125 bool fPrimary : 1;
126 DXGI_DDI_PRIMARY_DESC PrimaryDesc;
127 D3DDDIFORMAT enmDDIFormat;
128 struct
129 {
130 /* These will be needed by OpenResource */
131 UINT BindFlags;
132 UINT MapFlags;
133 UINT MiscFlags;
134 DXGI_FORMAT Format;
135 UINT DecoderBufferType; /* D3D11_1DDI_VIDEO_DECODER_BUFFER_TYPE */
136 } resourceInfo;
137} VBOXDXALLOCATIONDESC, *PVBOXDXALLOCATIONDESC;
138#endif /* defined(VBOX_WITH_VMSVGA3D_DX) || defined(VBOXWDDMDISP) || defined(VBOX_WDDM_MINIPORT) || defined(VBOXGL) */
139
140/* create allocation func */
141typedef enum
142{
143 VBOXWDDM_ALLOC_TYPE_UNEFINED = 0,
144 VBOXWDDM_ALLOC_TYPE_STD_SHAREDPRIMARYSURFACE,
145 VBOXWDDM_ALLOC_TYPE_STD_SHADOWSURFACE,
146 VBOXWDDM_ALLOC_TYPE_STD_STAGINGSURFACE,
147 /* this one is win 7-specific and hence unused for now */
148 VBOXWDDM_ALLOC_TYPE_STD_GDISURFACE
149 /* custom allocation types requested from user-mode d3d module will go here */
150 , VBOXWDDM_ALLOC_TYPE_UMD_RC_GENERIC
151 , VBOXWDDM_ALLOC_TYPE_UMD_HGSMI_BUFFER
152 , VBOXWDDM_ALLOC_TYPE_D3D /* Direct3D UMD driver allocation. Actual type is a VBOXDXALLOCATIONTYPE value. */
153} VBOXWDDM_ALLOC_TYPE;
154
155/* usage */
156typedef enum
157{
158 VBOXWDDM_ALLOCUSAGE_TYPE_UNEFINED = 0,
159 /* set for the allocation being primary */
160 VBOXWDDM_ALLOCUSAGE_TYPE_PRIMARY,
161} VBOXWDDM_ALLOCUSAGE_TYPE;
162
163typedef struct VBOXWDDM_SURFACE_DESC
164{
165 UINT width;
166 UINT height;
167 D3DDDIFORMAT format;
168 UINT bpp;
169 UINT pitch;
170 UINT depth;
171 UINT slicePitch;
172 UINT d3dWidth;
173 UINT cbSize;
174 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId;
175 D3DDDI_RATIONAL RefreshRate;
176} VBOXWDDM_SURFACE_DESC, *PVBOXWDDM_SURFACE_DESC;
177
178typedef struct VBOXWDDM_ALLOCINFO
179{
180 VBOXWDDM_ALLOC_TYPE enmType;
181 union
182 {
183 struct
184 {
185 D3DDDI_RESOURCEFLAGS fFlags;
186 /* id used to identify the allocation on the host */
187 uint32_t hostID;
188 uint64_t hSharedHandle;
189 VBOXWDDM_SURFACE_DESC SurfDesc;
190 };
191
192 struct
193 {
194 uint32_t cbBuffer;
195 VBOXUHGSMI_BUFFER_TYPE_FLAGS fUhgsmiType;
196 };
197 };
198} VBOXWDDM_ALLOCINFO, *PVBOXWDDM_ALLOCINFO;
199
200#ifdef VBOX_WITH_VMSVGA3D_DX
201AssertCompile(sizeof(VBOXDXALLOCATIONDESC) != sizeof(VBOXWDDM_ALLOCINFO));
202#endif
203
204typedef struct VBOXWDDM_RC_DESC
205{
206 D3DDDI_RESOURCEFLAGS fFlags;
207 D3DDDIFORMAT enmFormat;
208 D3DDDI_POOL enmPool;
209 D3DDDIMULTISAMPLE_TYPE enmMultisampleType;
210 UINT MultisampleQuality;
211 UINT MipLevels;
212 UINT Fvf;
213 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId;
214 D3DDDI_RATIONAL RefreshRate;
215 D3DDDI_ROTATION enmRotation;
216} VBOXWDDM_RC_DESC, *PVBOXWDDM_RC_DESC;
217
218typedef struct VBOXWDDMDISP_RESOURCE_FLAGS
219{
220 union
221 {
222 struct
223 {
224 UINT Opened : 1; /* this resource is OpenResource'd rather than CreateResource'd */
225 UINT Generic : 1; /* identifies this is a resource created with CreateResource, the VBOXWDDMDISP_RESOURCE::fRcFlags is valid */
226 UINT KmResource : 1; /* this resource has underlying km resource */
227 UINT Reserved : 29; /* reserved */
228 };
229 UINT Value;
230 };
231} VBOXWDDMDISP_RESOURCE_FLAGS, *PVBOXWDDMDISP_RESOURCE_FLAGS;
232
233typedef struct VBOXWDDM_RCINFO
234{
235 VBOXWDDMDISP_RESOURCE_FLAGS fFlags;
236 VBOXWDDM_RC_DESC RcDesc;
237 uint32_t cAllocInfos;
238// VBOXWDDM_ALLOCINFO aAllocInfos[1];
239} VBOXWDDM_RCINFO, *PVBOXWDDM_RCINFO;
240
241typedef struct VBOXWDDM_DMA_PRIVATEDATA_FLAFS
242{
243 union
244 {
245 struct
246 {
247 UINT bCmdInDmaBuffer : 1;
248 UINT bReserved : 31;
249 };
250 uint32_t Value;
251 };
252} VBOXWDDM_DMA_PRIVATEDATA_FLAFS, *PVBOXWDDM_DMA_PRIVATEDATA_FLAFS;
253
254typedef struct VBOXWDDM_DMA_PRIVATEDATA_BASEHDR
255{
256 VBOXVDMACMD_TYPE enmCmd;
257 union
258 {
259 VBOXWDDM_DMA_PRIVATEDATA_FLAFS fFlags;
260 uint32_t u32CmdReserved;
261 };
262} VBOXWDDM_DMA_PRIVATEDATA_BASEHDR, *PVBOXWDDM_DMA_PRIVATEDATA_BASEHDR;
263
264typedef struct VBOXWDDM_UHGSMI_BUFFER_UI_SUBMIT_INFO
265{
266 uint32_t offData;
267 uint32_t cbData;
268} VBOXWDDM_UHGSMI_BUFFER_UI_SUBMIT_INFO, *PVBOXWDDM_UHGSMI_BUFFER_UI_SUBMIT_INFO;
269
270typedef struct VBOXWDDM_DMA_PRIVATEDATA_UM_CHROMIUM_CMD
271{
272 VBOXWDDM_DMA_PRIVATEDATA_BASEHDR Base;
273 VBOXWDDM_UHGSMI_BUFFER_UI_SUBMIT_INFO aBufInfos[1];
274} VBOXWDDM_DMA_PRIVATEDATA_UM_CHROMIUM_CMD, *PVBOXWDDM_DMA_PRIVATEDATA_UM_CHROMIUM_CMD;
275
276
277#define VBOXVHWA_F_ENABLED 0x00000001
278#define VBOXVHWA_F_CKEY_DST 0x00000002
279#define VBOXVHWA_F_CKEY_SRC 0x00000004
280
281#define VBOXVHWA_MAX_FORMATS 8
282
283typedef struct VBOXVHWA_INFO
284{
285 uint32_t fFlags;
286 uint32_t cOverlaysSupported;
287 uint32_t cFormats;
288 D3DDDIFORMAT aFormats[VBOXVHWA_MAX_FORMATS];
289} VBOXVHWA_INFO;
290
291#define VBOXWDDM_OVERLAY_F_CKEY_DST 0x00000001
292#define VBOXWDDM_OVERLAY_F_CKEY_DSTRANGE 0x00000002
293#define VBOXWDDM_OVERLAY_F_CKEY_SRC 0x00000004
294#define VBOXWDDM_OVERLAY_F_CKEY_SRCRANGE 0x00000008
295#define VBOXWDDM_OVERLAY_F_BOB 0x00000010
296#define VBOXWDDM_OVERLAY_F_INTERLEAVED 0x00000020
297#define VBOXWDDM_OVERLAY_F_MIRROR_LR 0x00000040
298#define VBOXWDDM_OVERLAY_F_MIRROR_UD 0x00000080
299#define VBOXWDDM_OVERLAY_F_DEINTERLACED 0x00000100
300
301typedef struct VBOXWDDM_OVERLAY_DESC
302{
303 uint32_t fFlags;
304 UINT DstColorKeyLow;
305 UINT DstColorKeyHigh;
306 UINT SrcColorKeyLow;
307 UINT SrcColorKeyHigh;
308} VBOXWDDM_OVERLAY_DESC, *PVBOXWDDM_OVERLAY_DESC;
309
310typedef struct VBOXWDDM_OVERLAY_INFO
311{
312 VBOXWDDM_OVERLAY_DESC OverlayDesc;
313 VBOXWDDM_DIRTYREGION DirtyRegion; /* <- the dirty region of the overlay surface */
314} VBOXWDDM_OVERLAY_INFO, *PVBOXWDDM_OVERLAY_INFO;
315
316typedef struct VBOXWDDM_OVERLAYFLIP_INFO
317{
318 VBOXWDDM_DIRTYREGION DirtyRegion; /* <- the dirty region of the overlay surface */
319} VBOXWDDM_OVERLAYFLIP_INFO, *PVBOXWDDM_OVERLAYFLIP_INFO;
320
321
322typedef enum
323{
324 VBOXWDDM_CONTEXT_TYPE_UNDEFINED = 0,
325 /* system-created context (for GDI rendering) */
326 VBOXWDDM_CONTEXT_TYPE_SYSTEM,
327 /* context created by the D3D User-mode driver when crogl IS available */
328 obsolete_VBOXWDDM_CONTEXT_TYPE_CUSTOM_3D,
329 /* context created by the D3D User-mode driver when crogl is NOT available or for ddraw overlay acceleration */
330 obsolete_VBOXWDDM_CONTEXT_TYPE_CUSTOM_2D,
331 /* contexts created by the cromium HGSMI transport for HGSMI commands submission */
332 obsolete_VBOXWDDM_CONTEXT_TYPE_CUSTOM_UHGSMI_3D,
333 obsolete_VBOXWDDM_CONTEXT_TYPE_CUSTOM_UHGSMI_GL,
334 /* context created by the kernel->user communication mechanism for visible rects reporting, etc. */
335 VBOXWDDM_CONTEXT_TYPE_CUSTOM_SESSION,
336 /* context created by VBoxTray to handle resize operations */
337 VBOXWDDM_CONTEXT_TYPE_CUSTOM_DISPIF_RESIZE,
338 /* context created by VBoxTray to handle seamless operations */
339 VBOXWDDM_CONTEXT_TYPE_CUSTOM_DISPIF_SEAMLESS,
340 /* Gallium driver context. */
341 VBOXWDDM_CONTEXT_TYPE_GA_3D,
342 /* Direct3D UMD context for VMSVGA device. */
343 VBOXWDDM_CONTEXT_TYPE_VMSVGA_D3D,
344} VBOXWDDM_CONTEXT_TYPE;
345
346typedef struct VBOXWDDM_CREATECONTEXT_INFO
347{
348 /* interface version, i.e. 9 for d3d9, 8 for d3d8, etc. */
349 uint32_t u32IfVersion;
350 /* What kind of context to create. */
351 VBOXWDDM_CONTEXT_TYPE enmType;
352 union
353 {
354 struct
355 {
356 uint32_t crVersionMajor;
357 uint32_t crVersionMinor;
358 /* we use uint64_t instead of HANDLE to ensure structure def is the same for both 32-bit and 64-bit
359 * since x64 kernel driver can be called by 32-bit UMD */
360 uint64_t hUmEvent;
361 /* info to be passed to UMD notification to identify the context */
362 uint64_t u64UmInfo;
363 } vbox;
364#ifdef VBOX_WITH_VMSVGA
365 struct
366 {
367 /* VBOXWDDM_F_GA_CONTEXT_* */
368 uint32_t u32Flags;
369 } vmsvga;
370#endif
371 } u;
372} VBOXWDDM_CREATECONTEXT_INFO, *PVBOXWDDM_CREATECONTEXT_INFO;
373
374typedef uint64_t VBOXDISP_UMHANDLE;
375typedef uint32_t VBOXDISP_KMHANDLE;
376
377typedef struct VBOXWDDM_RECTS_FLAFS
378{
379 union
380 {
381 struct
382 {
383 /* used only in conjunction with bSetVisibleRects.
384 * if set - VBOXWDDM_RECTS_INFO::aRects[0] contains view rectangle */
385 UINT bSetViewRect : 1;
386 /* adds visible regions */
387 UINT bAddVisibleRects : 1;
388 /* adds hidden regions */
389 UINT bAddHiddenRects : 1;
390 /* hide entire window */
391 UINT bHide : 1;
392 /* reserved */
393 UINT Reserved : 28;
394 };
395 uint32_t Value;
396 };
397} VBOXWDDM_RECTS_FLAFS, *PVBOXWDDM_RECTS_FLAFS;
398
399typedef struct VBOXWDDM_RECTS_INFO
400{
401 uint32_t cRects;
402 RECT aRects[1];
403} VBOXWDDM_RECTS_INFO, *PVBOXWDDM_RECTS_INFO;
404
405#define VBOXWDDM_RECTS_INFO_SIZE4CRECTS(_cRects) (RT_UOFFSETOF_DYN(VBOXWDDM_RECTS_INFO, aRects[(_cRects)]))
406#define VBOXWDDM_RECTS_INFO_SIZE(_pRects) (VBOXVIDEOCM_CMD_RECTS_SIZE4CRECTS((_pRects)->cRects))
407
408typedef enum
409{
410 /* command to be post to user mode */
411 VBOXVIDEOCM_CMD_TYPE_UM = 0,
412 /* control command processed in kernel mode */
413 VBOXVIDEOCM_CMD_TYPE_CTL_KM,
414 VBOXVIDEOCM_CMD_DUMMY_32BIT = 0x7fffffff
415} VBOXVIDEOCM_CMD_TYPE;
416
417typedef struct VBOXVIDEOCM_CMD_HDR
418{
419 uint64_t u64UmData;
420 uint32_t cbCmd;
421 VBOXVIDEOCM_CMD_TYPE enmType;
422}VBOXVIDEOCM_CMD_HDR, *PVBOXVIDEOCM_CMD_HDR;
423
424AssertCompile((sizeof (VBOXVIDEOCM_CMD_HDR) & 7) == 0);
425
426typedef struct VBOXVIDEOCM_CMD_RECTS
427{
428 VBOXWDDM_RECTS_FLAFS fFlags;
429 VBOXWDDM_RECTS_INFO RectsInfo;
430} VBOXVIDEOCM_CMD_RECTS, *PVBOXVIDEOCM_CMD_RECTS;
431
432typedef struct VBOXWDDM_GETVBOXVIDEOCMCMD_HDR
433{
434 uint32_t cbCmdsReturned;
435 uint32_t cbRemainingCmds;
436 uint32_t cbRemainingFirstCmd;
437 uint32_t u32Reserved;
438} VBOXWDDM_GETVBOXVIDEOCMCMD_HDR, *PVBOXWDDM_GETVBOXVIDEOCMCMD_HDR;
439
440typedef struct VBOXDISPIFESCAPE_GETVBOXVIDEOCMCMD
441{
442 VBOXDISPIFESCAPE EscapeHdr;
443 VBOXWDDM_GETVBOXVIDEOCMCMD_HDR Hdr;
444} VBOXDISPIFESCAPE_GETVBOXVIDEOCMCMD, *PVBOXDISPIFESCAPE_GETVBOXVIDEOCMCMD;
445
446AssertCompile((sizeof (VBOXDISPIFESCAPE_GETVBOXVIDEOCMCMD) & 7) == 0);
447AssertCompile(RT_OFFSETOF(VBOXDISPIFESCAPE_GETVBOXVIDEOCMCMD, EscapeHdr) == 0);
448
449typedef struct VBOXDISPIFESCAPE_DBGPRINT
450{
451 VBOXDISPIFESCAPE EscapeHdr;
452 /* null-terminated string to DbgPrint including \0 */
453 char aStringBuf[1];
454} VBOXDISPIFESCAPE_DBGPRINT, *PVBOXDISPIFESCAPE_DBGPRINT;
455AssertCompile(RT_OFFSETOF(VBOXDISPIFESCAPE_DBGPRINT, EscapeHdr) == 0);
456
457typedef enum
458{
459 VBOXDISPIFESCAPE_DBGDUMPBUF_TYPE_UNDEFINED = 0,
460 VBOXDISPIFESCAPE_DBGDUMPBUF_TYPE_D3DCAPS9 = 1,
461 VBOXDISPIFESCAPE_DBGDUMPBUF_TYPE_DUMMY32BIT = 0x7fffffff
462} VBOXDISPIFESCAPE_DBGDUMPBUF_TYPE;
463
464typedef struct VBOXDISPIFESCAPE_DBGDUMPBUF_FLAGS
465{
466 union
467 {
468 struct
469 {
470 UINT WoW64 : 1;
471 UINT Reserved : 31; /* reserved */
472 };
473 UINT Value;
474 };
475} VBOXDISPIFESCAPE_DBGDUMPBUF_FLAGS, *PVBOXDISPIFESCAPE_DBGDUMPBUF_FLAGS;
476
477typedef struct VBOXDISPIFESCAPE_DBGDUMPBUF
478{
479 VBOXDISPIFESCAPE EscapeHdr;
480 VBOXDISPIFESCAPE_DBGDUMPBUF_TYPE enmType;
481 VBOXDISPIFESCAPE_DBGDUMPBUF_FLAGS Flags;
482 char aBuf[1];
483} VBOXDISPIFESCAPE_DBGDUMPBUF, *PVBOXDISPIFESCAPE_DBGDUMPBUF;
484AssertCompile(RT_OFFSETOF(VBOXDISPIFESCAPE_DBGDUMPBUF, EscapeHdr) == 0);
485
486typedef struct VBOXVIDEOCM_UM_ALLOC
487{
488 VBOXDISP_KMHANDLE hAlloc;
489 uint32_t cbData;
490 uint64_t pvData;
491 uint64_t hSynch;
492 VBOXUHGSMI_BUFFER_TYPE_FLAGS fUhgsmiType;
493} VBOXVIDEOCM_UM_ALLOC, *PVBOXVIDEOCM_UM_ALLOC;
494
495typedef struct VBOXDISPIFESCAPE_SETALLOCHOSTID
496{
497 VBOXDISPIFESCAPE EscapeHdr;
498 int32_t rc;
499 uint32_t hostID;
500 uint64_t hAlloc;
501
502} VBOXDISPIFESCAPE_SETALLOCHOSTID, *PVBOXDISPIFESCAPE_SETALLOCHOSTID;
503
504#ifdef VBOX_WITH_VMSVGA
505
506#define VBOXWDDM_F_GA_CONTEXT_EXTENDED 0x00000001
507#define VBOXWDDM_F_GA_CONTEXT_VGPU10 0x00000002
508
509#define VBOXESC_GAGETCID 0xA0000002
510#define VBOXESC_GAREGION 0xA0000003
511#define VBOXESC_GAPRESENT 0xA0000004
512#define VBOXESC_GASURFACEDEFINE 0xA0000005
513#define VBOXESC_GASURFACEDESTROY 0xA0000006
514#define VBOXESC_GASHAREDSID 0xA0000008
515#define VBOXESC_GAFENCECREATE 0xA0000020
516#define VBOXESC_GAFENCEQUERY 0xA0000021
517#define VBOXESC_GAFENCEWAIT 0xA0000022
518#define VBOXESC_GAFENCEUNREF 0xA0000023
519#define VBOXESC_SVGAGBSURFACEDEFINE 0xA0010001
520#define VBOXESC_SVGAGETSID 0xA0010002
521
522/* Get Gallium context id (cid) of the WDDM context. */
523typedef struct VBOXDISPIFESCAPE_GAGETCID
524{
525 VBOXDISPIFESCAPE EscapeHdr;
526 uint32_t u32Cid;
527} VBOXDISPIFESCAPE_GAGETCID;
528
529/* Create or delete a Guest Memory Region (GMR). */
530#define GA_REGION_CMD_CREATE 0
531#define GA_REGION_CMD_DESTROY 1
532typedef struct VBOXDISPIFESCAPE_GAREGION
533{
534 VBOXDISPIFESCAPE EscapeHdr;
535 uint32_t u32Command;
536 uint32_t u32GmrId;
537 uint32_t u32NumPages;
538 uint32_t u32Reserved;
539 uint64_t u64UserAddress;
540} VBOXDISPIFESCAPE_GAREGION;
541
542/* Debug helper. Present the specified surface by copying to the guest screen VRAM. */
543typedef struct VBOXDISPIFESCAPE_GAPRESENT
544{
545 VBOXDISPIFESCAPE EscapeHdr;
546 uint32_t u32Sid;
547 uint32_t u32Width;
548 uint32_t u32Height;
549} VBOXDISPIFESCAPE_GAPRESENT;
550
551/* Create a host surface. */
552typedef struct VBOXDISPIFESCAPE_GASURFACEDEFINE
553{
554 VBOXDISPIFESCAPE EscapeHdr;
555 uint32_t u32Sid; /* Returned surface id. */
556 uint32_t cbReq; /* Size of data after cSizes field. */
557 uint32_t cSizes; /* Number of GASURFSIZE structures. */
558 /* GASURFCREATE */
559 /* GASURFSIZE[cSizes] */
560} VBOXDISPIFESCAPE_GASURFACEDEFINE;
561
562#if defined(VBOXWDDMDISP) || defined(VBOX_WDDM_MINIPORT) || defined(VBOXGL)
563/* Create a GB host surface. */
564typedef struct VBOXDISPIFESCAPE_SVGAGBSURFACEDEFINE
565{
566 VBOXDISPIFESCAPE EscapeHdr;
567 SVGAGBSURFCREATE CreateParms;
568} VBOXDISPIFESCAPE_SVGAGBSURFACEDEFINE;
569
570/* Get SVGA surface id (sid) of the allocation. */
571typedef struct VBOXDISPIFESCAPE_SVGAGETSID
572{
573 VBOXDISPIFESCAPE EscapeHdr;
574 uint64_t hAllocation;
575 uint32_t u32Sid;
576} VBOXDISPIFESCAPE_SVGAGETSID;
577#endif /* defined(VBOXWDDMDISP) || defined(VBOX_WDDM_MINIPORT) || defined(VBOXGL) */
578
579/* Delete a host surface. */
580typedef struct VBOXDISPIFESCAPE_GASURFACEDESTROY
581{
582 VBOXDISPIFESCAPE EscapeHdr;
583 uint32_t u32Sid;
584} VBOXDISPIFESCAPE_GASURFACEDESTROY;
585
586/* Inform the miniport that 'u32Sid' actually maps to 'u32SharedSid'.
587 * If 'u32SharedSid' is ~0, then remove the mapping.
588 */
589typedef struct VBOXDISPIFESCAPE_GASHAREDSID
590{
591 VBOXDISPIFESCAPE EscapeHdr;
592 uint32_t u32Sid;
593 uint32_t u32SharedSid;
594} VBOXDISPIFESCAPE_GASHAREDSID;
595
596/* Create a user mode fence object. */
597typedef struct VBOXDISPIFESCAPE_GAFENCECREATE
598{
599 VBOXDISPIFESCAPE EscapeHdr;
600
601 /* IN: The miniport's handle of the fence.
602 * Assigned by the miniport. Not DXGK fence id!
603 */
604 uint32_t u32FenceHandle;
605} VBOXDISPIFESCAPE_GAFENCECREATE;
606
607/* Query a user mode fence object state. */
608#define GA_FENCE_STATUS_NULL 0 /* Fence not found */
609#define GA_FENCE_STATUS_IDLE 1
610#define GA_FENCE_STATUS_SUBMITTED 2
611#define GA_FENCE_STATUS_SIGNALED 3
612typedef struct VBOXDISPIFESCAPE_GAFENCEQUERY
613{
614 VBOXDISPIFESCAPE EscapeHdr;
615
616 /* IN: The miniport's handle of the fence.
617 * Assigned by the miniport. Not DXGK fence id!
618 */
619 uint32_t u32FenceHandle;
620
621 /* OUT: The miniport's sequence number associated with the command buffer.
622 */
623 uint32_t u32SubmittedSeqNo;
624
625 /* OUT: The miniport's sequence number associated with the last command buffer completed on host.
626 */
627 uint32_t u32ProcessedSeqNo;
628
629 /* OUT: GA_FENCE_STATUS_*. */
630 uint32_t u32FenceStatus;
631} VBOXDISPIFESCAPE_GAFENCEQUERY;
632
633/* Wait on a user mode fence object. */
634typedef struct VBOXDISPIFESCAPE_GAFENCEWAIT
635{
636 VBOXDISPIFESCAPE EscapeHdr;
637
638 /* IN: The miniport's handle of the fence.
639 * Assigned by the miniport. Not DXGK fence id!
640 */
641 uint32_t u32FenceHandle;
642
643 /* IN: Timeout in microseconds.
644 */
645 uint32_t u32TimeoutUS;
646} VBOXDISPIFESCAPE_GAFENCEWAIT;
647
648/* Delete a user mode fence object. */
649typedef struct VBOXDISPIFESCAPE_GAFENCEUNREF
650{
651 VBOXDISPIFESCAPE EscapeHdr;
652
653 /* IN: The miniport's handle of the fence.
654 * Assigned by the miniport. Not DXGK fence id!
655 */
656 uint32_t u32FenceHandle;
657} VBOXDISPIFESCAPE_GAFENCEUNREF;
658
659#include <VBoxGaHWInfo.h>
660#endif
661
662#define VBOXWDDM_QAI_CAP_3D 0x00000001 /* 3D is enabled in the VM settings. */
663#define VBOXWDDM_QAI_CAP_DXVA 0x00000002 /* DXVA is not disabled in the guest registry. */
664#define VBOXWDDM_QAI_CAP_DXVAHD 0x00000004 /* DXVA-HD is not disabled in the guest registry. */
665#define VBOXWDDM_QAI_CAP_WIN7 0x00000008 /* User mode driver can report D3D_UMD_INTERFACE_VERSION_WIN7. */
666
667/* D3DDDICB_QUERYADAPTERINFO::pPrivateDriverData */
668typedef struct VBOXWDDM_QAI
669{
670 uint32_t u32Version; /* VBOXVIDEOIF_VERSION */
671 uint32_t u32Reserved; /* Must be 0. */
672 VBOXVIDEO_HWTYPE enmHwType; /* Hardware type. Determines what kind of data is returned. */
673 uint32_t u32AdapterCaps; /* VBOXWDDM_QAI_CAP_* */
674 uint32_t cInfos; /* Number of initialized elements in aInfos (equal to number of guest
675 * displays). 0 if VBOX_WITH_VIDEOHWACCEL is not defined. */
676 VBOXVHWA_INFO aInfos[VBOX_VIDEO_MAX_SCREENS]; /* cInfos elements are initialized. */
677 union
678 {
679 struct
680 {
681 /* VBOXVIDEO_HWTYPE_VBOX */
682 uint32_t u32VBox3DCaps; /* CR_VBOX_CAP_* */
683 } vbox;
684#if defined(VBOX_WITH_VMSVGA)
685 struct
686 {
687 /* VBOXVIDEO_HWTYPE_VMSVGA */
688 VBOXGAHWINFO HWInfo;
689 } vmsvga;
690#endif
691 } u;
692} VBOXWDDM_QAI;
693
694/** Convert a given FourCC code to a D3DDDIFORMAT enum. */
695#define VBOXWDDM_D3DDDIFORMAT_FROM_FOURCC(_a, _b, _c, _d) \
696 ((D3DDDIFORMAT)MAKEFOURCC(_a, _b, _c, _d))
697
698/* submit cmd func */
699DECLINLINE(D3DDDIFORMAT) vboxWddmFmtNoAlphaFormat(D3DDDIFORMAT enmFormat)
700{
701 switch (enmFormat)
702 {
703 case D3DDDIFMT_A8R8G8B8:
704 return D3DDDIFMT_X8R8G8B8;
705 case D3DDDIFMT_A1R5G5B5:
706 return D3DDDIFMT_X1R5G5B5;
707 case D3DDDIFMT_A4R4G4B4:
708 return D3DDDIFMT_X4R4G4B4;
709 case D3DDDIFMT_A8B8G8R8:
710 return D3DDDIFMT_X8B8G8R8;
711 default:
712 return enmFormat;
713 }
714}
715
716/* tooling */
717DECLINLINE(UINT) vboxWddmCalcBitsPerPixel(D3DDDIFORMAT enmFormat)
718{
719#ifdef _MSC_VER
720# pragma warning(push)
721# pragma warning(disable:4063) /* VBOXWDDM_D3DDDIFORMAT_FROM_FOURCC('Y', 'V', '1', '2'): isn't part of the enum */
722#endif
723 switch (enmFormat)
724 {
725 case D3DDDIFMT_R8G8B8:
726 return 24;
727 case D3DDDIFMT_A8R8G8B8:
728 case D3DDDIFMT_X8R8G8B8:
729 return 32;
730 case D3DDDIFMT_R5G6B5:
731 case D3DDDIFMT_X1R5G5B5:
732 case D3DDDIFMT_A1R5G5B5:
733 case D3DDDIFMT_A4R4G4B4:
734 return 16;
735 case D3DDDIFMT_R3G3B2:
736 case D3DDDIFMT_A8:
737 return 8;
738 case D3DDDIFMT_A8R3G3B2:
739 case D3DDDIFMT_X4R4G4B4:
740 return 16;
741 case D3DDDIFMT_A2B10G10R10:
742 case D3DDDIFMT_A8B8G8R8:
743 case D3DDDIFMT_X8B8G8R8:
744 case D3DDDIFMT_G16R16:
745 case D3DDDIFMT_A2R10G10B10:
746 return 32;
747 case D3DDDIFMT_A16B16G16R16:
748 case D3DDDIFMT_A16B16G16R16F:
749 return 64;
750 case D3DDDIFMT_A32B32G32R32F:
751 return 128;
752 case D3DDDIFMT_A8P8:
753 return 16;
754 case D3DDDIFMT_P8:
755 case D3DDDIFMT_L8:
756 return 8;
757 case D3DDDIFMT_L16:
758 case D3DDDIFMT_A8L8:
759 return 16;
760 case D3DDDIFMT_A4L4:
761 return 8;
762 case D3DDDIFMT_V8U8:
763 case D3DDDIFMT_L6V5U5:
764 return 16;
765 case D3DDDIFMT_X8L8V8U8:
766 case D3DDDIFMT_Q8W8V8U8:
767 case D3DDDIFMT_V16U16:
768 case D3DDDIFMT_W11V11U10:
769 case D3DDDIFMT_A2W10V10U10:
770 return 32;
771 case D3DDDIFMT_D16_LOCKABLE:
772 case D3DDDIFMT_D16:
773 case D3DDDIFMT_D15S1:
774 return 16;
775 case D3DDDIFMT_D32:
776 case D3DDDIFMT_D24S8:
777 case D3DDDIFMT_D24X8:
778 case D3DDDIFMT_D24X4S4:
779 case D3DDDIFMT_D24FS8:
780 case D3DDDIFMT_D32_LOCKABLE:
781 case D3DDDIFMT_D32F_LOCKABLE:
782 return 32;
783 case D3DDDIFMT_S8_LOCKABLE:
784 return 8;
785 case D3DDDIFMT_DXT1:
786 return 4;
787 case D3DDDIFMT_DXT2:
788 case D3DDDIFMT_DXT3:
789 case D3DDDIFMT_DXT4:
790 case D3DDDIFMT_DXT5:
791 case D3DDDIFMT_VERTEXDATA:
792 case D3DDDIFMT_INDEX16: /* <- yes, dx runtime treats it as such */
793 return 8;
794 case D3DDDIFMT_INDEX32:
795 return 8;
796 case D3DDDIFMT_R32F:
797 return 32;
798 case D3DDDIFMT_G32R32F:
799 return 64;
800 case D3DDDIFMT_R16F:
801 return 16;
802 case D3DDDIFMT_G16R16F:
803 return 32;
804 case D3DDDIFMT_YUY2: /* 4 bytes per 2 pixels. */
805 case VBOXWDDM_D3DDDIFORMAT_FROM_FOURCC('Y', 'V', '1', '2'):
806 return 16;
807 default:
808 AssertBreakpoint();
809 return 0;
810 }
811#ifdef _MSC_VER
812# pragma warning(pop)
813#endif
814}
815
816DECLINLINE(uint32_t) vboxWddmFormatToFourcc(D3DDDIFORMAT enmFormat)
817{
818 uint32_t uFormat = (uint32_t)enmFormat;
819 /* assume that in case both four bytes are non-zero, this is a fourcc */
820 if ((uFormat & 0xff000000)
821 && (uFormat & 0x00ff0000)
822 && (uFormat & 0x0000ff00)
823 && (uFormat & 0x000000ff)
824 )
825 return uFormat;
826 return 0;
827}
828
829#define VBOXWDDM_ROUNDBOUND(_v, _b) (((_v) + ((_b) - 1)) & ~((_b) - 1))
830
831DECLINLINE(UINT) vboxWddmCalcOffXru(UINT w, D3DDDIFORMAT enmFormat)
832{
833 switch (enmFormat)
834 {
835 /* pitch for the DXT* (aka compressed) formats is the size in bytes of blocks that fill in an image width
836 * i.e. each block decompressed into 4 x 4 pixels, so we have ((Width + 3) / 4) blocks for Width.
837 * then each block has 64 bits (8 bytes) for DXT1 and 64+64 bits (16 bytes) for DXT2-DXT5, so.. : */
838 case D3DDDIFMT_DXT1:
839 {
840 UINT Pitch = (w + 3) / 4; /* <- pitch size in blocks */
841 Pitch *= 8; /* <- pitch size in bytes */
842 return Pitch;
843 }
844 case D3DDDIFMT_DXT2:
845 case D3DDDIFMT_DXT3:
846 case D3DDDIFMT_DXT4:
847 case D3DDDIFMT_DXT5:
848 {
849 UINT Pitch = (w + 3) / 4; /* <- pitch size in blocks */
850 Pitch *= 16; /* <- pitch size in bytes */
851 return Pitch;
852 }
853 default:
854 {
855 /* the default is just to calculate the pitch from bpp */
856 UINT bpp = vboxWddmCalcBitsPerPixel(enmFormat);
857 UINT Pitch = bpp * w;
858 /* pitch is now in bits, translate in bytes */
859 return VBOXWDDM_ROUNDBOUND(Pitch, 8) >> 3;
860 }
861 }
862}
863
864DECLINLINE(UINT) vboxWddmCalcOffXrd(UINT w, D3DDDIFORMAT enmFormat)
865{
866 switch (enmFormat)
867 {
868 /* pitch for the DXT* (aka compressed) formats is the size in bytes of blocks that fill in an image width
869 * i.e. each block decompressed into 4 x 4 pixels, so we have ((Width + 3) / 4) blocks for Width.
870 * then each block has 64 bits (8 bytes) for DXT1 and 64+64 bits (16 bytes) for DXT2-DXT5, so.. : */
871 case D3DDDIFMT_DXT1:
872 {
873 UINT Pitch = w / 4; /* <- pitch size in blocks */
874 Pitch *= 8; /* <- pitch size in bytes */
875 return Pitch;
876 }
877 case D3DDDIFMT_DXT2:
878 case D3DDDIFMT_DXT3:
879 case D3DDDIFMT_DXT4:
880 case D3DDDIFMT_DXT5:
881 {
882 UINT Pitch = w / 4; /* <- pitch size in blocks */
883 Pitch *= 16; /* <- pitch size in bytes */
884 return Pitch;
885 }
886 default:
887 {
888 /* the default is just to calculate the pitch from bpp */
889 UINT bpp = vboxWddmCalcBitsPerPixel(enmFormat);
890 UINT Pitch = bpp * w;
891 /* pitch is now in bits, translate in bytes */
892 return Pitch >> 3;
893 }
894 }
895}
896
897DECLINLINE(UINT) vboxWddmCalcHightPacking(D3DDDIFORMAT enmFormat)
898{
899 switch (enmFormat)
900 {
901 /* for the DXT* (aka compressed) formats each block is decompressed into 4 x 4 pixels,
902 * so packing is 4
903 */
904 case D3DDDIFMT_DXT1:
905 case D3DDDIFMT_DXT2:
906 case D3DDDIFMT_DXT3:
907 case D3DDDIFMT_DXT4:
908 case D3DDDIFMT_DXT5:
909 return 4;
910 default:
911 return 1;
912 }
913}
914
915DECLINLINE(UINT) vboxWddmCalcOffYru(UINT height, D3DDDIFORMAT enmFormat)
916{
917 UINT packing = vboxWddmCalcHightPacking(enmFormat);
918 /* round it up */
919 return (height + packing - 1) / packing;
920}
921
922DECLINLINE(UINT) vboxWddmCalcOffYrd(UINT height, D3DDDIFORMAT enmFormat)
923{
924 UINT packing = vboxWddmCalcHightPacking(enmFormat);
925 /* round it up */
926 return height / packing;
927}
928
929DECLINLINE(UINT) vboxWddmCalcPitch(UINT w, D3DDDIFORMAT enmFormat)
930{
931 return vboxWddmCalcOffXru(w, enmFormat);
932}
933
934DECLINLINE(UINT) vboxWddmCalcWidthForPitch(UINT Pitch, D3DDDIFORMAT enmFormat)
935{
936 switch (enmFormat)
937 {
938 /* pitch for the DXT* (aka compressed) formats is the size in bytes of blocks that fill in an image width
939 * i.e. each block decompressed into 4 x 4 pixels, so we have ((Width + 3) / 4) blocks for Width.
940 * then each block has 64 bits (8 bytes) for DXT1 and 64+64 bits (16 bytes) for DXT2-DXT5, so.. : */
941 case D3DDDIFMT_DXT1:
942 {
943 return (Pitch / 8) * 4;
944 }
945 case D3DDDIFMT_DXT2:
946 case D3DDDIFMT_DXT3:
947 case D3DDDIFMT_DXT4:
948 case D3DDDIFMT_DXT5:
949 {
950 return (Pitch / 16) * 4;;
951 }
952 default:
953 {
954 /* the default is just to calculate it from bpp */
955 UINT bpp = vboxWddmCalcBitsPerPixel(enmFormat);
956 return (Pitch << 3) / bpp;
957 }
958 }
959}
960
961DECLINLINE(UINT) vboxWddmCalcNumRows(UINT top, UINT bottom, D3DDDIFORMAT enmFormat)
962{
963 Assert(bottom > top);
964 top = top ? vboxWddmCalcOffYrd(top, enmFormat) : 0; /* <- just to optimize it a bit */
965 bottom = vboxWddmCalcOffYru(bottom, enmFormat);
966 return bottom - top;
967}
968
969DECLINLINE(UINT) vboxWddmCalcRowSize(UINT left, UINT right, D3DDDIFORMAT enmFormat)
970{
971 Assert(right > left);
972 left = left ? vboxWddmCalcOffXrd(left, enmFormat) : 0; /* <- just to optimize it a bit */
973 right = vboxWddmCalcOffXru(right, enmFormat);
974 return right - left;
975}
976
977DECLINLINE(UINT) vboxWddmCalcSize(UINT pitch, UINT height, D3DDDIFORMAT enmFormat)
978{
979 UINT cRows = vboxWddmCalcNumRows(0, height, enmFormat);
980 return pitch * cRows;
981}
982
983DECLINLINE(UINT) vboxWddmCalcOffXYrd(UINT x, UINT y, UINT pitch, D3DDDIFORMAT enmFormat)
984{
985 UINT offY = 0;
986 if (y)
987 offY = vboxWddmCalcSize(pitch, y, enmFormat);
988
989 return offY + vboxWddmCalcOffXrd(x, enmFormat);
990}
991
992#if defined(VBOX_WITH_VMSVGA3D_DX)
993#include <dxgiformat.h>
994DECLINLINE(UINT) vboxWddmCalcBitsPerPixelDXGI(DXGI_FORMAT enmFormat)
995{
996 switch (enmFormat)
997 {
998 case DXGI_FORMAT_UNKNOWN:
999 return 8;
1000 case DXGI_FORMAT_R32G32B32A32_TYPELESS:
1001 case DXGI_FORMAT_R32G32B32A32_FLOAT:
1002 case DXGI_FORMAT_R32G32B32A32_UINT:
1003 case DXGI_FORMAT_R32G32B32A32_SINT:
1004 return 128;
1005 case DXGI_FORMAT_R32G32B32_TYPELESS:
1006 case DXGI_FORMAT_R32G32B32_FLOAT:
1007 case DXGI_FORMAT_R32G32B32_UINT:
1008 case DXGI_FORMAT_R32G32B32_SINT:
1009 return 96;
1010 case DXGI_FORMAT_R16G16B16A16_TYPELESS:
1011 case DXGI_FORMAT_R16G16B16A16_FLOAT:
1012 case DXGI_FORMAT_R16G16B16A16_UNORM:
1013 case DXGI_FORMAT_R16G16B16A16_UINT:
1014 case DXGI_FORMAT_R16G16B16A16_SNORM:
1015 case DXGI_FORMAT_R16G16B16A16_SINT:
1016 case DXGI_FORMAT_R32G32_TYPELESS:
1017 case DXGI_FORMAT_R32G32_FLOAT:
1018 case DXGI_FORMAT_R32G32_UINT:
1019 case DXGI_FORMAT_R32G32_SINT:
1020 return 64;
1021 case DXGI_FORMAT_R32G8X24_TYPELESS:
1022 case DXGI_FORMAT_D32_FLOAT_S8X24_UINT:
1023 case DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS:
1024 case DXGI_FORMAT_X32_TYPELESS_G8X24_UINT:
1025 return 64;
1026 case DXGI_FORMAT_R10G10B10A2_TYPELESS:
1027 case DXGI_FORMAT_R10G10B10A2_UNORM:
1028 case DXGI_FORMAT_R10G10B10A2_UINT:
1029 return 32;
1030 case DXGI_FORMAT_R11G11B10_FLOAT:
1031 return 32;
1032 case DXGI_FORMAT_R8G8B8A8_TYPELESS:
1033 case DXGI_FORMAT_R8G8B8A8_UNORM:
1034 case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB:
1035 case DXGI_FORMAT_R8G8B8A8_UINT:
1036 case DXGI_FORMAT_R8G8B8A8_SNORM:
1037 case DXGI_FORMAT_R8G8B8A8_SINT:
1038 return 32;
1039 case DXGI_FORMAT_R16G16_TYPELESS:
1040 case DXGI_FORMAT_R16G16_FLOAT:
1041 case DXGI_FORMAT_R16G16_UNORM:
1042 case DXGI_FORMAT_R16G16_UINT:
1043 case DXGI_FORMAT_R16G16_SNORM:
1044 case DXGI_FORMAT_R16G16_SINT:
1045 return 32;
1046 case DXGI_FORMAT_R32_TYPELESS:
1047 case DXGI_FORMAT_D32_FLOAT:
1048 case DXGI_FORMAT_R32_FLOAT:
1049 case DXGI_FORMAT_R32_UINT:
1050 case DXGI_FORMAT_R32_SINT:
1051 case DXGI_FORMAT_R24G8_TYPELESS:
1052 case DXGI_FORMAT_D24_UNORM_S8_UINT:
1053 case DXGI_FORMAT_R24_UNORM_X8_TYPELESS:
1054 case DXGI_FORMAT_X24_TYPELESS_G8_UINT:
1055 return 32;
1056 case DXGI_FORMAT_R8G8_TYPELESS:
1057 case DXGI_FORMAT_R8G8_UNORM:
1058 case DXGI_FORMAT_R8G8_UINT:
1059 case DXGI_FORMAT_R8G8_SNORM:
1060 case DXGI_FORMAT_R8G8_SINT:
1061 case DXGI_FORMAT_R16_TYPELESS:
1062 case DXGI_FORMAT_R16_FLOAT:
1063 case DXGI_FORMAT_D16_UNORM:
1064 case DXGI_FORMAT_R16_UNORM:
1065 case DXGI_FORMAT_R16_UINT:
1066 case DXGI_FORMAT_R16_SNORM:
1067 case DXGI_FORMAT_R16_SINT:
1068 return 16;
1069 case DXGI_FORMAT_R8_TYPELESS:
1070 case DXGI_FORMAT_R8_UNORM:
1071 case DXGI_FORMAT_R8_UINT:
1072 case DXGI_FORMAT_R8_SNORM:
1073 case DXGI_FORMAT_R8_SINT:
1074 case DXGI_FORMAT_A8_UNORM:
1075 return 8;
1076 case DXGI_FORMAT_R1_UNORM:
1077 return 1;
1078 case DXGI_FORMAT_R9G9B9E5_SHAREDEXP:
1079 case DXGI_FORMAT_R8G8_B8G8_UNORM:
1080 case DXGI_FORMAT_G8R8_G8B8_UNORM:
1081 return 32;
1082 case DXGI_FORMAT_BC1_TYPELESS:
1083 case DXGI_FORMAT_BC1_UNORM:
1084 case DXGI_FORMAT_BC1_UNORM_SRGB:
1085 return 4;
1086 case DXGI_FORMAT_BC2_TYPELESS:
1087 case DXGI_FORMAT_BC2_UNORM:
1088 case DXGI_FORMAT_BC2_UNORM_SRGB:
1089 case DXGI_FORMAT_BC3_TYPELESS:
1090 case DXGI_FORMAT_BC3_UNORM:
1091 case DXGI_FORMAT_BC3_UNORM_SRGB:
1092 return 8;
1093 case DXGI_FORMAT_BC4_TYPELESS:
1094 case DXGI_FORMAT_BC4_UNORM:
1095 case DXGI_FORMAT_BC4_SNORM:
1096 return 4;
1097 case DXGI_FORMAT_BC5_TYPELESS:
1098 case DXGI_FORMAT_BC5_UNORM:
1099 case DXGI_FORMAT_BC5_SNORM:
1100 return 8;
1101 case DXGI_FORMAT_B5G6R5_UNORM:
1102 case DXGI_FORMAT_B5G5R5A1_UNORM:
1103 return 16;
1104 case DXGI_FORMAT_B8G8R8A8_UNORM:
1105 case DXGI_FORMAT_B8G8R8X8_UNORM:
1106 case DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM:
1107 case DXGI_FORMAT_B8G8R8A8_TYPELESS:
1108 case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB:
1109 case DXGI_FORMAT_B8G8R8X8_TYPELESS:
1110 case DXGI_FORMAT_B8G8R8X8_UNORM_SRGB:
1111 return 32;
1112 case DXGI_FORMAT_BC6H_TYPELESS:
1113 case DXGI_FORMAT_BC6H_UF16:
1114 case DXGI_FORMAT_BC6H_SF16:
1115 case DXGI_FORMAT_BC7_TYPELESS:
1116 case DXGI_FORMAT_BC7_UNORM:
1117 case DXGI_FORMAT_BC7_UNORM_SRGB:
1118 return 8;
1119 case DXGI_FORMAT_AYUV:
1120 case DXGI_FORMAT_Y410:
1121 return 32;
1122 case DXGI_FORMAT_Y416:
1123 return 64;
1124 case DXGI_FORMAT_NV12:
1125 return 12;
1126 case DXGI_FORMAT_P010:
1127 case DXGI_FORMAT_P016:
1128 return 24;
1129 case DXGI_FORMAT_420_OPAQUE:
1130 return 12;
1131 case DXGI_FORMAT_YUY2:
1132 return 32;
1133 case DXGI_FORMAT_Y210:
1134 case DXGI_FORMAT_Y216:
1135 return 64;
1136 case DXGI_FORMAT_NV11:
1137 return 12;
1138 case DXGI_FORMAT_AI44:
1139 case DXGI_FORMAT_IA44:
1140 case DXGI_FORMAT_P8:
1141 return 8;
1142 case DXGI_FORMAT_A8P8:
1143 case DXGI_FORMAT_B4G4R4A4_UNORM:
1144 case DXGI_FORMAT_P208:
1145 case DXGI_FORMAT_V208:
1146 return 16;
1147 case DXGI_FORMAT_V408:
1148 return 24;
1149 default:
1150 AssertBreakpoint();
1151 return 0;
1152 }
1153}
1154#endif /* VBOX_WITH_VMSVGA3D_DX */
1155
1156#define VBOXWDDM_ARRAY_MAXELEMENTSU32(_t) ((uint32_t)((UINT32_MAX) / sizeof (_t)))
1157#define VBOXWDDM_TRAILARRAY_MAXELEMENTSU32(_t, _af) ((uint32_t)(((~(0UL)) - (uint32_t)RT_OFFSETOF(_t, _af[0])) / RT_SIZEOFMEMB(_t, _af[0])))
1158
1159#endif /* !GA_INCLUDED_SRC_WINNT_Graphics_Video_common_wddm_VBoxMPIf_h */
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