VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoIf.h@ 29922

Last change on this file since 29922 was 29895, checked in by vboxsync, 15 years ago

wddm/2d: overlay creation

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.5 KB
Line 
1/** @file
2 * Contains base definitions of constants & structures used
3 * to control & perform rendering,
4 * such as DMA commands types, allocation types, escape codes, etc.
5 * used by both miniport & display drivers.
6 *
7 * The latter uses these and only these defs to communicate with the former
8 * by posting appropriate requests via D3D RT Krnl Svc accessing callbacks.
9 */
10/*
11 * Copyright (C) 2010 Oracle Corporation
12 *
13 * This file is part of VirtualBox Open Source Edition (OSE), as
14 * available from http://www.virtualbox.org. This file is free software;
15 * you can redistribute it and/or modify it under the terms of the GNU
16 * General Public License (GPL) as published by the Free Software
17 * Foundation, in version 2 as it comes in the "COPYING" file of the
18 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
19 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
20 */
21#ifndef ___VBoxVideoIf_h___
22#define ___VBoxVideoIf_h___
23
24#include <VBox/VBoxVideo.h>
25
26/* @todo: implement a check to ensure display & miniport versions match.
27 * One would increase this whenever definitions in this file are changed */
28#define VBOXVIDEOIF_VERSION 2
29
30/* create allocation func */
31typedef enum
32{
33 VBOXWDDM_ALLOC_TYPE_UNEFINED = 0,
34 VBOXWDDM_ALLOC_TYPE_STD_SHAREDPRIMARYSURFACE,
35 VBOXWDDM_ALLOC_TYPE_STD_SHADOWSURFACE,
36 VBOXWDDM_ALLOC_TYPE_STD_STAGINGSURFACE,
37 /* this one is win 7-specific and hence unused for now */
38 VBOXWDDM_ALLOC_TYPE_STD_GDISURFACE
39 /* custom allocation types requested from user-mode d3d module will go here */
40 , VBOXWDDM_ALLOC_TYPE_UMD_RC_GENERIC
41} VBOXWDDM_ALLOC_TYPE;
42
43typedef struct VBOXWDDM_SURFACE_DESC
44{
45 UINT width;
46 UINT height;
47 D3DDDIFORMAT format;
48 UINT bpp;
49 UINT pitch;
50 UINT depth;
51 UINT slicePitch;
52 UINT cbSize;
53 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId;
54 D3DDDI_RATIONAL RefreshRate;
55} VBOXWDDM_SURFACE_DESC, *PVBOXWDDM_SURFACE_DESC;
56
57typedef struct VBOXWDDM_ALLOCINFO
58{
59 VBOXWDDM_ALLOC_TYPE enmType;
60 VBOXWDDM_SURFACE_DESC SurfDesc;
61} VBOXWDDM_ALLOCINFO, *PVBOXWDDM_ALLOCINFO;
62
63//#define VBOXWDDM_ALLOCINFO_HEADSIZE() (sizeof (VBOXWDDM_ALLOCINFO))
64//#define VBOXWDDM_ALLOCINFO_SIZE_FROMBODYSIZE(_s) (VBOXWDDM_ALLOCINFO_HEADSIZE() + (_s))
65//#define VBOXWDDM_ALLOCINFO_SIZE(_tCmd) (VBOXWDDM_ALLOCINFO_SIZE_FROMBODYSIZE(sizeof(_tCmd)))
66//#define VBOXWDDM_ALLOCINFO_BODY(_p, _t) ( (_t*)(((uint8_t*)(_p)) + VBOXWDDM_ALLOCINFO_HEADSIZE()) )
67//#define VBOXWDDM_ALLOCINFO_HEAD(_pb) ((VBOXWDDM_ALLOCINFO*)((uint8_t *)(_pb) - VBOXWDDM_ALLOCATION_HEADSIZE()))
68
69/* this resource is OpenResource'd rather than CreateResource'd */
70#define VBOXWDDM_RESOURCE_F_OPENNED 0x00000001
71/* identifies this is a resource created with CreateResource, the VBOXWDDMDISP_RESOURCE::fRcFlags is valid */
72#define VBOXWDDM_RESOURCE_F_TYPE_GENERIC 0x00000002
73
74typedef struct VBOXWDDM_RC_DESC
75{
76 D3DDDI_RESOURCEFLAGS fFlags;
77 D3DDDIFORMAT enmFormat;
78 D3DDDI_POOL enmPool;
79 D3DDDIMULTISAMPLE_TYPE enmMultisampleType;
80 UINT MultisampleQuality;
81 UINT MipLevels;
82 UINT Fvf;
83 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId;
84 D3DDDI_RATIONAL RefreshRate;
85 D3DDDI_ROTATION enmRotation;
86} VBOXWDDM_RC_DESC, *PVBOXWDDM_RC_DESC;
87
88typedef struct VBOXWDDM_RCINFO
89{
90 uint32_t fFlags;
91 VBOXWDDM_RC_DESC RcDesc;
92 uint32_t cAllocInfos;
93// VBOXWDDM_ALLOCINFO aAllocInfos[1];
94} VBOXWDDM_RCINFO, *PVBOXWDDM_RCINFO;
95
96#define VBOXVHWA_F_ENABLED 0x00000001
97#define VBOXVHWA_F_CKEY_DST 0x00000002
98#define VBOXVHWA_F_CKEY_SRC 0x00000004
99
100#define VBOXVHWA_MAX_FORMATS 8
101
102typedef struct VBOXVHWA_INFO
103{
104 uint32_t fFlags;
105 uint32_t cOverlaysSupported;
106 uint32_t cFormats;
107 D3DDDIFORMAT aFormats[VBOXVHWA_MAX_FORMATS];
108} VBOXVHWA_INFO;
109
110/* query info func */
111typedef struct VBOXWDDM_QI
112{
113 uint32_t u32Version;
114 uint32_t cInfos;
115 VBOXVHWA_INFO aInfos[VBOX_VIDEO_MAX_SCREENS];
116} VBOXWDDM_QI;
117
118/* submit cmd func */
119
120
121
122
123/* tooling */
124DECLINLINE(UINT) vboxWddmCalcBitsPerPixel(D3DDDIFORMAT format)
125{
126 switch (format)
127 {
128 case D3DDDIFMT_R8G8B8:
129 return 24;
130 case D3DDDIFMT_A8R8G8B8:
131 case D3DDDIFMT_X8R8G8B8:
132 return 32;
133 case D3DDDIFMT_R5G6B5:
134 case D3DDDIFMT_X1R5G5B5:
135 case D3DDDIFMT_A1R5G5B5:
136 case D3DDDIFMT_A4R4G4B4:
137 return 16;
138 case D3DDDIFMT_R3G3B2:
139 case D3DDDIFMT_A8:
140 return 8;
141 case D3DDDIFMT_A8R3G3B2:
142 case D3DDDIFMT_X4R4G4B4:
143 return 16;
144 case D3DDDIFMT_A2B10G10R10:
145 case D3DDDIFMT_A8B8G8R8:
146 case D3DDDIFMT_X8B8G8R8:
147 case D3DDDIFMT_G16R16:
148 case D3DDDIFMT_A2R10G10B10:
149 return 32;
150 case D3DDDIFMT_A16B16G16R16:
151 return 64;
152 case D3DDDIFMT_A8P8:
153 return 16;
154 case D3DDDIFMT_P8:
155 return 8;
156 default:
157 AssertBreakpoint();
158 return 0;
159 }
160}
161
162DECLINLINE(uint32_t) vboxWddmFormatToFourcc(D3DDDIFORMAT format)
163{
164 uint32_t uFormat = (uint32_t)format;
165 /* assume that in case both four bytes are non-zero, this is a fourcc */
166 if ((format & 0xff000000)
167 && (format & 0x00ff0000)
168 && (format & 0x0000ff00)
169 && (format & 0x000000ff)
170 )
171 return uFormat;
172 return 0;
173}
174
175#define VBOXWDDM_ROUNDBOUND(_v, _b) (((_v) + ((_b) - 1)) & ~((_b) - 1))
176
177DECLINLINE(UINT) vboxWddmCalcPitch(UINT w, UINT bitsPerPixel)
178{
179 UINT Pitch = bitsPerPixel * w;
180 /* pitch is now in bits, translate in bytes */
181 return VBOXWDDM_ROUNDBOUND(Pitch, 8) >> 3;
182}
183
184#endif /* #ifndef ___VBoxVideoIf_h___ */
Note: See TracBrowser for help on using the repository browser.

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