1 | /*
|
---|
2 | * Copyright (C) 2010 Oracle Corporation
|
---|
3 | *
|
---|
4 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
5 | * available from http://www.virtualbox.org. This file is free software;
|
---|
6 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
7 | * General Public License (GPL) as published by the Free Software
|
---|
8 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
9 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
10 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
11 | */
|
---|
12 | #include "../VBoxVideo.h"
|
---|
13 | #include "../Helper.h"
|
---|
14 |
|
---|
15 | NTSTATUS vboxVidPnCheckTopology(const D3DKMDT_HVIDPN hDesiredVidPn,
|
---|
16 | D3DKMDT_HVIDPNTOPOLOGY hVidPnTopology, const DXGK_VIDPNTOPOLOGY_INTERFACE* pVidPnTopologyInterface,
|
---|
17 | BOOLEAN *pbSupported)
|
---|
18 | {
|
---|
19 | const D3DKMDT_VIDPN_PRESENT_PATH *pNewVidPnPresentPathInfo = NULL;
|
---|
20 | NTSTATUS Status = pVidPnTopologyInterface->pfnAcquireFirstPathInfo(hVidPnTopology, &pNewVidPnPresentPathInfo);
|
---|
21 | BOOLEAN bSupported = TRUE;
|
---|
22 |
|
---|
23 | if (Status == STATUS_SUCCESS)
|
---|
24 | {
|
---|
25 | while (1)
|
---|
26 | {
|
---|
27 | /* @todo: which paths do we support? no matter for now
|
---|
28 | pNewVidPnPresentPathInfo->VidPnSourceId
|
---|
29 | pNewVidPnPresentPathInfo->VidPnTargetId
|
---|
30 |
|
---|
31 | ImportanceOrdinal does not matter for now
|
---|
32 | pNewVidPnPresentPathInfo->ImportanceOrdinal
|
---|
33 | */
|
---|
34 |
|
---|
35 | if (pNewVidPnPresentPathInfo->ContentTransformation.Scaling != D3DKMDT_VPPS_UNPINNED
|
---|
36 | && pNewVidPnPresentPathInfo->ContentTransformation.Scaling != D3DKMDT_VPPS_IDENTITY
|
---|
37 | && pNewVidPnPresentPathInfo->ContentTransformation.Scaling != D3DKMDT_VPPS_CENTERED
|
---|
38 | && pNewVidPnPresentPathInfo->ContentTransformation.Scaling != D3DKMDT_VPPS_NOTSPECIFIED)
|
---|
39 | {
|
---|
40 | dprintf(("unsupported Scaling (%d)\n", pNewVidPnPresentPathInfo->ContentTransformation.Scaling));
|
---|
41 | AssertBreakpoint();
|
---|
42 | bSupported = FALSE;
|
---|
43 | break;
|
---|
44 | }
|
---|
45 |
|
---|
46 | if (pNewVidPnPresentPathInfo->ContentTransformation.ScalingSupport.Stretched)
|
---|
47 | {
|
---|
48 | dprintf(("unsupported Scaling support (Stretched)\n"));
|
---|
49 | AssertBreakpoint();
|
---|
50 | bSupported = FALSE;
|
---|
51 | break;
|
---|
52 | }
|
---|
53 |
|
---|
54 | if (!pNewVidPnPresentPathInfo->ContentTransformation.ScalingSupport.Identity
|
---|
55 | && !pNewVidPnPresentPathInfo->ContentTransformation.ScalingSupport.Centered)
|
---|
56 | {
|
---|
57 | dprintf(("\"Identity\" or \"Centered\" Scaling support not set\n"));
|
---|
58 | AssertBreakpoint();
|
---|
59 | bSupported = FALSE;
|
---|
60 | break;
|
---|
61 | }
|
---|
62 |
|
---|
63 | if (pNewVidPnPresentPathInfo->ContentTransformation.Rotation != D3DKMDT_VPPR_UNPINNED
|
---|
64 | && pNewVidPnPresentPathInfo->ContentTransformation.Rotation != D3DKMDT_VPPR_IDENTITY)
|
---|
65 | {
|
---|
66 | dprintf(("unsupported rotation (%d)\n", pNewVidPnPresentPathInfo->ContentTransformation.Rotation));
|
---|
67 | AssertBreakpoint();
|
---|
68 | bSupported = FALSE;
|
---|
69 | break;
|
---|
70 | }
|
---|
71 |
|
---|
72 | if (pNewVidPnPresentPathInfo->ContentTransformation.RotationSupport.Rotate180
|
---|
73 | || pNewVidPnPresentPathInfo->ContentTransformation.RotationSupport.Rotate270
|
---|
74 | || pNewVidPnPresentPathInfo->ContentTransformation.RotationSupport.Rotate90)
|
---|
75 | {
|
---|
76 | dprintf(("unsupported RotationSupport\n"));
|
---|
77 | AssertBreakpoint();
|
---|
78 | bSupported = FALSE;
|
---|
79 | break;
|
---|
80 | }
|
---|
81 |
|
---|
82 | if (!pNewVidPnPresentPathInfo->ContentTransformation.RotationSupport.Identity)
|
---|
83 | {
|
---|
84 | dprintf(("\"Identity\" RotationSupport not set\n"));
|
---|
85 | AssertBreakpoint();
|
---|
86 | bSupported = FALSE;
|
---|
87 | break;
|
---|
88 | }
|
---|
89 |
|
---|
90 | if (pNewVidPnPresentPathInfo->VisibleFromActiveTLOffset.cx
|
---|
91 | || pNewVidPnPresentPathInfo->VisibleFromActiveTLOffset.cy)
|
---|
92 | {
|
---|
93 | dprintf(("Non-zero TLOffset: cx(%d), cy(%d)\n",
|
---|
94 | pNewVidPnPresentPathInfo->VisibleFromActiveTLOffset.cx,
|
---|
95 | pNewVidPnPresentPathInfo->VisibleFromActiveTLOffset.cy));
|
---|
96 | AssertBreakpoint();
|
---|
97 | bSupported = FALSE;
|
---|
98 | break;
|
---|
99 | }
|
---|
100 |
|
---|
101 | if (pNewVidPnPresentPathInfo->VisibleFromActiveBROffset.cx
|
---|
102 | || pNewVidPnPresentPathInfo->VisibleFromActiveBROffset.cy)
|
---|
103 | {
|
---|
104 | dprintf(("Non-zero TLOffset: cx(%d), cy(%d)\n",
|
---|
105 | pNewVidPnPresentPathInfo->VisibleFromActiveBROffset.cx,
|
---|
106 | pNewVidPnPresentPathInfo->VisibleFromActiveBROffset.cy));
|
---|
107 | AssertBreakpoint();
|
---|
108 | bSupported = FALSE;
|
---|
109 | break;
|
---|
110 | }
|
---|
111 |
|
---|
112 | if (pNewVidPnPresentPathInfo->VidPnTargetColorBasis != D3DKMDT_CB_SRGB
|
---|
113 | && pNewVidPnPresentPathInfo->VidPnTargetColorBasis != D3DKMDT_CB_UNINITIALIZED)
|
---|
114 | {
|
---|
115 | dprintf(("unsupported VidPnTargetColorBasis (%d)\n", pNewVidPnPresentPathInfo->VidPnTargetColorBasis));
|
---|
116 | AssertBreakpoint();
|
---|
117 | bSupported = FALSE;
|
---|
118 | break;
|
---|
119 | }
|
---|
120 |
|
---|
121 | /* channels?
|
---|
122 | pNewVidPnPresentPathInfo->VidPnTargetColorCoeffDynamicRanges.FirstChannel;
|
---|
123 | pNewVidPnPresentPathInfo->VidPnTargetColorCoeffDynamicRanges.SecondChannel;
|
---|
124 | pNewVidPnPresentPathInfo->VidPnTargetColorCoeffDynamicRanges.ThirdChannel;
|
---|
125 | we definitely not support fourth channel
|
---|
126 | */
|
---|
127 | if (pNewVidPnPresentPathInfo->VidPnTargetColorCoeffDynamicRanges.FourthChannel)
|
---|
128 | {
|
---|
129 | dprintf(("Non-zero FourthChannel (%d)\n", pNewVidPnPresentPathInfo->VidPnTargetColorCoeffDynamicRanges.FourthChannel));
|
---|
130 | AssertBreakpoint();
|
---|
131 | bSupported = FALSE;
|
---|
132 | break;
|
---|
133 | }
|
---|
134 |
|
---|
135 | /* Content (D3DKMDT_VPPC_GRAPHICS, _NOTSPECIFIED, _VIDEO), does not matter for now
|
---|
136 | pNewVidPnPresentPathInfo->Content
|
---|
137 | */
|
---|
138 | /* not support copy protection for now */
|
---|
139 | if (pNewVidPnPresentPathInfo->CopyProtection.CopyProtectionType != D3DKMDT_VPPMT_NOPROTECTION
|
---|
140 | && pNewVidPnPresentPathInfo->CopyProtection.CopyProtectionType != D3DKMDT_VPPMT_UNINITIALIZED)
|
---|
141 | {
|
---|
142 | dprintf(("Copy protection not supported CopyProtectionType(%d)\n", pNewVidPnPresentPathInfo->CopyProtection.CopyProtectionType));
|
---|
143 | AssertBreakpoint();
|
---|
144 | bSupported = FALSE;
|
---|
145 | break;
|
---|
146 | }
|
---|
147 |
|
---|
148 | if (pNewVidPnPresentPathInfo->CopyProtection.APSTriggerBits)
|
---|
149 | {
|
---|
150 | dprintf(("Copy protection not supported APSTriggerBits(%d)\n", pNewVidPnPresentPathInfo->CopyProtection.APSTriggerBits));
|
---|
151 | AssertBreakpoint();
|
---|
152 | bSupported = FALSE;
|
---|
153 | break;
|
---|
154 | }
|
---|
155 |
|
---|
156 | D3DKMDT_VIDPN_PRESENT_PATH_COPYPROTECTION_SUPPORT tstCPSupport = {0};
|
---|
157 | tstCPSupport.NoProtection = 1;
|
---|
158 | if (memcmp(&tstCPSupport, &pNewVidPnPresentPathInfo->CopyProtection.CopyProtectionSupport, sizeof(tstCPSupport)))
|
---|
159 | {
|
---|
160 | dprintf(("Copy protection support (0x%x)\n", *((UINT*)&pNewVidPnPresentPathInfo->CopyProtection.CopyProtectionSupport)));
|
---|
161 | AssertBreakpoint();
|
---|
162 | bSupported = FALSE;
|
---|
163 | break;
|
---|
164 | }
|
---|
165 |
|
---|
166 | if (pNewVidPnPresentPathInfo->GammaRamp.Type != D3DDDI_GAMMARAMP_DEFAULT
|
---|
167 | && pNewVidPnPresentPathInfo->GammaRamp.Type != D3DDDI_GAMMARAMP_UNINITIALIZED)
|
---|
168 | {
|
---|
169 | dprintf(("Unsupported GammaRamp.Type (%d)\n", pNewVidPnPresentPathInfo->GammaRamp.Type));
|
---|
170 | AssertBreakpoint();
|
---|
171 | bSupported = FALSE;
|
---|
172 | break;
|
---|
173 | }
|
---|
174 |
|
---|
175 | if (pNewVidPnPresentPathInfo->GammaRamp.DataSize != 0)
|
---|
176 | {
|
---|
177 | dprintf(("Warning: non-zero GammaRamp.DataSize (%d), treating as supported\n", pNewVidPnPresentPathInfo->GammaRamp.DataSize));
|
---|
178 | }
|
---|
179 |
|
---|
180 | const D3DKMDT_VIDPN_PRESENT_PATH *pNextVidPnPresentPathInfo;
|
---|
181 |
|
---|
182 | Status = pVidPnTopologyInterface->pfnAcquireNextPathInfo(hVidPnTopology, pNewVidPnPresentPathInfo, &pNextVidPnPresentPathInfo);
|
---|
183 | pVidPnTopologyInterface->pfnReleasePathInfo(hVidPnTopology, pNewVidPnPresentPathInfo);
|
---|
184 | if (Status == STATUS_SUCCESS)
|
---|
185 | {
|
---|
186 | pNewVidPnPresentPathInfo = pNextVidPnPresentPathInfo;
|
---|
187 | }
|
---|
188 | else if (Status == STATUS_GRAPHICS_NO_MORE_ELEMENTS_IN_DATASET)
|
---|
189 | {
|
---|
190 | Status = STATUS_SUCCESS;
|
---|
191 | pNewVidPnPresentPathInfo = NULL;
|
---|
192 | break;
|
---|
193 | }
|
---|
194 | else
|
---|
195 | {
|
---|
196 | AssertBreakpoint();
|
---|
197 | dprintf(("pfnAcquireNextPathInfo Failed Status(0x%x)\n", Status));
|
---|
198 | pNewVidPnPresentPathInfo = NULL;
|
---|
199 | break;
|
---|
200 | }
|
---|
201 | }
|
---|
202 |
|
---|
203 | if (pNewVidPnPresentPathInfo)
|
---|
204 | pVidPnTopologyInterface->pfnReleasePathInfo(hVidPnTopology, pNewVidPnPresentPathInfo);
|
---|
205 |
|
---|
206 | }
|
---|
207 | else if (Status == STATUS_GRAPHICS_DATASET_IS_EMPTY)
|
---|
208 | Status = STATUS_SUCCESS;
|
---|
209 | else
|
---|
210 | drprintf((__FUNCTION__": pfnAcquireFirstPathInfo failed Status(0x%x)\n", Status));
|
---|
211 |
|
---|
212 | *pbSupported = bSupported;
|
---|
213 |
|
---|
214 | return Status;
|
---|
215 | }
|
---|
216 |
|
---|
217 | NTSTATUS vboxVidPnCheckSourceModeInfo(const D3DKMDT_HVIDPN hDesiredVidPn,
|
---|
218 | const D3DKMDT_VIDPN_SOURCE_MODE *pNewVidPnSourceModeInfo,
|
---|
219 | BOOLEAN *pbSupported)
|
---|
220 | {
|
---|
221 | BOOLEAN bSupported = TRUE;
|
---|
222 | /* we support both GRAPHICS and TEXT modes */
|
---|
223 | switch (pNewVidPnSourceModeInfo->Type)
|
---|
224 | {
|
---|
225 | case D3DKMDT_RMT_GRAPHICS:
|
---|
226 | /* any primary surface size actually
|
---|
227 | pNewVidPnSourceModeInfo->Format.Graphics.PrimSurfSize.cx
|
---|
228 | pNewVidPnSourceModeInfo->Format.Graphics.PrimSurfSize.cy
|
---|
229 | */
|
---|
230 | if (pNewVidPnSourceModeInfo->Format.Graphics.VisibleRegionSize.cx != pNewVidPnSourceModeInfo->Format.Graphics.PrimSurfSize.cx
|
---|
231 | || pNewVidPnSourceModeInfo->Format.Graphics.VisibleRegionSize.cy != pNewVidPnSourceModeInfo->Format.Graphics.PrimSurfSize.cy)
|
---|
232 | {
|
---|
233 | dprintf(("VisibleRegionSize(%d, %d) != PrimSurfSize(%d, %d)\n",
|
---|
234 | pNewVidPnSourceModeInfo->Format.Graphics.VisibleRegionSize.cx,
|
---|
235 | pNewVidPnSourceModeInfo->Format.Graphics.VisibleRegionSize.cy,
|
---|
236 | pNewVidPnSourceModeInfo->Format.Graphics.PrimSurfSize.cx,
|
---|
237 | pNewVidPnSourceModeInfo->Format.Graphics.PrimSurfSize.cy));
|
---|
238 | AssertBreakpoint();
|
---|
239 | bSupported = FALSE;
|
---|
240 | break;
|
---|
241 | }
|
---|
242 |
|
---|
243 | /*
|
---|
244 | pNewVidPnSourceModeInfo->Format.Graphics.Stride
|
---|
245 | pNewVidPnSourceModeInfo->Format.Graphics.PixelFormat
|
---|
246 | pNewVidPnSourceModeInfo->Format.Graphics.ColorBasis
|
---|
247 | pNewVidPnSourceModeInfo->Format.Graphics.PixelValueAccessMode
|
---|
248 | */
|
---|
249 |
|
---|
250 | break;
|
---|
251 | case D3DKMDT_RMT_TEXT:
|
---|
252 | break;
|
---|
253 | default:
|
---|
254 | AssertBreakpoint();
|
---|
255 | dprintf(("Warning: Unknown Src mode Type (%d)\n", pNewVidPnSourceModeInfo->Type));
|
---|
256 | break;
|
---|
257 | }
|
---|
258 |
|
---|
259 | *pbSupported = bSupported;
|
---|
260 | return STATUS_SUCCESS;
|
---|
261 | }
|
---|
262 |
|
---|
263 | NTSTATUS vboxVidPnCheckSourceModeSet(const D3DKMDT_HVIDPN hDesiredVidPn,
|
---|
264 | D3DKMDT_HVIDPNSOURCEMODESET hNewVidPnSourceModeSet, const DXGK_VIDPNSOURCEMODESET_INTERFACE *pVidPnSourceModeSetInterface,
|
---|
265 | BOOLEAN *pbSupported)
|
---|
266 | {
|
---|
267 | const D3DKMDT_VIDPN_SOURCE_MODE *pNewVidPnSourceModeInfo;
|
---|
268 | NTSTATUS Status = pVidPnSourceModeSetInterface->pfnAcquireFirstModeInfo(hNewVidPnSourceModeSet, &pNewVidPnSourceModeInfo);
|
---|
269 | BOOLEAN bSupported = TRUE;
|
---|
270 | if (Status == STATUS_SUCCESS)
|
---|
271 | {
|
---|
272 | while (1)
|
---|
273 | {
|
---|
274 | Status = vboxVidPnCheckSourceModeInfo(hDesiredVidPn, pNewVidPnSourceModeInfo, &bSupported);
|
---|
275 | if (Status == STATUS_SUCCESS && bSupported)
|
---|
276 | {
|
---|
277 | const D3DKMDT_VIDPN_SOURCE_MODE *pNextVidPnSourceModeInfo;
|
---|
278 | Status = pVidPnSourceModeSetInterface->pfnAcquireNextModeInfo(hNewVidPnSourceModeSet, pNewVidPnSourceModeInfo, &pNextVidPnSourceModeInfo);
|
---|
279 | pVidPnSourceModeSetInterface->pfnReleaseModeInfo(hNewVidPnSourceModeSet, pNewVidPnSourceModeInfo);
|
---|
280 | if (Status == STATUS_SUCCESS)
|
---|
281 | {
|
---|
282 | pNewVidPnSourceModeInfo = pNextVidPnSourceModeInfo;
|
---|
283 | }
|
---|
284 | else if (Status == STATUS_GRAPHICS_NO_MORE_ELEMENTS_IN_DATASET)
|
---|
285 | {
|
---|
286 | Status = STATUS_SUCCESS;
|
---|
287 | break;
|
---|
288 | }
|
---|
289 | else
|
---|
290 | {
|
---|
291 | drprintf(("pfnAcquireNextModeInfo Failed Status(0x%x)\n", Status));
|
---|
292 | break;
|
---|
293 | }
|
---|
294 | }
|
---|
295 | else
|
---|
296 | {
|
---|
297 | pVidPnSourceModeSetInterface->pfnReleaseModeInfo(hNewVidPnSourceModeSet, pNewVidPnSourceModeInfo);
|
---|
298 | break;
|
---|
299 | }
|
---|
300 | }
|
---|
301 | }
|
---|
302 | else if (Status == STATUS_GRAPHICS_DATASET_IS_EMPTY)
|
---|
303 | Status = STATUS_SUCCESS;
|
---|
304 | else
|
---|
305 | drprintf(("VBoxVideoWddm: pfnAcquireFirstModeInfo failed Status(0x%x)\n", Status));
|
---|
306 |
|
---|
307 | *pbSupported = bSupported;
|
---|
308 | return Status;
|
---|
309 | }
|
---|
310 |
|
---|
311 | NTSTATUS vboxVidPnPopulateVideoSignalInfo(D3DKMDT_VIDEO_SIGNAL_INFO *pVsi,
|
---|
312 | D3DKMDT_2DREGION *pResolution,
|
---|
313 | ULONG VSync)
|
---|
314 | {
|
---|
315 | NTSTATUS Status = STATUS_SUCCESS;
|
---|
316 |
|
---|
317 | pVsi->VideoStandard = D3DKMDT_VSS_VESA_DMT;
|
---|
318 | pVsi->ActiveSize = *pResolution;
|
---|
319 | pVsi->VSyncFreq.Numerator = VSync * 1000;
|
---|
320 | pVsi->VSyncFreq.Denominator = 1000;
|
---|
321 | pVsi->TotalSize.cx = pVsi->ActiveSize.cx + VBOXVDPN_C_DISPLAY_HBLANK_SIZE;
|
---|
322 | pVsi->TotalSize.cy = pVsi->ActiveSize.cy + VBOXVDPN_C_DISPLAY_VBLANK_SIZE;
|
---|
323 | pVsi->PixelRate = pVsi->TotalSize.cx * pVsi->TotalSize.cy * VSync;
|
---|
324 | pVsi->HSyncFreq.Numerator = (UINT)((pVsi->PixelRate / pVsi->TotalSize.cy) * 1000);
|
---|
325 | pVsi->HSyncFreq.Denominator = 1000;
|
---|
326 | pVsi->ScanLineOrdering = D3DDDI_VSSLO_PROGRESSIVE;
|
---|
327 |
|
---|
328 | return Status;
|
---|
329 | }
|
---|
330 |
|
---|
331 | BOOLEAN vboxVidPnMatchVideoSignal(const D3DKMDT_VIDEO_SIGNAL_INFO *pVsi1, const D3DKMDT_VIDEO_SIGNAL_INFO *pVsi2)
|
---|
332 | {
|
---|
333 | if (pVsi1->VideoStandard != pVsi2->VideoStandard)
|
---|
334 | return FALSE;
|
---|
335 | if (pVsi1->TotalSize.cx != pVsi2->TotalSize.cx)
|
---|
336 | return FALSE;
|
---|
337 | if (pVsi1->TotalSize.cy != pVsi2->TotalSize.cy)
|
---|
338 | return FALSE;
|
---|
339 | if (pVsi1->ActiveSize.cx != pVsi2->ActiveSize.cx)
|
---|
340 | return FALSE;
|
---|
341 | if (pVsi1->ActiveSize.cy != pVsi2->ActiveSize.cy)
|
---|
342 | return FALSE;
|
---|
343 | if (pVsi1->VSyncFreq.Numerator != pVsi2->VSyncFreq.Numerator)
|
---|
344 | return FALSE;
|
---|
345 | if (pVsi1->VSyncFreq.Denominator != pVsi2->VSyncFreq.Denominator)
|
---|
346 | return FALSE;
|
---|
347 | if (pVsi1->HSyncFreq.Numerator != pVsi2->HSyncFreq.Numerator)
|
---|
348 | return FALSE;
|
---|
349 | if (pVsi1->HSyncFreq.Denominator != pVsi2->HSyncFreq.Denominator)
|
---|
350 | return FALSE;
|
---|
351 | if (pVsi1->PixelRate != pVsi2->PixelRate)
|
---|
352 | return FALSE;
|
---|
353 | if (pVsi1->ScanLineOrdering != pVsi2->ScanLineOrdering)
|
---|
354 | return FALSE;
|
---|
355 |
|
---|
356 | return TRUE;
|
---|
357 | }
|
---|
358 |
|
---|
359 | NTSTATUS vboxVidPnCheckTargetModeInfo(const D3DKMDT_HVIDPN hDesiredVidPn,
|
---|
360 | const D3DKMDT_VIDPN_TARGET_MODE *pNewVidPnTargetModeInfo,
|
---|
361 | BOOLEAN *pbSupported)
|
---|
362 | {
|
---|
363 | BOOLEAN bSupported = TRUE;
|
---|
364 | D3DKMDT_VIDEO_SIGNAL_INFO CmpVsi;
|
---|
365 | D3DKMDT_2DREGION CmpRes;
|
---|
366 | CmpRes.cx = pNewVidPnTargetModeInfo->VideoSignalInfo.ActiveSize.cx;
|
---|
367 | CmpRes.cy = pNewVidPnTargetModeInfo->VideoSignalInfo.ActiveSize.cy;
|
---|
368 | NTSTATUS Status = vboxVidPnPopulateVideoSignalInfo(&CmpVsi,
|
---|
369 | &CmpRes,
|
---|
370 | pNewVidPnTargetModeInfo->VideoSignalInfo.VSyncFreq.Numerator/pNewVidPnTargetModeInfo->VideoSignalInfo.VSyncFreq.Denominator);
|
---|
371 | Assert(Status == STATUS_SUCCESS);
|
---|
372 | if (Status != STATUS_SUCCESS)
|
---|
373 | {
|
---|
374 | drprintf((__FUNCTION__": vboxVidPnPopulateVideoSignalInfo error Status (0x%x)\n", Status));
|
---|
375 | return Status;
|
---|
376 | }
|
---|
377 |
|
---|
378 | if (!vboxVidPnMatchVideoSignal(&CmpVsi, &pNewVidPnTargetModeInfo->VideoSignalInfo))
|
---|
379 | {
|
---|
380 | dfprintf((__FUNCTION__": VideoSignalInfos do not match!!!\n"));
|
---|
381 | AssertBreakpoint();
|
---|
382 | bSupported = FALSE;
|
---|
383 | }
|
---|
384 |
|
---|
385 | *pbSupported = bSupported;
|
---|
386 | return STATUS_SUCCESS;
|
---|
387 | }
|
---|
388 |
|
---|
389 | NTSTATUS vboxVidPnCheckTargetModeSet(const D3DKMDT_HVIDPN hDesiredVidPn,
|
---|
390 | D3DKMDT_HVIDPNTARGETMODESET hNewVidPnTargetModeSet, const DXGK_VIDPNTARGETMODESET_INTERFACE *pVidPnTargetModeSetInterface,
|
---|
391 | BOOLEAN *pbSupported)
|
---|
392 | {
|
---|
393 | const D3DKMDT_VIDPN_TARGET_MODE *pNewVidPnTargetModeInfo;
|
---|
394 | NTSTATUS Status = pVidPnTargetModeSetInterface->pfnAcquireFirstModeInfo(hNewVidPnTargetModeSet, &pNewVidPnTargetModeInfo);
|
---|
395 | BOOLEAN bSupported = TRUE;
|
---|
396 | if (Status == STATUS_SUCCESS)
|
---|
397 | {
|
---|
398 | Assert(pNewVidPnTargetModeInfo);
|
---|
399 | while (1)
|
---|
400 | {
|
---|
401 | Status = vboxVidPnCheckTargetModeInfo(hDesiredVidPn, pNewVidPnTargetModeInfo, &bSupported);
|
---|
402 | if (Status == STATUS_SUCCESS && bSupported)
|
---|
403 | {
|
---|
404 | const D3DKMDT_VIDPN_TARGET_MODE *pNextVidPnTargetModeInfo;
|
---|
405 | Status = pVidPnTargetModeSetInterface->pfnAcquireNextModeInfo(hNewVidPnTargetModeSet, pNewVidPnTargetModeInfo, &pNextVidPnTargetModeInfo);
|
---|
406 | pVidPnTargetModeSetInterface->pfnReleaseModeInfo(hNewVidPnTargetModeSet, pNewVidPnTargetModeInfo);
|
---|
407 | if (Status == STATUS_SUCCESS)
|
---|
408 | {
|
---|
409 | pNewVidPnTargetModeInfo = pNextVidPnTargetModeInfo;
|
---|
410 | }
|
---|
411 | else if (Status == STATUS_GRAPHICS_NO_MORE_ELEMENTS_IN_DATASET)
|
---|
412 | {
|
---|
413 | Status = STATUS_SUCCESS;
|
---|
414 | break;
|
---|
415 | }
|
---|
416 | else
|
---|
417 | {
|
---|
418 | drprintf((__FUNCTION__": pfnAcquireNextModeInfo Failed Status(0x%x)\n", Status));
|
---|
419 | break;
|
---|
420 | }
|
---|
421 | }
|
---|
422 | else
|
---|
423 | {
|
---|
424 | pVidPnTargetModeSetInterface->pfnReleaseModeInfo(hNewVidPnTargetModeSet, pNewVidPnTargetModeInfo);
|
---|
425 | break;
|
---|
426 | }
|
---|
427 | }
|
---|
428 | }
|
---|
429 | else if (Status == STATUS_GRAPHICS_DATASET_IS_EMPTY)
|
---|
430 | Status = STATUS_SUCCESS;
|
---|
431 | else
|
---|
432 | drprintf((__FUNCTION__": pfnAcquireFirstModeInfo failed Status(0x%x)\n", Status));
|
---|
433 |
|
---|
434 | *pbSupported = bSupported;
|
---|
435 | return Status;
|
---|
436 | }
|
---|
437 |
|
---|
438 | #if 0
|
---|
439 | DECLCALLBACK(BOOLEAN) vboxVidPnCofuncModalitySourceModeCheck(PDEVICE_EXTENSION pDevExt, const D3DKMDT_HVIDPN hDesiredVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface,
|
---|
440 | D3DKMDT_HVIDPNSOURCEMODESET hNewVidPnSourceModeSet, const DXGK_VIDPNSOURCEMODESET_INTERFACE *pVidPnSourceModeSetInterface,
|
---|
441 | const D3DKMDT_VIDPN_SOURCE_MODE *pNewVidPnSourceModeInfo, PVOID pContext)
|
---|
442 | {
|
---|
443 | NTSTATUS Status = STATUS_SUCCESS;
|
---|
444 | PVBOXVIDPN_NEW_SRCMODESET_CHECK pCbContext = (PVBOXVIDPN_NEW_SRCMODESET_CHECK)pContext;
|
---|
445 | pCbContext->CommonInfo.Status = STATUS_SUCCESS;
|
---|
446 |
|
---|
447 | pVidPnSourceModeSetInterface->pfnReleaseModeInfo(hNewVidPnSourceModeSet, pNewVidPnSourceModeInfo);
|
---|
448 |
|
---|
449 | pCbContext->CommonInfo.Status = Status;
|
---|
450 | return Status == STATUS_SUCCESS;
|
---|
451 | }
|
---|
452 |
|
---|
453 | DECLCALLBACK(BOOLEAN) vboxVidPnCofuncModalitySourceModeEnum(PDEVICE_EXTENSION pDevExt, const D3DKMDT_HVIDPN hDesiredVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface,
|
---|
454 | D3DKMDT_HVIDPNSOURCEMODESET hNewVidPnSourceModeSet, const DXGK_VIDPNSOURCEMODESET_INTERFACE *pVidPnSourceModeSetInterface,
|
---|
455 | const D3DKMDT_VIDPN_SOURCE_MODE *pNewVidPnSourceModeInfo, PVOID pContext)
|
---|
456 | {
|
---|
457 | NTSTATUS Status = STATUS_SUCCESS;
|
---|
458 | PVBOXVIDPNCMCONTEXT pCbContext = (PVBOXVIDPNCMCONTEXT)pContext;
|
---|
459 | pCbContext->Status = STATUS_SUCCESS;
|
---|
460 |
|
---|
461 | pVidPnSourceModeSetInterface->pfnReleaseModeInfo(hNewVidPnSourceModeSet, pNewVidPnSourceModeInfo);
|
---|
462 |
|
---|
463 | pCbContext->Status = Status;
|
---|
464 | return Status == STATUS_SUCCESS;
|
---|
465 | }
|
---|
466 |
|
---|
467 | DECLCALLBACK(BOOLEAN) vboxVidPnCofuncModalityTargetModeEnum(PDEVICE_EXTENSION pDevExt, const D3DKMDT_HVIDPN hDesiredVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface,
|
---|
468 | D3DKMDT_HVIDPNTARGETMODESET hNewVidPnTargetModeSet, const DXGK_VIDPNTARGETMODESET_INTERFACE *pVidPnTargetModeSetInterface,
|
---|
469 | const D3DKMDT_VIDPN_TARGET_MODE *pNewVidPnTargetModeInfo, PVOID pContext)
|
---|
470 | {
|
---|
471 | NTSTATUS Status = STATUS_SUCCESS;
|
---|
472 | PVBOXVIDPNCMCONTEXT pCbContext = (PVBOXVIDPNCMCONTEXT)pContext;
|
---|
473 | pCbContext->Status = STATUS_SUCCESS;
|
---|
474 |
|
---|
475 | pVidPnTargetModeSetInterface->pfnReleaseModeInfo(hNewVidPnTargetModeSet, pNewVidPnTargetModeInfo);
|
---|
476 |
|
---|
477 | pCbContext->Status = Status;
|
---|
478 | return Status == STATUS_SUCCESS;
|
---|
479 | }
|
---|
480 | #endif
|
---|
481 |
|
---|
482 | NTSTATUS vboxVidPnPopulateSourceModeInfoFromLegacy(PDEVICE_EXTENSION pDevExt,
|
---|
483 | D3DKMDT_VIDPN_SOURCE_MODE *pNewVidPnSourceModeInfo,
|
---|
484 | VIDEO_MODE_INFORMATION *pMode)
|
---|
485 | {
|
---|
486 | NTSTATUS Status = STATUS_SUCCESS;
|
---|
487 | if (pMode->AttributeFlags & VIDEO_MODE_GRAPHICS)
|
---|
488 | {
|
---|
489 | /* this is a graphics mode */
|
---|
490 | pNewVidPnSourceModeInfo->Type = D3DKMDT_RMT_GRAPHICS;
|
---|
491 | pNewVidPnSourceModeInfo->Format.Graphics.PrimSurfSize.cx = pMode->VisScreenWidth;
|
---|
492 | pNewVidPnSourceModeInfo->Format.Graphics.PrimSurfSize.cy = pMode->VisScreenHeight;
|
---|
493 | pNewVidPnSourceModeInfo->Format.Graphics.VisibleRegionSize = pNewVidPnSourceModeInfo->Format.Graphics.PrimSurfSize;
|
---|
494 | pNewVidPnSourceModeInfo->Format.Graphics.Stride = pMode->ScreenStride;
|
---|
495 | pNewVidPnSourceModeInfo->Format.Graphics.PixelFormat = vboxWddmCalcPixelFormat(pMode);
|
---|
496 | Assert(pNewVidPnSourceModeInfo->Format.Graphics.PixelFormat != D3DDDIFMT_UNKNOWN);
|
---|
497 | if (pNewVidPnSourceModeInfo->Format.Graphics.PixelFormat != D3DDDIFMT_UNKNOWN)
|
---|
498 | {
|
---|
499 | pNewVidPnSourceModeInfo->Format.Graphics.ColorBasis = D3DKMDT_CB_SRGB;
|
---|
500 | if (pNewVidPnSourceModeInfo->Format.Graphics.PixelFormat == D3DDDIFMT_P8)
|
---|
501 | pNewVidPnSourceModeInfo->Format.Graphics.PixelValueAccessMode = D3DKMDT_PVAM_SETTABLEPALETTE;
|
---|
502 | else
|
---|
503 | pNewVidPnSourceModeInfo->Format.Graphics.PixelValueAccessMode = D3DKMDT_PVAM_DIRECT;
|
---|
504 | }
|
---|
505 | else
|
---|
506 | {
|
---|
507 | drprintf((__FUNCTION__": vboxWddmCalcPixelFormat failed\n"));
|
---|
508 | Status = STATUS_INVALID_PARAMETER;
|
---|
509 | }
|
---|
510 | }
|
---|
511 | else
|
---|
512 | {
|
---|
513 | /* @todo: XPDM driver does not seem to return text modes, should we? */
|
---|
514 | drprintf((__FUNCTION__": text mode not supported currently\n"));
|
---|
515 | AssertBreakpoint();
|
---|
516 | Status = STATUS_INVALID_PARAMETER;
|
---|
517 | }
|
---|
518 |
|
---|
519 | return Status;
|
---|
520 | }
|
---|
521 |
|
---|
522 | NTSTATUS vboxVidPnPopulateSourceModeSetFromLegacy(PDEVICE_EXTENSION pDevExt,
|
---|
523 | D3DKMDT_HVIDPNSOURCEMODESET hNewVidPnSourceModeSet,
|
---|
524 | const DXGK_VIDPNSOURCEMODESET_INTERFACE *pNewVidPnSourceModeSetInterface,
|
---|
525 | VIDEO_MODE_INFORMATION *pModes,
|
---|
526 | uint32_t cModes,
|
---|
527 | int iPreferredMode,
|
---|
528 | D3DKMDT_VIDEO_PRESENT_SOURCE_MODE_ID *pPreferredModeId)
|
---|
529 | {
|
---|
530 | NTSTATUS Status = STATUS_SUCCESS;
|
---|
531 | D3DKMDT_VIDEO_PRESENT_SOURCE_MODE_ID PreferredModeId = D3DDDI_ID_UNINITIALIZED;
|
---|
532 | for (uint32_t i = 0; i < cModes; ++i)
|
---|
533 | {
|
---|
534 | D3DKMDT_VIDPN_SOURCE_MODE *pNewVidPnSourceModeInfo;
|
---|
535 | Status = pNewVidPnSourceModeSetInterface->pfnCreateNewModeInfo(hNewVidPnSourceModeSet, &pNewVidPnSourceModeInfo);
|
---|
536 | Assert(Status == STATUS_SUCCESS);
|
---|
537 | if (Status == STATUS_SUCCESS)
|
---|
538 | {
|
---|
539 | Status = vboxVidPnPopulateSourceModeInfoFromLegacy(pDevExt, pNewVidPnSourceModeInfo, &pModes[i]);
|
---|
540 | Assert(Status == STATUS_SUCCESS);
|
---|
541 | if (Status == STATUS_SUCCESS)
|
---|
542 | {
|
---|
543 | D3DKMDT_VIDEO_PRESENT_SOURCE_MODE_ID modeId = pNewVidPnSourceModeInfo->Id;
|
---|
544 | Status = pNewVidPnSourceModeSetInterface->pfnAddMode(hNewVidPnSourceModeSet, pNewVidPnSourceModeInfo);
|
---|
545 | Assert(Status == STATUS_SUCCESS);
|
---|
546 | if (Status == STATUS_SUCCESS)
|
---|
547 | {
|
---|
548 | if (iPreferredMode == i)
|
---|
549 | {
|
---|
550 | PreferredModeId = modeId;
|
---|
551 | // AssertBreakpoint();
|
---|
552 | // Status = pNewVidPnSourceModeSetInterface->pfnPinMode(hNewVidPnSourceModeSet, modeId);
|
---|
553 | // Assert(Status == STATUS_SUCCESS);
|
---|
554 | // if (Status != STATUS_SUCCESS)
|
---|
555 | // {
|
---|
556 | // drprintf((__FUNCTION__": pfnPinMode failed, Status(0x%x)", Status));
|
---|
557 | // /* don't treat it as fatal */
|
---|
558 | // Status = STATUS_SUCCESS;
|
---|
559 | // }
|
---|
560 | }
|
---|
561 | }
|
---|
562 | else
|
---|
563 | {
|
---|
564 | drprintf((__FUNCTION__": pfnAddMode failed, Status(0x%x)", Status));
|
---|
565 | pNewVidPnSourceModeSetInterface->pfnReleaseModeInfo(hNewVidPnSourceModeSet, pNewVidPnSourceModeInfo);
|
---|
566 | break;
|
---|
567 | }
|
---|
568 | }
|
---|
569 | else
|
---|
570 | {
|
---|
571 | drprintf((__FUNCTION__": pfnCreateNewModeInfo failed, Status(0x%x)", Status));
|
---|
572 | pNewVidPnSourceModeSetInterface->pfnReleaseModeInfo(hNewVidPnSourceModeSet, pNewVidPnSourceModeInfo);
|
---|
573 | break;
|
---|
574 | }
|
---|
575 | }
|
---|
576 | }
|
---|
577 |
|
---|
578 | if (pPreferredModeId)
|
---|
579 | *pPreferredModeId = PreferredModeId;
|
---|
580 |
|
---|
581 | return Status;
|
---|
582 | }
|
---|
583 |
|
---|
584 | NTSTATUS vboxVidPnPopulateMonitorSourceModeInfoFromLegacy(PDEVICE_EXTENSION pDevExt,
|
---|
585 | D3DKMDT_MONITOR_SOURCE_MODE *pMonitorSourceMode,
|
---|
586 | D3DKMDT_2DREGION *pResolution,
|
---|
587 | D3DKMDT_MONITOR_CAPABILITIES_ORIGIN enmOrigin,
|
---|
588 | BOOLEAN bPreferred)
|
---|
589 | {
|
---|
590 | NTSTATUS Status = vboxVidPnPopulateVideoSignalInfo(&pMonitorSourceMode->VideoSignalInfo, pResolution, 60 /* ULONG VSync */);
|
---|
591 | Assert(Status == STATUS_SUCCESS);
|
---|
592 | if (Status == STATUS_SUCCESS)
|
---|
593 | {
|
---|
594 | pMonitorSourceMode->ColorBasis = D3DKMDT_CB_SRGB;
|
---|
595 | pMonitorSourceMode->ColorCoeffDynamicRanges.FirstChannel = 8;
|
---|
596 | pMonitorSourceMode->ColorCoeffDynamicRanges.SecondChannel = 8;
|
---|
597 | pMonitorSourceMode->ColorCoeffDynamicRanges.ThirdChannel = 8;
|
---|
598 | pMonitorSourceMode->ColorCoeffDynamicRanges.FourthChannel = 0;
|
---|
599 | pMonitorSourceMode->Origin = enmOrigin;
|
---|
600 | pMonitorSourceMode->Preference = bPreferred ? D3DKMDT_MP_PREFERRED : D3DKMDT_MP_NOTPREFERRED;
|
---|
601 | }
|
---|
602 |
|
---|
603 | return Status;
|
---|
604 | }
|
---|
605 |
|
---|
606 | NTSTATUS vboxVidPnCreatePopulateMonitorSourceModeInfoFromLegacy(PDEVICE_EXTENSION pDevExt,
|
---|
607 | CONST D3DKMDT_HMONITORSOURCEMODESET hMonitorSMS,
|
---|
608 | CONST DXGK_MONITORSOURCEMODESET_INTERFACE *pMonitorSMSIf,
|
---|
609 | D3DKMDT_2DREGION *pResolution,
|
---|
610 | D3DKMDT_MONITOR_CAPABILITIES_ORIGIN enmOrigin,
|
---|
611 | BOOLEAN bPreferred)
|
---|
612 | {
|
---|
613 | D3DKMDT_MONITOR_SOURCE_MODE * pMonitorSMI;
|
---|
614 | NTSTATUS Status = pMonitorSMSIf->pfnCreateNewModeInfo(hMonitorSMS, &pMonitorSMI);
|
---|
615 | Assert(Status == STATUS_SUCCESS);
|
---|
616 | if (Status == STATUS_SUCCESS)
|
---|
617 | {
|
---|
618 | do
|
---|
619 | {
|
---|
620 | Status = vboxVidPnPopulateMonitorSourceModeInfoFromLegacy(pDevExt,
|
---|
621 | pMonitorSMI,
|
---|
622 | pResolution,
|
---|
623 | enmOrigin,
|
---|
624 | bPreferred);
|
---|
625 | Assert(Status == STATUS_SUCCESS);
|
---|
626 | if (Status == STATUS_SUCCESS)
|
---|
627 | {
|
---|
628 | Status = pMonitorSMSIf->pfnAddMode(hMonitorSMS, pMonitorSMI);
|
---|
629 | Assert(Status == STATUS_SUCCESS);
|
---|
630 | if (Status == STATUS_SUCCESS)
|
---|
631 | break;
|
---|
632 | drprintf((__FUNCTION__": pfnAddMode failed, Status(0x%x)", Status));
|
---|
633 | }
|
---|
634 | else
|
---|
635 | drprintf((__FUNCTION__": vboxVidPnPopulateMonitorSourceModeInfoFromLegacy failed, Status(0x%x)", Status));
|
---|
636 |
|
---|
637 | Assert (Status != STATUS_SUCCESS);
|
---|
638 | /* we're here because of a failure */
|
---|
639 | NTSTATUS tmpStatus = pMonitorSMSIf->pfnReleaseModeInfo(hMonitorSMS, pMonitorSMI);
|
---|
640 | Assert(tmpStatus == STATUS_SUCCESS);
|
---|
641 | if (tmpStatus != STATUS_SUCCESS)
|
---|
642 | drprintf((__FUNCTION__": pfnReleaseModeInfo failed tmpStatus(0x%x)\n", tmpStatus));
|
---|
643 | } while (0);
|
---|
644 | }
|
---|
645 | else
|
---|
646 | drprintf((__FUNCTION__": pfnCreateNewModeInfo failed, Status(0x%x)", Status));
|
---|
647 |
|
---|
648 | return Status;
|
---|
649 | }
|
---|
650 |
|
---|
651 | NTSTATUS vboxVidPnPopulateTargetModeInfoFromLegacy(D3DKMDT_VIDPN_TARGET_MODE *pNewVidPnTargetModeInfo,
|
---|
652 | D3DKMDT_2DREGION *pResolution,
|
---|
653 | BOOLEAN bPreferred)
|
---|
654 | {
|
---|
655 | Assert(!bPreferred);
|
---|
656 | pNewVidPnTargetModeInfo->Preference = bPreferred ? D3DKMDT_MP_PREFERRED : D3DKMDT_MP_NOTPREFERRED;
|
---|
657 |
|
---|
658 | return vboxVidPnPopulateVideoSignalInfo(&pNewVidPnTargetModeInfo->VideoSignalInfo, pResolution, 60 /* ULONG VSync */);
|
---|
659 | }
|
---|
660 |
|
---|
661 | #define VBOXVIDPN_MODESET_NO_PIN_PREFERRED 0x00000001
|
---|
662 | #define VBOXVIDPN_MODESET_MARK_PREFERRED 0x00000002
|
---|
663 |
|
---|
664 | NTSTATUS vboxVidPnPopulateTargetModeSetFromLegacy(PDEVICE_EXTENSION pDevExt,
|
---|
665 | D3DKMDT_HVIDPNTARGETMODESET hNewVidPnTargetModeSet,
|
---|
666 | const DXGK_VIDPNTARGETMODESET_INTERFACE *pNewVidPnTargetModeSetInterface,
|
---|
667 | D3DKMDT_2DREGION *pResolutions,
|
---|
668 | uint32_t cResolutions,
|
---|
669 | VIDEO_MODE_INFORMATION *pPreferredMode,
|
---|
670 | uint32_t fFlags,
|
---|
671 | D3DKMDT_VIDEO_PRESENT_TARGET_MODE_ID *pPreferredModeId)
|
---|
672 | {
|
---|
673 | NTSTATUS Status = STATUS_SUCCESS;
|
---|
674 | D3DKMDT_VIDEO_PRESENT_TARGET_MODE_ID PreferredModeId = D3DDDI_ID_UNINITIALIZED;
|
---|
675 | for (uint32_t i = 0; i < cResolutions; ++i)
|
---|
676 | {
|
---|
677 | D3DKMDT_VIDPN_TARGET_MODE *pNewVidPnTargetModeInfo;
|
---|
678 | Status = pNewVidPnTargetModeSetInterface->pfnCreateNewModeInfo(hNewVidPnTargetModeSet, &pNewVidPnTargetModeInfo);
|
---|
679 | Assert(Status == STATUS_SUCCESS);
|
---|
680 | if (Status == STATUS_SUCCESS)
|
---|
681 | {
|
---|
682 | bool bPreferred = pPreferredMode ? pPreferredMode->VisScreenWidth == pResolutions[i].cx
|
---|
683 | && pPreferredMode->VisScreenHeight == pResolutions[i].cy : FALSE;
|
---|
684 | Status = vboxVidPnPopulateTargetModeInfoFromLegacy(pNewVidPnTargetModeInfo, &pResolutions[i], bPreferred && (fFlags & VBOXVIDPN_MODESET_MARK_PREFERRED));
|
---|
685 | Assert(Status == STATUS_SUCCESS);
|
---|
686 | if (Status == STATUS_SUCCESS)
|
---|
687 | {
|
---|
688 | D3DKMDT_VIDEO_PRESENT_SOURCE_MODE_ID modeId = pNewVidPnTargetModeInfo->Id;
|
---|
689 | Status = pNewVidPnTargetModeSetInterface->pfnAddMode(hNewVidPnTargetModeSet, pNewVidPnTargetModeInfo);
|
---|
690 | Assert(Status == STATUS_SUCCESS);
|
---|
691 | if (Status == STATUS_SUCCESS)
|
---|
692 | {
|
---|
693 | if (bPreferred) // && !(fFlags & VBOXVIDPN_MODESET_NO_PIN_PREFERRED))
|
---|
694 | {
|
---|
695 | PreferredModeId = modeId;
|
---|
696 | // AssertBreakpoint();
|
---|
697 | // Status = pNewVidPnTargetModeSetInterface->pfnPinMode(hNewVidPnTargetModeSet, modeId);
|
---|
698 | // Assert(Status == STATUS_SUCCESS);
|
---|
699 | // if (Status != STATUS_SUCCESS)
|
---|
700 | // {
|
---|
701 | // drprintf((__FUNCTION__": pfnPinMode failed, Status(0x%x)", Status));
|
---|
702 | // /* don't treat it as fatal */
|
---|
703 | // Status = STATUS_SUCCESS;
|
---|
704 | // }
|
---|
705 | }
|
---|
706 | }
|
---|
707 | else
|
---|
708 | {
|
---|
709 | drprintf((__FUNCTION__": pfnAddMode failed, Status(0x%x)", Status));
|
---|
710 | pNewVidPnTargetModeSetInterface->pfnReleaseModeInfo(hNewVidPnTargetModeSet, pNewVidPnTargetModeInfo);
|
---|
711 | break;
|
---|
712 | }
|
---|
713 | }
|
---|
714 | else
|
---|
715 | {
|
---|
716 | drprintf((__FUNCTION__": pfnCreateNewModeInfo failed, Status(0x%x)", Status));
|
---|
717 | pNewVidPnTargetModeSetInterface->pfnReleaseModeInfo(hNewVidPnTargetModeSet, pNewVidPnTargetModeInfo);
|
---|
718 | break;
|
---|
719 | }
|
---|
720 | }
|
---|
721 | }
|
---|
722 |
|
---|
723 | if (pPreferredModeId)
|
---|
724 | *pPreferredModeId = PreferredModeId;
|
---|
725 | return Status;
|
---|
726 | }
|
---|
727 |
|
---|
728 | NTSTATUS vboxVidPnCreatePopulateSourceModeSetFromLegacy(PDEVICE_EXTENSION pDevExt, const D3DKMDT_HVIDPN hDesiredVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface,
|
---|
729 | D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId,
|
---|
730 | VIDEO_MODE_INFORMATION *pModes, uint32_t cModes, int iPreferredMode, D3DKMDT_VIDEO_PRESENT_SOURCE_MODE_ID *pPreferredModeId)
|
---|
731 | {
|
---|
732 | D3DKMDT_HVIDPNSOURCEMODESET hNewVidPnSourceModeSet;
|
---|
733 | const DXGK_VIDPNSOURCEMODESET_INTERFACE *pNewVidPnSourceModeSetInterface;
|
---|
734 | NTSTATUS Status = pVidPnInterface->pfnCreateNewSourceModeSet(hDesiredVidPn,
|
---|
735 | srcId, /*__in CONST D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId */
|
---|
736 | &hNewVidPnSourceModeSet,
|
---|
737 | &pNewVidPnSourceModeSetInterface);
|
---|
738 | Assert(Status == STATUS_SUCCESS);
|
---|
739 | if (Status == STATUS_SUCCESS)
|
---|
740 | {
|
---|
741 | Status = vboxVidPnPopulateSourceModeSetFromLegacy(pDevExt,
|
---|
742 | hNewVidPnSourceModeSet, pNewVidPnSourceModeSetInterface,
|
---|
743 | pModes, cModes, iPreferredMode, pPreferredModeId);
|
---|
744 | Assert(Status == STATUS_SUCCESS);
|
---|
745 | if (Status == STATUS_SUCCESS)
|
---|
746 | {
|
---|
747 | Status = pVidPnInterface->pfnAssignSourceModeSet(hDesiredVidPn,
|
---|
748 | srcId,
|
---|
749 | hNewVidPnSourceModeSet);
|
---|
750 | Assert(Status == STATUS_SUCCESS);
|
---|
751 | if(Status != STATUS_SUCCESS)
|
---|
752 | {
|
---|
753 | drprintf((__FUNCTION__": pfnAssignSourceModeSet failed Status(0x%x)\n", Status));
|
---|
754 | pVidPnInterface->pfnReleaseSourceModeSet(hDesiredVidPn, hNewVidPnSourceModeSet);
|
---|
755 | }
|
---|
756 | }
|
---|
757 | else
|
---|
758 | {
|
---|
759 | drprintf((__FUNCTION__": vboxVidPnPopulateSourceModeSetFromLegacy failed Status(0x%x)\n", Status));
|
---|
760 | pVidPnInterface->pfnReleaseSourceModeSet(hDesiredVidPn, hNewVidPnSourceModeSet);
|
---|
761 | }
|
---|
762 | }
|
---|
763 | else
|
---|
764 | drprintf((__FUNCTION__": pfnCreateNewSourceModeSet failed Status(0x%x)\n", Status));
|
---|
765 | return Status;
|
---|
766 | }
|
---|
767 |
|
---|
768 | NTSTATUS vboxVidPnCreatePopulateTargetModeSetFromLegacy(PDEVICE_EXTENSION pDevExt, const D3DKMDT_HVIDPN hDesiredVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface,
|
---|
769 | D3DDDI_VIDEO_PRESENT_TARGET_ID tgtId,
|
---|
770 | D3DKMDT_2DREGION *pResolutions,
|
---|
771 | uint32_t cResolutions,
|
---|
772 | VIDEO_MODE_INFORMATION *pPreferredMode, uint32_t fFlags,
|
---|
773 | D3DKMDT_VIDEO_PRESENT_TARGET_MODE_ID *pPreferredModeId)
|
---|
774 | {
|
---|
775 | D3DKMDT_HVIDPNTARGETMODESET hNewVidPnTargetModeSet;
|
---|
776 | const DXGK_VIDPNTARGETMODESET_INTERFACE *pNewVidPnTargetModeSetInterface;
|
---|
777 | NTSTATUS Status = pVidPnInterface->pfnCreateNewTargetModeSet(hDesiredVidPn,
|
---|
778 | tgtId, /*__in CONST D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId */
|
---|
779 | &hNewVidPnTargetModeSet,
|
---|
780 | &pNewVidPnTargetModeSetInterface);
|
---|
781 | Assert(Status == STATUS_SUCCESS);
|
---|
782 | if (Status == STATUS_SUCCESS)
|
---|
783 | {
|
---|
784 | Status = vboxVidPnPopulateTargetModeSetFromLegacy(pDevExt,
|
---|
785 | hNewVidPnTargetModeSet, pNewVidPnTargetModeSetInterface,
|
---|
786 | pResolutions, cResolutions, pPreferredMode, fFlags, pPreferredModeId);
|
---|
787 | Assert(Status == STATUS_SUCCESS);
|
---|
788 | if (Status == STATUS_SUCCESS)
|
---|
789 | {
|
---|
790 | Status = pVidPnInterface->pfnAssignTargetModeSet(hDesiredVidPn,
|
---|
791 | tgtId,
|
---|
792 | hNewVidPnTargetModeSet);
|
---|
793 | Assert(Status == STATUS_SUCCESS);
|
---|
794 | if(Status != STATUS_SUCCESS)
|
---|
795 | {
|
---|
796 | drprintf((__FUNCTION__": pfnAssignTargetModeSet failed Status(0x%x)\n", Status));
|
---|
797 | pVidPnInterface->pfnReleaseTargetModeSet(hDesiredVidPn, hNewVidPnTargetModeSet);
|
---|
798 | }
|
---|
799 | }
|
---|
800 | else
|
---|
801 | {
|
---|
802 | drprintf((__FUNCTION__": vboxVidPnPopulateTargetModeSetFromLegacy failed Status(0x%x)\n", Status));
|
---|
803 | pVidPnInterface->pfnReleaseTargetModeSet(hDesiredVidPn, hNewVidPnTargetModeSet);
|
---|
804 | }
|
---|
805 | }
|
---|
806 | else
|
---|
807 | drprintf((__FUNCTION__": pfnCreateNewTargetModeSet failed Status(0x%x)\n", Status));
|
---|
808 | return Status;
|
---|
809 |
|
---|
810 | }
|
---|
811 |
|
---|
812 | typedef struct VBOXVIDPNCHECKADDMONITORMODES
|
---|
813 | {
|
---|
814 | NTSTATUS Status;
|
---|
815 | D3DKMDT_2DREGION *pResolutions;
|
---|
816 | uint32_t cResolutions;
|
---|
817 | } VBOXVIDPNCHECKADDMONITORMODES, *PVBOXVIDPNCHECKADDMONITORMODES;
|
---|
818 |
|
---|
819 | static DECLCALLBACK(BOOLEAN) vboxVidPnCheckAddMonitorModesEnum(struct _DEVICE_EXTENSION* pDevExt, D3DKMDT_HMONITORSOURCEMODESET hMonitorSMS, CONST DXGK_MONITORSOURCEMODESET_INTERFACE *pMonitorSMSIf,
|
---|
820 | CONST D3DKMDT_MONITOR_SOURCE_MODE *pMonitorSMI, PVOID pContext)
|
---|
821 | {
|
---|
822 | PVBOXVIDPNCHECKADDMONITORMODES pData = (PVBOXVIDPNCHECKADDMONITORMODES)pContext;
|
---|
823 | NTSTATUS Status = STATUS_SUCCESS;
|
---|
824 |
|
---|
825 | for (uint32_t i = 0; i < pData->cResolutions; ++i)
|
---|
826 | {
|
---|
827 | D3DKMDT_VIDPN_TARGET_MODE dummyMode = {0};
|
---|
828 | Status = vboxVidPnPopulateTargetModeInfoFromLegacy(&dummyMode, &pData->pResolutions[i], FALSE);
|
---|
829 | Assert(Status == STATUS_SUCCESS);
|
---|
830 | if (Status == STATUS_SUCCESS)
|
---|
831 | {
|
---|
832 | if (vboxVidPnMatchVideoSignal(&dummyMode.VideoSignalInfo, &pMonitorSMI->VideoSignalInfo))
|
---|
833 | {
|
---|
834 | /* mark it as unneened */
|
---|
835 | pData->pResolutions[i].cx = 0;
|
---|
836 | break;
|
---|
837 | }
|
---|
838 | }
|
---|
839 | else
|
---|
840 | {
|
---|
841 | drprintf((__FUNCTION__": vboxVidPnPopulateTargetModeInfoFromLegacy failed Status(0x%x)\n", Status));
|
---|
842 | break;
|
---|
843 | }
|
---|
844 | }
|
---|
845 |
|
---|
846 | pMonitorSMSIf->pfnReleaseModeInfo(hMonitorSMS, pMonitorSMI);
|
---|
847 |
|
---|
848 | pData->Status = Status;
|
---|
849 |
|
---|
850 | return Status == STATUS_SUCCESS;
|
---|
851 | }
|
---|
852 |
|
---|
853 | NTSTATUS vboxVidPnCheckAddMonitorModes(PDEVICE_EXTENSION pDevExt,
|
---|
854 | D3DDDI_VIDEO_PRESENT_TARGET_ID targetId, D3DKMDT_MONITOR_CAPABILITIES_ORIGIN enmOrigin,
|
---|
855 | D3DKMDT_2DREGION *pResolutions, uint32_t cResolutions, int32_t iPreferred)
|
---|
856 | {
|
---|
857 | NTSTATUS Status;
|
---|
858 | D3DKMDT_2DREGION *pResolutionsCopy = (D3DKMDT_2DREGION*)vboxWddmMemAlloc(cResolutions * sizeof (D3DKMDT_2DREGION));
|
---|
859 | if (pResolutionsCopy)
|
---|
860 | {
|
---|
861 | memcpy(pResolutionsCopy, pResolutions, cResolutions * sizeof (D3DKMDT_2DREGION));
|
---|
862 | CONST DXGK_MONITOR_INTERFACE *pMonitorInterface;
|
---|
863 | Status = pDevExt->u.primary.DxgkInterface.DxgkCbQueryMonitorInterface(pDevExt->u.primary.DxgkInterface.DeviceHandle, DXGK_MONITOR_INTERFACE_VERSION_V1, &pMonitorInterface);
|
---|
864 | Assert(Status == STATUS_SUCCESS);
|
---|
865 | if (Status == STATUS_SUCCESS)
|
---|
866 | {
|
---|
867 | D3DKMDT_HMONITORSOURCEMODESET hMonitorSMS;
|
---|
868 | CONST DXGK_MONITORSOURCEMODESET_INTERFACE *pMonitorSMSIf;
|
---|
869 | Status = pMonitorInterface->pfnAcquireMonitorSourceModeSet(pDevExt->u.primary.DxgkInterface.DeviceHandle,
|
---|
870 | targetId,
|
---|
871 | &hMonitorSMS,
|
---|
872 | &pMonitorSMSIf);
|
---|
873 | Assert(Status == STATUS_SUCCESS);
|
---|
874 | if (Status == STATUS_SUCCESS)
|
---|
875 | {
|
---|
876 | VBOXVIDPNCHECKADDMONITORMODES EnumData = {0};
|
---|
877 | EnumData.cResolutions = cResolutions;
|
---|
878 | EnumData.pResolutions = pResolutionsCopy;
|
---|
879 | Status = vboxVidPnEnumMonitorSourceModes(pDevExt, hMonitorSMS, pMonitorSMSIf,
|
---|
880 | vboxVidPnCheckAddMonitorModesEnum, &EnumData);
|
---|
881 | Assert(Status == STATUS_SUCCESS);
|
---|
882 | if (Status == STATUS_SUCCESS)
|
---|
883 | {
|
---|
884 | Assert(EnumData.Status == STATUS_SUCCESS);
|
---|
885 | if (EnumData.Status == STATUS_SUCCESS)
|
---|
886 | {
|
---|
887 | for (uint32_t i = 0; i < cResolutions; ++i)
|
---|
888 | {
|
---|
889 | D3DKMDT_2DREGION *pRes = &pResolutionsCopy[i];
|
---|
890 | if (pRes->cx)
|
---|
891 | {
|
---|
892 | Status = vboxVidPnCreatePopulateMonitorSourceModeInfoFromLegacy(pDevExt,
|
---|
893 | hMonitorSMS,
|
---|
894 | pMonitorSMSIf,
|
---|
895 | pRes,
|
---|
896 | enmOrigin,
|
---|
897 | i == (uint32_t)iPreferred);
|
---|
898 | Assert(Status == STATUS_SUCCESS);
|
---|
899 | if (Status != STATUS_SUCCESS)
|
---|
900 | {
|
---|
901 | drprintf((__FUNCTION__": vboxVidPnCreatePopulateMonitorSourceModeInfoFromLegacy failed Status(0x%x)\n", Status));
|
---|
902 | break;
|
---|
903 | }
|
---|
904 | }
|
---|
905 | }
|
---|
906 | }
|
---|
907 | }
|
---|
908 |
|
---|
909 | NTSTATUS tmpStatus = pMonitorInterface->pfnReleaseMonitorSourceModeSet(pDevExt->u.primary.DxgkInterface.DeviceHandle, hMonitorSMS);
|
---|
910 | Assert(tmpStatus == STATUS_SUCCESS);
|
---|
911 | if (tmpStatus != STATUS_SUCCESS)
|
---|
912 | drprintf((__FUNCTION__": pfnReleaseMonitorSourceModeSet failed tmpStatus(0x%x)\n", tmpStatus));
|
---|
913 | }
|
---|
914 | else
|
---|
915 | drprintf((__FUNCTION__": pfnAcquireMonitorSourceModeSet failed Status(0x%x)\n", Status));
|
---|
916 | }
|
---|
917 | else
|
---|
918 | drprintf((__FUNCTION__": DxgkCbQueryMonitorInterface failed Status(0x%x)\n", Status));
|
---|
919 | }
|
---|
920 | else
|
---|
921 | {
|
---|
922 | drprintf((__FUNCTION__": failed to allocate resolution copy of size (%d)\n", cResolutions));
|
---|
923 | Status = STATUS_NO_MEMORY;
|
---|
924 | }
|
---|
925 |
|
---|
926 | return Status;
|
---|
927 | }
|
---|
928 |
|
---|
929 | NTSTATUS vboxVidPnCreatePopulateVidPnFromLegacy(PDEVICE_EXTENSION pDevExt, D3DKMDT_HVIDPN hVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface,
|
---|
930 | VIDEO_MODE_INFORMATION *pModes, uint32_t cModes, int iPreferredMode,
|
---|
931 | D3DKMDT_2DREGION *pResolutions, uint32_t cResolutions)
|
---|
932 | {
|
---|
933 | D3DKMDT_HVIDPNTOPOLOGY hVidPnTopology;
|
---|
934 | const DXGK_VIDPNTOPOLOGY_INTERFACE* pVidPnTopologyInterface;
|
---|
935 | VIDEO_MODE_INFORMATION *pPreferredMode = iPreferredMode >= 0 ? &pModes[iPreferredMode] : NULL;
|
---|
936 | D3DKMDT_VIDEO_PRESENT_SOURCE_MODE_ID PreferredSrcModeId = D3DDDI_ID_UNINITIALIZED;
|
---|
937 | D3DKMDT_HVIDPNSOURCEMODESET hNewVidPnSourceModeSet;
|
---|
938 | const DXGK_VIDPNSOURCEMODESET_INTERFACE *pNewVidPnSourceModeSetInterface;
|
---|
939 | D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId = 0;
|
---|
940 | D3DDDI_VIDEO_PRESENT_TARGET_ID tgtId = 0;
|
---|
941 | NTSTATUS Status = pVidPnInterface->pfnCreateNewSourceModeSet(hVidPn,
|
---|
942 | srcId, /*__in CONST D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId */
|
---|
943 | &hNewVidPnSourceModeSet,
|
---|
944 | &pNewVidPnSourceModeSetInterface);
|
---|
945 | Assert(Status == STATUS_SUCCESS);
|
---|
946 | if (Status == STATUS_SUCCESS)
|
---|
947 | {
|
---|
948 | Status = vboxVidPnPopulateSourceModeSetFromLegacy(pDevExt,
|
---|
949 | hNewVidPnSourceModeSet, pNewVidPnSourceModeSetInterface,
|
---|
950 | pModes, cModes, iPreferredMode, &PreferredSrcModeId);
|
---|
951 | Assert(Status == STATUS_SUCCESS);
|
---|
952 | if (Status == STATUS_SUCCESS)
|
---|
953 | {
|
---|
954 | Status = pVidPnInterface->pfnAssignSourceModeSet(hVidPn,
|
---|
955 | srcId,
|
---|
956 | hNewVidPnSourceModeSet);
|
---|
957 | Assert(Status == STATUS_SUCCESS);
|
---|
958 | if(Status == STATUS_SUCCESS)
|
---|
959 | {
|
---|
960 | Assert(PreferredSrcModeId != D3DDDI_ID_UNINITIALIZED);
|
---|
961 | D3DKMDT_VIDEO_PRESENT_TARGET_MODE_ID PreferredTrgModeId = D3DDDI_ID_UNINITIALIZED;
|
---|
962 | D3DKMDT_HVIDPNTARGETMODESET hNewVidPnTargetModeSet;
|
---|
963 | const DXGK_VIDPNTARGETMODESET_INTERFACE *pNewVidPnTargetModeSetInterface;
|
---|
964 | NTSTATUS Status = pVidPnInterface->pfnCreateNewTargetModeSet(hVidPn,
|
---|
965 | tgtId, /*__in CONST D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId */
|
---|
966 | &hNewVidPnTargetModeSet,
|
---|
967 | &pNewVidPnTargetModeSetInterface);
|
---|
968 | Assert(Status == STATUS_SUCCESS);
|
---|
969 | if (Status == STATUS_SUCCESS)
|
---|
970 | {
|
---|
971 | Status = vboxVidPnPopulateTargetModeSetFromLegacy(pDevExt,
|
---|
972 | hNewVidPnTargetModeSet, pNewVidPnTargetModeSetInterface,
|
---|
973 | pResolutions, cResolutions, pPreferredMode, 0, &PreferredTrgModeId);
|
---|
974 | Assert(Status == STATUS_SUCCESS);
|
---|
975 | if (Status == STATUS_SUCCESS)
|
---|
976 | {
|
---|
977 | Status = pVidPnInterface->pfnAssignTargetModeSet(hVidPn,
|
---|
978 | tgtId,
|
---|
979 | hNewVidPnTargetModeSet);
|
---|
980 | Assert(Status == STATUS_SUCCESS);
|
---|
981 | if(Status == STATUS_SUCCESS)
|
---|
982 | {
|
---|
983 |
|
---|
984 | Assert(PreferredTrgModeId != D3DDDI_ID_UNINITIALIZED);
|
---|
985 | Status = pVidPnInterface->pfnGetTopology(hVidPn, &hVidPnTopology, &pVidPnTopologyInterface);
|
---|
986 | if (Status == STATUS_SUCCESS)
|
---|
987 | {
|
---|
988 | D3DKMDT_VIDPN_PRESENT_PATH *pNewVidPnPresentPathInfo;
|
---|
989 | Status = pVidPnTopologyInterface->pfnCreateNewPathInfo(hVidPnTopology, &pNewVidPnPresentPathInfo);
|
---|
990 | if (Status == STATUS_SUCCESS)
|
---|
991 | {
|
---|
992 | pNewVidPnPresentPathInfo->VidPnSourceId = 0;
|
---|
993 | pNewVidPnPresentPathInfo->VidPnTargetId = 0;
|
---|
994 | pNewVidPnPresentPathInfo->ImportanceOrdinal = D3DKMDT_VPPI_PRIMARY;
|
---|
995 | pNewVidPnPresentPathInfo->ContentTransformation.Scaling = D3DKMDT_VPPS_IDENTITY;
|
---|
996 | memset(&pNewVidPnPresentPathInfo->ContentTransformation.ScalingSupport,
|
---|
997 | 0, sizeof (pNewVidPnPresentPathInfo->ContentTransformation.ScalingSupport));
|
---|
998 | pNewVidPnPresentPathInfo->ContentTransformation.ScalingSupport.Identity = 1;
|
---|
999 | pNewVidPnPresentPathInfo->ContentTransformation.ScalingSupport.Centered = 0;
|
---|
1000 | pNewVidPnPresentPathInfo->ContentTransformation.ScalingSupport.Stretched = 0;
|
---|
1001 | pNewVidPnPresentPathInfo->ContentTransformation.Rotation = D3DKMDT_VPPR_IDENTITY;
|
---|
1002 | pNewVidPnPresentPathInfo->ContentTransformation.RotationSupport.Identity = 1;
|
---|
1003 | pNewVidPnPresentPathInfo->ContentTransformation.RotationSupport.Rotate180 = 0;
|
---|
1004 | pNewVidPnPresentPathInfo->ContentTransformation.RotationSupport.Rotate270 = 0;
|
---|
1005 | pNewVidPnPresentPathInfo->ContentTransformation.RotationSupport.Rotate90 = 0;
|
---|
1006 | pNewVidPnPresentPathInfo->VisibleFromActiveTLOffset.cx = 0;
|
---|
1007 | pNewVidPnPresentPathInfo->VisibleFromActiveTLOffset.cy = 0;
|
---|
1008 | pNewVidPnPresentPathInfo->VisibleFromActiveBROffset.cx = 0;
|
---|
1009 | pNewVidPnPresentPathInfo->VisibleFromActiveBROffset.cy = 0;
|
---|
1010 | pNewVidPnPresentPathInfo->VidPnTargetColorBasis = D3DKMDT_CB_SRGB; /* @todo: how does it matters? */
|
---|
1011 | pNewVidPnPresentPathInfo->VidPnTargetColorCoeffDynamicRanges.FirstChannel = 8;
|
---|
1012 | pNewVidPnPresentPathInfo->VidPnTargetColorCoeffDynamicRanges.SecondChannel = 8;
|
---|
1013 | pNewVidPnPresentPathInfo->VidPnTargetColorCoeffDynamicRanges.ThirdChannel = 8;
|
---|
1014 | pNewVidPnPresentPathInfo->VidPnTargetColorCoeffDynamicRanges.FourthChannel = 0;
|
---|
1015 | pNewVidPnPresentPathInfo->Content = D3DKMDT_VPPC_GRAPHICS;
|
---|
1016 | pNewVidPnPresentPathInfo->CopyProtection.CopyProtectionType = D3DKMDT_VPPMT_UNINITIALIZED;
|
---|
1017 | // pNewVidPnPresentPathInfo->CopyProtection.CopyProtectionType = D3DKMDT_VPPMT_NOPROTECTION;
|
---|
1018 | pNewVidPnPresentPathInfo->CopyProtection.APSTriggerBits = 0;
|
---|
1019 | memset(&pNewVidPnPresentPathInfo->CopyProtection.CopyProtectionSupport, 0, sizeof (pNewVidPnPresentPathInfo->CopyProtection.CopyProtectionSupport));
|
---|
1020 | // pNewVidPnPresentPathInfo->CopyProtection.CopyProtectionSupport.NoProtection = 1;
|
---|
1021 | memset (&pNewVidPnPresentPathInfo->GammaRamp, 0, sizeof (pNewVidPnPresentPathInfo->GammaRamp));
|
---|
1022 | // pNewVidPnPresentPathInfo->GammaRamp.Type = D3DDDI_GAMMARAMP_DEFAULT;
|
---|
1023 | // pNewVidPnPresentPathInfo->GammaRamp.DataSize = 0;
|
---|
1024 | Status = pVidPnTopologyInterface->pfnAddPath(hVidPnTopology, pNewVidPnPresentPathInfo);
|
---|
1025 | Assert(Status == STATUS_SUCCESS);
|
---|
1026 | if (Status == STATUS_SUCCESS)
|
---|
1027 | {
|
---|
1028 | if (PreferredSrcModeId != D3DDDI_ID_UNINITIALIZED)
|
---|
1029 | {
|
---|
1030 | Status = pNewVidPnSourceModeSetInterface->pfnPinMode(hNewVidPnSourceModeSet, PreferredSrcModeId);
|
---|
1031 | Assert(Status == STATUS_SUCCESS);
|
---|
1032 | if (Status == STATUS_SUCCESS)
|
---|
1033 | {
|
---|
1034 | Status = pNewVidPnTargetModeSetInterface->pfnPinMode(hNewVidPnTargetModeSet, PreferredTrgModeId);
|
---|
1035 | Assert(Status == STATUS_SUCCESS);
|
---|
1036 | if (Status != STATUS_SUCCESS)
|
---|
1037 | drprintf((__FUNCTION__": TRG pfnPinMode failed Status(0x%x)\n", Status));
|
---|
1038 | }
|
---|
1039 | else
|
---|
1040 | drprintf((__FUNCTION__": SRC pfnPinMode failed Status(0x%x)\n", Status));
|
---|
1041 | }
|
---|
1042 | }
|
---|
1043 | else
|
---|
1044 | {
|
---|
1045 | drprintf((__FUNCTION__": pfnAddPath failed Status(0x%x)\n", Status));
|
---|
1046 | pVidPnTopologyInterface->pfnReleasePathInfo(hVidPnTopology, pNewVidPnPresentPathInfo);
|
---|
1047 | pNewVidPnPresentPathInfo = NULL;
|
---|
1048 | }
|
---|
1049 | }
|
---|
1050 | else
|
---|
1051 | drprintf((__FUNCTION__": pfnCreateNewPathInfo failed Status(0x%x)\n", Status));
|
---|
1052 | }
|
---|
1053 | else
|
---|
1054 | drprintf((__FUNCTION__": pfnGetTopology failed Status(0x%x)\n", Status));
|
---|
1055 | }
|
---|
1056 | else
|
---|
1057 | {
|
---|
1058 | drprintf((__FUNCTION__": pfnAssignTargetModeSet failed Status(0x%x)\n", Status));
|
---|
1059 | pVidPnInterface->pfnReleaseTargetModeSet(hVidPn, hNewVidPnTargetModeSet);
|
---|
1060 | }
|
---|
1061 | }
|
---|
1062 | else
|
---|
1063 | {
|
---|
1064 | drprintf((__FUNCTION__": vboxVidPnPopulateTargetModeSetFromLegacy failed Status(0x%x)\n", Status));
|
---|
1065 | pVidPnInterface->pfnReleaseTargetModeSet(hVidPn, hNewVidPnTargetModeSet);
|
---|
1066 | }
|
---|
1067 | }
|
---|
1068 | else
|
---|
1069 | drprintf((__FUNCTION__": pfnCreateNewTargetModeSet failed Status(0x%x)\n", Status));
|
---|
1070 | }
|
---|
1071 | else
|
---|
1072 | {
|
---|
1073 | drprintf((__FUNCTION__": pfnAssignSourceModeSet failed Status(0x%x)\n", Status));
|
---|
1074 | pVidPnInterface->pfnReleaseSourceModeSet(hVidPn, hNewVidPnSourceModeSet);
|
---|
1075 | }
|
---|
1076 | }
|
---|
1077 | else
|
---|
1078 | {
|
---|
1079 | drprintf((__FUNCTION__": vboxVidPnPopulateSourceModeSetFromLegacy failed Status(0x%x)\n", Status));
|
---|
1080 | pVidPnInterface->pfnReleaseSourceModeSet(hVidPn, hNewVidPnSourceModeSet);
|
---|
1081 | }
|
---|
1082 | }
|
---|
1083 | else
|
---|
1084 | drprintf((__FUNCTION__": pfnCreateNewSourceModeSet failed Status(0x%x)\n", Status));
|
---|
1085 |
|
---|
1086 | return Status;
|
---|
1087 | }
|
---|
1088 |
|
---|
1089 | DECLCALLBACK(BOOLEAN) vboxVidPnCofuncModalityPathEnum(PDEVICE_EXTENSION pDevExt, const D3DKMDT_HVIDPN hDesiredVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface,
|
---|
1090 | D3DKMDT_HVIDPNTOPOLOGY hVidPnTopology, const DXGK_VIDPNTOPOLOGY_INTERFACE* pVidPnTopologyInterface,
|
---|
1091 | const D3DKMDT_VIDPN_PRESENT_PATH *pNewVidPnPresentPathInfo, PVOID pContext)
|
---|
1092 | {
|
---|
1093 | PVBOXVIDPNCOFUNCMODALITY pCbContext = (PVBOXVIDPNCOFUNCMODALITY)pContext;
|
---|
1094 | NTSTATUS Status = STATUS_SUCCESS;
|
---|
1095 | pCbContext->Status = STATUS_SUCCESS;
|
---|
1096 | VIDEO_MODE_INFORMATION *pModes = pCbContext->pModes;
|
---|
1097 | uint32_t cModes = pCbContext->cModes;
|
---|
1098 | int iPreferredMode = pCbContext->iPreferredMode;
|
---|
1099 | uint32_t cResolutions = pCbContext->cResolutions;
|
---|
1100 | D3DKMDT_2DREGION * pResolutions = pCbContext->pResolutions;
|
---|
1101 |
|
---|
1102 |
|
---|
1103 | /* adjust scaling */
|
---|
1104 | if (pCbContext->pEnumCofuncModalityArg->EnumPivotType != D3DKMDT_EPT_SCALING)
|
---|
1105 | {
|
---|
1106 | if (pNewVidPnPresentPathInfo->ContentTransformation.Scaling != D3DKMDT_VPPS_IDENTITY
|
---|
1107 | && pNewVidPnPresentPathInfo->ContentTransformation.Scaling != D3DKMDT_VPPS_CENTERED
|
---|
1108 | && pNewVidPnPresentPathInfo->ContentTransformation.Scaling != D3DKMDT_VPPS_STRETCHED
|
---|
1109 | && pNewVidPnPresentPathInfo->ContentTransformation.Scaling != D3DKMDT_VPPS_UNPINNED
|
---|
1110 | && pNewVidPnPresentPathInfo->ContentTransformation.Scaling != D3DKMDT_VPPS_NOTSPECIFIED)
|
---|
1111 | {
|
---|
1112 | AssertBreakpoint();
|
---|
1113 | /* todo: create a new path (if not done already) and assign a proper info */
|
---|
1114 | }
|
---|
1115 | }
|
---|
1116 |
|
---|
1117 | /* adjust rotation */
|
---|
1118 | if (pCbContext->pEnumCofuncModalityArg->EnumPivotType != D3DKMDT_EPT_ROTATION)
|
---|
1119 | {
|
---|
1120 | if (pNewVidPnPresentPathInfo->ContentTransformation.Rotation != D3DKMDT_VPPR_IDENTITY
|
---|
1121 | && pNewVidPnPresentPathInfo->ContentTransformation.Rotation != D3DKMDT_VPPR_ROTATE90
|
---|
1122 | && pNewVidPnPresentPathInfo->ContentTransformation.Rotation != D3DKMDT_VPPR_ROTATE180
|
---|
1123 | && pNewVidPnPresentPathInfo->ContentTransformation.Rotation != D3DKMDT_VPPR_ROTATE270
|
---|
1124 | && pNewVidPnPresentPathInfo->ContentTransformation.Rotation != D3DKMDT_VPPR_UNPINNED)
|
---|
1125 | {
|
---|
1126 | AssertBreakpoint();
|
---|
1127 | /* todo: create a new path (if not done already) and assign a proper info */
|
---|
1128 | }
|
---|
1129 | }
|
---|
1130 |
|
---|
1131 | D3DKMDT_HVIDPNSOURCEMODESET hCurVidPnSourceModeSet;
|
---|
1132 | const DXGK_VIDPNSOURCEMODESET_INTERFACE *pCurVidPnSourceModeSetInterface;
|
---|
1133 | VIDEO_MODE_INFORMATION *pPreferredMode = iPreferredMode >= 0 ? &pModes[iPreferredMode] : NULL;
|
---|
1134 |
|
---|
1135 | Status = pVidPnInterface->pfnAcquireSourceModeSet(hDesiredVidPn,
|
---|
1136 | pNewVidPnPresentPathInfo->VidPnSourceId,
|
---|
1137 | &hCurVidPnSourceModeSet,
|
---|
1138 | &pCurVidPnSourceModeSetInterface);
|
---|
1139 | Assert(Status == STATUS_SUCCESS);
|
---|
1140 | if (Status == STATUS_SUCCESS)
|
---|
1141 | {
|
---|
1142 | CONST D3DKMDT_VIDPN_SOURCE_MODE* pPinnedVidPnSourceModeInfo;
|
---|
1143 | Status = pCurVidPnSourceModeSetInterface->pfnAcquirePinnedModeInfo(hCurVidPnSourceModeSet, &pPinnedVidPnSourceModeInfo);
|
---|
1144 | Assert(Status == STATUS_SUCCESS || Status == STATUS_GRAPHICS_MODE_NOT_PINNED);
|
---|
1145 | if (Status == STATUS_GRAPHICS_MODE_NOT_PINNED)
|
---|
1146 | {
|
---|
1147 | pPinnedVidPnSourceModeInfo = NULL;
|
---|
1148 | Status = STATUS_SUCCESS;
|
---|
1149 | }
|
---|
1150 | else if (Status != STATUS_SUCCESS)
|
---|
1151 | drprintf((__FUNCTION__": pfnAcquirePinnedModeInfo failed Status(0x%x)\n", Status));
|
---|
1152 |
|
---|
1153 | D3DKMDT_HVIDPNTARGETMODESET hCurVidPnTargetModeSet;
|
---|
1154 | const DXGK_VIDPNTARGETMODESET_INTERFACE *pCurVidPnTargetModeSetInterface;
|
---|
1155 | Status = pVidPnInterface->pfnAcquireTargetModeSet(hDesiredVidPn,
|
---|
1156 | pNewVidPnPresentPathInfo->VidPnTargetId,
|
---|
1157 | &hCurVidPnTargetModeSet,
|
---|
1158 | &pCurVidPnTargetModeSetInterface);
|
---|
1159 | Assert(Status == STATUS_SUCCESS);
|
---|
1160 | if (Status == STATUS_SUCCESS)
|
---|
1161 | {
|
---|
1162 | CONST D3DKMDT_VIDPN_TARGET_MODE* pPinnedVidPnTargetModeInfo;
|
---|
1163 | Status = pCurVidPnTargetModeSetInterface->pfnAcquirePinnedModeInfo(hCurVidPnTargetModeSet, &pPinnedVidPnTargetModeInfo);
|
---|
1164 | Assert(Status == STATUS_SUCCESS || Status == STATUS_GRAPHICS_MODE_NOT_PINNED);
|
---|
1165 | if (Status == STATUS_GRAPHICS_MODE_NOT_PINNED)
|
---|
1166 | {
|
---|
1167 | pPinnedVidPnTargetModeInfo = NULL;
|
---|
1168 | Status = STATUS_SUCCESS;
|
---|
1169 | }
|
---|
1170 | else if (Status != STATUS_SUCCESS)
|
---|
1171 | drprintf((__FUNCTION__": pfnAcquirePinnedModeInfo failed Status(0x%x)\n", Status));
|
---|
1172 |
|
---|
1173 | switch (pCbContext->pEnumCofuncModalityArg->EnumPivotType)
|
---|
1174 | {
|
---|
1175 | case D3DKMDT_EPT_VIDPNSOURCE:
|
---|
1176 | if (!pPinnedVidPnTargetModeInfo)
|
---|
1177 | {
|
---|
1178 | if (pPinnedVidPnSourceModeInfo)
|
---|
1179 | {
|
---|
1180 | SIZE_T cModes;
|
---|
1181 | Status = pCurVidPnTargetModeSetInterface->pfnGetNumModes(hCurVidPnTargetModeSet, &cModes);
|
---|
1182 | Assert(Status == STATUS_SUCCESS);
|
---|
1183 | if (Status == STATUS_SUCCESS)
|
---|
1184 | {
|
---|
1185 | D3DKMDT_2DREGION Resolution;
|
---|
1186 | Resolution.cx = pPinnedVidPnSourceModeInfo->Format.Graphics.VisibleRegionSize.cx;
|
---|
1187 | Resolution.cy = pPinnedVidPnSourceModeInfo->Format.Graphics.VisibleRegionSize.cy;
|
---|
1188 | BOOLEAN bCreateTrg = FALSE;
|
---|
1189 | if (cModes == 1)
|
---|
1190 | {
|
---|
1191 | const D3DKMDT_VIDPN_TARGET_MODE *pVidPnTargetModeInfo;
|
---|
1192 | Status = pCurVidPnTargetModeSetInterface->pfnAcquireFirstModeInfo(hCurVidPnTargetModeSet, &pVidPnTargetModeInfo);
|
---|
1193 | Assert(Status == STATUS_SUCCESS);
|
---|
1194 | if (Status == STATUS_SUCCESS)
|
---|
1195 | {
|
---|
1196 | D3DKMDT_VIDPN_TARGET_MODE dummyMode = {0};
|
---|
1197 | Status = vboxVidPnPopulateTargetModeInfoFromLegacy(&dummyMode, &Resolution, FALSE);
|
---|
1198 | Assert(Status == STATUS_SUCCESS);
|
---|
1199 | if (Status == STATUS_SUCCESS)
|
---|
1200 | {
|
---|
1201 | if (!vboxVidPnMatchVideoSignal(&dummyMode.VideoSignalInfo, &pVidPnTargetModeInfo->VideoSignalInfo))
|
---|
1202 | bCreateTrg = TRUE;
|
---|
1203 | else
|
---|
1204 | {
|
---|
1205 | /* do we need to check pVidPnTargetModeInfo->Preference; ? */
|
---|
1206 | }
|
---|
1207 | }
|
---|
1208 | else
|
---|
1209 | {
|
---|
1210 | drprintf((__FUNCTION__": trg vboxVidPnPopulateTargetModeInfoFromLegacy failed Status(0x%x), pretending success\n", Status));
|
---|
1211 | Status = STATUS_SUCCESS;
|
---|
1212 | bCreateTrg = TRUE;
|
---|
1213 | }
|
---|
1214 | }
|
---|
1215 | else
|
---|
1216 | drprintf((__FUNCTION__": trg pfnAcquireFirstModeInfo failed Status(0x%x)\n", Status));
|
---|
1217 | }
|
---|
1218 | else
|
---|
1219 | bCreateTrg = TRUE;
|
---|
1220 |
|
---|
1221 | if (bCreateTrg)
|
---|
1222 | {
|
---|
1223 | Status = vboxVidPnCreatePopulateTargetModeSetFromLegacy(pDevExt, hDesiredVidPn, pVidPnInterface,
|
---|
1224 | pNewVidPnPresentPathInfo->VidPnTargetId,
|
---|
1225 | &Resolution,
|
---|
1226 | 1,
|
---|
1227 | pPreferredMode,
|
---|
1228 | 0,
|
---|
1229 | NULL);
|
---|
1230 | Assert(Status == STATUS_SUCCESS);
|
---|
1231 | if (Status != STATUS_SUCCESS)
|
---|
1232 | drprintf((__FUNCTION__": vboxVidPnCreatePopulateTargetModeSetFromLegacy for pinned source failed Status(0x%x)\n", Status)); }
|
---|
1233 | }
|
---|
1234 | else
|
---|
1235 | drprintf((__FUNCTION__": trg pfnGetNumModes failed Status(0x%x)\n", Status));
|
---|
1236 | }
|
---|
1237 | else
|
---|
1238 | {
|
---|
1239 | dprintf((__FUNCTION__": source pivot w/o pinned source mode\n"));
|
---|
1240 | // AssertBreakpoint();
|
---|
1241 | }
|
---|
1242 | }
|
---|
1243 | break;
|
---|
1244 | case D3DKMDT_EPT_VIDPNTARGET:
|
---|
1245 | break;
|
---|
1246 | case D3DKMDT_EPT_SCALING:
|
---|
1247 | break;
|
---|
1248 | case D3DKMDT_EPT_ROTATION:
|
---|
1249 | break;
|
---|
1250 | case D3DKMDT_EPT_NOPIVOT:
|
---|
1251 | /* just create and populate the new source mode set for now */
|
---|
1252 | Status = vboxVidPnCreatePopulateSourceModeSetFromLegacy(pDevExt, hDesiredVidPn, pVidPnInterface,
|
---|
1253 | pNewVidPnPresentPathInfo->VidPnSourceId,
|
---|
1254 | pModes, cModes, iPreferredMode, NULL);
|
---|
1255 | Assert(Status == STATUS_SUCCESS);
|
---|
1256 | if (Status == STATUS_SUCCESS)
|
---|
1257 | {
|
---|
1258 | /* just create and populate a new target mode info for now */
|
---|
1259 | Status = vboxVidPnCreatePopulateTargetModeSetFromLegacy(pDevExt, hDesiredVidPn, pVidPnInterface,
|
---|
1260 | pNewVidPnPresentPathInfo->VidPnTargetId,
|
---|
1261 | pResolutions,
|
---|
1262 | cResolutions,
|
---|
1263 | pPreferredMode,
|
---|
1264 | 0,
|
---|
1265 | NULL);
|
---|
1266 | Assert(Status == STATUS_SUCCESS);
|
---|
1267 | if (Status != STATUS_SUCCESS)
|
---|
1268 | drprintf((__FUNCTION__": vboxVidPnCreatePopulateTargetModeSetFromLegacy failed Status(0x%x)\n", Status));
|
---|
1269 | }
|
---|
1270 | else
|
---|
1271 | drprintf((__FUNCTION__": vboxVidPnCreatePopulateSourceModeSetFromLegacy failed Status(0x%x)\n", Status));
|
---|
1272 |
|
---|
1273 | break;
|
---|
1274 | default:
|
---|
1275 | drprintf((__FUNCTION__": unknown EnumPivotType (%dx)\n", pCbContext->pEnumCofuncModalityArg->EnumPivotType));
|
---|
1276 | break;
|
---|
1277 | }
|
---|
1278 |
|
---|
1279 | if (pPinnedVidPnTargetModeInfo)
|
---|
1280 | pCurVidPnTargetModeSetInterface->pfnReleaseModeInfo(hCurVidPnTargetModeSet, pPinnedVidPnTargetModeInfo);
|
---|
1281 | pVidPnInterface->pfnReleaseTargetModeSet(hDesiredVidPn, hCurVidPnTargetModeSet);
|
---|
1282 | }
|
---|
1283 | else
|
---|
1284 | drprintf((__FUNCTION__": pfnAcquireTargetModeSet failed Status(0x%x)\n", Status));
|
---|
1285 |
|
---|
1286 | if (pPinnedVidPnSourceModeInfo)
|
---|
1287 | pCurVidPnSourceModeSetInterface->pfnReleaseModeInfo(hCurVidPnSourceModeSet, pPinnedVidPnSourceModeInfo);
|
---|
1288 | pVidPnInterface->pfnReleaseSourceModeSet(hDesiredVidPn, hCurVidPnSourceModeSet);
|
---|
1289 | }
|
---|
1290 | else
|
---|
1291 | drprintf((__FUNCTION__": pfnAcquireSourceModeSet failed Status(0x%x)\n", Status));
|
---|
1292 |
|
---|
1293 | pVidPnTopologyInterface->pfnReleasePathInfo(hVidPnTopology, pNewVidPnPresentPathInfo);
|
---|
1294 |
|
---|
1295 | pCbContext->Status = Status;
|
---|
1296 | Assert(Status == STATUS_SUCCESS);
|
---|
1297 | return Status == STATUS_SUCCESS;
|
---|
1298 | }
|
---|
1299 |
|
---|
1300 | NTSTATUS vboxVidPnEnumMonitorSourceModes(PDEVICE_EXTENSION pDevExt, D3DKMDT_HMONITORSOURCEMODESET hMonitorSMS, CONST DXGK_MONITORSOURCEMODESET_INTERFACE *pMonitorSMSIf,
|
---|
1301 | PFNVBOXVIDPNENUMMONITORSOURCEMODES pfnCallback, PVOID pContext)
|
---|
1302 | {
|
---|
1303 | CONST D3DKMDT_MONITOR_SOURCE_MODE *pMonitorSMI;
|
---|
1304 | NTSTATUS Status = pMonitorSMSIf->pfnAcquireFirstModeInfo(hMonitorSMS, &pMonitorSMI);
|
---|
1305 | Assert(Status == STATUS_SUCCESS || Status == STATUS_GRAPHICS_DATASET_IS_EMPTY);
|
---|
1306 | if (Status == STATUS_SUCCESS)
|
---|
1307 | {
|
---|
1308 | Assert(pMonitorSMI);
|
---|
1309 | while (1)
|
---|
1310 | {
|
---|
1311 | CONST D3DKMDT_MONITOR_SOURCE_MODE *pNextMonitorSMI;
|
---|
1312 | Status = pMonitorSMSIf->pfnAcquireNextModeInfo(hMonitorSMS, pMonitorSMI, &pNextMonitorSMI);
|
---|
1313 | if (!pfnCallback(pDevExt, hMonitorSMS, pMonitorSMSIf, pMonitorSMI, pContext))
|
---|
1314 | {
|
---|
1315 | Assert(Status == STATUS_SUCCESS || Status == STATUS_GRAPHICS_NO_MORE_ELEMENTS_IN_DATASET);
|
---|
1316 | if (Status == STATUS_SUCCESS)
|
---|
1317 | pMonitorSMSIf->pfnReleaseModeInfo(hMonitorSMS, pNextMonitorSMI);
|
---|
1318 | else if (Status == STATUS_GRAPHICS_NO_MORE_ELEMENTS_IN_DATASET)
|
---|
1319 | {
|
---|
1320 | Status = STATUS_SUCCESS;
|
---|
1321 | break;
|
---|
1322 | }
|
---|
1323 | else
|
---|
1324 | {
|
---|
1325 | drprintf((__FUNCTION__": pfnAcquireNextModeInfo Failed Status(0x%x), ignored since callback returned false\n", Status));
|
---|
1326 | Status = STATUS_SUCCESS;
|
---|
1327 | }
|
---|
1328 | break;
|
---|
1329 | }
|
---|
1330 | else if (Status == STATUS_SUCCESS)
|
---|
1331 | pMonitorSMI = pNextMonitorSMI;
|
---|
1332 | else if (Status == STATUS_GRAPHICS_NO_MORE_ELEMENTS_IN_DATASET)
|
---|
1333 | {
|
---|
1334 | Status = STATUS_SUCCESS;
|
---|
1335 | break;
|
---|
1336 | }
|
---|
1337 | else
|
---|
1338 | {
|
---|
1339 | AssertBreakpoint();
|
---|
1340 | drprintf((__FUNCTION__": pfnAcquireNextModeInfo Failed Status(0x%x)\n", Status));
|
---|
1341 | pNextMonitorSMI = NULL;
|
---|
1342 | break;
|
---|
1343 | }
|
---|
1344 | }
|
---|
1345 | }
|
---|
1346 | else if (Status == STATUS_GRAPHICS_DATASET_IS_EMPTY)
|
---|
1347 | Status = STATUS_SUCCESS;
|
---|
1348 | else
|
---|
1349 | drprintf((__FUNCTION__": pfnAcquireFirstModeInfo failed Status(0x%x)\n", Status));
|
---|
1350 |
|
---|
1351 | return Status;
|
---|
1352 | }
|
---|
1353 |
|
---|
1354 | NTSTATUS vboxVidPnEnumSourceModes(PDEVICE_EXTENSION pDevExt, const D3DKMDT_HVIDPN hDesiredVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface,
|
---|
1355 | D3DKMDT_HVIDPNSOURCEMODESET hNewVidPnSourceModeSet, const DXGK_VIDPNSOURCEMODESET_INTERFACE *pVidPnSourceModeSetInterface,
|
---|
1356 | PFNVBOXVIDPNENUMSOURCEMODES pfnCallback, PVOID pContext)
|
---|
1357 | {
|
---|
1358 | const D3DKMDT_VIDPN_SOURCE_MODE *pNewVidPnSourceModeInfo;
|
---|
1359 | NTSTATUS Status = pVidPnSourceModeSetInterface->pfnAcquireFirstModeInfo(hNewVidPnSourceModeSet, &pNewVidPnSourceModeInfo);
|
---|
1360 | if (Status == STATUS_SUCCESS)
|
---|
1361 | {
|
---|
1362 | Assert(pNewVidPnSourceModeInfo);
|
---|
1363 | while (1)
|
---|
1364 | {
|
---|
1365 | const D3DKMDT_VIDPN_SOURCE_MODE *pNextVidPnSourceModeInfo;
|
---|
1366 | Status = pVidPnSourceModeSetInterface->pfnAcquireNextModeInfo(hNewVidPnSourceModeSet, pNewVidPnSourceModeInfo, &pNextVidPnSourceModeInfo);
|
---|
1367 | if (!pfnCallback(pDevExt, hDesiredVidPn, pVidPnInterface,
|
---|
1368 | hNewVidPnSourceModeSet, pVidPnSourceModeSetInterface,
|
---|
1369 | pNewVidPnSourceModeInfo, pContext))
|
---|
1370 | {
|
---|
1371 | Assert(Status == STATUS_SUCCESS);
|
---|
1372 | if (Status == STATUS_SUCCESS)
|
---|
1373 | pVidPnSourceModeSetInterface->pfnReleaseModeInfo(hNewVidPnSourceModeSet, pNextVidPnSourceModeInfo);
|
---|
1374 | else if (Status == STATUS_GRAPHICS_NO_MORE_ELEMENTS_IN_DATASET)
|
---|
1375 | {
|
---|
1376 | Status = STATUS_SUCCESS;
|
---|
1377 | break;
|
---|
1378 | }
|
---|
1379 | else
|
---|
1380 | {
|
---|
1381 | drprintf((__FUNCTION__": pfnAcquireNextModeInfo Failed Status(0x%x), ignored since callback returned false\n", Status));
|
---|
1382 | Status = STATUS_SUCCESS;
|
---|
1383 | }
|
---|
1384 |
|
---|
1385 | break;
|
---|
1386 | }
|
---|
1387 | else if (Status == STATUS_SUCCESS)
|
---|
1388 | pNewVidPnSourceModeInfo = pNextVidPnSourceModeInfo;
|
---|
1389 | else if (Status == STATUS_GRAPHICS_NO_MORE_ELEMENTS_IN_DATASET)
|
---|
1390 | {
|
---|
1391 | Status = STATUS_SUCCESS;
|
---|
1392 | break;
|
---|
1393 | }
|
---|
1394 | else
|
---|
1395 | {
|
---|
1396 | AssertBreakpoint();
|
---|
1397 | drprintf((__FUNCTION__": pfnAcquireNextModeInfo Failed Status(0x%x)\n", Status));
|
---|
1398 | pNewVidPnSourceModeInfo = NULL;
|
---|
1399 | break;
|
---|
1400 | }
|
---|
1401 | }
|
---|
1402 | }
|
---|
1403 | else if (Status == STATUS_GRAPHICS_DATASET_IS_EMPTY)
|
---|
1404 | Status = STATUS_SUCCESS;
|
---|
1405 | else
|
---|
1406 | drprintf((__FUNCTION__": pfnAcquireFirstModeInfo failed Status(0x%x)\n", Status));
|
---|
1407 |
|
---|
1408 | return Status;
|
---|
1409 | }
|
---|
1410 |
|
---|
1411 | NTSTATUS vboxVidPnEnumTargetModes(PDEVICE_EXTENSION pDevExt, const D3DKMDT_HVIDPN hDesiredVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface,
|
---|
1412 | D3DKMDT_HVIDPNTARGETMODESET hNewVidPnTargetModeSet, const DXGK_VIDPNTARGETMODESET_INTERFACE *pVidPnTargetModeSetInterface,
|
---|
1413 | PFNVBOXVIDPNENUMTARGETMODES pfnCallback, PVOID pContext)
|
---|
1414 | {
|
---|
1415 | const D3DKMDT_VIDPN_TARGET_MODE *pNewVidPnTargetModeInfo;
|
---|
1416 | NTSTATUS Status = pVidPnTargetModeSetInterface->pfnAcquireFirstModeInfo(hNewVidPnTargetModeSet, &pNewVidPnTargetModeInfo);
|
---|
1417 | if (Status == STATUS_SUCCESS)
|
---|
1418 | {
|
---|
1419 | Assert(pNewVidPnTargetModeInfo);
|
---|
1420 | while (1)
|
---|
1421 | {
|
---|
1422 | const D3DKMDT_VIDPN_TARGET_MODE *pNextVidPnTargetModeInfo;
|
---|
1423 | Status = pVidPnTargetModeSetInterface->pfnAcquireNextModeInfo(hNewVidPnTargetModeSet, pNewVidPnTargetModeInfo, &pNextVidPnTargetModeInfo);
|
---|
1424 | if (!pfnCallback(pDevExt, hDesiredVidPn, pVidPnInterface,
|
---|
1425 | hNewVidPnTargetModeSet, pVidPnTargetModeSetInterface,
|
---|
1426 | pNewVidPnTargetModeInfo, pContext))
|
---|
1427 | {
|
---|
1428 | Assert(Status == STATUS_SUCCESS);
|
---|
1429 | if (Status == STATUS_SUCCESS)
|
---|
1430 | pVidPnTargetModeSetInterface->pfnReleaseModeInfo(hNewVidPnTargetModeSet, pNextVidPnTargetModeInfo);
|
---|
1431 | else if (Status == STATUS_GRAPHICS_NO_MORE_ELEMENTS_IN_DATASET)
|
---|
1432 | {
|
---|
1433 | Status = STATUS_SUCCESS;
|
---|
1434 | break;
|
---|
1435 | }
|
---|
1436 | else
|
---|
1437 | {
|
---|
1438 | drprintf((__FUNCTION__": pfnAcquireNextModeInfo Failed Status(0x%x), ignored since callback returned false\n", Status));
|
---|
1439 | Status = STATUS_SUCCESS;
|
---|
1440 | }
|
---|
1441 |
|
---|
1442 | break;
|
---|
1443 | }
|
---|
1444 | else if (Status == STATUS_SUCCESS)
|
---|
1445 | pNewVidPnTargetModeInfo = pNextVidPnTargetModeInfo;
|
---|
1446 | else if (Status == STATUS_GRAPHICS_NO_MORE_ELEMENTS_IN_DATASET)
|
---|
1447 | {
|
---|
1448 | Status = STATUS_SUCCESS;
|
---|
1449 | break;
|
---|
1450 | }
|
---|
1451 | else
|
---|
1452 | {
|
---|
1453 | AssertBreakpoint();
|
---|
1454 | drprintf((__FUNCTION__": pfnAcquireNextModeInfo Failed Status(0x%x)\n", Status));
|
---|
1455 | pNewVidPnTargetModeInfo = NULL;
|
---|
1456 | break;
|
---|
1457 | }
|
---|
1458 | }
|
---|
1459 | }
|
---|
1460 | else if (Status == STATUS_GRAPHICS_DATASET_IS_EMPTY)
|
---|
1461 | Status = STATUS_SUCCESS;
|
---|
1462 | else
|
---|
1463 | drprintf((__FUNCTION__": pfnAcquireFirstModeInfo failed Status(0x%x)\n", Status));
|
---|
1464 |
|
---|
1465 | return Status;
|
---|
1466 | }
|
---|
1467 |
|
---|
1468 | NTSTATUS vboxVidPnEnumTargetsForSource(PDEVICE_EXTENSION pDevExt, D3DKMDT_HVIDPNTOPOLOGY hVidPnTopology, const DXGK_VIDPNTOPOLOGY_INTERFACE* pVidPnTopologyInterface,
|
---|
1469 | CONST D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId,
|
---|
1470 | PFNVBOXVIDPNENUMTARGETSFORSOURCE pfnCallback, PVOID pContext)
|
---|
1471 | {
|
---|
1472 | SIZE_T cTgtPaths;
|
---|
1473 | NTSTATUS Status = pVidPnTopologyInterface->pfnGetNumPathsFromSource(hVidPnTopology, VidPnSourceId, &cTgtPaths);
|
---|
1474 | Assert(Status == STATUS_SUCCESS || Status == STATUS_GRAPHICS_SOURCE_NOT_IN_TOPOLOGY);
|
---|
1475 | if (Status == STATUS_SUCCESS)
|
---|
1476 | {
|
---|
1477 | for (SIZE_T i = 0; i < cTgtPaths; ++i)
|
---|
1478 | {
|
---|
1479 | D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId;
|
---|
1480 | Status = pVidPnTopologyInterface->pfnEnumPathTargetsFromSource(hVidPnTopology, VidPnSourceId, i, &VidPnTargetId);
|
---|
1481 | Assert(Status == STATUS_SUCCESS);
|
---|
1482 | if (Status == STATUS_SUCCESS)
|
---|
1483 | {
|
---|
1484 | if (!pfnCallback(pDevExt, hVidPnTopology, pVidPnTopologyInterface, VidPnSourceId, VidPnTargetId, cTgtPaths, pContext))
|
---|
1485 | break;
|
---|
1486 | }
|
---|
1487 | else
|
---|
1488 | {
|
---|
1489 | drprintf((__FUNCTION__": pfnEnumPathTargetsFromSource failed Status(0x%x)\n", Status));
|
---|
1490 | break;
|
---|
1491 | }
|
---|
1492 | }
|
---|
1493 | }
|
---|
1494 | else if (Status != STATUS_GRAPHICS_SOURCE_NOT_IN_TOPOLOGY)
|
---|
1495 | drprintf((__FUNCTION__": pfnGetNumPathsFromSource failed Status(0x%x)\n", Status));
|
---|
1496 |
|
---|
1497 | return Status;
|
---|
1498 | }
|
---|
1499 |
|
---|
1500 | NTSTATUS vboxVidPnEnumPaths(PDEVICE_EXTENSION pDevExt, const D3DKMDT_HVIDPN hDesiredVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface,
|
---|
1501 | D3DKMDT_HVIDPNTOPOLOGY hVidPnTopology, const DXGK_VIDPNTOPOLOGY_INTERFACE* pVidPnTopologyInterface,
|
---|
1502 | PFNVBOXVIDPNENUMPATHS pfnCallback, PVOID pContext)
|
---|
1503 | {
|
---|
1504 | const D3DKMDT_VIDPN_PRESENT_PATH *pNewVidPnPresentPathInfo = NULL;
|
---|
1505 | NTSTATUS Status = pVidPnTopologyInterface->pfnAcquireFirstPathInfo(hVidPnTopology, &pNewVidPnPresentPathInfo);
|
---|
1506 | if (Status == STATUS_SUCCESS)
|
---|
1507 | {
|
---|
1508 | while (1)
|
---|
1509 | {
|
---|
1510 | const D3DKMDT_VIDPN_PRESENT_PATH *pNextVidPnPresentPathInfo;
|
---|
1511 | Status = pVidPnTopologyInterface->pfnAcquireNextPathInfo(hVidPnTopology, pNewVidPnPresentPathInfo, &pNextVidPnPresentPathInfo);
|
---|
1512 |
|
---|
1513 | if (!pfnCallback(pDevExt, hDesiredVidPn, pVidPnInterface, hVidPnTopology, pVidPnTopologyInterface, pNewVidPnPresentPathInfo, pContext))
|
---|
1514 | {
|
---|
1515 | Assert(Status == STATUS_SUCCESS);
|
---|
1516 | if (Status == STATUS_SUCCESS)
|
---|
1517 | pVidPnTopologyInterface->pfnReleasePathInfo(hVidPnTopology, pNextVidPnPresentPathInfo);
|
---|
1518 | else
|
---|
1519 | {
|
---|
1520 | Assert(Status == STATUS_GRAPHICS_NO_MORE_ELEMENTS_IN_DATASET);
|
---|
1521 | if (Status != STATUS_GRAPHICS_NO_MORE_ELEMENTS_IN_DATASET)
|
---|
1522 | drprintf((__FUNCTION__": pfnAcquireNextPathInfo Failed Status(0x%x), ignored since callback returned false\n", Status));
|
---|
1523 | Status = STATUS_SUCCESS;
|
---|
1524 | }
|
---|
1525 |
|
---|
1526 | break;
|
---|
1527 | }
|
---|
1528 | else if (Status == STATUS_SUCCESS)
|
---|
1529 | pNewVidPnPresentPathInfo = pNextVidPnPresentPathInfo;
|
---|
1530 | else if (Status == STATUS_GRAPHICS_NO_MORE_ELEMENTS_IN_DATASET)
|
---|
1531 | {
|
---|
1532 | Status = STATUS_SUCCESS;
|
---|
1533 | break;
|
---|
1534 | }
|
---|
1535 | else
|
---|
1536 | {
|
---|
1537 | AssertBreakpoint();
|
---|
1538 | drprintf((__FUNCTION__": pfnAcquireNextPathInfo Failed Status(0x%x)\n", Status));
|
---|
1539 | pNewVidPnPresentPathInfo = NULL;
|
---|
1540 | break;
|
---|
1541 | }
|
---|
1542 | }
|
---|
1543 | }
|
---|
1544 | else if (Status == STATUS_GRAPHICS_DATASET_IS_EMPTY)
|
---|
1545 | Status = STATUS_SUCCESS;
|
---|
1546 | else
|
---|
1547 | drprintf((__FUNCTION__": pfnAcquireFirstModeInfo failed Status(0x%x)\n", Status));
|
---|
1548 |
|
---|
1549 | return Status;
|
---|
1550 | }
|
---|
1551 |
|
---|
1552 | NTSTATUS vboxVidPnSetupSourceInfo(struct _DEVICE_EXTENSION* pDevExt, D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId, PVBOXWDDM_SOURCE pSource, CONST D3DKMDT_VIDPN_SOURCE_MODE* pVidPnSourceModeInfo, PVBOXWDDM_ALLOCATION pAllocation)
|
---|
1553 | {
|
---|
1554 | vboxWddmAssignPrimary(pDevExt, pSource, pAllocation, srcId);
|
---|
1555 | return STATUS_SUCCESS;
|
---|
1556 | }
|
---|
1557 |
|
---|
1558 | NTSTATUS vboxVidPnCommitSourceMode(struct _DEVICE_EXTENSION* pDevExt, D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId, CONST D3DKMDT_VIDPN_SOURCE_MODE* pVidPnSourceModeInfo, PVBOXWDDM_ALLOCATION pAllocation)
|
---|
1559 | {
|
---|
1560 | Assert(srcId < (UINT)pDevExt->u.primary.cDisplays);
|
---|
1561 | if (srcId < (UINT)pDevExt->u.primary.cDisplays)
|
---|
1562 | {
|
---|
1563 | PVBOXWDDM_SOURCE pSource = &pDevExt->aSources[srcId];
|
---|
1564 | return vboxVidPnSetupSourceInfo(pDevExt, srcId, pSource, pVidPnSourceModeInfo, pAllocation);
|
---|
1565 | }
|
---|
1566 |
|
---|
1567 | drprintf((__FUNCTION__": invalid srcId (%d), cSources(%d)\n", srcId, pDevExt->u.primary.cDisplays));
|
---|
1568 | return STATUS_INVALID_PARAMETER;
|
---|
1569 | }
|
---|
1570 |
|
---|
1571 | typedef struct VBOXVIDPNCOMMITTARGETMODE
|
---|
1572 | {
|
---|
1573 | NTSTATUS Status;
|
---|
1574 | D3DKMDT_HVIDPN hVidPn;
|
---|
1575 | const DXGK_VIDPN_INTERFACE* pVidPnInterface;
|
---|
1576 | } VBOXVIDPNCOMMITTARGETMODE;
|
---|
1577 |
|
---|
1578 | DECLCALLBACK(BOOLEAN) vboxVidPnCommitTargetModeEnum(PDEVICE_EXTENSION pDevExt, D3DKMDT_HVIDPNTOPOLOGY hVidPnTopology, const DXGK_VIDPNTOPOLOGY_INTERFACE* pVidPnTopologyInterface,
|
---|
1579 | CONST D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId, D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId, SIZE_T cTgtPaths, PVOID pContext)
|
---|
1580 | {
|
---|
1581 | VBOXVIDPNCOMMITTARGETMODE *pInfo = (VBOXVIDPNCOMMITTARGETMODE*)pContext;
|
---|
1582 | Assert(cTgtPaths <= (SIZE_T)pDevExt->u.primary.cDisplays);
|
---|
1583 | D3DKMDT_HVIDPNTARGETMODESET hVidPnTargetModeSet;
|
---|
1584 | CONST DXGK_VIDPNTARGETMODESET_INTERFACE* pVidPnTargetModeSetInterface;
|
---|
1585 | NTSTATUS Status = pInfo->pVidPnInterface->pfnAcquireTargetModeSet(pInfo->hVidPn, VidPnTargetId, &hVidPnTargetModeSet, &pVidPnTargetModeSetInterface);
|
---|
1586 | Assert(Status == STATUS_SUCCESS);
|
---|
1587 | if (Status == STATUS_SUCCESS)
|
---|
1588 | {
|
---|
1589 | CONST D3DKMDT_VIDPN_TARGET_MODE* pPinnedVidPnTargetModeInfo;
|
---|
1590 | Status = pVidPnTargetModeSetInterface->pfnAcquirePinnedModeInfo(hVidPnTargetModeSet, &pPinnedVidPnTargetModeInfo);
|
---|
1591 | Assert(Status == STATUS_SUCCESS);
|
---|
1592 | if (Status == STATUS_SUCCESS)
|
---|
1593 | {
|
---|
1594 | VBOXWDDM_TARGET *pTarget = &pDevExt->aTargets[VidPnTargetId];
|
---|
1595 | if (pTarget->HeightVisible != pPinnedVidPnTargetModeInfo->VideoSignalInfo.ActiveSize.cy
|
---|
1596 | || pTarget->HeightTotal != pPinnedVidPnTargetModeInfo->VideoSignalInfo.TotalSize.cy)
|
---|
1597 | {
|
---|
1598 | pTarget->HeightVisible = pPinnedVidPnTargetModeInfo->VideoSignalInfo.ActiveSize.cy;
|
---|
1599 | pTarget->HeightTotal = pPinnedVidPnTargetModeInfo->VideoSignalInfo.TotalSize.cy;
|
---|
1600 | pTarget->ScanLineState = 0;
|
---|
1601 | }
|
---|
1602 | pVidPnTargetModeSetInterface->pfnReleaseModeInfo(hVidPnTargetModeSet, pPinnedVidPnTargetModeInfo);
|
---|
1603 | }
|
---|
1604 |
|
---|
1605 | pInfo->pVidPnInterface->pfnReleaseTargetModeSet(pInfo->hVidPn, hVidPnTargetModeSet);
|
---|
1606 | }
|
---|
1607 | else
|
---|
1608 | drprintf((__FUNCTION__": pfnAcquireTargetModeSet failed Status(0x%x)\n", Status));
|
---|
1609 |
|
---|
1610 | pInfo->Status = Status;
|
---|
1611 | return Status == STATUS_SUCCESS;
|
---|
1612 | }
|
---|
1613 |
|
---|
1614 | NTSTATUS vboxVidPnCommitSourceModeForSrcId(struct _DEVICE_EXTENSION* pDevExt, const D3DKMDT_HVIDPN hDesiredVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface, D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId, PVBOXWDDM_ALLOCATION pAllocation)
|
---|
1615 | {
|
---|
1616 | D3DKMDT_HVIDPNSOURCEMODESET hCurVidPnSourceModeSet;
|
---|
1617 | const DXGK_VIDPNSOURCEMODESET_INTERFACE *pCurVidPnSourceModeSetInterface;
|
---|
1618 |
|
---|
1619 | NTSTATUS Status = pVidPnInterface->pfnAcquireSourceModeSet(hDesiredVidPn,
|
---|
1620 | srcId,
|
---|
1621 | &hCurVidPnSourceModeSet,
|
---|
1622 | &pCurVidPnSourceModeSetInterface);
|
---|
1623 | Assert(Status == STATUS_SUCCESS);
|
---|
1624 | if (Status == STATUS_SUCCESS)
|
---|
1625 | {
|
---|
1626 | CONST D3DKMDT_VIDPN_SOURCE_MODE* pPinnedVidPnSourceModeInfo;
|
---|
1627 | Status = pCurVidPnSourceModeSetInterface->pfnAcquirePinnedModeInfo(hCurVidPnSourceModeSet, &pPinnedVidPnSourceModeInfo);
|
---|
1628 | Assert(Status == STATUS_SUCCESS || Status == STATUS_GRAPHICS_MODE_NOT_PINNED);
|
---|
1629 | if (Status == STATUS_SUCCESS)
|
---|
1630 | {
|
---|
1631 | Assert(pPinnedVidPnSourceModeInfo);
|
---|
1632 | Status = vboxVidPnCommitSourceMode(pDevExt, srcId, pPinnedVidPnSourceModeInfo, pAllocation);
|
---|
1633 | Assert(Status == STATUS_SUCCESS);
|
---|
1634 | if (Status == STATUS_SUCCESS)
|
---|
1635 | {
|
---|
1636 | D3DKMDT_HVIDPNTOPOLOGY hVidPnTopology;
|
---|
1637 | CONST DXGK_VIDPNTOPOLOGY_INTERFACE* pVidPnTopologyInterface;
|
---|
1638 | Status = pVidPnInterface->pfnGetTopology(hDesiredVidPn, &hVidPnTopology, &pVidPnTopologyInterface);
|
---|
1639 | Assert(Status == STATUS_SUCCESS);
|
---|
1640 | if (Status == STATUS_SUCCESS)
|
---|
1641 | {
|
---|
1642 | VBOXVIDPNCOMMITTARGETMODE TgtModeInfo = {0};
|
---|
1643 | TgtModeInfo.Status = STATUS_SUCCESS; /* <- to ensure we're succeeded if no targets are set */
|
---|
1644 | TgtModeInfo.hVidPn = hDesiredVidPn;
|
---|
1645 | TgtModeInfo.pVidPnInterface = pVidPnInterface;
|
---|
1646 | Status = vboxVidPnEnumTargetsForSource(pDevExt, hVidPnTopology, pVidPnTopologyInterface,
|
---|
1647 | srcId,
|
---|
1648 | vboxVidPnCommitTargetModeEnum, &TgtModeInfo);
|
---|
1649 | Assert(Status == STATUS_SUCCESS);
|
---|
1650 | if (Status == STATUS_SUCCESS)
|
---|
1651 | {
|
---|
1652 | Status = TgtModeInfo.Status;
|
---|
1653 | Assert(Status == STATUS_SUCCESS);
|
---|
1654 | }
|
---|
1655 | else
|
---|
1656 | drprintf((__FUNCTION__": vboxVidPnEnumTargetsForSource failed Status(0x%x)\n", Status));
|
---|
1657 | }
|
---|
1658 | else
|
---|
1659 | drprintf((__FUNCTION__": pfnGetTopology failed Status(0x%x)\n", Status));
|
---|
1660 | }
|
---|
1661 | else
|
---|
1662 | drprintf((__FUNCTION__": vboxVidPnCommitSourceMode failed Status(0x%x)\n", Status));
|
---|
1663 | /* release */
|
---|
1664 | pCurVidPnSourceModeSetInterface->pfnReleaseModeInfo(hCurVidPnSourceModeSet, pPinnedVidPnSourceModeInfo);
|
---|
1665 | }
|
---|
1666 | else if (Status == STATUS_GRAPHICS_MODE_NOT_PINNED)
|
---|
1667 | {
|
---|
1668 | Status = vboxVidPnCommitSourceMode(pDevExt, srcId, pPinnedVidPnSourceModeInfo, pAllocation);
|
---|
1669 | Assert(Status == STATUS_SUCCESS);
|
---|
1670 | }
|
---|
1671 | else
|
---|
1672 | drprintf((__FUNCTION__": pfnAcquirePinnedModeInfo failed Status(0x%x)\n", Status));
|
---|
1673 |
|
---|
1674 | pVidPnInterface->pfnReleaseSourceModeSet(hDesiredVidPn, hCurVidPnSourceModeSet);
|
---|
1675 | }
|
---|
1676 | else
|
---|
1677 | {
|
---|
1678 | drprintf((__FUNCTION__": pfnAcquireSourceModeSet failed Status(0x%x)\n", Status));
|
---|
1679 | }
|
---|
1680 |
|
---|
1681 | return Status;
|
---|
1682 | }
|
---|
1683 |
|
---|
1684 | DECLCALLBACK(BOOLEAN) vboxVidPnCommitPathEnum(struct _DEVICE_EXTENSION* pDevExt, const D3DKMDT_HVIDPN hDesiredVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface,
|
---|
1685 | D3DKMDT_HVIDPNTOPOLOGY hVidPnTopology, const DXGK_VIDPNTOPOLOGY_INTERFACE* pVidPnTopologyInterface,
|
---|
1686 | const D3DKMDT_VIDPN_PRESENT_PATH *pVidPnPresentPathInfo, PVOID pContext)
|
---|
1687 | {
|
---|
1688 | NTSTATUS Status = STATUS_SUCCESS;
|
---|
1689 | PVBOXVIDPNCOMMIT pCommitInfo = (PVBOXVIDPNCOMMIT)pContext;
|
---|
1690 |
|
---|
1691 | if (pCommitInfo->pCommitVidPnArg->AffectedVidPnSourceId == D3DDDI_ID_ALL
|
---|
1692 | || pCommitInfo->pCommitVidPnArg->AffectedVidPnSourceId == pVidPnPresentPathInfo->VidPnSourceId)
|
---|
1693 | {
|
---|
1694 | Status = vboxVidPnCommitSourceModeForSrcId(pDevExt, hDesiredVidPn, pVidPnInterface, pVidPnPresentPathInfo->VidPnSourceId, (PVBOXWDDM_ALLOCATION)pCommitInfo->pCommitVidPnArg->hPrimaryAllocation);
|
---|
1695 | Assert(Status == STATUS_SUCCESS);
|
---|
1696 | if (Status != STATUS_SUCCESS)
|
---|
1697 | drprintf((__FUNCTION__": vboxVidPnCommitSourceModeForSrcId failed Status(0x%x)\n", Status));
|
---|
1698 | }
|
---|
1699 |
|
---|
1700 | pCommitInfo->Status = Status;
|
---|
1701 | pVidPnTopologyInterface->pfnReleasePathInfo(hVidPnTopology, pVidPnPresentPathInfo);
|
---|
1702 | return Status == STATUS_SUCCESS;
|
---|
1703 | }
|
---|