1 | /* $Id: VBoxMPVidPn.cpp 37189 2011-05-23 20:50:29Z vboxsync $ */
|
---|
2 |
|
---|
3 | /** @file
|
---|
4 | * VBox WDDM Miniport driver
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2011 Oracle Corporation
|
---|
9 | *
|
---|
10 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
11 | * available from http://www.virtualbox.org. This file is free software;
|
---|
12 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
13 | * General Public License (GPL) as published by the Free Software
|
---|
14 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
15 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
16 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
17 | */
|
---|
18 |
|
---|
19 | #include "VBoxMPWddm.h"
|
---|
20 | #include "VBoxMPVidPn.h"
|
---|
21 | #include "common/VBoxMPCommon.h"
|
---|
22 |
|
---|
23 | static D3DDDIFORMAT vboxWddmCalcPixelFormat(const VIDEO_MODE_INFORMATION *pInfo)
|
---|
24 | {
|
---|
25 | switch (pInfo->BitsPerPlane)
|
---|
26 | {
|
---|
27 | case 32:
|
---|
28 | if(!(pInfo->AttributeFlags & VIDEO_MODE_PALETTE_DRIVEN) && !(pInfo->AttributeFlags & VIDEO_MODE_MANAGED_PALETTE))
|
---|
29 | {
|
---|
30 | if (pInfo->RedMask == 0xFF0000 && pInfo->GreenMask == 0xFF00 && pInfo->BlueMask == 0xFF)
|
---|
31 | return D3DDDIFMT_A8R8G8B8;
|
---|
32 | WARN(("unsupported format: bpp(%d), rmask(%d), gmask(%d), bmask(%d)",
|
---|
33 | pInfo->BitsPerPlane, pInfo->RedMask, pInfo->GreenMask, pInfo->BlueMask));
|
---|
34 | AssertBreakpoint();
|
---|
35 | }
|
---|
36 | else
|
---|
37 | {
|
---|
38 | WARN(("unsupported AttributeFlags(0x%x)", pInfo->AttributeFlags));
|
---|
39 | AssertBreakpoint();
|
---|
40 | }
|
---|
41 | break;
|
---|
42 | case 24:
|
---|
43 | if(!(pInfo->AttributeFlags & VIDEO_MODE_PALETTE_DRIVEN) && !(pInfo->AttributeFlags & VIDEO_MODE_MANAGED_PALETTE))
|
---|
44 | {
|
---|
45 | if (pInfo->RedMask == 0xFF0000 && pInfo->GreenMask == 0xFF00 && pInfo->BlueMask == 0xFF)
|
---|
46 | return D3DDDIFMT_R8G8B8;
|
---|
47 | WARN(("unsupported format: bpp(%d), rmask(%d), gmask(%d), bmask(%d)",
|
---|
48 | pInfo->BitsPerPlane, pInfo->RedMask, pInfo->GreenMask, pInfo->BlueMask));
|
---|
49 | AssertBreakpoint();
|
---|
50 | }
|
---|
51 | else
|
---|
52 | {
|
---|
53 | WARN(("unsupported AttributeFlags(0x%x)", pInfo->AttributeFlags));
|
---|
54 | AssertBreakpoint();
|
---|
55 | }
|
---|
56 | break;
|
---|
57 | case 16:
|
---|
58 | if(!(pInfo->AttributeFlags & VIDEO_MODE_PALETTE_DRIVEN) && !(pInfo->AttributeFlags & VIDEO_MODE_MANAGED_PALETTE))
|
---|
59 | {
|
---|
60 | if (pInfo->RedMask == 0xF800 && pInfo->GreenMask == 0x7E0 && pInfo->BlueMask == 0x1F)
|
---|
61 | return D3DDDIFMT_R5G6B5;
|
---|
62 | WARN(("unsupported format: bpp(%d), rmask(%d), gmask(%d), bmask(%d)",
|
---|
63 | pInfo->BitsPerPlane, pInfo->RedMask, pInfo->GreenMask, pInfo->BlueMask));
|
---|
64 | AssertBreakpoint();
|
---|
65 | }
|
---|
66 | else
|
---|
67 | {
|
---|
68 | WARN(("unsupported AttributeFlags(0x%x)", pInfo->AttributeFlags));
|
---|
69 | AssertBreakpoint();
|
---|
70 | }
|
---|
71 | break;
|
---|
72 | case 8:
|
---|
73 | if((pInfo->AttributeFlags & VIDEO_MODE_PALETTE_DRIVEN) && (pInfo->AttributeFlags & VIDEO_MODE_MANAGED_PALETTE))
|
---|
74 | {
|
---|
75 | return D3DDDIFMT_P8;
|
---|
76 | }
|
---|
77 | else
|
---|
78 | {
|
---|
79 | WARN(("unsupported AttributeFlags(0x%x)", pInfo->AttributeFlags));
|
---|
80 | AssertBreakpoint();
|
---|
81 | }
|
---|
82 | break;
|
---|
83 | default:
|
---|
84 | WARN(("unsupported bpp(%d)", pInfo->BitsPerPlane));
|
---|
85 | AssertBreakpoint();
|
---|
86 | break;
|
---|
87 | }
|
---|
88 |
|
---|
89 | return D3DDDIFMT_UNKNOWN;
|
---|
90 | }
|
---|
91 |
|
---|
92 | static int vboxWddmResolutionFind(const D3DKMDT_2DREGION *pResolutions, int cResolutions, const D3DKMDT_2DREGION *pRes)
|
---|
93 | {
|
---|
94 | for (int i = 0; i < cResolutions; ++i)
|
---|
95 | {
|
---|
96 | const D3DKMDT_2DREGION *pResolution = &pResolutions[i];
|
---|
97 | if (pResolution->cx == pRes->cx && pResolution->cy == pRes->cy)
|
---|
98 | return i;
|
---|
99 | }
|
---|
100 | return -1;
|
---|
101 | }
|
---|
102 |
|
---|
103 | static bool vboxWddmVideoModesMatch(const VIDEO_MODE_INFORMATION *pMode1, const VIDEO_MODE_INFORMATION *pMode2)
|
---|
104 | {
|
---|
105 | return pMode1->VisScreenHeight == pMode2->VisScreenHeight
|
---|
106 | && pMode1->VisScreenWidth == pMode2->VisScreenWidth
|
---|
107 | && pMode1->BitsPerPlane == pMode2->BitsPerPlane;
|
---|
108 | }
|
---|
109 |
|
---|
110 | static int vboxWddmVideoModeFind(const VIDEO_MODE_INFORMATION *pModes, int cModes, const VIDEO_MODE_INFORMATION *pM)
|
---|
111 | {
|
---|
112 | for (int i = 0; i < cModes; ++i)
|
---|
113 | {
|
---|
114 | const VIDEO_MODE_INFORMATION *pMode = &pModes[i];
|
---|
115 | if (vboxWddmVideoModesMatch(pMode, pM))
|
---|
116 | return i;
|
---|
117 | }
|
---|
118 | return -1;
|
---|
119 | }
|
---|
120 |
|
---|
121 |
|
---|
122 | NTSTATUS vboxVidPnCheckTopology(PVBOXMP_DEVEXT pDevExt, const D3DKMDT_HVIDPN hDesiredVidPn,
|
---|
123 | D3DKMDT_HVIDPNTOPOLOGY hVidPnTopology, const DXGK_VIDPNTOPOLOGY_INTERFACE* pVidPnTopologyInterface,
|
---|
124 | BOOLEAN *pbSupported)
|
---|
125 | {
|
---|
126 | const D3DKMDT_VIDPN_PRESENT_PATH *pNewVidPnPresentPathInfo = NULL;
|
---|
127 | NTSTATUS Status = pVidPnTopologyInterface->pfnAcquireFirstPathInfo(hVidPnTopology, &pNewVidPnPresentPathInfo);
|
---|
128 | BOOLEAN bSupported = TRUE;
|
---|
129 |
|
---|
130 | if (Status == STATUS_SUCCESS)
|
---|
131 | {
|
---|
132 | BOOLEAN bFoundPrimary = FALSE;
|
---|
133 |
|
---|
134 | while (1)
|
---|
135 | {
|
---|
136 | if (pNewVidPnPresentPathInfo->VidPnSourceId != pNewVidPnPresentPathInfo->VidPnTargetId)
|
---|
137 | {
|
---|
138 | LOG(("unsupported source(%d)->target(%d) pair", pNewVidPnPresentPathInfo->VidPnSourceId, pNewVidPnPresentPathInfo->VidPnTargetId));
|
---|
139 | bSupported = FALSE;
|
---|
140 | break;
|
---|
141 | }
|
---|
142 |
|
---|
143 | if (pNewVidPnPresentPathInfo->VidPnSourceId == 0)
|
---|
144 | {
|
---|
145 | bFoundPrimary = TRUE;
|
---|
146 | }
|
---|
147 |
|
---|
148 | /*
|
---|
149 | ImportanceOrdinal does not matter for now
|
---|
150 | pNewVidPnPresentPathInfo->ImportanceOrdinal
|
---|
151 | */
|
---|
152 |
|
---|
153 | if (pNewVidPnPresentPathInfo->ContentTransformation.Scaling != D3DKMDT_VPPS_UNPINNED
|
---|
154 | && pNewVidPnPresentPathInfo->ContentTransformation.Scaling != D3DKMDT_VPPS_IDENTITY
|
---|
155 | && pNewVidPnPresentPathInfo->ContentTransformation.Scaling != D3DKMDT_VPPS_CENTERED
|
---|
156 | && pNewVidPnPresentPathInfo->ContentTransformation.Scaling != D3DKMDT_VPPS_NOTSPECIFIED)
|
---|
157 | {
|
---|
158 | LOG(("unsupported Scaling (%d)", pNewVidPnPresentPathInfo->ContentTransformation.Scaling));
|
---|
159 | AssertBreakpoint();
|
---|
160 | bSupported = FALSE;
|
---|
161 | break;
|
---|
162 | }
|
---|
163 |
|
---|
164 | if (pNewVidPnPresentPathInfo->ContentTransformation.ScalingSupport.Stretched)
|
---|
165 | {
|
---|
166 | LOG(("unsupported Scaling support (Stretched)"));
|
---|
167 | AssertBreakpoint();
|
---|
168 | bSupported = FALSE;
|
---|
169 | break;
|
---|
170 | }
|
---|
171 |
|
---|
172 | if (!pNewVidPnPresentPathInfo->ContentTransformation.ScalingSupport.Identity
|
---|
173 | && !pNewVidPnPresentPathInfo->ContentTransformation.ScalingSupport.Centered)
|
---|
174 | {
|
---|
175 | LOG(("\"Identity\" or \"Centered\" Scaling support not set"));
|
---|
176 | AssertBreakpoint();
|
---|
177 | bSupported = FALSE;
|
---|
178 | break;
|
---|
179 | }
|
---|
180 |
|
---|
181 | if (pNewVidPnPresentPathInfo->ContentTransformation.Rotation != D3DKMDT_VPPR_UNPINNED
|
---|
182 | && pNewVidPnPresentPathInfo->ContentTransformation.Rotation != D3DKMDT_VPPR_IDENTITY)
|
---|
183 | {
|
---|
184 | LOG(("unsupported rotation (%d)", pNewVidPnPresentPathInfo->ContentTransformation.Rotation));
|
---|
185 | AssertBreakpoint();
|
---|
186 | bSupported = FALSE;
|
---|
187 | break;
|
---|
188 | }
|
---|
189 |
|
---|
190 | if (pNewVidPnPresentPathInfo->ContentTransformation.RotationSupport.Rotate180
|
---|
191 | || pNewVidPnPresentPathInfo->ContentTransformation.RotationSupport.Rotate270
|
---|
192 | || pNewVidPnPresentPathInfo->ContentTransformation.RotationSupport.Rotate90)
|
---|
193 | {
|
---|
194 | LOG(("unsupported RotationSupport"));
|
---|
195 | AssertBreakpoint();
|
---|
196 | bSupported = FALSE;
|
---|
197 | break;
|
---|
198 | }
|
---|
199 |
|
---|
200 | if (!pNewVidPnPresentPathInfo->ContentTransformation.RotationSupport.Identity)
|
---|
201 | {
|
---|
202 | LOG(("\"Identity\" RotationSupport not set"));
|
---|
203 | AssertBreakpoint();
|
---|
204 | bSupported = FALSE;
|
---|
205 | break;
|
---|
206 | }
|
---|
207 |
|
---|
208 | if (pNewVidPnPresentPathInfo->VisibleFromActiveTLOffset.cx
|
---|
209 | || pNewVidPnPresentPathInfo->VisibleFromActiveTLOffset.cy)
|
---|
210 | {
|
---|
211 | LOG(("Non-zero TLOffset: cx(%d), cy(%d)",
|
---|
212 | pNewVidPnPresentPathInfo->VisibleFromActiveTLOffset.cx,
|
---|
213 | pNewVidPnPresentPathInfo->VisibleFromActiveTLOffset.cy));
|
---|
214 | AssertBreakpoint();
|
---|
215 | bSupported = FALSE;
|
---|
216 | break;
|
---|
217 | }
|
---|
218 |
|
---|
219 | if (pNewVidPnPresentPathInfo->VisibleFromActiveBROffset.cx
|
---|
220 | || pNewVidPnPresentPathInfo->VisibleFromActiveBROffset.cy)
|
---|
221 | {
|
---|
222 | LOG(("Non-zero TLOffset: cx(%d), cy(%d)",
|
---|
223 | pNewVidPnPresentPathInfo->VisibleFromActiveBROffset.cx,
|
---|
224 | pNewVidPnPresentPathInfo->VisibleFromActiveBROffset.cy));
|
---|
225 | AssertBreakpoint();
|
---|
226 | bSupported = FALSE;
|
---|
227 | break;
|
---|
228 | }
|
---|
229 |
|
---|
230 | if (pNewVidPnPresentPathInfo->VidPnTargetColorBasis != D3DKMDT_CB_SRGB
|
---|
231 | && pNewVidPnPresentPathInfo->VidPnTargetColorBasis != D3DKMDT_CB_UNINITIALIZED)
|
---|
232 | {
|
---|
233 | LOG(("unsupported VidPnTargetColorBasis (%d)", pNewVidPnPresentPathInfo->VidPnTargetColorBasis));
|
---|
234 | AssertBreakpoint();
|
---|
235 | bSupported = FALSE;
|
---|
236 | break;
|
---|
237 | }
|
---|
238 |
|
---|
239 | /* channels?
|
---|
240 | pNewVidPnPresentPathInfo->VidPnTargetColorCoeffDynamicRanges.FirstChannel;
|
---|
241 | pNewVidPnPresentPathInfo->VidPnTargetColorCoeffDynamicRanges.SecondChannel;
|
---|
242 | pNewVidPnPresentPathInfo->VidPnTargetColorCoeffDynamicRanges.ThirdChannel;
|
---|
243 | we definitely not support fourth channel
|
---|
244 | */
|
---|
245 | if (pNewVidPnPresentPathInfo->VidPnTargetColorCoeffDynamicRanges.FourthChannel)
|
---|
246 | {
|
---|
247 | LOG(("Non-zero FourthChannel (%d)", pNewVidPnPresentPathInfo->VidPnTargetColorCoeffDynamicRanges.FourthChannel));
|
---|
248 | AssertBreakpoint();
|
---|
249 | bSupported = FALSE;
|
---|
250 | break;
|
---|
251 | }
|
---|
252 |
|
---|
253 | /* Content (D3DKMDT_VPPC_GRAPHICS, _NOTSPECIFIED, _VIDEO), does not matter for now
|
---|
254 | pNewVidPnPresentPathInfo->Content
|
---|
255 | */
|
---|
256 | /* not support copy protection for now */
|
---|
257 | if (pNewVidPnPresentPathInfo->CopyProtection.CopyProtectionType != D3DKMDT_VPPMT_NOPROTECTION
|
---|
258 | && pNewVidPnPresentPathInfo->CopyProtection.CopyProtectionType != D3DKMDT_VPPMT_UNINITIALIZED)
|
---|
259 | {
|
---|
260 | LOG(("Copy protection not supported CopyProtectionType(%d)", pNewVidPnPresentPathInfo->CopyProtection.CopyProtectionType));
|
---|
261 | AssertBreakpoint();
|
---|
262 | bSupported = FALSE;
|
---|
263 | break;
|
---|
264 | }
|
---|
265 |
|
---|
266 | if (pNewVidPnPresentPathInfo->CopyProtection.APSTriggerBits)
|
---|
267 | {
|
---|
268 | LOG(("Copy protection not supported APSTriggerBits(%d)", pNewVidPnPresentPathInfo->CopyProtection.APSTriggerBits));
|
---|
269 | AssertBreakpoint();
|
---|
270 | bSupported = FALSE;
|
---|
271 | break;
|
---|
272 | }
|
---|
273 |
|
---|
274 | D3DKMDT_VIDPN_PRESENT_PATH_COPYPROTECTION_SUPPORT tstCPSupport = {0};
|
---|
275 | tstCPSupport.NoProtection = 1;
|
---|
276 | if (memcmp(&tstCPSupport, &pNewVidPnPresentPathInfo->CopyProtection.CopyProtectionSupport, sizeof(tstCPSupport)))
|
---|
277 | {
|
---|
278 | LOG(("Copy protection support (0x%x)", *((UINT*)&pNewVidPnPresentPathInfo->CopyProtection.CopyProtectionSupport)));
|
---|
279 | AssertBreakpoint();
|
---|
280 | bSupported = FALSE;
|
---|
281 | break;
|
---|
282 | }
|
---|
283 |
|
---|
284 | if (pNewVidPnPresentPathInfo->GammaRamp.Type != D3DDDI_GAMMARAMP_DEFAULT
|
---|
285 | && pNewVidPnPresentPathInfo->GammaRamp.Type != D3DDDI_GAMMARAMP_UNINITIALIZED)
|
---|
286 | {
|
---|
287 | LOG(("Unsupported GammaRamp.Type (%d)", pNewVidPnPresentPathInfo->GammaRamp.Type));
|
---|
288 | AssertBreakpoint();
|
---|
289 | bSupported = FALSE;
|
---|
290 | break;
|
---|
291 | }
|
---|
292 |
|
---|
293 | if (pNewVidPnPresentPathInfo->GammaRamp.DataSize != 0)
|
---|
294 | {
|
---|
295 | LOG(("Warning: non-zero GammaRamp.DataSize (%d), treating as supported", pNewVidPnPresentPathInfo->GammaRamp.DataSize));
|
---|
296 | }
|
---|
297 |
|
---|
298 | const D3DKMDT_VIDPN_PRESENT_PATH *pNextVidPnPresentPathInfo;
|
---|
299 |
|
---|
300 | Status = pVidPnTopologyInterface->pfnAcquireNextPathInfo(hVidPnTopology, pNewVidPnPresentPathInfo, &pNextVidPnPresentPathInfo);
|
---|
301 | pVidPnTopologyInterface->pfnReleasePathInfo(hVidPnTopology, pNewVidPnPresentPathInfo);
|
---|
302 | if (Status == STATUS_SUCCESS)
|
---|
303 | {
|
---|
304 | pNewVidPnPresentPathInfo = pNextVidPnPresentPathInfo;
|
---|
305 | }
|
---|
306 | else if (Status == STATUS_GRAPHICS_NO_MORE_ELEMENTS_IN_DATASET)
|
---|
307 | {
|
---|
308 | Status = STATUS_SUCCESS;
|
---|
309 | pNewVidPnPresentPathInfo = NULL;
|
---|
310 | break;
|
---|
311 | }
|
---|
312 | else
|
---|
313 | {
|
---|
314 | AssertBreakpoint();
|
---|
315 | LOG(("pfnAcquireNextPathInfo Failed Status(0x%x)", Status));
|
---|
316 | pNewVidPnPresentPathInfo = NULL;
|
---|
317 | break;
|
---|
318 | }
|
---|
319 | }
|
---|
320 |
|
---|
321 | bSupported &= bFoundPrimary;
|
---|
322 |
|
---|
323 | if (pNewVidPnPresentPathInfo)
|
---|
324 | pVidPnTopologyInterface->pfnReleasePathInfo(hVidPnTopology, pNewVidPnPresentPathInfo);
|
---|
325 |
|
---|
326 | }
|
---|
327 | else if (Status == STATUS_GRAPHICS_DATASET_IS_EMPTY)
|
---|
328 | Status = STATUS_SUCCESS;
|
---|
329 | else
|
---|
330 | LOGREL(("pfnAcquireFirstPathInfo failed Status(0x%x)", Status));
|
---|
331 |
|
---|
332 | *pbSupported = bSupported;
|
---|
333 |
|
---|
334 | return Status;
|
---|
335 | }
|
---|
336 |
|
---|
337 | NTSTATUS vboxVidPnCheckSourceModeInfo(const D3DKMDT_HVIDPN hDesiredVidPn,
|
---|
338 | const D3DKMDT_VIDPN_SOURCE_MODE *pNewVidPnSourceModeInfo,
|
---|
339 | BOOLEAN *pbSupported)
|
---|
340 | {
|
---|
341 | BOOLEAN bSupported = TRUE;
|
---|
342 | /* we support both GRAPHICS and TEXT modes */
|
---|
343 | switch (pNewVidPnSourceModeInfo->Type)
|
---|
344 | {
|
---|
345 | case D3DKMDT_RMT_GRAPHICS:
|
---|
346 | /* any primary surface size actually
|
---|
347 | pNewVidPnSourceModeInfo->Format.Graphics.PrimSurfSize.cx
|
---|
348 | pNewVidPnSourceModeInfo->Format.Graphics.PrimSurfSize.cy
|
---|
349 | */
|
---|
350 | if (pNewVidPnSourceModeInfo->Format.Graphics.VisibleRegionSize.cx != pNewVidPnSourceModeInfo->Format.Graphics.PrimSurfSize.cx
|
---|
351 | || pNewVidPnSourceModeInfo->Format.Graphics.VisibleRegionSize.cy != pNewVidPnSourceModeInfo->Format.Graphics.PrimSurfSize.cy)
|
---|
352 | {
|
---|
353 | LOG(("VisibleRegionSize(%d, %d) != PrimSurfSize(%d, %d)",
|
---|
354 | pNewVidPnSourceModeInfo->Format.Graphics.VisibleRegionSize.cx,
|
---|
355 | pNewVidPnSourceModeInfo->Format.Graphics.VisibleRegionSize.cy,
|
---|
356 | pNewVidPnSourceModeInfo->Format.Graphics.PrimSurfSize.cx,
|
---|
357 | pNewVidPnSourceModeInfo->Format.Graphics.PrimSurfSize.cy));
|
---|
358 | AssertBreakpoint();
|
---|
359 | bSupported = FALSE;
|
---|
360 | break;
|
---|
361 | }
|
---|
362 |
|
---|
363 | /*
|
---|
364 | pNewVidPnSourceModeInfo->Format.Graphics.Stride
|
---|
365 | pNewVidPnSourceModeInfo->Format.Graphics.PixelFormat
|
---|
366 | pNewVidPnSourceModeInfo->Format.Graphics.ColorBasis
|
---|
367 | pNewVidPnSourceModeInfo->Format.Graphics.PixelValueAccessMode
|
---|
368 | */
|
---|
369 |
|
---|
370 | break;
|
---|
371 | case D3DKMDT_RMT_TEXT:
|
---|
372 | break;
|
---|
373 | default:
|
---|
374 | AssertBreakpoint();
|
---|
375 | LOG(("Warning: Unknown Src mode Type (%d)", pNewVidPnSourceModeInfo->Type));
|
---|
376 | break;
|
---|
377 | }
|
---|
378 |
|
---|
379 | *pbSupported = bSupported;
|
---|
380 | return STATUS_SUCCESS;
|
---|
381 | }
|
---|
382 |
|
---|
383 | NTSTATUS vboxVidPnCheckSourceModeSet(const D3DKMDT_HVIDPN hDesiredVidPn,
|
---|
384 | D3DKMDT_HVIDPNSOURCEMODESET hNewVidPnSourceModeSet, const DXGK_VIDPNSOURCEMODESET_INTERFACE *pVidPnSourceModeSetInterface,
|
---|
385 | BOOLEAN *pbSupported)
|
---|
386 | {
|
---|
387 | const D3DKMDT_VIDPN_SOURCE_MODE *pNewVidPnSourceModeInfo;
|
---|
388 | NTSTATUS Status = pVidPnSourceModeSetInterface->pfnAcquireFirstModeInfo(hNewVidPnSourceModeSet, &pNewVidPnSourceModeInfo);
|
---|
389 | BOOLEAN bSupported = TRUE;
|
---|
390 | if (Status == STATUS_SUCCESS)
|
---|
391 | {
|
---|
392 | while (1)
|
---|
393 | {
|
---|
394 | Status = vboxVidPnCheckSourceModeInfo(hDesiredVidPn, pNewVidPnSourceModeInfo, &bSupported);
|
---|
395 | if (Status == STATUS_SUCCESS && bSupported)
|
---|
396 | {
|
---|
397 | const D3DKMDT_VIDPN_SOURCE_MODE *pNextVidPnSourceModeInfo;
|
---|
398 | Status = pVidPnSourceModeSetInterface->pfnAcquireNextModeInfo(hNewVidPnSourceModeSet, pNewVidPnSourceModeInfo, &pNextVidPnSourceModeInfo);
|
---|
399 | pVidPnSourceModeSetInterface->pfnReleaseModeInfo(hNewVidPnSourceModeSet, pNewVidPnSourceModeInfo);
|
---|
400 | if (Status == STATUS_SUCCESS)
|
---|
401 | {
|
---|
402 | pNewVidPnSourceModeInfo = pNextVidPnSourceModeInfo;
|
---|
403 | }
|
---|
404 | else if (Status == STATUS_GRAPHICS_NO_MORE_ELEMENTS_IN_DATASET)
|
---|
405 | {
|
---|
406 | Status = STATUS_SUCCESS;
|
---|
407 | break;
|
---|
408 | }
|
---|
409 | else
|
---|
410 | {
|
---|
411 | LOGREL(("pfnAcquireNextModeInfo Failed Status(0x%x)", Status));
|
---|
412 | break;
|
---|
413 | }
|
---|
414 | }
|
---|
415 | else
|
---|
416 | {
|
---|
417 | pVidPnSourceModeSetInterface->pfnReleaseModeInfo(hNewVidPnSourceModeSet, pNewVidPnSourceModeInfo);
|
---|
418 | break;
|
---|
419 | }
|
---|
420 | }
|
---|
421 | }
|
---|
422 | else if (Status == STATUS_GRAPHICS_DATASET_IS_EMPTY)
|
---|
423 | Status = STATUS_SUCCESS;
|
---|
424 | else
|
---|
425 | LOGREL(("VBoxVideoWddm: pfnAcquireFirstModeInfo failed Status(0x%x)", Status));
|
---|
426 |
|
---|
427 | *pbSupported = bSupported;
|
---|
428 | return Status;
|
---|
429 | }
|
---|
430 |
|
---|
431 | NTSTATUS vboxVidPnPopulateVideoSignalInfo(D3DKMDT_VIDEO_SIGNAL_INFO *pVsi,
|
---|
432 | D3DKMDT_2DREGION *pResolution,
|
---|
433 | ULONG VSync)
|
---|
434 | {
|
---|
435 | NTSTATUS Status = STATUS_SUCCESS;
|
---|
436 |
|
---|
437 | pVsi->VideoStandard = D3DKMDT_VSS_VESA_DMT;
|
---|
438 | pVsi->ActiveSize = *pResolution;
|
---|
439 | pVsi->VSyncFreq.Numerator = VSync * 1000;
|
---|
440 | pVsi->VSyncFreq.Denominator = 1000;
|
---|
441 | pVsi->TotalSize.cx = pVsi->ActiveSize.cx + VBOXVDPN_C_DISPLAY_HBLANK_SIZE;
|
---|
442 | pVsi->TotalSize.cy = pVsi->ActiveSize.cy + VBOXVDPN_C_DISPLAY_VBLANK_SIZE;
|
---|
443 | pVsi->PixelRate = pVsi->TotalSize.cx * pVsi->TotalSize.cy * VSync;
|
---|
444 | pVsi->HSyncFreq.Numerator = (UINT)((pVsi->PixelRate / pVsi->TotalSize.cy) * 1000);
|
---|
445 | pVsi->HSyncFreq.Denominator = 1000;
|
---|
446 | pVsi->ScanLineOrdering = D3DDDI_VSSLO_PROGRESSIVE;
|
---|
447 |
|
---|
448 | return Status;
|
---|
449 | }
|
---|
450 |
|
---|
451 | BOOLEAN vboxVidPnMatchVideoSignal(const D3DKMDT_VIDEO_SIGNAL_INFO *pVsi1, const D3DKMDT_VIDEO_SIGNAL_INFO *pVsi2)
|
---|
452 | {
|
---|
453 | if (pVsi1->VideoStandard != pVsi2->VideoStandard)
|
---|
454 | return FALSE;
|
---|
455 | if (pVsi1->TotalSize.cx != pVsi2->TotalSize.cx)
|
---|
456 | return FALSE;
|
---|
457 | if (pVsi1->TotalSize.cy != pVsi2->TotalSize.cy)
|
---|
458 | return FALSE;
|
---|
459 | if (pVsi1->ActiveSize.cx != pVsi2->ActiveSize.cx)
|
---|
460 | return FALSE;
|
---|
461 | if (pVsi1->ActiveSize.cy != pVsi2->ActiveSize.cy)
|
---|
462 | return FALSE;
|
---|
463 | if (pVsi1->VSyncFreq.Numerator != pVsi2->VSyncFreq.Numerator)
|
---|
464 | return FALSE;
|
---|
465 | if (pVsi1->VSyncFreq.Denominator != pVsi2->VSyncFreq.Denominator)
|
---|
466 | return FALSE;
|
---|
467 | if (pVsi1->HSyncFreq.Numerator != pVsi2->HSyncFreq.Numerator)
|
---|
468 | return FALSE;
|
---|
469 | if (pVsi1->HSyncFreq.Denominator != pVsi2->HSyncFreq.Denominator)
|
---|
470 | return FALSE;
|
---|
471 | if (pVsi1->PixelRate != pVsi2->PixelRate)
|
---|
472 | return FALSE;
|
---|
473 | if (pVsi1->ScanLineOrdering != pVsi2->ScanLineOrdering)
|
---|
474 | return FALSE;
|
---|
475 |
|
---|
476 | return TRUE;
|
---|
477 | }
|
---|
478 |
|
---|
479 | NTSTATUS vboxVidPnCheckTargetModeInfo(const D3DKMDT_HVIDPN hDesiredVidPn,
|
---|
480 | const D3DKMDT_VIDPN_TARGET_MODE *pNewVidPnTargetModeInfo,
|
---|
481 | BOOLEAN *pbSupported)
|
---|
482 | {
|
---|
483 | BOOLEAN bSupported = TRUE;
|
---|
484 | D3DKMDT_VIDEO_SIGNAL_INFO CmpVsi;
|
---|
485 | D3DKMDT_2DREGION CmpRes;
|
---|
486 | CmpRes.cx = pNewVidPnTargetModeInfo->VideoSignalInfo.ActiveSize.cx;
|
---|
487 | CmpRes.cy = pNewVidPnTargetModeInfo->VideoSignalInfo.ActiveSize.cy;
|
---|
488 | NTSTATUS Status = vboxVidPnPopulateVideoSignalInfo(&CmpVsi,
|
---|
489 | &CmpRes,
|
---|
490 | pNewVidPnTargetModeInfo->VideoSignalInfo.VSyncFreq.Numerator/pNewVidPnTargetModeInfo->VideoSignalInfo.VSyncFreq.Denominator);
|
---|
491 | Assert(Status == STATUS_SUCCESS);
|
---|
492 | if (Status != STATUS_SUCCESS)
|
---|
493 | {
|
---|
494 | LOGREL(("vboxVidPnPopulateVideoSignalInfo error Status (0x%x)", Status));
|
---|
495 | return Status;
|
---|
496 | }
|
---|
497 |
|
---|
498 | if (!vboxVidPnMatchVideoSignal(&CmpVsi, &pNewVidPnTargetModeInfo->VideoSignalInfo))
|
---|
499 | {
|
---|
500 | WARN(("VideoSignalInfos do not match!!!"));
|
---|
501 | AssertBreakpoint();
|
---|
502 | bSupported = FALSE;
|
---|
503 | }
|
---|
504 |
|
---|
505 | *pbSupported = bSupported;
|
---|
506 | return STATUS_SUCCESS;
|
---|
507 | }
|
---|
508 |
|
---|
509 | NTSTATUS vboxVidPnCheckTargetModeSet(const D3DKMDT_HVIDPN hDesiredVidPn,
|
---|
510 | D3DKMDT_HVIDPNTARGETMODESET hNewVidPnTargetModeSet, const DXGK_VIDPNTARGETMODESET_INTERFACE *pVidPnTargetModeSetInterface,
|
---|
511 | BOOLEAN *pbSupported)
|
---|
512 | {
|
---|
513 | const D3DKMDT_VIDPN_TARGET_MODE *pNewVidPnTargetModeInfo;
|
---|
514 | NTSTATUS Status = pVidPnTargetModeSetInterface->pfnAcquireFirstModeInfo(hNewVidPnTargetModeSet, &pNewVidPnTargetModeInfo);
|
---|
515 | BOOLEAN bSupported = TRUE;
|
---|
516 | if (Status == STATUS_SUCCESS)
|
---|
517 | {
|
---|
518 | Assert(pNewVidPnTargetModeInfo);
|
---|
519 | while (1)
|
---|
520 | {
|
---|
521 | Status = vboxVidPnCheckTargetModeInfo(hDesiredVidPn, pNewVidPnTargetModeInfo, &bSupported);
|
---|
522 | if (Status == STATUS_SUCCESS && bSupported)
|
---|
523 | {
|
---|
524 | const D3DKMDT_VIDPN_TARGET_MODE *pNextVidPnTargetModeInfo;
|
---|
525 | Status = pVidPnTargetModeSetInterface->pfnAcquireNextModeInfo(hNewVidPnTargetModeSet, pNewVidPnTargetModeInfo, &pNextVidPnTargetModeInfo);
|
---|
526 | pVidPnTargetModeSetInterface->pfnReleaseModeInfo(hNewVidPnTargetModeSet, pNewVidPnTargetModeInfo);
|
---|
527 | if (Status == STATUS_SUCCESS)
|
---|
528 | {
|
---|
529 | pNewVidPnTargetModeInfo = pNextVidPnTargetModeInfo;
|
---|
530 | }
|
---|
531 | else if (Status == STATUS_GRAPHICS_NO_MORE_ELEMENTS_IN_DATASET)
|
---|
532 | {
|
---|
533 | Status = STATUS_SUCCESS;
|
---|
534 | break;
|
---|
535 | }
|
---|
536 | else
|
---|
537 | {
|
---|
538 | LOGREL(("pfnAcquireNextModeInfo Failed Status(0x%x)", Status));
|
---|
539 | break;
|
---|
540 | }
|
---|
541 | }
|
---|
542 | else
|
---|
543 | {
|
---|
544 | pVidPnTargetModeSetInterface->pfnReleaseModeInfo(hNewVidPnTargetModeSet, pNewVidPnTargetModeInfo);
|
---|
545 | break;
|
---|
546 | }
|
---|
547 | }
|
---|
548 | }
|
---|
549 | else if (Status == STATUS_GRAPHICS_DATASET_IS_EMPTY)
|
---|
550 | Status = STATUS_SUCCESS;
|
---|
551 | else
|
---|
552 | LOGREL(("pfnAcquireFirstModeInfo failed Status(0x%x)", Status));
|
---|
553 |
|
---|
554 | *pbSupported = bSupported;
|
---|
555 | return Status;
|
---|
556 | }
|
---|
557 |
|
---|
558 | NTSTATUS vboxVidPnPopulateSourceModeInfoFromLegacy(D3DKMDT_VIDPN_SOURCE_MODE *pNewVidPnSourceModeInfo,
|
---|
559 | VIDEO_MODE_INFORMATION *pMode)
|
---|
560 | {
|
---|
561 | NTSTATUS Status = STATUS_SUCCESS;
|
---|
562 | if (pMode->AttributeFlags & VIDEO_MODE_GRAPHICS)
|
---|
563 | {
|
---|
564 | /* this is a graphics mode */
|
---|
565 | pNewVidPnSourceModeInfo->Type = D3DKMDT_RMT_GRAPHICS;
|
---|
566 | pNewVidPnSourceModeInfo->Format.Graphics.PrimSurfSize.cx = pMode->VisScreenWidth;
|
---|
567 | pNewVidPnSourceModeInfo->Format.Graphics.PrimSurfSize.cy = pMode->VisScreenHeight;
|
---|
568 | pNewVidPnSourceModeInfo->Format.Graphics.VisibleRegionSize = pNewVidPnSourceModeInfo->Format.Graphics.PrimSurfSize;
|
---|
569 | pNewVidPnSourceModeInfo->Format.Graphics.Stride = pMode->ScreenStride;
|
---|
570 | pNewVidPnSourceModeInfo->Format.Graphics.PixelFormat = vboxWddmCalcPixelFormat(pMode);
|
---|
571 | Assert(pNewVidPnSourceModeInfo->Format.Graphics.PixelFormat != D3DDDIFMT_UNKNOWN);
|
---|
572 | if (pNewVidPnSourceModeInfo->Format.Graphics.PixelFormat != D3DDDIFMT_UNKNOWN)
|
---|
573 | {
|
---|
574 | pNewVidPnSourceModeInfo->Format.Graphics.ColorBasis = D3DKMDT_CB_SRGB;
|
---|
575 | if (pNewVidPnSourceModeInfo->Format.Graphics.PixelFormat == D3DDDIFMT_P8)
|
---|
576 | pNewVidPnSourceModeInfo->Format.Graphics.PixelValueAccessMode = D3DKMDT_PVAM_SETTABLEPALETTE;
|
---|
577 | else
|
---|
578 | pNewVidPnSourceModeInfo->Format.Graphics.PixelValueAccessMode = D3DKMDT_PVAM_DIRECT;
|
---|
579 | }
|
---|
580 | else
|
---|
581 | {
|
---|
582 | LOGREL(("vboxWddmCalcPixelFormat failed"));
|
---|
583 | Status = STATUS_INVALID_PARAMETER;
|
---|
584 | }
|
---|
585 | }
|
---|
586 | else
|
---|
587 | {
|
---|
588 | /* @todo: XPDM driver does not seem to return text modes, should we? */
|
---|
589 | LOGREL(("text mode not supported currently"));
|
---|
590 | AssertBreakpoint();
|
---|
591 | Status = STATUS_INVALID_PARAMETER;
|
---|
592 | }
|
---|
593 |
|
---|
594 | return Status;
|
---|
595 | }
|
---|
596 |
|
---|
597 | NTSTATUS vboxVidPnPopulateMonitorSourceModeInfoFromLegacy(PVBOXMP_DEVEXT pDevExt,
|
---|
598 | D3DKMDT_MONITOR_SOURCE_MODE *pMonitorSourceMode,
|
---|
599 | D3DKMDT_2DREGION *pResolution,
|
---|
600 | D3DKMDT_MONITOR_CAPABILITIES_ORIGIN enmOrigin,
|
---|
601 | BOOLEAN bPreferred)
|
---|
602 | {
|
---|
603 | NTSTATUS Status = vboxVidPnPopulateVideoSignalInfo(&pMonitorSourceMode->VideoSignalInfo, pResolution, 60 /* ULONG VSync */);
|
---|
604 | Assert(Status == STATUS_SUCCESS);
|
---|
605 | if (Status == STATUS_SUCCESS)
|
---|
606 | {
|
---|
607 | pMonitorSourceMode->ColorBasis = D3DKMDT_CB_SRGB;
|
---|
608 | pMonitorSourceMode->ColorCoeffDynamicRanges.FirstChannel = 8;
|
---|
609 | pMonitorSourceMode->ColorCoeffDynamicRanges.SecondChannel = 8;
|
---|
610 | pMonitorSourceMode->ColorCoeffDynamicRanges.ThirdChannel = 8;
|
---|
611 | pMonitorSourceMode->ColorCoeffDynamicRanges.FourthChannel = 0;
|
---|
612 | pMonitorSourceMode->Origin = enmOrigin;
|
---|
613 | Assert(!bPreferred);
|
---|
614 | // pMonitorSourceMode->Preference = bPreferred ? D3DKMDT_MP_PREFERRED : D3DKMDT_MP_NOTPREFERRED;
|
---|
615 | pMonitorSourceMode->Preference = D3DKMDT_MP_PREFERRED;
|
---|
616 | }
|
---|
617 |
|
---|
618 | return Status;
|
---|
619 | }
|
---|
620 |
|
---|
621 | NTSTATUS vboxVidPnCreatePopulateMonitorSourceModeInfoFromLegacy(PVBOXMP_DEVEXT pDevExt,
|
---|
622 | CONST D3DKMDT_HMONITORSOURCEMODESET hMonitorSMS,
|
---|
623 | CONST DXGK_MONITORSOURCEMODESET_INTERFACE *pMonitorSMSIf,
|
---|
624 | D3DKMDT_2DREGION *pResolution,
|
---|
625 | D3DKMDT_MONITOR_CAPABILITIES_ORIGIN enmOrigin,
|
---|
626 | BOOLEAN bPreferred)
|
---|
627 | {
|
---|
628 | D3DKMDT_MONITOR_SOURCE_MODE * pMonitorSMI;
|
---|
629 | NTSTATUS Status = pMonitorSMSIf->pfnCreateNewModeInfo(hMonitorSMS, &pMonitorSMI);
|
---|
630 | Assert(Status == STATUS_SUCCESS);
|
---|
631 | if (Status == STATUS_SUCCESS)
|
---|
632 | {
|
---|
633 | do
|
---|
634 | {
|
---|
635 | Status = vboxVidPnPopulateMonitorSourceModeInfoFromLegacy(pDevExt,
|
---|
636 | pMonitorSMI,
|
---|
637 | pResolution,
|
---|
638 | enmOrigin,
|
---|
639 | bPreferred);
|
---|
640 | Assert(Status == STATUS_SUCCESS);
|
---|
641 | if (Status == STATUS_SUCCESS)
|
---|
642 | {
|
---|
643 | Status = pMonitorSMSIf->pfnAddMode(hMonitorSMS, pMonitorSMI);
|
---|
644 | Assert(Status == STATUS_SUCCESS/* || Status == STATUS_GRAPHICS_MODE_ALREADY_IN_MODESET*/);
|
---|
645 | // if (Status == STATUS_GRAPHICS_MODE_ALREADY_IN_MODESET)
|
---|
646 | // Status = STATUS_SUCCESS;
|
---|
647 | if (Status == STATUS_SUCCESS)
|
---|
648 | break;
|
---|
649 | LOGREL(("pfnAddMode failed, Status(0x%x)", Status));
|
---|
650 | }
|
---|
651 | else
|
---|
652 | LOGREL(("vboxVidPnPopulateMonitorSourceModeInfoFromLegacy failed, Status(0x%x)", Status));
|
---|
653 |
|
---|
654 | Assert (Status != STATUS_SUCCESS);
|
---|
655 | /* we're here because of a failure */
|
---|
656 | NTSTATUS tmpStatus = pMonitorSMSIf->pfnReleaseModeInfo(hMonitorSMS, pMonitorSMI);
|
---|
657 | Assert(tmpStatus == STATUS_SUCCESS);
|
---|
658 | if (tmpStatus != STATUS_SUCCESS)
|
---|
659 | LOGREL(("pfnReleaseModeInfo failed tmpStatus(0x%x)", tmpStatus));
|
---|
660 | } while (0);
|
---|
661 | }
|
---|
662 | else
|
---|
663 | LOGREL(("pfnCreateNewModeInfo failed, Status(0x%x)", Status));
|
---|
664 |
|
---|
665 | return Status;
|
---|
666 | }
|
---|
667 |
|
---|
668 | NTSTATUS vboxVidPnPopulateTargetModeInfoFromLegacy(D3DKMDT_VIDPN_TARGET_MODE *pNewVidPnTargetModeInfo, D3DKMDT_2DREGION *pResolution)
|
---|
669 | {
|
---|
670 | pNewVidPnTargetModeInfo->Preference = D3DKMDT_MP_NOTPREFERRED;
|
---|
671 | return vboxVidPnPopulateVideoSignalInfo(&pNewVidPnTargetModeInfo->VideoSignalInfo, pResolution, 60 /* ULONG VSync */);
|
---|
672 | }
|
---|
673 |
|
---|
674 | typedef struct VBOXVIDPNCHECKADDMONITORMODES
|
---|
675 | {
|
---|
676 | NTSTATUS Status;
|
---|
677 | D3DKMDT_2DREGION *pResolutions;
|
---|
678 | uint32_t cResolutions;
|
---|
679 | } VBOXVIDPNCHECKADDMONITORMODES, *PVBOXVIDPNCHECKADDMONITORMODES;
|
---|
680 |
|
---|
681 | static DECLCALLBACK(BOOLEAN) vboxVidPnCheckAddMonitorModesEnum(PVBOXMP_DEVEXT pDevExt, D3DKMDT_HMONITORSOURCEMODESET hMonitorSMS, CONST DXGK_MONITORSOURCEMODESET_INTERFACE *pMonitorSMSIf,
|
---|
682 | CONST D3DKMDT_MONITOR_SOURCE_MODE *pMonitorSMI, PVOID pContext)
|
---|
683 | {
|
---|
684 | PVBOXVIDPNCHECKADDMONITORMODES pData = (PVBOXVIDPNCHECKADDMONITORMODES)pContext;
|
---|
685 | NTSTATUS Status = STATUS_SUCCESS;
|
---|
686 |
|
---|
687 | for (uint32_t i = 0; i < pData->cResolutions; ++i)
|
---|
688 | {
|
---|
689 | D3DKMDT_VIDPN_TARGET_MODE dummyMode = {0};
|
---|
690 | Status = vboxVidPnPopulateTargetModeInfoFromLegacy(&dummyMode, &pData->pResolutions[i]);
|
---|
691 | Assert(Status == STATUS_SUCCESS);
|
---|
692 | if (Status == STATUS_SUCCESS)
|
---|
693 | {
|
---|
694 | if (vboxVidPnMatchVideoSignal(&dummyMode.VideoSignalInfo, &pMonitorSMI->VideoSignalInfo))
|
---|
695 | {
|
---|
696 | /* mark it as unneeded */
|
---|
697 | pData->pResolutions[i].cx = 0;
|
---|
698 | break;
|
---|
699 | }
|
---|
700 | }
|
---|
701 | else
|
---|
702 | {
|
---|
703 | LOGREL(("vboxVidPnPopulateTargetModeInfoFromLegacy failed Status(0x%x)", Status));
|
---|
704 | break;
|
---|
705 | }
|
---|
706 | }
|
---|
707 |
|
---|
708 | pMonitorSMSIf->pfnReleaseModeInfo(hMonitorSMS, pMonitorSMI);
|
---|
709 |
|
---|
710 | pData->Status = Status;
|
---|
711 |
|
---|
712 | return Status == STATUS_SUCCESS;
|
---|
713 | }
|
---|
714 |
|
---|
715 | typedef struct VBOXVIDPNCHECKMONMODESENUM
|
---|
716 | {
|
---|
717 | D3DKMDT_2DREGION Region;
|
---|
718 | const D3DKMDT_MONITOR_SOURCE_MODE * pMonitorSMI;
|
---|
719 | } VBOXVIDPNCHECKMONMODESENUM, *PVBOXVIDPNCHECKMONMODESENUM;
|
---|
720 |
|
---|
721 | static DECLCALLBACK(BOOLEAN) vboxFidPnCheckMonitorModesEnum(D3DKMDT_HMONITORSOURCEMODESET hMonitorSMS, CONST DXGK_MONITORSOURCEMODESET_INTERFACE *pMonitorSMSIf,
|
---|
722 | CONST D3DKMDT_MONITOR_SOURCE_MODE *pMonitorSMI, PVOID pContext)
|
---|
723 | {
|
---|
724 | PVBOXVIDPNCHECKMONMODESENUM pInfo = (PVBOXVIDPNCHECKMONMODESENUM)pContext;
|
---|
725 | if (pMonitorSMI->VideoSignalInfo.ActiveSize.cx == pInfo->Region.cx
|
---|
726 | && pMonitorSMI->VideoSignalInfo.ActiveSize.cy == pInfo->Region.cy)
|
---|
727 | {
|
---|
728 | Assert(!pInfo->pMonitorSMI);
|
---|
729 | if (pInfo->pMonitorSMI)
|
---|
730 | {
|
---|
731 | pMonitorSMSIf->pfnReleaseModeInfo(hMonitorSMS, pInfo->pMonitorSMI);
|
---|
732 | }
|
---|
733 | pInfo->pMonitorSMI = pMonitorSMI;
|
---|
734 | }
|
---|
735 | else
|
---|
736 | {
|
---|
737 | pMonitorSMSIf->pfnReleaseModeInfo(hMonitorSMS, pMonitorSMI);
|
---|
738 | }
|
---|
739 | return TRUE;
|
---|
740 | }
|
---|
741 |
|
---|
742 | NTSTATUS vboxVidPnCheckAddMonitorModes(PVBOXMP_DEVEXT pDevExt,
|
---|
743 | D3DDDI_VIDEO_PRESENT_TARGET_ID targetId, D3DKMDT_MONITOR_CAPABILITIES_ORIGIN enmOrigin,
|
---|
744 | D3DKMDT_2DREGION *pResolutions, uint32_t cResolutions)
|
---|
745 | {
|
---|
746 | NTSTATUS Status;
|
---|
747 | CONST DXGK_MONITOR_INTERFACE *pMonitorInterface;
|
---|
748 | Status = pDevExt->u.primary.DxgkInterface.DxgkCbQueryMonitorInterface(pDevExt->u.primary.DxgkInterface.DeviceHandle, DXGK_MONITOR_INTERFACE_VERSION_V1, &pMonitorInterface);
|
---|
749 | Assert(Status == STATUS_SUCCESS);
|
---|
750 | if (Status == STATUS_SUCCESS)
|
---|
751 | {
|
---|
752 | D3DKMDT_HMONITORSOURCEMODESET hMonitorSMS;
|
---|
753 | CONST DXGK_MONITORSOURCEMODESET_INTERFACE *pMonitorSMSIf;
|
---|
754 | Status = pMonitorInterface->pfnAcquireMonitorSourceModeSet(pDevExt->u.primary.DxgkInterface.DeviceHandle,
|
---|
755 | targetId,
|
---|
756 | &hMonitorSMS,
|
---|
757 | &pMonitorSMSIf);
|
---|
758 | Assert(Status == STATUS_SUCCESS);
|
---|
759 | if (Status == STATUS_SUCCESS)
|
---|
760 | {
|
---|
761 | for (uint32_t i = 0; i < cResolutions; ++i)
|
---|
762 | {
|
---|
763 | D3DKMDT_2DREGION *pRes = &pResolutions[i];
|
---|
764 | VBOXVIDPNCHECKMONMODESENUM ChkInfo = {0};
|
---|
765 | ChkInfo.Region = *pRes;
|
---|
766 | Status = vboxVidPnEnumMonitorSourceModes(hMonitorSMS, pMonitorSMSIf,
|
---|
767 | vboxFidPnCheckMonitorModesEnum, &ChkInfo);
|
---|
768 | Assert(Status == STATUS_SUCCESS);
|
---|
769 | if (Status == STATUS_SUCCESS)
|
---|
770 | {
|
---|
771 | if (!ChkInfo.pMonitorSMI)
|
---|
772 | {
|
---|
773 | Status = vboxVidPnCreatePopulateMonitorSourceModeInfoFromLegacy(pDevExt,
|
---|
774 | hMonitorSMS,
|
---|
775 | pMonitorSMSIf,
|
---|
776 | pRes,
|
---|
777 | enmOrigin,
|
---|
778 | FALSE
|
---|
779 | );
|
---|
780 | Assert(Status == STATUS_SUCCESS);
|
---|
781 | if (Status != STATUS_SUCCESS)
|
---|
782 | {
|
---|
783 | LOGREL(("vboxVidPnCreatePopulateMonitorSourceModeInfoFromLegacy failed Status(0x%x)", Status));
|
---|
784 | break;
|
---|
785 | }
|
---|
786 | }
|
---|
787 | else
|
---|
788 | {
|
---|
789 | pMonitorSMSIf->pfnReleaseModeInfo(hMonitorSMS, ChkInfo.pMonitorSMI);
|
---|
790 | }
|
---|
791 | }
|
---|
792 | else
|
---|
793 | {
|
---|
794 | LOGREL(("vboxVidPnEnumMonitorSourceModes failed Status(0x%x)", Status));
|
---|
795 | break;
|
---|
796 | }
|
---|
797 | }
|
---|
798 | NTSTATUS tmpStatus = pMonitorInterface->pfnReleaseMonitorSourceModeSet(pDevExt->u.primary.DxgkInterface.DeviceHandle, hMonitorSMS);
|
---|
799 | Assert(tmpStatus == STATUS_SUCCESS);
|
---|
800 | if (tmpStatus != STATUS_SUCCESS)
|
---|
801 | LOGREL(("pfnReleaseMonitorSourceModeSet failed tmpStatus(0x%x)", tmpStatus));
|
---|
802 | }
|
---|
803 | else
|
---|
804 | LOGREL(("pfnAcquireMonitorSourceModeSet failed Status(0x%x)", Status));
|
---|
805 | }
|
---|
806 | else
|
---|
807 | LOGREL(("DxgkCbQueryMonitorInterface failed Status(0x%x)", Status));
|
---|
808 |
|
---|
809 | return Status;
|
---|
810 | }
|
---|
811 |
|
---|
812 | static NTSTATUS vboxVidPnPathAdd(D3DKMDT_HVIDPN hVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface,
|
---|
813 | const D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId, const D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId)
|
---|
814 | {
|
---|
815 | D3DKMDT_HVIDPNTOPOLOGY hVidPnTopology;
|
---|
816 | const DXGK_VIDPNTOPOLOGY_INTERFACE* pVidPnTopologyInterface;
|
---|
817 | NTSTATUS Status = pVidPnInterface->pfnGetTopology(hVidPn, &hVidPnTopology, &pVidPnTopologyInterface);
|
---|
818 | if (!NT_SUCCESS(Status))
|
---|
819 | {
|
---|
820 | AssertFailed();
|
---|
821 | return Status;
|
---|
822 | }
|
---|
823 |
|
---|
824 | D3DKMDT_VIDPN_PRESENT_PATH *pNewVidPnPresentPathInfo;
|
---|
825 | Status = pVidPnTopologyInterface->pfnCreateNewPathInfo(hVidPnTopology, &pNewVidPnPresentPathInfo);
|
---|
826 | if (!NT_SUCCESS(Status))
|
---|
827 | {
|
---|
828 | AssertFailed();
|
---|
829 | return Status;
|
---|
830 | }
|
---|
831 |
|
---|
832 | pNewVidPnPresentPathInfo->VidPnSourceId = VidPnSourceId;
|
---|
833 | pNewVidPnPresentPathInfo->VidPnTargetId = VidPnTargetId;
|
---|
834 | pNewVidPnPresentPathInfo->ImportanceOrdinal = D3DKMDT_VPPI_PRIMARY;
|
---|
835 | pNewVidPnPresentPathInfo->ContentTransformation.Scaling = D3DKMDT_VPPS_IDENTITY;
|
---|
836 | memset(&pNewVidPnPresentPathInfo->ContentTransformation.ScalingSupport,
|
---|
837 | 0, sizeof (pNewVidPnPresentPathInfo->ContentTransformation.ScalingSupport));
|
---|
838 | pNewVidPnPresentPathInfo->ContentTransformation.ScalingSupport.Identity = 1;
|
---|
839 | pNewVidPnPresentPathInfo->ContentTransformation.ScalingSupport.Centered = 0;
|
---|
840 | pNewVidPnPresentPathInfo->ContentTransformation.ScalingSupport.Stretched = 0;
|
---|
841 | pNewVidPnPresentPathInfo->ContentTransformation.Rotation = D3DKMDT_VPPR_IDENTITY;
|
---|
842 | pNewVidPnPresentPathInfo->ContentTransformation.RotationSupport.Identity = 1;
|
---|
843 | pNewVidPnPresentPathInfo->ContentTransformation.RotationSupport.Rotate180 = 0;
|
---|
844 | pNewVidPnPresentPathInfo->ContentTransformation.RotationSupport.Rotate270 = 0;
|
---|
845 | pNewVidPnPresentPathInfo->ContentTransformation.RotationSupport.Rotate90 = 0;
|
---|
846 | pNewVidPnPresentPathInfo->VisibleFromActiveTLOffset.cx = 0;
|
---|
847 | pNewVidPnPresentPathInfo->VisibleFromActiveTLOffset.cy = 0;
|
---|
848 | pNewVidPnPresentPathInfo->VisibleFromActiveBROffset.cx = 0;
|
---|
849 | pNewVidPnPresentPathInfo->VisibleFromActiveBROffset.cy = 0;
|
---|
850 | pNewVidPnPresentPathInfo->VidPnTargetColorBasis = D3DKMDT_CB_SRGB; /* @todo: how does it matters? */
|
---|
851 | pNewVidPnPresentPathInfo->VidPnTargetColorCoeffDynamicRanges.FirstChannel = 8;
|
---|
852 | pNewVidPnPresentPathInfo->VidPnTargetColorCoeffDynamicRanges.SecondChannel = 8;
|
---|
853 | pNewVidPnPresentPathInfo->VidPnTargetColorCoeffDynamicRanges.ThirdChannel = 8;
|
---|
854 | pNewVidPnPresentPathInfo->VidPnTargetColorCoeffDynamicRanges.FourthChannel = 0;
|
---|
855 | pNewVidPnPresentPathInfo->Content = D3DKMDT_VPPC_GRAPHICS;
|
---|
856 | pNewVidPnPresentPathInfo->CopyProtection.CopyProtectionType = D3DKMDT_VPPMT_UNINITIALIZED;
|
---|
857 | // pNewVidPnPresentPathInfo->CopyProtection.CopyProtectionType = D3DKMDT_VPPMT_NOPROTECTION;
|
---|
858 | pNewVidPnPresentPathInfo->CopyProtection.APSTriggerBits = 0;
|
---|
859 | memset(&pNewVidPnPresentPathInfo->CopyProtection.CopyProtectionSupport, 0, sizeof (pNewVidPnPresentPathInfo->CopyProtection.CopyProtectionSupport));
|
---|
860 | // pNewVidPnPresentPathInfo->CopyProtection.CopyProtectionSupport.NoProtection = 1;
|
---|
861 | memset (&pNewVidPnPresentPathInfo->GammaRamp, 0, sizeof (pNewVidPnPresentPathInfo->GammaRamp));
|
---|
862 | // pNewVidPnPresentPathInfo->GammaRamp.Type = D3DDDI_GAMMARAMP_DEFAULT;
|
---|
863 | // pNewVidPnPresentPathInfo->GammaRamp.DataSize = 0;
|
---|
864 | Status = pVidPnTopologyInterface->pfnAddPath(hVidPnTopology, pNewVidPnPresentPathInfo);
|
---|
865 | if (!NT_SUCCESS(Status))
|
---|
866 | {
|
---|
867 | AssertFailed();
|
---|
868 | NTSTATUS tmpStatus = pVidPnTopologyInterface->pfnReleasePathInfo(hVidPnTopology, pNewVidPnPresentPathInfo);
|
---|
869 | Assert(NT_SUCCESS(tmpStatus));
|
---|
870 | }
|
---|
871 |
|
---|
872 | return Status;
|
---|
873 | }
|
---|
874 |
|
---|
875 | static NTSTATUS vboxVidPnCreatePopulateSourceModeInfoFromLegacy(D3DKMDT_HVIDPN hVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface,
|
---|
876 | const D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId,
|
---|
877 | VIDEO_MODE_INFORMATION *pModes, uint32_t cModes, int iModeToPin,
|
---|
878 | D3DKMDT_VIDEO_PRESENT_SOURCE_MODE_ID *pModeIdToPin,
|
---|
879 | BOOLEAN fDoPin
|
---|
880 | )
|
---|
881 | {
|
---|
882 | D3DKMDT_HVIDPNSOURCEMODESET hNewVidPnSourceModeSet;
|
---|
883 | const DXGK_VIDPNSOURCEMODESET_INTERFACE *pNewVidPnSourceModeSetInterface;
|
---|
884 |
|
---|
885 | if (pModeIdToPin)
|
---|
886 | *pModeIdToPin = D3DDDI_ID_UNINITIALIZED;
|
---|
887 |
|
---|
888 | NTSTATUS Status = pVidPnInterface->pfnCreateNewSourceModeSet(hVidPn,
|
---|
889 | VidPnSourceId,
|
---|
890 | &hNewVidPnSourceModeSet,
|
---|
891 | &pNewVidPnSourceModeSetInterface);
|
---|
892 | if (!NT_SUCCESS(Status))
|
---|
893 | {
|
---|
894 | AssertFailed();
|
---|
895 | return Status;
|
---|
896 | }
|
---|
897 |
|
---|
898 | D3DKMDT_VIDEO_PRESENT_SOURCE_MODE_ID sourceModeId = D3DDDI_ID_UNINITIALIZED;
|
---|
899 |
|
---|
900 | for (uint32_t i = 0; i < cModes; ++i)
|
---|
901 | {
|
---|
902 | VIDEO_MODE_INFORMATION *pMode = &pModes[i];
|
---|
903 | D3DKMDT_VIDPN_SOURCE_MODE *pNewVidPnSourceModeInfo;
|
---|
904 | Status = pNewVidPnSourceModeSetInterface->pfnCreateNewModeInfo(hNewVidPnSourceModeSet, &pNewVidPnSourceModeInfo);
|
---|
905 | if (!NT_SUCCESS(Status))
|
---|
906 | {
|
---|
907 | AssertFailed();
|
---|
908 | break;
|
---|
909 | }
|
---|
910 |
|
---|
911 | Status = vboxVidPnPopulateSourceModeInfoFromLegacy(pNewVidPnSourceModeInfo, pMode);
|
---|
912 | if (NT_SUCCESS(Status))
|
---|
913 | {
|
---|
914 | if (i == iModeToPin)
|
---|
915 | {
|
---|
916 | sourceModeId = pNewVidPnSourceModeInfo->Id;
|
---|
917 | }
|
---|
918 | Status = pNewVidPnSourceModeSetInterface->pfnAddMode(hNewVidPnSourceModeSet, pNewVidPnSourceModeInfo);
|
---|
919 | if (NT_SUCCESS(Status))
|
---|
920 | {
|
---|
921 |
|
---|
922 | /* success */
|
---|
923 | continue;
|
---|
924 | }
|
---|
925 | AssertFailed();
|
---|
926 | }
|
---|
927 | else
|
---|
928 | {
|
---|
929 | AssertFailed();
|
---|
930 | }
|
---|
931 |
|
---|
932 | NTSTATUS tmpStatus = pNewVidPnSourceModeSetInterface->pfnReleaseModeInfo(hNewVidPnSourceModeSet, pNewVidPnSourceModeInfo);
|
---|
933 | Assert(tmpStatus == STATUS_SUCCESS);
|
---|
934 |
|
---|
935 | /* we're here because of an error */
|
---|
936 | Assert(!NT_SUCCESS(Status));
|
---|
937 | break;
|
---|
938 | }
|
---|
939 |
|
---|
940 | if (!NT_SUCCESS(Status))
|
---|
941 | {
|
---|
942 | AssertFailed();
|
---|
943 | return Status;
|
---|
944 | }
|
---|
945 |
|
---|
946 | if (sourceModeId != D3DDDI_ID_UNINITIALIZED)
|
---|
947 | {
|
---|
948 | if (pModeIdToPin)
|
---|
949 | {
|
---|
950 | *pModeIdToPin = sourceModeId;
|
---|
951 | }
|
---|
952 | Assert(iModeToPin >= 0);
|
---|
953 | if (fDoPin)
|
---|
954 | {
|
---|
955 | Status = pNewVidPnSourceModeSetInterface->pfnPinMode(hNewVidPnSourceModeSet, sourceModeId);
|
---|
956 | if (!NT_SUCCESS(Status))
|
---|
957 | {
|
---|
958 | AssertFailed();
|
---|
959 | return Status;
|
---|
960 | }
|
---|
961 | }
|
---|
962 | }
|
---|
963 | else
|
---|
964 | {
|
---|
965 | Assert(iModeToPin < 0);
|
---|
966 | }
|
---|
967 |
|
---|
968 | Status = pVidPnInterface->pfnAssignSourceModeSet(hVidPn, VidPnSourceId, hNewVidPnSourceModeSet);
|
---|
969 | if (!NT_SUCCESS(Status))
|
---|
970 | {
|
---|
971 | AssertFailed();
|
---|
972 | return Status;
|
---|
973 | }
|
---|
974 |
|
---|
975 | return Status;
|
---|
976 | }
|
---|
977 |
|
---|
978 | static NTSTATUS vboxVidPnCreatePopulateTargetModeInfoFromLegacy(D3DKMDT_HVIDPN hVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface,
|
---|
979 | const D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId,
|
---|
980 | D3DKMDT_2DREGION *pResolutions, uint32_t cResolutions,
|
---|
981 | VIDEO_MODE_INFORMATION *pModeToPin,
|
---|
982 | D3DKMDT_VIDEO_PRESENT_TARGET_MODE_ID *pModeIdToPin,
|
---|
983 | BOOLEAN fDoPin
|
---|
984 | )
|
---|
985 | {
|
---|
986 | D3DKMDT_HVIDPNTARGETMODESET hNewVidPnTargetModeSet;
|
---|
987 | const DXGK_VIDPNTARGETMODESET_INTERFACE *pNewVidPnTargetModeSetInterface;
|
---|
988 |
|
---|
989 | if (pModeIdToPin)
|
---|
990 | *pModeIdToPin = D3DDDI_ID_UNINITIALIZED;
|
---|
991 |
|
---|
992 | NTSTATUS Status = pVidPnInterface->pfnCreateNewTargetModeSet(hVidPn,
|
---|
993 | VidPnTargetId,
|
---|
994 | &hNewVidPnTargetModeSet,
|
---|
995 | &pNewVidPnTargetModeSetInterface);
|
---|
996 | if (!NT_SUCCESS(Status))
|
---|
997 | {
|
---|
998 | AssertFailed();
|
---|
999 | return Status;
|
---|
1000 | }
|
---|
1001 |
|
---|
1002 | D3DKMDT_VIDEO_PRESENT_TARGET_MODE_ID targetModeId = D3DDDI_ID_UNINITIALIZED;
|
---|
1003 |
|
---|
1004 | for (uint32_t i = 0; i < cResolutions; ++i)
|
---|
1005 | {
|
---|
1006 | D3DKMDT_2DREGION *pResolution = &pResolutions[i];
|
---|
1007 | D3DKMDT_VIDPN_TARGET_MODE *pNewVidPnTargetModeInfo;
|
---|
1008 | Status = pNewVidPnTargetModeSetInterface->pfnCreateNewModeInfo(hNewVidPnTargetModeSet, &pNewVidPnTargetModeInfo);
|
---|
1009 | if (!NT_SUCCESS(Status))
|
---|
1010 | {
|
---|
1011 | AssertFailed();
|
---|
1012 | break;
|
---|
1013 | }
|
---|
1014 |
|
---|
1015 | Status = vboxVidPnPopulateTargetModeInfoFromLegacy(pNewVidPnTargetModeInfo, pResolution);
|
---|
1016 | if (NT_SUCCESS(Status))
|
---|
1017 | {
|
---|
1018 | if (pModeToPin && pModeToPin->VisScreenWidth == pResolution->cx
|
---|
1019 | && pModeToPin->VisScreenHeight == pResolution->cy)
|
---|
1020 | {
|
---|
1021 | targetModeId = pNewVidPnTargetModeInfo->Id;
|
---|
1022 | }
|
---|
1023 | Status = pNewVidPnTargetModeSetInterface->pfnAddMode(hNewVidPnTargetModeSet, pNewVidPnTargetModeInfo);
|
---|
1024 | if (NT_SUCCESS(Status))
|
---|
1025 | {
|
---|
1026 |
|
---|
1027 | /* success */
|
---|
1028 | continue;
|
---|
1029 | }
|
---|
1030 | AssertFailed();
|
---|
1031 | }
|
---|
1032 | else
|
---|
1033 | {
|
---|
1034 | AssertFailed();
|
---|
1035 | }
|
---|
1036 |
|
---|
1037 | NTSTATUS tmpStatus = pNewVidPnTargetModeSetInterface->pfnReleaseModeInfo(hNewVidPnTargetModeSet, pNewVidPnTargetModeInfo);
|
---|
1038 | Assert(tmpStatus == STATUS_SUCCESS);
|
---|
1039 |
|
---|
1040 | /* we're here because of an error */
|
---|
1041 | Assert(!NT_SUCCESS(Status));
|
---|
1042 | break;
|
---|
1043 | }
|
---|
1044 |
|
---|
1045 | if (!NT_SUCCESS(Status))
|
---|
1046 | {
|
---|
1047 | AssertFailed();
|
---|
1048 | return Status;
|
---|
1049 | }
|
---|
1050 |
|
---|
1051 | if (targetModeId != D3DDDI_ID_UNINITIALIZED)
|
---|
1052 | {
|
---|
1053 | Assert(pModeToPin);
|
---|
1054 |
|
---|
1055 | if (pModeIdToPin)
|
---|
1056 | {
|
---|
1057 | *pModeIdToPin = targetModeId;
|
---|
1058 | }
|
---|
1059 |
|
---|
1060 | if (fDoPin)
|
---|
1061 | {
|
---|
1062 | Status = pNewVidPnTargetModeSetInterface->pfnPinMode(hNewVidPnTargetModeSet, targetModeId);
|
---|
1063 | if (!NT_SUCCESS(Status))
|
---|
1064 | {
|
---|
1065 | AssertFailed();
|
---|
1066 | return Status;
|
---|
1067 | }
|
---|
1068 | }
|
---|
1069 | }
|
---|
1070 | else
|
---|
1071 | {
|
---|
1072 | Assert(!pModeToPin);
|
---|
1073 | }
|
---|
1074 |
|
---|
1075 | Status = pVidPnInterface->pfnAssignTargetModeSet(hVidPn, VidPnTargetId, hNewVidPnTargetModeSet);
|
---|
1076 | if (!NT_SUCCESS(Status))
|
---|
1077 | {
|
---|
1078 | AssertFailed();
|
---|
1079 | return Status;
|
---|
1080 | }
|
---|
1081 |
|
---|
1082 | return Status;
|
---|
1083 | }
|
---|
1084 |
|
---|
1085 | NTSTATUS vboxVidPnCreatePopulateVidPnPathFromLegacy(PVBOXMP_DEVEXT pDevExt, D3DKMDT_HVIDPN hVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface,
|
---|
1086 | VIDEO_MODE_INFORMATION *pModes, uint32_t cModes, int iModeToPin,
|
---|
1087 | D3DKMDT_2DREGION *pResolutions, uint32_t cResolutions,
|
---|
1088 | const D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId, const D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId)
|
---|
1089 | {
|
---|
1090 | NTSTATUS Status;
|
---|
1091 |
|
---|
1092 | Status = vboxVidPnPathAdd(hVidPn, pVidPnInterface, VidPnSourceId, VidPnTargetId);
|
---|
1093 | if (!NT_SUCCESS(Status))
|
---|
1094 | {
|
---|
1095 | AssertFailed();
|
---|
1096 | return Status;
|
---|
1097 | }
|
---|
1098 |
|
---|
1099 | VIDEO_MODE_INFORMATION *pModeToPin = iModeToPin >= 0 ? &pModes[iModeToPin] : NULL;
|
---|
1100 | Status = vboxVidPnCreatePopulateTargetModeInfoFromLegacy(hVidPn, pVidPnInterface, VidPnTargetId, pResolutions, cResolutions, pModeToPin, NULL, TRUE);
|
---|
1101 | if (!NT_SUCCESS(Status))
|
---|
1102 | {
|
---|
1103 | AssertFailed();
|
---|
1104 | return Status;
|
---|
1105 | }
|
---|
1106 |
|
---|
1107 | Status = vboxVidPnCreatePopulateSourceModeInfoFromLegacy(hVidPn, pVidPnInterface, VidPnSourceId, pModes, cModes, iModeToPin, NULL, TRUE);
|
---|
1108 | if (!NT_SUCCESS(Status))
|
---|
1109 | {
|
---|
1110 | AssertFailed();
|
---|
1111 | return Status;
|
---|
1112 | }
|
---|
1113 |
|
---|
1114 | return Status;
|
---|
1115 | }
|
---|
1116 |
|
---|
1117 | typedef struct VBOXVIDPNPOPRESOLUTIONENUM
|
---|
1118 | {
|
---|
1119 | NTSTATUS Status;
|
---|
1120 | D3DKMDT_2DREGION *pResolutions;
|
---|
1121 | int cResolutions;
|
---|
1122 | int cResultResolutions;
|
---|
1123 | }VBOXVIDPNPOPRESOLUTIONENUM, *PVBOXVIDPNPOPRESOLUTIONENUM;
|
---|
1124 |
|
---|
1125 | static DECLCALLBACK(BOOLEAN) vboxVidPnPopulateResolutionsFromSourceModeSetEnum(D3DKMDT_HVIDPNSOURCEMODESET hNewVidPnSourceModeSet, const DXGK_VIDPNSOURCEMODESET_INTERFACE *pVidPnSourceModeSetInterface,
|
---|
1126 | const D3DKMDT_VIDPN_SOURCE_MODE *pNewVidPnSourceModeInfo, PVOID pContext)
|
---|
1127 | {
|
---|
1128 | NTSTATUS Status = STATUS_SUCCESS;
|
---|
1129 | PVBOXVIDPNPOPRESOLUTIONENUM pInfo = (PVBOXVIDPNPOPRESOLUTIONENUM)pContext;
|
---|
1130 | Assert(pInfo->cResolutions >= pInfo->cResultResolutions);
|
---|
1131 | Assert(pInfo->Status == STATUS_SUCCESS);
|
---|
1132 | if (vboxWddmResolutionFind(pInfo->pResolutions, pInfo->cResultResolutions, &pNewVidPnSourceModeInfo->Format.Graphics.PrimSurfSize) < 0)
|
---|
1133 | {
|
---|
1134 | if (pInfo->cResultResolutions < pInfo->cResolutions)
|
---|
1135 | {
|
---|
1136 | pInfo->pResolutions[pInfo->cResultResolutions] = pNewVidPnSourceModeInfo->Format.Graphics.PrimSurfSize;
|
---|
1137 | ++pInfo->cResultResolutions;
|
---|
1138 | }
|
---|
1139 | else
|
---|
1140 | {
|
---|
1141 | Status = STATUS_BUFFER_OVERFLOW;
|
---|
1142 | }
|
---|
1143 | }
|
---|
1144 |
|
---|
1145 | pInfo->Status = Status;
|
---|
1146 |
|
---|
1147 | return Status == STATUS_SUCCESS;
|
---|
1148 | }
|
---|
1149 |
|
---|
1150 | static DECLCALLBACK(BOOLEAN) vboxVidPnPopulateResolutionsFromTargetModeSetEnum(D3DKMDT_HVIDPNTARGETMODESET hNewVidPnTargetModeSet, const DXGK_VIDPNTARGETMODESET_INTERFACE *pVidPnTargetModeSetInterface,
|
---|
1151 | const D3DKMDT_VIDPN_TARGET_MODE *pNewVidPnTargetModeInfo, PVOID pContext)
|
---|
1152 | {
|
---|
1153 | NTSTATUS Status = STATUS_SUCCESS;
|
---|
1154 | PVBOXVIDPNPOPRESOLUTIONENUM pInfo = (PVBOXVIDPNPOPRESOLUTIONENUM)pContext;
|
---|
1155 | Assert(pInfo->cResolutions >= pInfo->cResultResolutions);
|
---|
1156 | Assert(pInfo->Status == STATUS_SUCCESS);
|
---|
1157 | if (vboxWddmResolutionFind(pInfo->pResolutions, pInfo->cResultResolutions, &pNewVidPnTargetModeInfo->VideoSignalInfo.ActiveSize) < 0)
|
---|
1158 | {
|
---|
1159 | if (pInfo->cResultResolutions < pInfo->cResolutions)
|
---|
1160 | {
|
---|
1161 | pInfo->pResolutions[pInfo->cResultResolutions] = pNewVidPnTargetModeInfo->VideoSignalInfo.ActiveSize;
|
---|
1162 | ++pInfo->cResultResolutions;
|
---|
1163 | }
|
---|
1164 | else
|
---|
1165 | {
|
---|
1166 | Status = STATUS_BUFFER_OVERFLOW;
|
---|
1167 | }
|
---|
1168 | }
|
---|
1169 |
|
---|
1170 | pInfo->Status = Status;
|
---|
1171 |
|
---|
1172 | return Status == STATUS_SUCCESS;
|
---|
1173 | }
|
---|
1174 |
|
---|
1175 | typedef struct VBOXVIDPNPOPMODEENUM
|
---|
1176 | {
|
---|
1177 | NTSTATUS Status;
|
---|
1178 | VIDEO_MODE_INFORMATION *pModes;
|
---|
1179 | int cModes;
|
---|
1180 | int cResultModes;
|
---|
1181 | }VBOXVIDPNPOPMODEENUM, *PVBOXVIDPNPOPMODEENUM;
|
---|
1182 |
|
---|
1183 | static DECLCALLBACK(BOOLEAN) vboxVidPnPopulateModesFromSourceModeSetEnum(D3DKMDT_HVIDPNSOURCEMODESET hNewVidPnSourceModeSet, const DXGK_VIDPNSOURCEMODESET_INTERFACE *pVidPnSourceModeSetInterface,
|
---|
1184 | const D3DKMDT_VIDPN_SOURCE_MODE *pNewVidPnSourceModeInfo, PVOID pContext)
|
---|
1185 | {
|
---|
1186 | NTSTATUS Status = STATUS_SUCCESS;
|
---|
1187 | PVBOXVIDPNPOPMODEENUM pInfo = (PVBOXVIDPNPOPMODEENUM)pContext;
|
---|
1188 | VIDEO_MODE_INFORMATION Mode;
|
---|
1189 | Assert(pInfo->cModes >= pInfo->cResultModes);
|
---|
1190 | Assert(pInfo->Status == STATUS_SUCCESS);
|
---|
1191 | if (VBoxWddmFillMode(&Mode, pNewVidPnSourceModeInfo->Format.Graphics.PixelFormat,
|
---|
1192 | pNewVidPnSourceModeInfo->Format.Graphics.VisibleRegionSize.cx,
|
---|
1193 | pNewVidPnSourceModeInfo->Format.Graphics.VisibleRegionSize.cy))
|
---|
1194 | {
|
---|
1195 | if (vboxWddmVideoModeFind(pInfo->pModes, pInfo->cModes, &Mode) < 0)
|
---|
1196 | {
|
---|
1197 | if (pInfo->cResultModes < pInfo->cModes)
|
---|
1198 | {
|
---|
1199 | pInfo->pModes[pInfo->cResultModes] = Mode;
|
---|
1200 | ++pInfo->cResultModes;
|
---|
1201 | }
|
---|
1202 | else
|
---|
1203 | {
|
---|
1204 | Status = STATUS_BUFFER_OVERFLOW;
|
---|
1205 | }
|
---|
1206 | }
|
---|
1207 | }
|
---|
1208 | else
|
---|
1209 | {
|
---|
1210 | Assert(0);
|
---|
1211 | Status = STATUS_INVALID_PARAMETER;
|
---|
1212 | }
|
---|
1213 |
|
---|
1214 | pInfo->Status = Status;
|
---|
1215 |
|
---|
1216 | return Status == STATUS_SUCCESS;
|
---|
1217 | }
|
---|
1218 |
|
---|
1219 | typedef struct VBOXVIDPNPOPMODETARGETENUM
|
---|
1220 | {
|
---|
1221 | VBOXVIDPNPOPMODEENUM Base;
|
---|
1222 | VIDEO_MODE_INFORMATION *pSuperset;
|
---|
1223 | int cSuperset;
|
---|
1224 | }VBOXVIDPNPOPMODETARGETENUM, *PVBOXVIDPNPOPMODETARGETENUM;
|
---|
1225 |
|
---|
1226 | static DECLCALLBACK(BOOLEAN) vboxVidPnPopulateModesFromTargetModeSetEnum(D3DKMDT_HVIDPNTARGETMODESET hNewVidPnTargetModeSet, const DXGK_VIDPNTARGETMODESET_INTERFACE *pVidPnTargetModeSetInterface,
|
---|
1227 | const D3DKMDT_VIDPN_TARGET_MODE *pNewVidPnTargetModeInfo, PVOID pContext)
|
---|
1228 | {
|
---|
1229 | NTSTATUS Status = STATUS_SUCCESS;
|
---|
1230 | PVBOXVIDPNPOPMODETARGETENUM pInfo = (PVBOXVIDPNPOPMODETARGETENUM)pContext;
|
---|
1231 | Assert(pInfo->Base.cModes >= pInfo->Base.cResultModes);
|
---|
1232 | Assert(pInfo->Base.Status == STATUS_SUCCESS);
|
---|
1233 | uint32_t cResult;
|
---|
1234 | Status = VBoxWddmGetModesForResolution(pInfo->pSuperset, pInfo->cSuperset, -1, &pNewVidPnTargetModeInfo->VideoSignalInfo.ActiveSize,
|
---|
1235 | pInfo->Base.pModes + pInfo->Base.cResultModes, pInfo->Base.cModes - pInfo->Base.cResultModes, &cResult, NULL);
|
---|
1236 | Assert(Status == STATUS_SUCCESS);
|
---|
1237 | if (Status == STATUS_SUCCESS)
|
---|
1238 | {
|
---|
1239 | pInfo->Base.cResultModes += cResult;
|
---|
1240 | }
|
---|
1241 |
|
---|
1242 | pInfo->Base.Status = Status;
|
---|
1243 |
|
---|
1244 | return Status == STATUS_SUCCESS;
|
---|
1245 | }
|
---|
1246 |
|
---|
1247 | static D3DKMDT_ENUMCOFUNCMODALITY_PIVOT_TYPE vboxVidPnCofuncModalityCurrentPathPivot(CONST DXGKARG_ENUMVIDPNCOFUNCMODALITY* pEnumCofuncModalityArg,
|
---|
1248 | D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId, D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId)
|
---|
1249 | {
|
---|
1250 | switch (pEnumCofuncModalityArg->EnumPivotType)
|
---|
1251 | {
|
---|
1252 | case D3DKMDT_EPT_VIDPNSOURCE:
|
---|
1253 | if (pEnumCofuncModalityArg->EnumPivot.VidPnSourceId == VidPnSourceId)
|
---|
1254 | return D3DKMDT_EPT_VIDPNSOURCE;
|
---|
1255 | if (pEnumCofuncModalityArg->EnumPivot.VidPnSourceId == D3DDDI_ID_ALL)
|
---|
1256 | {
|
---|
1257 | #ifdef DEBUG_misha
|
---|
1258 | AssertFailed();
|
---|
1259 | #endif
|
---|
1260 | return D3DKMDT_EPT_VIDPNSOURCE;
|
---|
1261 | }
|
---|
1262 | return D3DKMDT_EPT_NOPIVOT;
|
---|
1263 | case D3DKMDT_EPT_VIDPNTARGET:
|
---|
1264 | if (pEnumCofuncModalityArg->EnumPivot.VidPnTargetId == VidPnTargetId)
|
---|
1265 | return D3DKMDT_EPT_VIDPNTARGET;
|
---|
1266 | if (pEnumCofuncModalityArg->EnumPivot.VidPnTargetId == D3DDDI_ID_ALL)
|
---|
1267 | {
|
---|
1268 | #ifdef DEBUG_misha
|
---|
1269 | AssertFailed();
|
---|
1270 | #endif
|
---|
1271 | return D3DKMDT_EPT_VIDPNTARGET;
|
---|
1272 | }
|
---|
1273 | return D3DKMDT_EPT_NOPIVOT;
|
---|
1274 | case D3DKMDT_EPT_SCALING:
|
---|
1275 | case D3DKMDT_EPT_ROTATION:
|
---|
1276 | case D3DKMDT_EPT_NOPIVOT:
|
---|
1277 | return D3DKMDT_EPT_NOPIVOT;
|
---|
1278 | default:
|
---|
1279 | AssertFailed();
|
---|
1280 | return D3DKMDT_EPT_NOPIVOT;
|
---|
1281 | }
|
---|
1282 | }
|
---|
1283 |
|
---|
1284 | NTSTATUS vboxVidPnHasPinnedTargetMode(D3DKMDT_HVIDPN hVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface,
|
---|
1285 | D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId, BOOLEAN *pfHas)
|
---|
1286 | {
|
---|
1287 | D3DKMDT_HVIDPNTARGETMODESET hCurVidPnTargetModeSet;
|
---|
1288 | const DXGK_VIDPNTARGETMODESET_INTERFACE *pCurVidPnTargetModeSetInterface;
|
---|
1289 | *pfHas = FALSE;
|
---|
1290 | NTSTATUS Status = pVidPnInterface->pfnAcquireTargetModeSet(hVidPn,
|
---|
1291 | VidPnTargetId,
|
---|
1292 | &hCurVidPnTargetModeSet,
|
---|
1293 | &pCurVidPnTargetModeSetInterface);
|
---|
1294 | if (!NT_SUCCESS(Status))
|
---|
1295 | {
|
---|
1296 | AssertFailed();
|
---|
1297 | return Status;
|
---|
1298 | }
|
---|
1299 |
|
---|
1300 | CONST D3DKMDT_VIDPN_TARGET_MODE* pPinnedVidPnTargetModeInfo;
|
---|
1301 | Status = pCurVidPnTargetModeSetInterface->pfnAcquirePinnedModeInfo(hCurVidPnTargetModeSet, &pPinnedVidPnTargetModeInfo);
|
---|
1302 | if (Status == STATUS_GRAPHICS_MODE_NOT_PINNED)
|
---|
1303 | {
|
---|
1304 | pPinnedVidPnTargetModeInfo = NULL;
|
---|
1305 | Status = STATUS_SUCCESS;
|
---|
1306 | }
|
---|
1307 | else if (!NT_SUCCESS(Status))
|
---|
1308 | {
|
---|
1309 | LOGREL(("pfnAcquirePinnedModeInfo failed Status(0x%x)", Status));
|
---|
1310 | AssertFailed();
|
---|
1311 | }
|
---|
1312 | else
|
---|
1313 | {
|
---|
1314 | Assert(pPinnedVidPnTargetModeInfo);
|
---|
1315 | NTSTATUS tmpStatus = pCurVidPnTargetModeSetInterface->pfnReleaseModeInfo(hCurVidPnTargetModeSet, pPinnedVidPnTargetModeInfo);
|
---|
1316 | Assert(NT_SUCCESS(tmpStatus));
|
---|
1317 | *pfHas = TRUE;
|
---|
1318 | }
|
---|
1319 |
|
---|
1320 | NTSTATUS tmpStatus = pVidPnInterface->pfnReleaseTargetModeSet(hVidPn, hCurVidPnTargetModeSet);
|
---|
1321 | Assert(tmpStatus == STATUS_SUCCESS);
|
---|
1322 |
|
---|
1323 | return Status;
|
---|
1324 | }
|
---|
1325 |
|
---|
1326 | NTSTATUS vboxVidPnHasPinnedSourceMode(D3DKMDT_HVIDPN hVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface,
|
---|
1327 | D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId, BOOLEAN *pfHas)
|
---|
1328 | {
|
---|
1329 | D3DKMDT_HVIDPNSOURCEMODESET hCurVidPnSourceModeSet;
|
---|
1330 | const DXGK_VIDPNSOURCEMODESET_INTERFACE *pCurVidPnSourceModeSetInterface;
|
---|
1331 | *pfHas = FALSE;
|
---|
1332 | NTSTATUS Status = pVidPnInterface->pfnAcquireSourceModeSet(hVidPn,
|
---|
1333 | VidPnSourceId,
|
---|
1334 | &hCurVidPnSourceModeSet,
|
---|
1335 | &pCurVidPnSourceModeSetInterface);
|
---|
1336 | if (!NT_SUCCESS(Status))
|
---|
1337 | {
|
---|
1338 | AssertFailed();
|
---|
1339 | return Status;
|
---|
1340 | }
|
---|
1341 |
|
---|
1342 | CONST D3DKMDT_VIDPN_SOURCE_MODE* pPinnedVidPnSourceModeInfo;
|
---|
1343 | Status = pCurVidPnSourceModeSetInterface->pfnAcquirePinnedModeInfo(hCurVidPnSourceModeSet, &pPinnedVidPnSourceModeInfo);
|
---|
1344 | if (Status == STATUS_GRAPHICS_MODE_NOT_PINNED)
|
---|
1345 | {
|
---|
1346 | pPinnedVidPnSourceModeInfo = NULL;
|
---|
1347 | Status = STATUS_SUCCESS;
|
---|
1348 | }
|
---|
1349 | else if (!NT_SUCCESS(Status))
|
---|
1350 | {
|
---|
1351 | LOGREL(("pfnAcquirePinnedModeInfo failed Status(0x%x)", Status));
|
---|
1352 | AssertFailed();
|
---|
1353 | }
|
---|
1354 | else
|
---|
1355 | {
|
---|
1356 | Assert(pPinnedVidPnSourceModeInfo);
|
---|
1357 | NTSTATUS tmpStatus = pCurVidPnSourceModeSetInterface->pfnReleaseModeInfo(hCurVidPnSourceModeSet, pPinnedVidPnSourceModeInfo);
|
---|
1358 | Assert(NT_SUCCESS(tmpStatus));
|
---|
1359 | *pfHas = TRUE;
|
---|
1360 | }
|
---|
1361 |
|
---|
1362 | NTSTATUS tmpStatus = pVidPnInterface->pfnReleaseSourceModeSet(hVidPn, hCurVidPnSourceModeSet);
|
---|
1363 | Assert(tmpStatus == STATUS_SUCCESS);
|
---|
1364 |
|
---|
1365 | return Status;
|
---|
1366 | }
|
---|
1367 |
|
---|
1368 | static NTSTATUS vboxVidPnCofuncModalityForPathTarget(PVBOXVIDPNCOFUNCMODALITY pCbContext,
|
---|
1369 | D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId, D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId)
|
---|
1370 | {
|
---|
1371 | PVBOXMP_DEVEXT pDevExt = pCbContext->pDevExt;
|
---|
1372 | D3DKMDT_HVIDPN hVidPn = pCbContext->pEnumCofuncModalityArg->hConstrainingVidPn;
|
---|
1373 | const DXGK_VIDPN_INTERFACE* pVidPnInterface = pCbContext->pVidPnInterface;
|
---|
1374 | PVBOXWDDM_VIDEOMODES_INFO pInfo = &pCbContext->pInfos[VidPnTargetId];
|
---|
1375 |
|
---|
1376 | D3DKMDT_HVIDPNTARGETMODESET hNewVidPnTargetModeSet = NULL;
|
---|
1377 | const DXGK_VIDPNTARGETMODESET_INTERFACE *pNewVidPnTargetModeSetInterface;
|
---|
1378 |
|
---|
1379 | D3DKMDT_HVIDPNSOURCEMODESET hCurVidPnSourceModeSet;
|
---|
1380 | const DXGK_VIDPNSOURCEMODESET_INTERFACE *pCurVidPnSourceModeSetInterface;
|
---|
1381 | NTSTATUS Status = pVidPnInterface->pfnAcquireSourceModeSet(hVidPn,
|
---|
1382 | VidPnSourceId,
|
---|
1383 | &hCurVidPnSourceModeSet,
|
---|
1384 | &pCurVidPnSourceModeSetInterface);
|
---|
1385 | if (!NT_SUCCESS(Status))
|
---|
1386 | {
|
---|
1387 | AssertFailed();
|
---|
1388 | return Status;
|
---|
1389 | }
|
---|
1390 |
|
---|
1391 | CONST D3DKMDT_VIDPN_SOURCE_MODE* pPinnedVidPnSourceModeInfo;
|
---|
1392 | Status = pCurVidPnSourceModeSetInterface->pfnAcquirePinnedModeInfo(hCurVidPnSourceModeSet, &pPinnedVidPnSourceModeInfo);
|
---|
1393 | if (Status == STATUS_GRAPHICS_MODE_NOT_PINNED)
|
---|
1394 | {
|
---|
1395 | pPinnedVidPnSourceModeInfo = NULL;
|
---|
1396 | Status = STATUS_SUCCESS;
|
---|
1397 | }
|
---|
1398 | else if (!NT_SUCCESS(Status))
|
---|
1399 | {
|
---|
1400 | LOGREL(("pfnAcquirePinnedModeInfo failed Status(0x%x)", Status));
|
---|
1401 | AssertFailed();
|
---|
1402 | }
|
---|
1403 | else
|
---|
1404 | {
|
---|
1405 | Assert(pPinnedVidPnSourceModeInfo);
|
---|
1406 | }
|
---|
1407 |
|
---|
1408 | if (NT_SUCCESS(Status))
|
---|
1409 | {
|
---|
1410 | Status = pVidPnInterface->pfnCreateNewTargetModeSet(hVidPn,
|
---|
1411 | VidPnTargetId,
|
---|
1412 | &hNewVidPnTargetModeSet,
|
---|
1413 | &pNewVidPnTargetModeSetInterface);
|
---|
1414 | if (NT_SUCCESS(Status))
|
---|
1415 | {
|
---|
1416 | Assert(hNewVidPnTargetModeSet);
|
---|
1417 | for (uint32_t i = 0; i < pInfo->cResolutions; ++i)
|
---|
1418 | {
|
---|
1419 | D3DKMDT_2DREGION *pResolution = &pInfo->aResolutions[i];
|
---|
1420 | if (pPinnedVidPnSourceModeInfo)
|
---|
1421 | {
|
---|
1422 | if (pPinnedVidPnSourceModeInfo->Format.Graphics.PrimSurfSize.cx != pResolution->cx
|
---|
1423 | || pPinnedVidPnSourceModeInfo->Format.Graphics.PrimSurfSize.cy != pResolution->cy)
|
---|
1424 | {
|
---|
1425 | continue;
|
---|
1426 | }
|
---|
1427 | }
|
---|
1428 |
|
---|
1429 | D3DKMDT_VIDPN_TARGET_MODE *pNewVidPnTargetModeInfo;
|
---|
1430 | Status = pNewVidPnTargetModeSetInterface->pfnCreateNewModeInfo(hNewVidPnTargetModeSet, &pNewVidPnTargetModeInfo);
|
---|
1431 | Assert(Status == STATUS_SUCCESS);
|
---|
1432 | if (NT_SUCCESS(Status))
|
---|
1433 | {
|
---|
1434 | Status = vboxVidPnPopulateTargetModeInfoFromLegacy(pNewVidPnTargetModeInfo, pResolution);
|
---|
1435 | Assert(Status == STATUS_SUCCESS);
|
---|
1436 | if (NT_SUCCESS(Status))
|
---|
1437 | {
|
---|
1438 | Status = pNewVidPnTargetModeSetInterface->pfnAddMode(hNewVidPnTargetModeSet, pNewVidPnTargetModeInfo);
|
---|
1439 | Assert(Status == STATUS_SUCCESS);
|
---|
1440 | if (NT_SUCCESS(Status))
|
---|
1441 | {
|
---|
1442 | /* success */
|
---|
1443 | continue;
|
---|
1444 | }
|
---|
1445 | }
|
---|
1446 |
|
---|
1447 | NTSTATUS tmpStatus = pNewVidPnTargetModeSetInterface->pfnReleaseModeInfo(hNewVidPnTargetModeSet, pNewVidPnTargetModeInfo);
|
---|
1448 | Assert(tmpStatus == STATUS_SUCCESS);
|
---|
1449 | }
|
---|
1450 | /* we're here because of an error */
|
---|
1451 | Assert(!NT_SUCCESS(Status));
|
---|
1452 | break;
|
---|
1453 | }
|
---|
1454 | }
|
---|
1455 | else
|
---|
1456 | {
|
---|
1457 | AssertFailed();
|
---|
1458 | }
|
---|
1459 | }
|
---|
1460 | else
|
---|
1461 | {
|
---|
1462 | AssertFailed();
|
---|
1463 | }
|
---|
1464 |
|
---|
1465 | if (pPinnedVidPnSourceModeInfo)
|
---|
1466 | {
|
---|
1467 | NTSTATUS tmpStatus = pCurVidPnSourceModeSetInterface->pfnReleaseModeInfo(hCurVidPnSourceModeSet, pPinnedVidPnSourceModeInfo);
|
---|
1468 | Assert(tmpStatus == STATUS_SUCCESS);
|
---|
1469 | }
|
---|
1470 |
|
---|
1471 | NTSTATUS tmpStatus = pVidPnInterface->pfnReleaseSourceModeSet(hVidPn, hCurVidPnSourceModeSet);
|
---|
1472 | Assert(tmpStatus == STATUS_SUCCESS);
|
---|
1473 |
|
---|
1474 | if (NT_SUCCESS(Status))
|
---|
1475 | {
|
---|
1476 | Assert(hNewVidPnTargetModeSet);
|
---|
1477 | Status = pVidPnInterface->pfnAssignTargetModeSet(hVidPn, VidPnTargetId, hNewVidPnTargetModeSet);
|
---|
1478 | if (!NT_SUCCESS(Status))
|
---|
1479 | {
|
---|
1480 | AssertFailed();
|
---|
1481 | tmpStatus = pVidPnInterface->pfnReleaseTargetModeSet(hVidPn, hNewVidPnTargetModeSet);
|
---|
1482 | Assert(tmpStatus == STATUS_SUCCESS);
|
---|
1483 | }
|
---|
1484 | }
|
---|
1485 |
|
---|
1486 | return Status;
|
---|
1487 | }
|
---|
1488 |
|
---|
1489 | static NTSTATUS vboxVidPnCofuncModalityForPathSource(PVBOXVIDPNCOFUNCMODALITY pCbContext,
|
---|
1490 | D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId, D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId)
|
---|
1491 | {
|
---|
1492 | PVBOXMP_DEVEXT pDevExt = pCbContext->pDevExt;
|
---|
1493 | D3DKMDT_HVIDPN hVidPn = pCbContext->pEnumCofuncModalityArg->hConstrainingVidPn;
|
---|
1494 | const DXGK_VIDPN_INTERFACE* pVidPnInterface = pCbContext->pVidPnInterface;
|
---|
1495 | PVBOXWDDM_VIDEOMODES_INFO pInfo = &pCbContext->pInfos[VidPnTargetId];
|
---|
1496 | D3DKMDT_HVIDPNSOURCEMODESET hNewVidPnSourceModeSet = NULL;
|
---|
1497 | const DXGK_VIDPNSOURCEMODESET_INTERFACE *pNewVidPnSourceModeSetInterface;
|
---|
1498 |
|
---|
1499 | D3DKMDT_HVIDPNTARGETMODESET hCurVidPnTargetModeSet;
|
---|
1500 | const DXGK_VIDPNTARGETMODESET_INTERFACE *pCurVidPnTargetModeSetInterface;
|
---|
1501 | NTSTATUS Status = pVidPnInterface->pfnAcquireTargetModeSet(hVidPn,
|
---|
1502 | VidPnTargetId,
|
---|
1503 | &hCurVidPnTargetModeSet,
|
---|
1504 | &pCurVidPnTargetModeSetInterface);
|
---|
1505 | if (!NT_SUCCESS(Status))
|
---|
1506 | {
|
---|
1507 | AssertFailed();
|
---|
1508 | return Status;
|
---|
1509 | }
|
---|
1510 |
|
---|
1511 | CONST D3DKMDT_VIDPN_TARGET_MODE* pPinnedVidPnTargetModeInfo;
|
---|
1512 | Status = pCurVidPnTargetModeSetInterface->pfnAcquirePinnedModeInfo(hCurVidPnTargetModeSet, &pPinnedVidPnTargetModeInfo);
|
---|
1513 | if (Status == STATUS_GRAPHICS_MODE_NOT_PINNED)
|
---|
1514 | {
|
---|
1515 | pPinnedVidPnTargetModeInfo = NULL;
|
---|
1516 | Status = STATUS_SUCCESS;
|
---|
1517 | }
|
---|
1518 | else if (!NT_SUCCESS(Status))
|
---|
1519 | {
|
---|
1520 | LOGREL(("pfnAcquirePinnedModeInfo failed Status(0x%x)", Status));
|
---|
1521 | AssertFailed();
|
---|
1522 | }
|
---|
1523 | else
|
---|
1524 | {
|
---|
1525 | Assert(pPinnedVidPnTargetModeInfo);
|
---|
1526 | }
|
---|
1527 |
|
---|
1528 | if (NT_SUCCESS(Status))
|
---|
1529 | {
|
---|
1530 | NTSTATUS Status = pVidPnInterface->pfnCreateNewSourceModeSet(hVidPn,
|
---|
1531 | VidPnSourceId,
|
---|
1532 | &hNewVidPnSourceModeSet,
|
---|
1533 | &pNewVidPnSourceModeSetInterface);
|
---|
1534 | if (NT_SUCCESS(Status))
|
---|
1535 | {
|
---|
1536 | Assert(hNewVidPnSourceModeSet);
|
---|
1537 | for (uint32_t i = 0; i < pInfo->cModes; ++i)
|
---|
1538 | {
|
---|
1539 | VIDEO_MODE_INFORMATION *pMode = &pInfo->aModes[i];
|
---|
1540 | if (pPinnedVidPnTargetModeInfo)
|
---|
1541 | {
|
---|
1542 | if (pPinnedVidPnTargetModeInfo->VideoSignalInfo.ActiveSize.cx != pMode->VisScreenWidth
|
---|
1543 | || pPinnedVidPnTargetModeInfo->VideoSignalInfo.ActiveSize.cy != pMode->VisScreenHeight)
|
---|
1544 | {
|
---|
1545 | continue;
|
---|
1546 | }
|
---|
1547 | }
|
---|
1548 |
|
---|
1549 | D3DKMDT_VIDPN_SOURCE_MODE *pNewVidPnSourceModeInfo;
|
---|
1550 | Status = pNewVidPnSourceModeSetInterface->pfnCreateNewModeInfo(hNewVidPnSourceModeSet, &pNewVidPnSourceModeInfo);
|
---|
1551 | Assert(Status == STATUS_SUCCESS);
|
---|
1552 | if (NT_SUCCESS(Status))
|
---|
1553 | {
|
---|
1554 | Status = vboxVidPnPopulateSourceModeInfoFromLegacy(pNewVidPnSourceModeInfo, pMode);
|
---|
1555 | Assert(Status == STATUS_SUCCESS);
|
---|
1556 | if (NT_SUCCESS(Status))
|
---|
1557 | {
|
---|
1558 | Status = pNewVidPnSourceModeSetInterface->pfnAddMode(hNewVidPnSourceModeSet, pNewVidPnSourceModeInfo);
|
---|
1559 | Assert(Status == STATUS_SUCCESS);
|
---|
1560 | if (NT_SUCCESS(Status))
|
---|
1561 | {
|
---|
1562 | /* success */
|
---|
1563 | continue;
|
---|
1564 | }
|
---|
1565 | }
|
---|
1566 |
|
---|
1567 | NTSTATUS tmpStatus = pNewVidPnSourceModeSetInterface->pfnReleaseModeInfo(hNewVidPnSourceModeSet, pNewVidPnSourceModeInfo);
|
---|
1568 | Assert(tmpStatus == STATUS_SUCCESS);
|
---|
1569 | }
|
---|
1570 | /* we're here because of an error */
|
---|
1571 | Assert(!NT_SUCCESS(Status));
|
---|
1572 | break;
|
---|
1573 | }
|
---|
1574 | }
|
---|
1575 | else
|
---|
1576 | {
|
---|
1577 | AssertFailed();
|
---|
1578 | }
|
---|
1579 | }
|
---|
1580 | else
|
---|
1581 | {
|
---|
1582 | AssertFailed();
|
---|
1583 | }
|
---|
1584 |
|
---|
1585 | if (pPinnedVidPnTargetModeInfo)
|
---|
1586 | {
|
---|
1587 | NTSTATUS tmpStatus = pCurVidPnTargetModeSetInterface->pfnReleaseModeInfo(hCurVidPnTargetModeSet, pPinnedVidPnTargetModeInfo);
|
---|
1588 | Assert(tmpStatus == STATUS_SUCCESS);
|
---|
1589 | }
|
---|
1590 |
|
---|
1591 | NTSTATUS tmpStatus = pVidPnInterface->pfnReleaseTargetModeSet(hVidPn, hCurVidPnTargetModeSet);
|
---|
1592 | Assert(tmpStatus == STATUS_SUCCESS);
|
---|
1593 |
|
---|
1594 | if (NT_SUCCESS(Status))
|
---|
1595 | {
|
---|
1596 | Assert(hNewVidPnSourceModeSet);
|
---|
1597 | Status = pVidPnInterface->pfnAssignSourceModeSet(hVidPn, VidPnSourceId, hNewVidPnSourceModeSet);
|
---|
1598 | if (!NT_SUCCESS(Status))
|
---|
1599 | {
|
---|
1600 | AssertFailed();
|
---|
1601 | tmpStatus = pVidPnInterface->pfnReleaseSourceModeSet(hVidPn, hNewVidPnSourceModeSet);
|
---|
1602 | Assert(tmpStatus == STATUS_SUCCESS);
|
---|
1603 | }
|
---|
1604 | }
|
---|
1605 |
|
---|
1606 | return Status;
|
---|
1607 | }
|
---|
1608 |
|
---|
1609 | NTSTATUS vboxVidPnCofuncModalityForPath(PVBOXVIDPNCOFUNCMODALITY pCbContext,
|
---|
1610 | D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId, D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId)
|
---|
1611 | {
|
---|
1612 | PVBOXMP_DEVEXT pDevExt = pCbContext->pDevExt;
|
---|
1613 | D3DKMDT_HVIDPN hVidPn = pCbContext->pEnumCofuncModalityArg->hConstrainingVidPn;
|
---|
1614 | const DXGK_VIDPN_INTERFACE* pVidPnInterface = pCbContext->pVidPnInterface;
|
---|
1615 | NTSTATUS Status = STATUS_SUCCESS;
|
---|
1616 | pCbContext->Status = STATUS_SUCCESS;
|
---|
1617 | PVBOXWDDM_VIDEOMODES_INFO pInfo = &pCbContext->pInfos[VidPnTargetId];
|
---|
1618 |
|
---|
1619 | D3DKMDT_ENUMCOFUNCMODALITY_PIVOT_TYPE enmPivot = vboxVidPnCofuncModalityCurrentPathPivot(pCbContext->pEnumCofuncModalityArg, VidPnSourceId, VidPnTargetId);
|
---|
1620 | BOOLEAN fHasPinnedMode = FALSE;
|
---|
1621 | Status = vboxVidPnHasPinnedTargetMode(hVidPn, pVidPnInterface, VidPnTargetId, &fHasPinnedMode);
|
---|
1622 | if (!NT_SUCCESS(Status))
|
---|
1623 | {
|
---|
1624 | AssertFailed();
|
---|
1625 | return Status;
|
---|
1626 | }
|
---|
1627 |
|
---|
1628 | BOOLEAN fNeedUpdate = enmPivot != D3DKMDT_EPT_VIDPNTARGET && !fHasPinnedMode;
|
---|
1629 | if (fNeedUpdate)
|
---|
1630 | {
|
---|
1631 | Status = vboxVidPnCofuncModalityForPathTarget(pCbContext, VidPnSourceId, VidPnTargetId);
|
---|
1632 | }
|
---|
1633 |
|
---|
1634 | if (NT_SUCCESS(Status))
|
---|
1635 | {
|
---|
1636 | fHasPinnedMode = FALSE;
|
---|
1637 | Status = vboxVidPnHasPinnedSourceMode(hVidPn, pVidPnInterface, VidPnSourceId, &fHasPinnedMode);
|
---|
1638 | if (!NT_SUCCESS(Status))
|
---|
1639 | {
|
---|
1640 | AssertFailed();
|
---|
1641 | return Status;
|
---|
1642 | }
|
---|
1643 |
|
---|
1644 | fNeedUpdate = enmPivot != D3DKMDT_EPT_VIDPNSOURCE && !fHasPinnedMode;
|
---|
1645 | if (fNeedUpdate)
|
---|
1646 | {
|
---|
1647 | Status = vboxVidPnCofuncModalityForPathSource(pCbContext, VidPnSourceId, VidPnTargetId);
|
---|
1648 | }
|
---|
1649 | }
|
---|
1650 |
|
---|
1651 | return Status;
|
---|
1652 | }
|
---|
1653 |
|
---|
1654 | DECLCALLBACK(BOOLEAN) vboxVidPnCofuncModalityPathEnum(D3DKMDT_HVIDPNTOPOLOGY hVidPnTopology, const DXGK_VIDPNTOPOLOGY_INTERFACE* pVidPnTopologyInterface,
|
---|
1655 | const D3DKMDT_VIDPN_PRESENT_PATH *pNewVidPnPresentPathInfo, PVOID pContext)
|
---|
1656 | {
|
---|
1657 | PVBOXVIDPNCOFUNCMODALITY pCbContext = (PVBOXVIDPNCOFUNCMODALITY)pContext;
|
---|
1658 | D3DKMDT_VIDPN_PRESENT_PATH AdjustedPath = {};
|
---|
1659 | NTSTATUS Status = STATUS_SUCCESS;
|
---|
1660 | bool bUpdatePath = false;
|
---|
1661 | AdjustedPath.VidPnSourceId = pNewVidPnPresentPathInfo->VidPnSourceId;
|
---|
1662 | AdjustedPath.VidPnTargetId = pNewVidPnPresentPathInfo->VidPnTargetId;
|
---|
1663 | AdjustedPath.ContentTransformation = pNewVidPnPresentPathInfo->ContentTransformation;
|
---|
1664 | AdjustedPath.CopyProtection = pNewVidPnPresentPathInfo->CopyProtection;
|
---|
1665 |
|
---|
1666 | if (pNewVidPnPresentPathInfo->ContentTransformation.Scaling == D3DKMDT_VPPS_UNPINNED)
|
---|
1667 | {
|
---|
1668 | AdjustedPath.ContentTransformation.ScalingSupport.Identity = TRUE;
|
---|
1669 | bUpdatePath = true;
|
---|
1670 | }
|
---|
1671 |
|
---|
1672 | if (pNewVidPnPresentPathInfo->ContentTransformation.Rotation == D3DKMDT_VPPR_UNPINNED)
|
---|
1673 | {
|
---|
1674 | AdjustedPath.ContentTransformation.RotationSupport.Identity = TRUE;
|
---|
1675 | bUpdatePath = true;
|
---|
1676 | }
|
---|
1677 |
|
---|
1678 | if (bUpdatePath)
|
---|
1679 | {
|
---|
1680 | Status = pVidPnTopologyInterface->pfnUpdatePathSupportInfo(hVidPnTopology, &AdjustedPath);
|
---|
1681 | Assert(Status == STATUS_SUCCESS);
|
---|
1682 | }
|
---|
1683 |
|
---|
1684 | Status = vboxVidPnCofuncModalityForPath(pCbContext, pNewVidPnPresentPathInfo->VidPnSourceId, pNewVidPnPresentPathInfo->VidPnTargetId);
|
---|
1685 |
|
---|
1686 | pVidPnTopologyInterface->pfnReleasePathInfo(hVidPnTopology, pNewVidPnPresentPathInfo);
|
---|
1687 |
|
---|
1688 | pCbContext->Status = Status;
|
---|
1689 | Assert(Status == STATUS_SUCCESS);
|
---|
1690 | return Status == STATUS_SUCCESS;
|
---|
1691 | }
|
---|
1692 |
|
---|
1693 | NTSTATUS vboxVidPnEnumMonitorSourceModes(D3DKMDT_HMONITORSOURCEMODESET hMonitorSMS, CONST DXGK_MONITORSOURCEMODESET_INTERFACE *pMonitorSMSIf,
|
---|
1694 | PFNVBOXVIDPNENUMMONITORSOURCEMODES pfnCallback, PVOID pContext)
|
---|
1695 | {
|
---|
1696 | CONST D3DKMDT_MONITOR_SOURCE_MODE *pMonitorSMI;
|
---|
1697 | NTSTATUS Status = pMonitorSMSIf->pfnAcquireFirstModeInfo(hMonitorSMS, &pMonitorSMI);
|
---|
1698 | Assert(Status == STATUS_SUCCESS || Status == STATUS_GRAPHICS_DATASET_IS_EMPTY);
|
---|
1699 | if (Status == STATUS_SUCCESS)
|
---|
1700 | {
|
---|
1701 | Assert(pMonitorSMI);
|
---|
1702 | while (1)
|
---|
1703 | {
|
---|
1704 | CONST D3DKMDT_MONITOR_SOURCE_MODE *pNextMonitorSMI;
|
---|
1705 | Status = pMonitorSMSIf->pfnAcquireNextModeInfo(hMonitorSMS, pMonitorSMI, &pNextMonitorSMI);
|
---|
1706 | if (!pfnCallback(hMonitorSMS, pMonitorSMSIf, pMonitorSMI, pContext))
|
---|
1707 | {
|
---|
1708 | Assert(Status == STATUS_SUCCESS || Status == STATUS_GRAPHICS_NO_MORE_ELEMENTS_IN_DATASET);
|
---|
1709 | if (Status == STATUS_SUCCESS)
|
---|
1710 | pMonitorSMSIf->pfnReleaseModeInfo(hMonitorSMS, pNextMonitorSMI);
|
---|
1711 | else if (Status == STATUS_GRAPHICS_NO_MORE_ELEMENTS_IN_DATASET)
|
---|
1712 | {
|
---|
1713 | Status = STATUS_SUCCESS;
|
---|
1714 | break;
|
---|
1715 | }
|
---|
1716 | else
|
---|
1717 | {
|
---|
1718 | LOGREL(("pfnAcquireNextModeInfo Failed Status(0x%x), ignored since callback returned false", Status));
|
---|
1719 | Status = STATUS_SUCCESS;
|
---|
1720 | }
|
---|
1721 | break;
|
---|
1722 | }
|
---|
1723 | else if (Status == STATUS_SUCCESS)
|
---|
1724 | pMonitorSMI = pNextMonitorSMI;
|
---|
1725 | else if (Status == STATUS_GRAPHICS_NO_MORE_ELEMENTS_IN_DATASET)
|
---|
1726 | {
|
---|
1727 | Status = STATUS_SUCCESS;
|
---|
1728 | break;
|
---|
1729 | }
|
---|
1730 | else
|
---|
1731 | {
|
---|
1732 | AssertBreakpoint();
|
---|
1733 | LOGREL(("pfnAcquireNextModeInfo Failed Status(0x%x)", Status));
|
---|
1734 | pNextMonitorSMI = NULL;
|
---|
1735 | break;
|
---|
1736 | }
|
---|
1737 | }
|
---|
1738 | }
|
---|
1739 | else if (Status == STATUS_GRAPHICS_DATASET_IS_EMPTY)
|
---|
1740 | Status = STATUS_SUCCESS;
|
---|
1741 | else
|
---|
1742 | LOGREL(("pfnAcquireFirstModeInfo failed Status(0x%x)", Status));
|
---|
1743 |
|
---|
1744 | return Status;
|
---|
1745 | }
|
---|
1746 |
|
---|
1747 | NTSTATUS vboxVidPnEnumSourceModes(D3DKMDT_HVIDPNSOURCEMODESET hNewVidPnSourceModeSet, const DXGK_VIDPNSOURCEMODESET_INTERFACE *pVidPnSourceModeSetInterface,
|
---|
1748 | PFNVBOXVIDPNENUMSOURCEMODES pfnCallback, PVOID pContext)
|
---|
1749 | {
|
---|
1750 | const D3DKMDT_VIDPN_SOURCE_MODE *pNewVidPnSourceModeInfo;
|
---|
1751 | NTSTATUS Status = pVidPnSourceModeSetInterface->pfnAcquireFirstModeInfo(hNewVidPnSourceModeSet, &pNewVidPnSourceModeInfo);
|
---|
1752 | if (Status == STATUS_SUCCESS)
|
---|
1753 | {
|
---|
1754 | Assert(pNewVidPnSourceModeInfo);
|
---|
1755 | while (1)
|
---|
1756 | {
|
---|
1757 | const D3DKMDT_VIDPN_SOURCE_MODE *pNextVidPnSourceModeInfo;
|
---|
1758 | Status = pVidPnSourceModeSetInterface->pfnAcquireNextModeInfo(hNewVidPnSourceModeSet, pNewVidPnSourceModeInfo, &pNextVidPnSourceModeInfo);
|
---|
1759 | if (!pfnCallback(hNewVidPnSourceModeSet, pVidPnSourceModeSetInterface,
|
---|
1760 | pNewVidPnSourceModeInfo, pContext))
|
---|
1761 | {
|
---|
1762 | Assert(Status == STATUS_SUCCESS);
|
---|
1763 | if (Status == STATUS_SUCCESS)
|
---|
1764 | pVidPnSourceModeSetInterface->pfnReleaseModeInfo(hNewVidPnSourceModeSet, pNextVidPnSourceModeInfo);
|
---|
1765 | else if (Status == STATUS_GRAPHICS_NO_MORE_ELEMENTS_IN_DATASET)
|
---|
1766 | {
|
---|
1767 | Status = STATUS_SUCCESS;
|
---|
1768 | break;
|
---|
1769 | }
|
---|
1770 | else
|
---|
1771 | {
|
---|
1772 | LOGREL(("pfnAcquireNextModeInfo Failed Status(0x%x), ignored since callback returned false", Status));
|
---|
1773 | Status = STATUS_SUCCESS;
|
---|
1774 | }
|
---|
1775 |
|
---|
1776 | break;
|
---|
1777 | }
|
---|
1778 | else if (Status == STATUS_SUCCESS)
|
---|
1779 | pNewVidPnSourceModeInfo = pNextVidPnSourceModeInfo;
|
---|
1780 | else if (Status == STATUS_GRAPHICS_NO_MORE_ELEMENTS_IN_DATASET)
|
---|
1781 | {
|
---|
1782 | Status = STATUS_SUCCESS;
|
---|
1783 | break;
|
---|
1784 | }
|
---|
1785 | else
|
---|
1786 | {
|
---|
1787 | AssertBreakpoint();
|
---|
1788 | LOGREL(("pfnAcquireNextModeInfo Failed Status(0x%x)", Status));
|
---|
1789 | pNewVidPnSourceModeInfo = NULL;
|
---|
1790 | break;
|
---|
1791 | }
|
---|
1792 | }
|
---|
1793 | }
|
---|
1794 | else if (Status == STATUS_GRAPHICS_DATASET_IS_EMPTY)
|
---|
1795 | Status = STATUS_SUCCESS;
|
---|
1796 | else
|
---|
1797 | LOGREL(("pfnAcquireFirstModeInfo failed Status(0x%x)", Status));
|
---|
1798 |
|
---|
1799 | return Status;
|
---|
1800 | }
|
---|
1801 |
|
---|
1802 | NTSTATUS vboxVidPnEnumTargetModes(D3DKMDT_HVIDPNTARGETMODESET hNewVidPnTargetModeSet, const DXGK_VIDPNTARGETMODESET_INTERFACE *pVidPnTargetModeSetInterface,
|
---|
1803 | PFNVBOXVIDPNENUMTARGETMODES pfnCallback, PVOID pContext)
|
---|
1804 | {
|
---|
1805 | const D3DKMDT_VIDPN_TARGET_MODE *pNewVidPnTargetModeInfo;
|
---|
1806 | NTSTATUS Status = pVidPnTargetModeSetInterface->pfnAcquireFirstModeInfo(hNewVidPnTargetModeSet, &pNewVidPnTargetModeInfo);
|
---|
1807 | if (Status == STATUS_SUCCESS)
|
---|
1808 | {
|
---|
1809 | Assert(pNewVidPnTargetModeInfo);
|
---|
1810 | while (1)
|
---|
1811 | {
|
---|
1812 | const D3DKMDT_VIDPN_TARGET_MODE *pNextVidPnTargetModeInfo;
|
---|
1813 | Status = pVidPnTargetModeSetInterface->pfnAcquireNextModeInfo(hNewVidPnTargetModeSet, pNewVidPnTargetModeInfo, &pNextVidPnTargetModeInfo);
|
---|
1814 | if (!pfnCallback(hNewVidPnTargetModeSet, pVidPnTargetModeSetInterface,
|
---|
1815 | pNewVidPnTargetModeInfo, pContext))
|
---|
1816 | {
|
---|
1817 | Assert(Status == STATUS_SUCCESS);
|
---|
1818 | if (Status == STATUS_SUCCESS)
|
---|
1819 | pVidPnTargetModeSetInterface->pfnReleaseModeInfo(hNewVidPnTargetModeSet, pNextVidPnTargetModeInfo);
|
---|
1820 | else if (Status == STATUS_GRAPHICS_NO_MORE_ELEMENTS_IN_DATASET)
|
---|
1821 | {
|
---|
1822 | Status = STATUS_SUCCESS;
|
---|
1823 | break;
|
---|
1824 | }
|
---|
1825 | else
|
---|
1826 | {
|
---|
1827 | LOGREL(("pfnAcquireNextModeInfo Failed Status(0x%x), ignored since callback returned false", Status));
|
---|
1828 | Status = STATUS_SUCCESS;
|
---|
1829 | }
|
---|
1830 |
|
---|
1831 | break;
|
---|
1832 | }
|
---|
1833 | else if (Status == STATUS_SUCCESS)
|
---|
1834 | pNewVidPnTargetModeInfo = pNextVidPnTargetModeInfo;
|
---|
1835 | else if (Status == STATUS_GRAPHICS_NO_MORE_ELEMENTS_IN_DATASET)
|
---|
1836 | {
|
---|
1837 | Status = STATUS_SUCCESS;
|
---|
1838 | break;
|
---|
1839 | }
|
---|
1840 | else
|
---|
1841 | {
|
---|
1842 | AssertBreakpoint();
|
---|
1843 | LOGREL(("pfnAcquireNextModeInfo Failed Status(0x%x)", Status));
|
---|
1844 | pNewVidPnTargetModeInfo = NULL;
|
---|
1845 | break;
|
---|
1846 | }
|
---|
1847 | }
|
---|
1848 | }
|
---|
1849 | else if (Status == STATUS_GRAPHICS_DATASET_IS_EMPTY)
|
---|
1850 | Status = STATUS_SUCCESS;
|
---|
1851 | else
|
---|
1852 | LOGREL(("pfnAcquireFirstModeInfo failed Status(0x%x)", Status));
|
---|
1853 |
|
---|
1854 | return Status;
|
---|
1855 | }
|
---|
1856 |
|
---|
1857 | NTSTATUS vboxVidPnEnumTargetsForSource(PVBOXMP_DEVEXT pDevExt, D3DKMDT_HVIDPNTOPOLOGY hVidPnTopology, const DXGK_VIDPNTOPOLOGY_INTERFACE* pVidPnTopologyInterface,
|
---|
1858 | CONST D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId,
|
---|
1859 | PFNVBOXVIDPNENUMTARGETSFORSOURCE pfnCallback, PVOID pContext)
|
---|
1860 | {
|
---|
1861 | SIZE_T cTgtPaths;
|
---|
1862 | NTSTATUS Status = pVidPnTopologyInterface->pfnGetNumPathsFromSource(hVidPnTopology, VidPnSourceId, &cTgtPaths);
|
---|
1863 | Assert(Status == STATUS_SUCCESS || Status == STATUS_GRAPHICS_SOURCE_NOT_IN_TOPOLOGY);
|
---|
1864 | if (Status == STATUS_SUCCESS)
|
---|
1865 | {
|
---|
1866 | for (SIZE_T i = 0; i < cTgtPaths; ++i)
|
---|
1867 | {
|
---|
1868 | D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId;
|
---|
1869 | Status = pVidPnTopologyInterface->pfnEnumPathTargetsFromSource(hVidPnTopology, VidPnSourceId, i, &VidPnTargetId);
|
---|
1870 | Assert(Status == STATUS_SUCCESS);
|
---|
1871 | if (Status == STATUS_SUCCESS)
|
---|
1872 | {
|
---|
1873 | if (!pfnCallback(pDevExt, hVidPnTopology, pVidPnTopologyInterface, VidPnSourceId, VidPnTargetId, cTgtPaths, pContext))
|
---|
1874 | break;
|
---|
1875 | }
|
---|
1876 | else
|
---|
1877 | {
|
---|
1878 | LOGREL(("pfnEnumPathTargetsFromSource failed Status(0x%x)", Status));
|
---|
1879 | break;
|
---|
1880 | }
|
---|
1881 | }
|
---|
1882 | }
|
---|
1883 | else if (Status != STATUS_GRAPHICS_SOURCE_NOT_IN_TOPOLOGY)
|
---|
1884 | LOGREL(("pfnGetNumPathsFromSource failed Status(0x%x)", Status));
|
---|
1885 |
|
---|
1886 | return Status;
|
---|
1887 | }
|
---|
1888 |
|
---|
1889 | NTSTATUS vboxVidPnEnumPaths(D3DKMDT_HVIDPNTOPOLOGY hVidPnTopology, const DXGK_VIDPNTOPOLOGY_INTERFACE* pVidPnTopologyInterface,
|
---|
1890 | PFNVBOXVIDPNENUMPATHS pfnCallback, PVOID pContext)
|
---|
1891 | {
|
---|
1892 | const D3DKMDT_VIDPN_PRESENT_PATH *pNewVidPnPresentPathInfo = NULL;
|
---|
1893 | NTSTATUS Status = pVidPnTopologyInterface->pfnAcquireFirstPathInfo(hVidPnTopology, &pNewVidPnPresentPathInfo);
|
---|
1894 | if (Status == STATUS_SUCCESS)
|
---|
1895 | {
|
---|
1896 | while (1)
|
---|
1897 | {
|
---|
1898 | const D3DKMDT_VIDPN_PRESENT_PATH *pNextVidPnPresentPathInfo;
|
---|
1899 | Status = pVidPnTopologyInterface->pfnAcquireNextPathInfo(hVidPnTopology, pNewVidPnPresentPathInfo, &pNextVidPnPresentPathInfo);
|
---|
1900 |
|
---|
1901 | if (!pfnCallback(hVidPnTopology, pVidPnTopologyInterface, pNewVidPnPresentPathInfo, pContext))
|
---|
1902 | {
|
---|
1903 | Assert(Status == STATUS_SUCCESS);
|
---|
1904 | if (Status == STATUS_SUCCESS)
|
---|
1905 | pVidPnTopologyInterface->pfnReleasePathInfo(hVidPnTopology, pNextVidPnPresentPathInfo);
|
---|
1906 | else
|
---|
1907 | {
|
---|
1908 | Assert(Status == STATUS_GRAPHICS_NO_MORE_ELEMENTS_IN_DATASET);
|
---|
1909 | if (Status != STATUS_GRAPHICS_NO_MORE_ELEMENTS_IN_DATASET)
|
---|
1910 | LOGREL(("pfnAcquireNextPathInfo Failed Status(0x%x), ignored since callback returned false", Status));
|
---|
1911 | Status = STATUS_SUCCESS;
|
---|
1912 | }
|
---|
1913 |
|
---|
1914 | break;
|
---|
1915 | }
|
---|
1916 | else if (Status == STATUS_SUCCESS)
|
---|
1917 | pNewVidPnPresentPathInfo = pNextVidPnPresentPathInfo;
|
---|
1918 | else if (Status == STATUS_GRAPHICS_NO_MORE_ELEMENTS_IN_DATASET)
|
---|
1919 | {
|
---|
1920 | Status = STATUS_SUCCESS;
|
---|
1921 | break;
|
---|
1922 | }
|
---|
1923 | else
|
---|
1924 | {
|
---|
1925 | AssertBreakpoint();
|
---|
1926 | LOGREL(("pfnAcquireNextPathInfo Failed Status(0x%x)", Status));
|
---|
1927 | pNewVidPnPresentPathInfo = NULL;
|
---|
1928 | break;
|
---|
1929 | }
|
---|
1930 | }
|
---|
1931 | }
|
---|
1932 | else if (Status == STATUS_GRAPHICS_DATASET_IS_EMPTY)
|
---|
1933 | Status = STATUS_SUCCESS;
|
---|
1934 | else
|
---|
1935 | LOGREL(("pfnAcquireFirstModeInfo failed Status(0x%x)", Status));
|
---|
1936 |
|
---|
1937 | return Status;
|
---|
1938 | }
|
---|
1939 |
|
---|
1940 | NTSTATUS vboxVidPnSetupSourceInfo(PVBOXMP_DEVEXT pDevExt, D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId, PVBOXWDDM_SOURCE pSource, CONST D3DKMDT_VIDPN_SOURCE_MODE* pVidPnSourceModeInfo, PVBOXWDDM_ALLOCATION pAllocation)
|
---|
1941 | {
|
---|
1942 | vboxWddmAssignPrimary(pDevExt, pSource, pAllocation, srcId);
|
---|
1943 | return STATUS_SUCCESS;
|
---|
1944 | }
|
---|
1945 |
|
---|
1946 | NTSTATUS vboxVidPnCommitSourceMode(PVBOXMP_DEVEXT pDevExt, D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId, CONST D3DKMDT_VIDPN_SOURCE_MODE* pVidPnSourceModeInfo, PVBOXWDDM_ALLOCATION pAllocation)
|
---|
1947 | {
|
---|
1948 | Assert(srcId < (UINT)VBoxCommonFromDeviceExt(pDevExt)->cDisplays);
|
---|
1949 | if (srcId < (UINT)VBoxCommonFromDeviceExt(pDevExt)->cDisplays)
|
---|
1950 | {
|
---|
1951 | PVBOXWDDM_SOURCE pSource = &pDevExt->aSources[srcId];
|
---|
1952 | return vboxVidPnSetupSourceInfo(pDevExt, srcId, pSource, pVidPnSourceModeInfo, pAllocation);
|
---|
1953 | }
|
---|
1954 |
|
---|
1955 | LOGREL(("invalid srcId (%d), cSources(%d)", srcId, VBoxCommonFromDeviceExt(pDevExt)->cDisplays));
|
---|
1956 | return STATUS_INVALID_PARAMETER;
|
---|
1957 | }
|
---|
1958 |
|
---|
1959 | typedef struct VBOXVIDPNCOMMITTARGETMODE
|
---|
1960 | {
|
---|
1961 | NTSTATUS Status;
|
---|
1962 | D3DKMDT_HVIDPN hVidPn;
|
---|
1963 | const DXGK_VIDPN_INTERFACE* pVidPnInterface;
|
---|
1964 | } VBOXVIDPNCOMMITTARGETMODE;
|
---|
1965 |
|
---|
1966 | DECLCALLBACK(BOOLEAN) vboxVidPnCommitTargetModeEnum(PVBOXMP_DEVEXT pDevExt, D3DKMDT_HVIDPNTOPOLOGY hVidPnTopology, const DXGK_VIDPNTOPOLOGY_INTERFACE* pVidPnTopologyInterface,
|
---|
1967 | CONST D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId, D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId, SIZE_T cTgtPaths, PVOID pContext)
|
---|
1968 | {
|
---|
1969 | VBOXVIDPNCOMMITTARGETMODE *pInfo = (VBOXVIDPNCOMMITTARGETMODE*)pContext;
|
---|
1970 | Assert(cTgtPaths <= (SIZE_T)VBoxCommonFromDeviceExt(pDevExt)->cDisplays);
|
---|
1971 | D3DKMDT_HVIDPNTARGETMODESET hVidPnTargetModeSet;
|
---|
1972 | CONST DXGK_VIDPNTARGETMODESET_INTERFACE* pVidPnTargetModeSetInterface;
|
---|
1973 | NTSTATUS Status = pInfo->pVidPnInterface->pfnAcquireTargetModeSet(pInfo->hVidPn, VidPnTargetId, &hVidPnTargetModeSet, &pVidPnTargetModeSetInterface);
|
---|
1974 | Assert(Status == STATUS_SUCCESS);
|
---|
1975 | if (Status == STATUS_SUCCESS)
|
---|
1976 | {
|
---|
1977 | CONST D3DKMDT_VIDPN_TARGET_MODE* pPinnedVidPnTargetModeInfo;
|
---|
1978 | Status = pVidPnTargetModeSetInterface->pfnAcquirePinnedModeInfo(hVidPnTargetModeSet, &pPinnedVidPnTargetModeInfo);
|
---|
1979 | Assert(Status == STATUS_SUCCESS);
|
---|
1980 | if (Status == STATUS_SUCCESS)
|
---|
1981 | {
|
---|
1982 | VBOXWDDM_TARGET *pTarget = &pDevExt->aTargets[VidPnTargetId];
|
---|
1983 | if (pTarget->HeightVisible != pPinnedVidPnTargetModeInfo->VideoSignalInfo.ActiveSize.cy
|
---|
1984 | || pTarget->HeightTotal != pPinnedVidPnTargetModeInfo->VideoSignalInfo.TotalSize.cy)
|
---|
1985 | {
|
---|
1986 | pTarget->HeightVisible = pPinnedVidPnTargetModeInfo->VideoSignalInfo.ActiveSize.cy;
|
---|
1987 | pTarget->HeightTotal = pPinnedVidPnTargetModeInfo->VideoSignalInfo.TotalSize.cy;
|
---|
1988 | pTarget->ScanLineState = 0;
|
---|
1989 | }
|
---|
1990 | pVidPnTargetModeSetInterface->pfnReleaseModeInfo(hVidPnTargetModeSet, pPinnedVidPnTargetModeInfo);
|
---|
1991 | }
|
---|
1992 |
|
---|
1993 | pInfo->pVidPnInterface->pfnReleaseTargetModeSet(pInfo->hVidPn, hVidPnTargetModeSet);
|
---|
1994 | }
|
---|
1995 | else
|
---|
1996 | LOGREL(("pfnAcquireTargetModeSet failed Status(0x%x)", Status));
|
---|
1997 |
|
---|
1998 | pInfo->Status = Status;
|
---|
1999 | return Status == STATUS_SUCCESS;
|
---|
2000 | }
|
---|
2001 |
|
---|
2002 | NTSTATUS vboxVidPnCommitSourceModeForSrcId(PVBOXMP_DEVEXT pDevExt, const D3DKMDT_HVIDPN hDesiredVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface, D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId, PVBOXWDDM_ALLOCATION pAllocation)
|
---|
2003 | {
|
---|
2004 | D3DKMDT_HVIDPNSOURCEMODESET hCurVidPnSourceModeSet;
|
---|
2005 | const DXGK_VIDPNSOURCEMODESET_INTERFACE *pCurVidPnSourceModeSetInterface;
|
---|
2006 |
|
---|
2007 | NTSTATUS Status = pVidPnInterface->pfnAcquireSourceModeSet(hDesiredVidPn,
|
---|
2008 | srcId,
|
---|
2009 | &hCurVidPnSourceModeSet,
|
---|
2010 | &pCurVidPnSourceModeSetInterface);
|
---|
2011 | Assert(Status == STATUS_SUCCESS);
|
---|
2012 | if (Status == STATUS_SUCCESS)
|
---|
2013 | {
|
---|
2014 | CONST D3DKMDT_VIDPN_SOURCE_MODE* pPinnedVidPnSourceModeInfo;
|
---|
2015 | Status = pCurVidPnSourceModeSetInterface->pfnAcquirePinnedModeInfo(hCurVidPnSourceModeSet, &pPinnedVidPnSourceModeInfo);
|
---|
2016 | Assert(Status == STATUS_SUCCESS || Status == STATUS_GRAPHICS_MODE_NOT_PINNED);
|
---|
2017 | if (Status == STATUS_SUCCESS)
|
---|
2018 | {
|
---|
2019 | Assert(pPinnedVidPnSourceModeInfo);
|
---|
2020 | Status = vboxVidPnCommitSourceMode(pDevExt, srcId, pPinnedVidPnSourceModeInfo, pAllocation);
|
---|
2021 | Assert(Status == STATUS_SUCCESS);
|
---|
2022 | if (Status == STATUS_SUCCESS)
|
---|
2023 | {
|
---|
2024 | D3DKMDT_HVIDPNTOPOLOGY hVidPnTopology;
|
---|
2025 | CONST DXGK_VIDPNTOPOLOGY_INTERFACE* pVidPnTopologyInterface;
|
---|
2026 | Status = pVidPnInterface->pfnGetTopology(hDesiredVidPn, &hVidPnTopology, &pVidPnTopologyInterface);
|
---|
2027 | Assert(Status == STATUS_SUCCESS);
|
---|
2028 | if (Status == STATUS_SUCCESS)
|
---|
2029 | {
|
---|
2030 | VBOXVIDPNCOMMITTARGETMODE TgtModeInfo = {0};
|
---|
2031 | TgtModeInfo.Status = STATUS_SUCCESS; /* <- to ensure we're succeeded if no targets are set */
|
---|
2032 | TgtModeInfo.hVidPn = hDesiredVidPn;
|
---|
2033 | TgtModeInfo.pVidPnInterface = pVidPnInterface;
|
---|
2034 | Status = vboxVidPnEnumTargetsForSource(pDevExt, hVidPnTopology, pVidPnTopologyInterface,
|
---|
2035 | srcId,
|
---|
2036 | vboxVidPnCommitTargetModeEnum, &TgtModeInfo);
|
---|
2037 | Assert(Status == STATUS_SUCCESS || Status == STATUS_GRAPHICS_SOURCE_NOT_IN_TOPOLOGY);
|
---|
2038 | if (Status == STATUS_SUCCESS)
|
---|
2039 | {
|
---|
2040 | Status = TgtModeInfo.Status;
|
---|
2041 | Assert(Status == STATUS_SUCCESS);
|
---|
2042 | }
|
---|
2043 | else if (Status == STATUS_GRAPHICS_SOURCE_NOT_IN_TOPOLOGY)
|
---|
2044 | {
|
---|
2045 | Status = STATUS_SUCCESS;
|
---|
2046 | }
|
---|
2047 | else
|
---|
2048 | LOGREL(("vboxVidPnEnumTargetsForSource failed Status(0x%x)", Status));
|
---|
2049 | }
|
---|
2050 | else
|
---|
2051 | LOGREL(("pfnGetTopology failed Status(0x%x)", Status));
|
---|
2052 | }
|
---|
2053 | else
|
---|
2054 | LOGREL(("vboxVidPnCommitSourceMode failed Status(0x%x)", Status));
|
---|
2055 | /* release */
|
---|
2056 | pCurVidPnSourceModeSetInterface->pfnReleaseModeInfo(hCurVidPnSourceModeSet, pPinnedVidPnSourceModeInfo);
|
---|
2057 | }
|
---|
2058 | else if (Status == STATUS_GRAPHICS_MODE_NOT_PINNED)
|
---|
2059 | {
|
---|
2060 | Status = vboxVidPnCommitSourceMode(pDevExt, srcId, NULL, pAllocation);
|
---|
2061 | Assert(Status == STATUS_SUCCESS);
|
---|
2062 | }
|
---|
2063 | else
|
---|
2064 | LOGREL(("pfnAcquirePinnedModeInfo failed Status(0x%x)", Status));
|
---|
2065 |
|
---|
2066 | pVidPnInterface->pfnReleaseSourceModeSet(hDesiredVidPn, hCurVidPnSourceModeSet);
|
---|
2067 | }
|
---|
2068 | else
|
---|
2069 | {
|
---|
2070 | LOGREL(("pfnAcquireSourceModeSet failed Status(0x%x)", Status));
|
---|
2071 | }
|
---|
2072 |
|
---|
2073 | return Status;
|
---|
2074 | }
|
---|
2075 |
|
---|
2076 | DECLCALLBACK(BOOLEAN) vboxVidPnCommitPathEnum(D3DKMDT_HVIDPNTOPOLOGY hVidPnTopology, const DXGK_VIDPNTOPOLOGY_INTERFACE* pVidPnTopologyInterface,
|
---|
2077 | const D3DKMDT_VIDPN_PRESENT_PATH *pVidPnPresentPathInfo, PVOID pContext)
|
---|
2078 | {
|
---|
2079 | NTSTATUS Status = STATUS_SUCCESS;
|
---|
2080 | PVBOXVIDPNCOMMIT pCommitInfo = (PVBOXVIDPNCOMMIT)pContext;
|
---|
2081 | PVBOXMP_DEVEXT pDevExt = pCommitInfo->pDevExt;
|
---|
2082 | const D3DKMDT_HVIDPN hDesiredVidPn = pCommitInfo->pCommitVidPnArg->hFunctionalVidPn;
|
---|
2083 | const DXGK_VIDPN_INTERFACE* pVidPnInterface = pCommitInfo->pVidPnInterface;
|
---|
2084 |
|
---|
2085 | if (pCommitInfo->pCommitVidPnArg->AffectedVidPnSourceId == D3DDDI_ID_ALL
|
---|
2086 | || pCommitInfo->pCommitVidPnArg->AffectedVidPnSourceId == pVidPnPresentPathInfo->VidPnSourceId)
|
---|
2087 | {
|
---|
2088 | Status = vboxVidPnCommitSourceModeForSrcId(pDevExt, hDesiredVidPn, pVidPnInterface, pVidPnPresentPathInfo->VidPnSourceId, (PVBOXWDDM_ALLOCATION)pCommitInfo->pCommitVidPnArg->hPrimaryAllocation);
|
---|
2089 | Assert(Status == STATUS_SUCCESS);
|
---|
2090 | if (Status != STATUS_SUCCESS)
|
---|
2091 | LOGREL(("vboxVidPnCommitSourceModeForSrcId failed Status(0x%x)", Status));
|
---|
2092 | }
|
---|
2093 |
|
---|
2094 | pCommitInfo->Status = Status;
|
---|
2095 | pVidPnTopologyInterface->pfnReleasePathInfo(hVidPnTopology, pVidPnPresentPathInfo);
|
---|
2096 | return Status == STATUS_SUCCESS;
|
---|
2097 | }
|
---|
2098 |
|
---|
2099 | #define VBOXVIDPNDUMP_STRCASE(_t) \
|
---|
2100 | case _t: return #_t;
|
---|
2101 | #define VBOXVIDPNDUMP_STRCASE_UNKNOWN() \
|
---|
2102 | default: Assert(0); return "Unknown";
|
---|
2103 |
|
---|
2104 | #define VBOXVIDPNDUMP_STRFLAGS(_v, _t) \
|
---|
2105 | if ((_v)._t return #_t;
|
---|
2106 |
|
---|
2107 | const char* vboxVidPnDumpStrImportance(D3DKMDT_VIDPN_PRESENT_PATH_IMPORTANCE ImportanceOrdinal)
|
---|
2108 | {
|
---|
2109 | switch (ImportanceOrdinal)
|
---|
2110 | {
|
---|
2111 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_VPPI_UNINITIALIZED);
|
---|
2112 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_VPPI_PRIMARY);
|
---|
2113 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_VPPI_SECONDARY);
|
---|
2114 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_VPPI_TERTIARY);
|
---|
2115 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_VPPI_QUATERNARY);
|
---|
2116 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_VPPI_QUINARY);
|
---|
2117 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_VPPI_SENARY);
|
---|
2118 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_VPPI_SEPTENARY);
|
---|
2119 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_VPPI_OCTONARY);
|
---|
2120 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_VPPI_NONARY);
|
---|
2121 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_VPPI_DENARY);
|
---|
2122 | VBOXVIDPNDUMP_STRCASE_UNKNOWN();
|
---|
2123 | }
|
---|
2124 | }
|
---|
2125 |
|
---|
2126 | const char* vboxVidPnDumpStrScaling(D3DKMDT_VIDPN_PRESENT_PATH_SCALING Scaling)
|
---|
2127 | {
|
---|
2128 | switch (Scaling)
|
---|
2129 | {
|
---|
2130 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_VPPS_UNINITIALIZED);
|
---|
2131 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_VPPS_IDENTITY);
|
---|
2132 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_VPPS_CENTERED);
|
---|
2133 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_VPPS_STRETCHED);
|
---|
2134 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_VPPS_UNPINNED);
|
---|
2135 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_VPPS_NOTSPECIFIED);
|
---|
2136 | VBOXVIDPNDUMP_STRCASE_UNKNOWN();
|
---|
2137 | }
|
---|
2138 | }
|
---|
2139 |
|
---|
2140 | const char* vboxVidPnDumpStrRotation(D3DKMDT_VIDPN_PRESENT_PATH_ROTATION Rotation)
|
---|
2141 | {
|
---|
2142 | switch (Rotation)
|
---|
2143 | {
|
---|
2144 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_VPPR_UNINITIALIZED);
|
---|
2145 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_VPPR_IDENTITY);
|
---|
2146 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_VPPR_ROTATE90);
|
---|
2147 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_VPPR_ROTATE180);
|
---|
2148 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_VPPR_ROTATE270);
|
---|
2149 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_VPPR_UNPINNED);
|
---|
2150 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_VPPR_NOTSPECIFIED);
|
---|
2151 | VBOXVIDPNDUMP_STRCASE_UNKNOWN();
|
---|
2152 | }
|
---|
2153 | }
|
---|
2154 |
|
---|
2155 | const char* vboxVidPnDumpStrColorBasis(const D3DKMDT_COLOR_BASIS ColorBasis)
|
---|
2156 | {
|
---|
2157 | switch (ColorBasis)
|
---|
2158 | {
|
---|
2159 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_CB_UNINITIALIZED);
|
---|
2160 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_CB_INTENSITY);
|
---|
2161 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_CB_SRGB);
|
---|
2162 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_CB_SCRGB);
|
---|
2163 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_CB_YCBCR);
|
---|
2164 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_CB_YPBPR);
|
---|
2165 | VBOXVIDPNDUMP_STRCASE_UNKNOWN();
|
---|
2166 | }
|
---|
2167 | }
|
---|
2168 |
|
---|
2169 | const char* vboxVidPnDumpStrPvam(D3DKMDT_PIXEL_VALUE_ACCESS_MODE PixelValueAccessMode)
|
---|
2170 | {
|
---|
2171 | switch (PixelValueAccessMode)
|
---|
2172 | {
|
---|
2173 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_PVAM_UNINITIALIZED);
|
---|
2174 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_PVAM_DIRECT);
|
---|
2175 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_PVAM_PRESETPALETTE);
|
---|
2176 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_PVAM_SETTABLEPALETTE);
|
---|
2177 | VBOXVIDPNDUMP_STRCASE_UNKNOWN();
|
---|
2178 | }
|
---|
2179 | }
|
---|
2180 |
|
---|
2181 |
|
---|
2182 |
|
---|
2183 | const char* vboxVidPnDumpStrContent(D3DKMDT_VIDPN_PRESENT_PATH_CONTENT Content)
|
---|
2184 | {
|
---|
2185 | switch (Content)
|
---|
2186 | {
|
---|
2187 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_VPPC_UNINITIALIZED);
|
---|
2188 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_VPPC_GRAPHICS);
|
---|
2189 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_VPPC_VIDEO);
|
---|
2190 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_VPPC_NOTSPECIFIED);
|
---|
2191 | VBOXVIDPNDUMP_STRCASE_UNKNOWN();
|
---|
2192 | }
|
---|
2193 | }
|
---|
2194 |
|
---|
2195 | const char* vboxVidPnDumpStrCopyProtectionType(D3DKMDT_VIDPN_PRESENT_PATH_COPYPROTECTION_TYPE CopyProtectionType)
|
---|
2196 | {
|
---|
2197 | switch (CopyProtectionType)
|
---|
2198 | {
|
---|
2199 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_VPPMT_UNINITIALIZED);
|
---|
2200 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_VPPMT_NOPROTECTION);
|
---|
2201 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_VPPMT_MACROVISION_APSTRIGGER);
|
---|
2202 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_VPPMT_MACROVISION_FULLSUPPORT);
|
---|
2203 | VBOXVIDPNDUMP_STRCASE_UNKNOWN();
|
---|
2204 | }
|
---|
2205 | }
|
---|
2206 |
|
---|
2207 | const char* vboxVidPnDumpStrGammaRampType(D3DDDI_GAMMARAMP_TYPE Type)
|
---|
2208 | {
|
---|
2209 | switch (Type)
|
---|
2210 | {
|
---|
2211 | VBOXVIDPNDUMP_STRCASE(D3DDDI_GAMMARAMP_UNINITIALIZED);
|
---|
2212 | VBOXVIDPNDUMP_STRCASE(D3DDDI_GAMMARAMP_DEFAULT);
|
---|
2213 | VBOXVIDPNDUMP_STRCASE(D3DDDI_GAMMARAMP_RGB256x3x16);
|
---|
2214 | VBOXVIDPNDUMP_STRCASE(D3DDDI_GAMMARAMP_DXGI_1);
|
---|
2215 | VBOXVIDPNDUMP_STRCASE_UNKNOWN();
|
---|
2216 | }
|
---|
2217 | }
|
---|
2218 |
|
---|
2219 | const char* vboxVidPnDumpStrSourceModeType(D3DKMDT_VIDPN_SOURCE_MODE_TYPE Type)
|
---|
2220 | {
|
---|
2221 | switch (Type)
|
---|
2222 | {
|
---|
2223 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_RMT_UNINITIALIZED);
|
---|
2224 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_RMT_GRAPHICS);
|
---|
2225 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_RMT_TEXT);
|
---|
2226 | VBOXVIDPNDUMP_STRCASE_UNKNOWN();
|
---|
2227 | }
|
---|
2228 | }
|
---|
2229 |
|
---|
2230 | const char* vboxVidPnDumpStrScanLineOrdering(D3DDDI_VIDEO_SIGNAL_SCANLINE_ORDERING ScanLineOrdering)
|
---|
2231 | {
|
---|
2232 | switch (ScanLineOrdering)
|
---|
2233 | {
|
---|
2234 | VBOXVIDPNDUMP_STRCASE(D3DDDI_VSSLO_UNINITIALIZED);
|
---|
2235 | VBOXVIDPNDUMP_STRCASE(D3DDDI_VSSLO_PROGRESSIVE);
|
---|
2236 | VBOXVIDPNDUMP_STRCASE(D3DDDI_VSSLO_INTERLACED_UPPERFIELDFIRST);
|
---|
2237 | VBOXVIDPNDUMP_STRCASE(D3DDDI_VSSLO_INTERLACED_LOWERFIELDFIRST);
|
---|
2238 | VBOXVIDPNDUMP_STRCASE(D3DDDI_VSSLO_OTHER);
|
---|
2239 | VBOXVIDPNDUMP_STRCASE_UNKNOWN();
|
---|
2240 | }
|
---|
2241 | }
|
---|
2242 |
|
---|
2243 | const char* vboxVidPnDumpStrCFMPivotType(D3DKMDT_ENUMCOFUNCMODALITY_PIVOT_TYPE EnumPivotType)
|
---|
2244 | {
|
---|
2245 | switch (EnumPivotType)
|
---|
2246 | {
|
---|
2247 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_EPT_UNINITIALIZED);
|
---|
2248 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_EPT_VIDPNSOURCE);
|
---|
2249 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_EPT_VIDPNTARGET);
|
---|
2250 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_EPT_SCALING);
|
---|
2251 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_EPT_ROTATION);
|
---|
2252 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_EPT_NOPIVOT);
|
---|
2253 | VBOXVIDPNDUMP_STRCASE_UNKNOWN();
|
---|
2254 | }
|
---|
2255 | }
|
---|
2256 |
|
---|
2257 | const char* vboxVidPnDumpStrModePreference(D3DKMDT_MODE_PREFERENCE Preference)
|
---|
2258 | {
|
---|
2259 | switch (Preference)
|
---|
2260 | {
|
---|
2261 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_MP_UNINITIALIZED);
|
---|
2262 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_MP_PREFERRED);
|
---|
2263 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_MP_NOTPREFERRED);
|
---|
2264 | VBOXVIDPNDUMP_STRCASE_UNKNOWN();
|
---|
2265 | }
|
---|
2266 | }
|
---|
2267 |
|
---|
2268 | const char* vboxVidPnDumpStrSignalStandard(D3DKMDT_VIDEO_SIGNAL_STANDARD VideoStandard)
|
---|
2269 | {
|
---|
2270 | switch (VideoStandard)
|
---|
2271 | {
|
---|
2272 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_VSS_UNINITIALIZED);
|
---|
2273 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_VSS_VESA_DMT);
|
---|
2274 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_VSS_VESA_GTF);
|
---|
2275 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_VSS_VESA_CVT);
|
---|
2276 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_VSS_IBM);
|
---|
2277 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_VSS_APPLE);
|
---|
2278 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_VSS_NTSC_M);
|
---|
2279 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_VSS_NTSC_J);
|
---|
2280 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_VSS_NTSC_443);
|
---|
2281 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_VSS_PAL_B);
|
---|
2282 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_VSS_PAL_B1);
|
---|
2283 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_VSS_PAL_G);
|
---|
2284 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_VSS_PAL_H);
|
---|
2285 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_VSS_PAL_I);
|
---|
2286 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_VSS_PAL_D);
|
---|
2287 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_VSS_PAL_N);
|
---|
2288 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_VSS_PAL_NC);
|
---|
2289 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_VSS_SECAM_B);
|
---|
2290 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_VSS_SECAM_D);
|
---|
2291 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_VSS_SECAM_G);
|
---|
2292 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_VSS_SECAM_H);
|
---|
2293 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_VSS_SECAM_K);
|
---|
2294 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_VSS_SECAM_K1);
|
---|
2295 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_VSS_SECAM_L);
|
---|
2296 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_VSS_SECAM_L1);
|
---|
2297 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_VSS_EIA_861);
|
---|
2298 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_VSS_EIA_861A);
|
---|
2299 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_VSS_EIA_861B);
|
---|
2300 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_VSS_PAL_K);
|
---|
2301 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_VSS_PAL_K1);
|
---|
2302 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_VSS_PAL_L);
|
---|
2303 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_VSS_PAL_M);
|
---|
2304 | VBOXVIDPNDUMP_STRCASE(D3DKMDT_VSS_OTHER);
|
---|
2305 | VBOXVIDPNDUMP_STRCASE_UNKNOWN();
|
---|
2306 | }
|
---|
2307 | }
|
---|
2308 |
|
---|
2309 | const char* vboxVidPnDumpStrPixFormat(D3DDDIFORMAT PixelFormat)
|
---|
2310 | {
|
---|
2311 | switch (PixelFormat)
|
---|
2312 | {
|
---|
2313 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_UNKNOWN);
|
---|
2314 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_R8G8B8);
|
---|
2315 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_A8R8G8B8);
|
---|
2316 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_X8R8G8B8);
|
---|
2317 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_R5G6B5);
|
---|
2318 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_X1R5G5B5);
|
---|
2319 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_A1R5G5B5);
|
---|
2320 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_A4R4G4B4);
|
---|
2321 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_R3G3B2);
|
---|
2322 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_A8);
|
---|
2323 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_A8R3G3B2);
|
---|
2324 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_X4R4G4B4);
|
---|
2325 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_A2B10G10R10);
|
---|
2326 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_A8B8G8R8);
|
---|
2327 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_X8B8G8R8);
|
---|
2328 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_G16R16);
|
---|
2329 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_A2R10G10B10);
|
---|
2330 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_A16B16G16R16);
|
---|
2331 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_A8P8);
|
---|
2332 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_R32F);
|
---|
2333 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_G32R32F);
|
---|
2334 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_A32B32G32R32F);
|
---|
2335 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_CxV8U8);
|
---|
2336 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_A1);
|
---|
2337 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_BINARYBUFFER);
|
---|
2338 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_VERTEXDATA);
|
---|
2339 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_INDEX16);
|
---|
2340 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_INDEX32);
|
---|
2341 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_Q16W16V16U16);
|
---|
2342 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_MULTI2_ARGB8);
|
---|
2343 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_R16F);
|
---|
2344 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_G16R16F);
|
---|
2345 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_A16B16G16R16F);
|
---|
2346 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_D32F_LOCKABLE);
|
---|
2347 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_D24FS8);
|
---|
2348 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_D32_LOCKABLE);
|
---|
2349 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_S8_LOCKABLE);
|
---|
2350 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_S1D15);
|
---|
2351 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_S8D24);
|
---|
2352 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_X8D24);
|
---|
2353 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_X4S4D24);
|
---|
2354 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_L16);
|
---|
2355 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_UYVY);
|
---|
2356 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_R8G8_B8G8);
|
---|
2357 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_YUY2);
|
---|
2358 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_G8R8_G8B8);
|
---|
2359 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_DXT1);
|
---|
2360 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_DXT2);
|
---|
2361 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_DXT3);
|
---|
2362 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_DXT4);
|
---|
2363 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_DXT5);
|
---|
2364 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_D16_LOCKABLE);
|
---|
2365 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_D32);
|
---|
2366 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_D15S1);
|
---|
2367 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_D24S8);
|
---|
2368 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_D24X8);
|
---|
2369 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_D24X4S4);
|
---|
2370 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_D16);
|
---|
2371 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_P8);
|
---|
2372 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_L8);
|
---|
2373 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_A8L8);
|
---|
2374 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_A4L4);
|
---|
2375 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_V8U8);
|
---|
2376 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_L6V5U5);
|
---|
2377 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_X8L8V8U8);
|
---|
2378 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_Q8W8V8U8);
|
---|
2379 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_V16U16);
|
---|
2380 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_W11V11U10);
|
---|
2381 | VBOXVIDPNDUMP_STRCASE(D3DDDIFMT_A2W10V10U10);
|
---|
2382 | VBOXVIDPNDUMP_STRCASE_UNKNOWN();
|
---|
2383 | }
|
---|
2384 | }
|
---|
2385 |
|
---|
2386 | void vboxVidPnDumpCopyProtectoin(const char *pPrefix, const D3DKMDT_VIDPN_PRESENT_PATH_COPYPROTECTION *pCopyProtection, const char *pSuffix)
|
---|
2387 | {
|
---|
2388 | LOGREL(("%sType(%s), TODO%s", pPrefix,
|
---|
2389 | vboxVidPnDumpStrCopyProtectionType(pCopyProtection->CopyProtectionType), pSuffix));
|
---|
2390 | }
|
---|
2391 |
|
---|
2392 |
|
---|
2393 | void vboxVidPnDumpPathTransformation(const D3DKMDT_VIDPN_PRESENT_PATH_TRANSFORMATION *pContentTransformation)
|
---|
2394 | {
|
---|
2395 | LOGREL((" --Transformation: Scaling(%s), ScalingSupport(%d), Rotation(%s), RotationSupport(%d)--",
|
---|
2396 | vboxVidPnDumpStrScaling(pContentTransformation->Scaling), pContentTransformation->ScalingSupport,
|
---|
2397 | vboxVidPnDumpStrRotation(pContentTransformation->Rotation), pContentTransformation->RotationSupport));
|
---|
2398 | }
|
---|
2399 |
|
---|
2400 | void vboxVidPnDumpRegion(const char *pPrefix, const D3DKMDT_2DREGION *pRegion, const char *pSuffix)
|
---|
2401 | {
|
---|
2402 | LOGREL(("%s%dX%d%s", pPrefix, pRegion->cx, pRegion->cy, pSuffix));
|
---|
2403 | }
|
---|
2404 |
|
---|
2405 | void vboxVidPnDumpRational(const char *pPrefix, const D3DDDI_RATIONAL *pRational, const char *pSuffix)
|
---|
2406 | {
|
---|
2407 | LOGREL(("%s%d/%d=%d%s", pPrefix, pRational->Numerator, pRational->Denominator, pRational->Numerator/pRational->Denominator, pSuffix));
|
---|
2408 | }
|
---|
2409 |
|
---|
2410 | void vboxVidPnDumpRanges(const char *pPrefix, const D3DKMDT_COLOR_COEFF_DYNAMIC_RANGES *pDynamicRanges, const char *pSuffix)
|
---|
2411 | {
|
---|
2412 | LOGREL(("%sFirstChannel(%d), SecondChannel(%d), ThirdChannel(%d), FourthChannel(%d)%s", pPrefix,
|
---|
2413 | pDynamicRanges->FirstChannel,
|
---|
2414 | pDynamicRanges->SecondChannel,
|
---|
2415 | pDynamicRanges->ThirdChannel,
|
---|
2416 | pDynamicRanges->FourthChannel,
|
---|
2417 | pSuffix));
|
---|
2418 | }
|
---|
2419 |
|
---|
2420 | void vboxVidPnDumpGammaRamp(const char *pPrefix, const D3DKMDT_GAMMA_RAMP *pGammaRamp, const char *pSuffix)
|
---|
2421 | {
|
---|
2422 | LOGREL(("%sType(%s), DataSize(%d), TODO: dump the rest%s", pPrefix,
|
---|
2423 | vboxVidPnDumpStrGammaRampType(pGammaRamp->Type), pGammaRamp->DataSize,
|
---|
2424 | pSuffix));
|
---|
2425 | }
|
---|
2426 |
|
---|
2427 | void vboxVidPnDumpSourceMode(const char *pPrefix, const D3DKMDT_VIDPN_SOURCE_MODE* pVidPnSourceModeInfo, const char *pSuffix)
|
---|
2428 | {
|
---|
2429 | LOGREL(("%sType(%s), ", pPrefix, vboxVidPnDumpStrSourceModeType(pVidPnSourceModeInfo->Type)));
|
---|
2430 | vboxVidPnDumpRegion("surf(", &pVidPnSourceModeInfo->Format.Graphics.PrimSurfSize, "), ");
|
---|
2431 | vboxVidPnDumpRegion("vis(", &pVidPnSourceModeInfo->Format.Graphics.VisibleRegionSize, "), ");
|
---|
2432 | LOGREL(("stride(%d), ", pVidPnSourceModeInfo->Format.Graphics.Stride));
|
---|
2433 | LOGREL(("format(%s), ", vboxVidPnDumpStrPixFormat(pVidPnSourceModeInfo->Format.Graphics.PixelFormat)));
|
---|
2434 | LOGREL(("clrBasis(%s), ", vboxVidPnDumpStrColorBasis(pVidPnSourceModeInfo->Format.Graphics.ColorBasis)));
|
---|
2435 | LOGREL(("pvam(%s)%s", vboxVidPnDumpStrPvam(pVidPnSourceModeInfo->Format.Graphics.PixelValueAccessMode), pSuffix));
|
---|
2436 | }
|
---|
2437 |
|
---|
2438 | void vboxVidPnDumpSignalInfo(const char *pPrefix, const D3DKMDT_VIDEO_SIGNAL_INFO *pVideoSignalInfo, const char *pSuffix)
|
---|
2439 | {
|
---|
2440 | LOGREL(("%sVStd(%s), ", pPrefix, vboxVidPnDumpStrSignalStandard(pVideoSignalInfo->VideoStandard)));
|
---|
2441 | vboxVidPnDumpRegion("totSize(", &pVideoSignalInfo->TotalSize, "), ");
|
---|
2442 | vboxVidPnDumpRegion("activeSize(", &pVideoSignalInfo->ActiveSize, "), ");
|
---|
2443 | vboxVidPnDumpRational("VSynch(", &pVideoSignalInfo->VSyncFreq, "), ");
|
---|
2444 | LOGREL(("PixelRate(%d), ScanLineOrdering(%s)%s", pVideoSignalInfo->PixelRate, vboxVidPnDumpStrScanLineOrdering(pVideoSignalInfo->ScanLineOrdering), pSuffix));
|
---|
2445 | }
|
---|
2446 |
|
---|
2447 | void vboxVidPnDumpTargetMode(const char *pPrefix, const D3DKMDT_VIDPN_TARGET_MODE* CONST pVidPnTargetModeInfo, const char *pSuffix)
|
---|
2448 | {
|
---|
2449 | LOGREL(("%s", pPrefix));
|
---|
2450 | vboxVidPnDumpSignalInfo("VSI: ", &pVidPnTargetModeInfo->VideoSignalInfo, ", ");
|
---|
2451 | LOGREL(("Preference(%s)%s", vboxVidPnDumpStrModePreference(pVidPnTargetModeInfo->Preference), pSuffix));
|
---|
2452 | }
|
---|
2453 |
|
---|
2454 | void vboxVidPnDumpPinnedSourceMode(const D3DKMDT_HVIDPN hVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface, D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId)
|
---|
2455 | {
|
---|
2456 | D3DKMDT_HVIDPNSOURCEMODESET hCurVidPnSourceModeSet;
|
---|
2457 | const DXGK_VIDPNSOURCEMODESET_INTERFACE *pCurVidPnSourceModeSetInterface;
|
---|
2458 |
|
---|
2459 | NTSTATUS Status = pVidPnInterface->pfnAcquireSourceModeSet(hVidPn,
|
---|
2460 | VidPnSourceId,
|
---|
2461 | &hCurVidPnSourceModeSet,
|
---|
2462 | &pCurVidPnSourceModeSetInterface);
|
---|
2463 | Assert(Status == STATUS_SUCCESS);
|
---|
2464 | if (Status == STATUS_SUCCESS)
|
---|
2465 | {
|
---|
2466 | CONST D3DKMDT_VIDPN_SOURCE_MODE* pPinnedVidPnSourceModeInfo;
|
---|
2467 |
|
---|
2468 | Status = pCurVidPnSourceModeSetInterface->pfnAcquirePinnedModeInfo(hCurVidPnSourceModeSet, &pPinnedVidPnSourceModeInfo);
|
---|
2469 | Assert(Status == STATUS_SUCCESS || Status == STATUS_GRAPHICS_MODE_NOT_PINNED);
|
---|
2470 | if (Status == STATUS_SUCCESS)
|
---|
2471 | {
|
---|
2472 | vboxVidPnDumpSourceMode("Source Pinned: ", pPinnedVidPnSourceModeInfo, "\n");
|
---|
2473 | pCurVidPnSourceModeSetInterface->pfnReleaseModeInfo(hCurVidPnSourceModeSet, pPinnedVidPnSourceModeInfo);
|
---|
2474 | }
|
---|
2475 | else if (Status == STATUS_GRAPHICS_MODE_NOT_PINNED)
|
---|
2476 | {
|
---|
2477 | LOGREL(("Source NOT Pinned"));
|
---|
2478 | }
|
---|
2479 | else
|
---|
2480 | {
|
---|
2481 | LOGREL(("ERROR getting piined Source Mode(0x%x)", Status));
|
---|
2482 | }
|
---|
2483 | pVidPnInterface->pfnReleaseSourceModeSet(hVidPn, hCurVidPnSourceModeSet);
|
---|
2484 | }
|
---|
2485 | else
|
---|
2486 | {
|
---|
2487 | LOGREL(("ERROR getting SourceModeSet(0x%x)", Status));
|
---|
2488 | }
|
---|
2489 | }
|
---|
2490 |
|
---|
2491 |
|
---|
2492 | static DECLCALLBACK(BOOLEAN) vboxVidPnDumpSourceModeSetEnum(D3DKMDT_HVIDPNSOURCEMODESET hNewVidPnSourceModeSet, const DXGK_VIDPNSOURCEMODESET_INTERFACE *pVidPnSourceModeSetInterface,
|
---|
2493 | const D3DKMDT_VIDPN_SOURCE_MODE *pNewVidPnSourceModeInfo, PVOID pContext)
|
---|
2494 | {
|
---|
2495 | vboxVidPnDumpSourceMode("SourceMode: ", pNewVidPnSourceModeInfo, "\n");
|
---|
2496 | return TRUE;
|
---|
2497 | }
|
---|
2498 |
|
---|
2499 | void vboxVidPnDumpSourceModeSet(PVBOXMP_DEVEXT pDevExt, const D3DKMDT_HVIDPN hVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface, D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId)
|
---|
2500 | {
|
---|
2501 | LOGREL((" >>>+++SourceMode Set for Source(%d)+++", VidPnSourceId));
|
---|
2502 | D3DKMDT_HVIDPNSOURCEMODESET hCurVidPnSourceModeSet;
|
---|
2503 | const DXGK_VIDPNSOURCEMODESET_INTERFACE *pCurVidPnSourceModeSetInterface;
|
---|
2504 |
|
---|
2505 | NTSTATUS Status = pVidPnInterface->pfnAcquireSourceModeSet(hVidPn,
|
---|
2506 | VidPnSourceId,
|
---|
2507 | &hCurVidPnSourceModeSet,
|
---|
2508 | &pCurVidPnSourceModeSetInterface);
|
---|
2509 | Assert(Status == STATUS_SUCCESS);
|
---|
2510 | if (Status == STATUS_SUCCESS)
|
---|
2511 | {
|
---|
2512 |
|
---|
2513 | Status = vboxVidPnEnumSourceModes(hCurVidPnSourceModeSet, pCurVidPnSourceModeSetInterface,
|
---|
2514 | vboxVidPnDumpSourceModeSetEnum, NULL);
|
---|
2515 | Assert(Status == STATUS_SUCCESS);
|
---|
2516 | if (Status != STATUS_SUCCESS)
|
---|
2517 | {
|
---|
2518 | LOGREL(("ERROR enumerating Source Modes(0x%x)", Status));
|
---|
2519 | }
|
---|
2520 | pVidPnInterface->pfnReleaseSourceModeSet(hVidPn, hCurVidPnSourceModeSet);
|
---|
2521 | }
|
---|
2522 | else
|
---|
2523 | {
|
---|
2524 | LOGREL(("ERROR getting SourceModeSet for Source(%d), Status(0x%x)", VidPnSourceId, Status));
|
---|
2525 | }
|
---|
2526 |
|
---|
2527 | LOGREL((" <<<+++End Of SourceMode Set for Source(%d)+++", VidPnSourceId));
|
---|
2528 | }
|
---|
2529 |
|
---|
2530 | DECLCALLBACK(BOOLEAN) vboxVidPnDumpTargetModeSetEnum(D3DKMDT_HVIDPNTARGETMODESET hNewVidPnTargetModeSet, const DXGK_VIDPNTARGETMODESET_INTERFACE *pVidPnTargetModeSetInterface,
|
---|
2531 | const D3DKMDT_VIDPN_TARGET_MODE *pNewVidPnTargetModeInfo, PVOID pContext)
|
---|
2532 | {
|
---|
2533 | vboxVidPnDumpTargetMode("TargetMode: ", pNewVidPnTargetModeInfo, "\n");
|
---|
2534 | return TRUE;
|
---|
2535 | }
|
---|
2536 |
|
---|
2537 | void vboxVidPnDumpTargetModeSet(PVBOXMP_DEVEXT pDevExt, const D3DKMDT_HVIDPN hVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface, D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId)
|
---|
2538 | {
|
---|
2539 | LOGREL((" >>>---TargetMode Set for Target(%d)---", VidPnTargetId));
|
---|
2540 | D3DKMDT_HVIDPNTARGETMODESET hCurVidPnTargetModeSet;
|
---|
2541 | const DXGK_VIDPNTARGETMODESET_INTERFACE *pCurVidPnTargetModeSetInterface;
|
---|
2542 |
|
---|
2543 | NTSTATUS Status = pVidPnInterface->pfnAcquireTargetModeSet(hVidPn,
|
---|
2544 | VidPnTargetId,
|
---|
2545 | &hCurVidPnTargetModeSet,
|
---|
2546 | &pCurVidPnTargetModeSetInterface);
|
---|
2547 | Assert(Status == STATUS_SUCCESS);
|
---|
2548 | if (Status == STATUS_SUCCESS)
|
---|
2549 | {
|
---|
2550 |
|
---|
2551 | Status = vboxVidPnEnumTargetModes(hCurVidPnTargetModeSet, pCurVidPnTargetModeSetInterface,
|
---|
2552 | vboxVidPnDumpTargetModeSetEnum, NULL);
|
---|
2553 | Assert(Status == STATUS_SUCCESS);
|
---|
2554 | if (Status != STATUS_SUCCESS)
|
---|
2555 | {
|
---|
2556 | LOGREL(("ERROR enumerating Target Modes(0x%x)", Status));
|
---|
2557 | }
|
---|
2558 | pVidPnInterface->pfnReleaseTargetModeSet(hVidPn, hCurVidPnTargetModeSet);
|
---|
2559 | }
|
---|
2560 | else
|
---|
2561 | {
|
---|
2562 | LOGREL(("ERROR getting TargetModeSet for Target(%d), Status(0x%x)", VidPnTargetId, Status));
|
---|
2563 | }
|
---|
2564 |
|
---|
2565 | LOGREL((" <<<---End Of TargetMode Set for Target(%d)---", VidPnTargetId));
|
---|
2566 | }
|
---|
2567 |
|
---|
2568 |
|
---|
2569 | void vboxVidPnDumpPinnedTargetMode(const D3DKMDT_HVIDPN hVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface, D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId)
|
---|
2570 | {
|
---|
2571 | D3DKMDT_HVIDPNTARGETMODESET hCurVidPnTargetModeSet;
|
---|
2572 | const DXGK_VIDPNTARGETMODESET_INTERFACE *pCurVidPnTargetModeSetInterface;
|
---|
2573 |
|
---|
2574 | NTSTATUS Status = pVidPnInterface->pfnAcquireTargetModeSet(hVidPn,
|
---|
2575 | VidPnTargetId,
|
---|
2576 | &hCurVidPnTargetModeSet,
|
---|
2577 | &pCurVidPnTargetModeSetInterface);
|
---|
2578 | Assert(Status == STATUS_SUCCESS);
|
---|
2579 | if (Status == STATUS_SUCCESS)
|
---|
2580 | {
|
---|
2581 | CONST D3DKMDT_VIDPN_TARGET_MODE* pPinnedVidPnTargetModeInfo;
|
---|
2582 |
|
---|
2583 | Status = pCurVidPnTargetModeSetInterface->pfnAcquirePinnedModeInfo(hCurVidPnTargetModeSet, &pPinnedVidPnTargetModeInfo);
|
---|
2584 | Assert(Status == STATUS_SUCCESS || Status == STATUS_GRAPHICS_MODE_NOT_PINNED);
|
---|
2585 | if (Status == STATUS_SUCCESS)
|
---|
2586 | {
|
---|
2587 | vboxVidPnDumpTargetMode("Target Pinned: ", pPinnedVidPnTargetModeInfo, "\n");
|
---|
2588 | pCurVidPnTargetModeSetInterface->pfnReleaseModeInfo(hCurVidPnTargetModeSet, pPinnedVidPnTargetModeInfo);
|
---|
2589 | }
|
---|
2590 | else if (Status == STATUS_GRAPHICS_MODE_NOT_PINNED)
|
---|
2591 | {
|
---|
2592 | LOGREL(("Target NOT Pinned"));
|
---|
2593 | }
|
---|
2594 | else
|
---|
2595 | {
|
---|
2596 | LOGREL(("ERROR getting piined Target Mode(0x%x)", Status));
|
---|
2597 | }
|
---|
2598 | pVidPnInterface->pfnReleaseTargetModeSet(hVidPn, hCurVidPnTargetModeSet);
|
---|
2599 | }
|
---|
2600 | else
|
---|
2601 | {
|
---|
2602 | LOGREL(("ERROR getting TargetModeSet(0x%x)", Status));
|
---|
2603 | }
|
---|
2604 | }
|
---|
2605 |
|
---|
2606 | void vboxVidPnDumpCofuncModalityArg(const char *pPrefix, CONST DXGKARG_ENUMVIDPNCOFUNCMODALITY* CONST pEnumCofuncModalityArg, const char *pSuffix)
|
---|
2607 | {
|
---|
2608 | LOGREL(("%sPivotType(%s), SourceId(0x%x), TargetId(0x%x),%s", pPrefix, vboxVidPnDumpStrCFMPivotType(pEnumCofuncModalityArg->EnumPivotType),
|
---|
2609 | pEnumCofuncModalityArg->EnumPivot.VidPnSourceId, pEnumCofuncModalityArg->EnumPivot.VidPnTargetId, pSuffix));
|
---|
2610 | }
|
---|
2611 |
|
---|
2612 | void vboxVidPnDumpPath(const D3DKMDT_HVIDPN hVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface, const D3DKMDT_VIDPN_PRESENT_PATH *pVidPnPresentPathInfo)
|
---|
2613 | {
|
---|
2614 | LOGREL((" >>**** Start Dump VidPn Path ****>>"));
|
---|
2615 | LOGREL(("VidPnSourceId(%d), VidPnTargetId(%d)",
|
---|
2616 | pVidPnPresentPathInfo->VidPnSourceId, pVidPnPresentPathInfo->VidPnTargetId));
|
---|
2617 |
|
---|
2618 | vboxVidPnDumpPinnedSourceMode(hVidPn, pVidPnInterface, pVidPnPresentPathInfo->VidPnSourceId);
|
---|
2619 | vboxVidPnDumpPinnedTargetMode(hVidPn, pVidPnInterface, pVidPnPresentPathInfo->VidPnTargetId);
|
---|
2620 |
|
---|
2621 | vboxVidPnDumpPathTransformation(&pVidPnPresentPathInfo->ContentTransformation);
|
---|
2622 |
|
---|
2623 | LOGREL(("Importance(%s), TargetColorBasis(%s), Content(%s), ",
|
---|
2624 | vboxVidPnDumpStrImportance(pVidPnPresentPathInfo->ImportanceOrdinal),
|
---|
2625 | vboxVidPnDumpStrColorBasis(pVidPnPresentPathInfo->VidPnTargetColorBasis),
|
---|
2626 | vboxVidPnDumpStrContent(pVidPnPresentPathInfo->Content)));
|
---|
2627 | vboxVidPnDumpRegion("VFA_TL_O(", &pVidPnPresentPathInfo->VisibleFromActiveTLOffset, "), ");
|
---|
2628 | vboxVidPnDumpRegion("VFA_BR_O(", &pVidPnPresentPathInfo->VisibleFromActiveBROffset, "), ");
|
---|
2629 | vboxVidPnDumpRanges("CCDynamicRanges: ", &pVidPnPresentPathInfo->VidPnTargetColorCoeffDynamicRanges, "| ");
|
---|
2630 | vboxVidPnDumpCopyProtectoin("CProtection: ", &pVidPnPresentPathInfo->CopyProtection, "| ");
|
---|
2631 | vboxVidPnDumpGammaRamp("GammaRamp: ", &pVidPnPresentPathInfo->GammaRamp, "\n");
|
---|
2632 |
|
---|
2633 | LOGREL((" <<**** Stop Dump VidPn Path ****<<"));
|
---|
2634 | }
|
---|
2635 |
|
---|
2636 | typedef struct VBOXVIDPNDUMPPATHENUM
|
---|
2637 | {
|
---|
2638 | D3DKMDT_HVIDPN hVidPn;
|
---|
2639 | const DXGK_VIDPN_INTERFACE* pVidPnInterface;
|
---|
2640 | } VBOXVIDPNDUMPPATHENUM, *PVBOXVIDPNDUMPPATHENUM;
|
---|
2641 |
|
---|
2642 | static DECLCALLBACK(BOOLEAN) vboxVidPnDumpPathEnum(D3DKMDT_HVIDPNTOPOLOGY hVidPnTopology, const DXGK_VIDPNTOPOLOGY_INTERFACE* pVidPnTopologyInterface,
|
---|
2643 | const D3DKMDT_VIDPN_PRESENT_PATH *pVidPnPresentPathInfo, PVOID pContext)
|
---|
2644 | {
|
---|
2645 | PVBOXVIDPNDUMPPATHENUM pData = (PVBOXVIDPNDUMPPATHENUM)pContext;
|
---|
2646 | vboxVidPnDumpPath(pData->hVidPn, pData->pVidPnInterface, pVidPnPresentPathInfo);
|
---|
2647 |
|
---|
2648 | pVidPnTopologyInterface->pfnReleasePathInfo(hVidPnTopology, pVidPnPresentPathInfo);
|
---|
2649 | return TRUE;
|
---|
2650 | }
|
---|
2651 |
|
---|
2652 | void vboxVidPnDumpVidPn(const char * pPrefix, PVBOXMP_DEVEXT pDevExt, D3DKMDT_HVIDPN hVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface, const char * pSuffix)
|
---|
2653 | {
|
---|
2654 | LOGREL(("%s", pPrefix));
|
---|
2655 |
|
---|
2656 | VBOXVIDPNDUMPPATHENUM CbData;
|
---|
2657 | CbData.hVidPn = hVidPn;
|
---|
2658 | CbData.pVidPnInterface = pVidPnInterface;
|
---|
2659 | D3DKMDT_HVIDPNTOPOLOGY hVidPnTopology;
|
---|
2660 | const DXGK_VIDPNTOPOLOGY_INTERFACE* pVidPnTopologyInterface;
|
---|
2661 | NTSTATUS Status = pVidPnInterface->pfnGetTopology(hVidPn, &hVidPnTopology, &pVidPnTopologyInterface);
|
---|
2662 | Assert(Status == STATUS_SUCCESS);
|
---|
2663 | if (Status == STATUS_SUCCESS)
|
---|
2664 | {
|
---|
2665 | Status = vboxVidPnEnumPaths(hVidPnTopology, pVidPnTopologyInterface,
|
---|
2666 | vboxVidPnDumpPathEnum, &CbData);
|
---|
2667 | Assert(Status == STATUS_SUCCESS);
|
---|
2668 | }
|
---|
2669 |
|
---|
2670 | for (int i = 0; i < VBoxCommonFromDeviceExt(pDevExt)->cDisplays; ++i)
|
---|
2671 | {
|
---|
2672 | vboxVidPnDumpSourceModeSet(pDevExt, hVidPn, pVidPnInterface, (D3DDDI_VIDEO_PRESENT_SOURCE_ID)i);
|
---|
2673 | vboxVidPnDumpTargetModeSet(pDevExt, hVidPn, pVidPnInterface, (D3DDDI_VIDEO_PRESENT_TARGET_ID)i);
|
---|
2674 | }
|
---|
2675 |
|
---|
2676 | LOGREL(("%s", pSuffix));
|
---|
2677 | }
|
---|