VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoWddm.cpp@ 26142

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

wddm: a bit more cleanup

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 64.8 KB
Line 
1/*
2 * Copyright (C) 2010 Sun Microsystems, Inc.
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 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
13 * Clara, CA 95054 USA or visit http://www.sun.com if you need
14 * additional information or have any questions.
15 */
16
17#include "../VBoxVideo.h"
18#include "../Helper.h"
19
20#include <VBox/VBoxGuestLib.h>
21#include <VBox/VBoxVideo.h>
22
23#define VBOXWDDM_MEMTAG 'MDBV'
24PVOID vboxWddmMemAlloc(IN SIZE_T cbSize)
25{
26 return ExAllocatePoolWithTag(NonPagedPool, cbSize, VBOXWDDM_MEMTAG);
27}
28
29PVOID vboxWddmMemAllocZero(IN SIZE_T cbSize)
30{
31 PVOID pvMem = vboxWddmMemAlloc(cbSize);
32 memset(pvMem, 0, cbSize);
33 return pvMem;
34}
35
36
37VOID vboxWddmMemFree(PVOID pvMem)
38{
39 ExFreePool(pvMem);
40}
41
42UINT vboxWddmCalcBitsPerPixel(D3DDDIFORMAT format)
43{
44 switch (format)
45 {
46 case D3DDDIFMT_R8G8B8:
47 return 24;
48 case D3DDDIFMT_A8R8G8B8:
49 case D3DDDIFMT_X8R8G8B8:
50 return 32;
51 case D3DDDIFMT_R5G6B5:
52 case D3DDDIFMT_X1R5G5B5:
53 case D3DDDIFMT_A1R5G5B5:
54 case D3DDDIFMT_A4R4G4B4:
55 return 16;
56 case D3DDDIFMT_R3G3B2:
57 case D3DDDIFMT_A8:
58 return 8;
59 case D3DDDIFMT_A8R3G3B2:
60 case D3DDDIFMT_X4R4G4B4:
61 return 16;
62 case D3DDDIFMT_A2B10G10R10:
63 case D3DDDIFMT_A8B8G8R8:
64 case D3DDDIFMT_X8B8G8R8:
65 case D3DDDIFMT_G16R16:
66 case D3DDDIFMT_A2R10G10B10:
67 return 32;
68 case D3DDDIFMT_A16B16G16R16:
69 return 64;
70 default:
71 AssertBreakpoint();
72 return 0;
73 }
74}
75
76UINT vboxWddmCalcPitch(UINT w, UINT bitsPerPixel)
77{
78 UINT Pitch = bitsPerPixel * w;
79 /* pitch is now in bits, translate in bytes */
80 if(Pitch & 7)
81 Pitch = (Pitch >> 3) + 1;
82 else
83 Pitch = (Pitch >> 3);
84
85 return Pitch;
86}
87
88NTSTATUS vboxWddmPickResources(PDEVICE_EXTENSION pContext, PDXGK_DEVICE_INFO pDeviceInfo, PULONG pAdapterMemorySize)
89{
90 NTSTATUS Status = STATUS_SUCCESS;
91 USHORT DispiId;
92 *pAdapterMemorySize = VBE_DISPI_TOTAL_VIDEO_MEMORY_BYTES;
93
94 VBoxVideoCmnPortWriteUshort((PUSHORT)VBE_DISPI_IOPORT_INDEX, VBE_DISPI_INDEX_ID);
95 VBoxVideoCmnPortWriteUshort((PUSHORT)VBE_DISPI_IOPORT_DATA, VBE_DISPI_ID2);
96 DispiId = VBoxVideoCmnPortReadUshort((PUSHORT)VBE_DISPI_IOPORT_DATA);
97 if (DispiId == VBE_DISPI_ID2)
98 {
99 dprintf(("VBoxVideoWddm: found the VBE card\n"));
100 /*
101 * Write some hardware information to registry, so that
102 * it's visible in Windows property dialog.
103 */
104
105 /*
106 * Query the adapter's memory size. It's a bit of a hack, we just read
107 * an ULONG from the data port without setting an index before.
108 */
109 *pAdapterMemorySize = VBoxVideoCmnPortReadUlong((PULONG)VBE_DISPI_IOPORT_DATA);
110 if (VBoxHGSMIIsSupported (pContext))
111 {
112 pContext->u.primary.IOPortHost = (RTIOPORT)VGA_PORT_HGSMI_HOST;
113 pContext->u.primary.IOPortGuest = (RTIOPORT)VGA_PORT_HGSMI_GUEST;
114
115 PCM_RESOURCE_LIST pRcList = pDeviceInfo->TranslatedResourceList;
116 /* @todo: verify resources */
117 for (ULONG i = 0; i < pRcList->Count; ++i)
118 {
119 PCM_FULL_RESOURCE_DESCRIPTOR pFRc = &pRcList->List[i];
120 for (ULONG j = 0; j < pFRc->PartialResourceList.Count; ++j)
121 {
122 PCM_PARTIAL_RESOURCE_DESCRIPTOR pPRc = &pFRc->PartialResourceList.PartialDescriptors[j];
123 switch (pPRc->Type)
124 {
125 case CmResourceTypePort:
126 break;
127 case CmResourceTypeInterrupt:
128 break;
129 case CmResourceTypeMemory:
130 break;
131 case CmResourceTypeDma:
132 break;
133 case CmResourceTypeDeviceSpecific:
134 break;
135 case CmResourceTypeBusNumber:
136 break;
137 default:
138 break;
139 }
140 }
141 }
142 }
143 else
144 {
145 drprintf(("VBoxVideoWddm: HGSMI unsupported, returning err\n"));
146 /* @todo: report a better status */
147 Status = STATUS_UNSUCCESSFUL;
148 }
149 }
150 else
151 {
152 drprintf(("VBoxVideoWddm:: VBE card not found, returning err\n"));
153 Status = STATUS_UNSUCCESSFUL;
154 }
155
156
157 return Status;
158}
159
160/* driver callbacks */
161
162NTSTATUS DxgkDdiAddDevice(
163 IN CONST PDEVICE_OBJECT PhysicalDeviceObject,
164 OUT PVOID *MiniportDeviceContext
165 )
166{
167 /* The DxgkDdiAddDevice function should be made pageable. */
168 PAGED_CODE();
169
170 dfprintf(("==> "__FUNCTION__ ", pdo(0x%x)\n", PhysicalDeviceObject));
171 NTSTATUS Status = STATUS_UNSUCCESSFUL;
172
173 PDEVICE_EXTENSION pContext = (PDEVICE_EXTENSION)vboxWddmMemAllocZero(sizeof (DEVICE_EXTENSION));
174 if (pContext)
175 {
176 *MiniportDeviceContext = pContext;
177 }
178 else
179 {
180 Status = STATUS_INSUFFICIENT_RESOURCES;
181 drprintf(("VBoxVideoWddm: ERROR, failed to create context\n"));
182 }
183
184 dfprintf(("<== "__FUNCTION__ ", status(0x%x), pContext(0x%x)\n", Status, pContext));
185
186 return Status;
187}
188
189NTSTATUS DxgkDdiStartDevice(
190 IN CONST PVOID MiniportDeviceContext,
191 IN PDXGK_START_INFO DxgkStartInfo,
192 IN PDXGKRNL_INTERFACE DxgkInterface,
193 OUT PULONG NumberOfVideoPresentSources,
194 OUT PULONG NumberOfChildren
195 )
196{
197 /* The DxgkDdiStartDevice function should be made pageable. */
198 PAGED_CODE();
199
200 NTSTATUS Status;
201
202 dfprintf(("==> "__FUNCTION__ ", context(0x%x)\n", MiniportDeviceContext));
203
204 if ( ARGUMENT_PRESENT(MiniportDeviceContext) &&
205 ARGUMENT_PRESENT(DxgkInterface) &&
206 ARGUMENT_PRESENT(DxgkStartInfo) &&
207 ARGUMENT_PRESENT(NumberOfVideoPresentSources),
208 ARGUMENT_PRESENT(NumberOfChildren)
209 )
210 {
211 PDEVICE_EXTENSION pContext = (PDEVICE_EXTENSION)MiniportDeviceContext;
212
213 /* Save DeviceHandle and function pointers supplied by the DXGKRNL_INTERFACE structure passed to DxgkInterface. */
214 memcpy(&pContext->u.primary.DxgkInterface, DxgkInterface, sizeof (DXGKRNL_INTERFACE));
215
216 /* Allocate a DXGK_DEVICE_INFO structure, and call DxgkCbGetDeviceInformation to fill in the members of that structure, which include the registry path, the PDO, and a list of translated resources for the display adapter represented by MiniportDeviceContext. Save selected members (ones that the display miniport driver will need later)
217 * of the DXGK_DEVICE_INFO structure in the context block represented by MiniportDeviceContext. */
218 DXGK_DEVICE_INFO DeviceInfo;
219 Status = pContext->u.primary.DxgkInterface.DxgkCbGetDeviceInformation (pContext->u.primary.DxgkInterface.DeviceHandle, &DeviceInfo);
220 if (Status == STATUS_SUCCESS)
221 {
222 ULONG AdapterMemorySize;
223 Status = vboxWddmPickResources(pContext, &DeviceInfo, &AdapterMemorySize);
224 if (Status == STATUS_SUCCESS)
225 {
226 /* Initialize VBoxGuest library, which is used for requests which go through VMMDev. */
227 VbglInit ();
228
229 /* Guest supports only HGSMI, the old VBVA via VMMDev is not supported. Old
230 * code will be ifdef'ed and later removed.
231 * The host will however support both old and new interface to keep compatibility
232 * with old guest additions.
233 */
234 VBoxSetupDisplaysHGSMI(pContext, AdapterMemorySize);
235 if ((pContext)->u.primary.bHGSMI)
236 {
237 drprintf(("VBoxVideoWddm: using HGSMI\n"));
238 *NumberOfVideoPresentSources = pContext->u.primary.cDisplays;
239 *NumberOfChildren = pContext->u.primary.cDisplays;
240 dprintf(("VBoxVideoWddm: sources(%d), children(%d)\n", *NumberOfVideoPresentSources, *NumberOfChildren));
241 }
242 else
243 {
244 drprintf(("VBoxVideoWddm: HGSMI failed to initialize, returning err\n"));
245 /* @todo: report a better status */
246 Status = STATUS_UNSUCCESSFUL;
247 }
248 }
249 else
250 {
251 drprintf(("VBoxVideoWddm:: vboxWddmPickResources failed Status(0x%x), returning err\n", Status));
252 Status = STATUS_UNSUCCESSFUL;
253 }
254 }
255 else
256 {
257 drprintf(("VBoxVideoWddm: DxgkCbGetDeviceInformation failed Status(0x%x), returning err\n", Status));
258 }
259 }
260 else
261 {
262 drprintf(("VBoxVideoWddm: invalid parameter, returning err\n"));
263 Status = STATUS_INVALID_PARAMETER;
264 }
265
266 dfprintf(("<== "__FUNCTION__ ", status(0x%x)\n", Status));
267
268 return Status;
269}
270
271NTSTATUS DxgkDdiStopDevice(
272 IN CONST PVOID MiniportDeviceContext
273 )
274{
275 return STATUS_NOT_IMPLEMENTED;
276}
277
278NTSTATUS DxgkDdiRemoveDevice(
279 IN CONST PVOID MiniportDeviceContext
280 )
281{
282 return STATUS_NOT_IMPLEMENTED;
283}
284
285NTSTATUS DxgkDdiDispatchIoRequest(
286 IN CONST PVOID MiniportDeviceContext,
287 IN ULONG VidPnSourceId,
288 IN PVIDEO_REQUEST_PACKET VideoRequestPacket
289 )
290{
291 return STATUS_NOT_IMPLEMENTED;
292}
293
294BOOLEAN DxgkDdiInterruptRoutine(
295 IN CONST PVOID MiniportDeviceContext,
296 IN ULONG MessageNumber
297 )
298{
299 return false;
300}
301
302VOID DxgkDdiDpcRoutine(
303 IN CONST PVOID MiniportDeviceContext
304 )
305{
306
307}
308
309NTSTATUS DxgkDdiQueryChildRelations(
310 IN CONST PVOID MiniportDeviceContext,
311 IN OUT PDXGK_CHILD_DESCRIPTOR ChildRelations,
312 IN ULONG ChildRelationsSize
313 )
314{
315 /* The DxgkDdiQueryChildRelations function should be made pageable. */
316 PAGED_CODE();
317
318 PDEVICE_EXTENSION pDevExt = (PDEVICE_EXTENSION)MiniportDeviceContext;
319
320 dfprintf(("==> "__FUNCTION__ ", context(0x%x)\n", MiniportDeviceContext));
321 for (int i = 0; i < pDevExt->u.primary.cDisplays; ++i)
322 {
323 ChildRelations[i].ChildDeviceType = TypeVideoOutput;
324 ChildRelations[i].ChildCapabilities.Type.VideoOutput.InterfaceTechnology = D3DKMDT_VOT_HD15; /* VGA */
325 ChildRelations[i].ChildCapabilities.Type.VideoOutput.MonitorOrientationAwareness = D3DKMDT_MOA_INTERRUPTIBLE; /* ?? D3DKMDT_MOA_NONE*/
326 ChildRelations[i].ChildCapabilities.Type.VideoOutput.SupportsSdtvModes = FALSE;
327 ChildRelations[i].ChildCapabilities.HpdAwareness = HpdAwarenessInterruptible; /* ?? HpdAwarenessAlwaysConnected; */
328 ChildRelations[i].AcpiUid = i; /* */
329 ChildRelations[i].ChildUid = i; /* should be == target id */
330 }
331 dfprintf(("<== "__FUNCTION__ ", context(0x%x)\n", MiniportDeviceContext));
332 return STATUS_SUCCESS;
333}
334
335NTSTATUS DxgkDdiQueryChildStatus(
336 IN CONST PVOID MiniportDeviceContext,
337 IN PDXGK_CHILD_STATUS ChildStatus,
338 IN BOOLEAN NonDestructiveOnly
339 )
340{
341 /* The DxgkDdiQueryChildStatus should be made pageable. */
342 PAGED_CODE();
343
344 dfprintf(("==> "__FUNCTION__ ", context(0x%x)\n", MiniportDeviceContext));
345
346 NTSTATUS Status = STATUS_SUCCESS;
347 switch (ChildStatus->Type)
348 {
349 case StatusConnection:
350 ChildStatus->HotPlug.Connected = TRUE;
351 dfprintf(("VBoxVideoWddm: StatusConnection\n"));
352 break;
353 case StatusRotation:
354 ChildStatus->Rotation.Angle = 0;
355 dfprintf(("VBoxVideoWddm: StatusRotation\n"));
356 break;
357 default:
358 drprintf(("VBoxVideoWddm: ERROR: status type: %d\n", ChildStatus->Type));
359 Status = STATUS_INVALID_PARAMETER;
360 break;
361 }
362
363 dfprintf(("<== "__FUNCTION__ ", context(0x%x)\n", MiniportDeviceContext));
364
365 return Status;
366}
367
368NTSTATUS DxgkDdiQueryDeviceDescriptor(
369 IN CONST PVOID MiniportDeviceContext,
370 IN ULONG ChildUid,
371 IN OUT PDXGK_DEVICE_DESCRIPTOR DeviceDescriptor
372 )
373{
374 /* The DxgkDdiQueryDeviceDescriptor should be made pageable. */
375 PAGED_CODE();
376
377 dfprintf(("==> "__FUNCTION__ ", context(0x%x)\n", MiniportDeviceContext));
378
379 /* we do not support EDID */
380 DeviceDescriptor->DescriptorOffset = 0;
381 DeviceDescriptor->DescriptorLength = 0;
382 DeviceDescriptor->DescriptorBuffer = NULL;
383
384 dfprintf(("<== "__FUNCTION__ ", context(0x%x)\n", MiniportDeviceContext));
385
386 return STATUS_SUCCESS;
387}
388
389NTSTATUS DxgkDdiSetPowerState(
390 IN CONST PVOID MiniportDeviceContext,
391 IN ULONG DeviceUid,
392 IN DEVICE_POWER_STATE DevicePowerState,
393 IN POWER_ACTION ActionType
394 )
395{
396 /* The DxgkDdiSetPowerState function should be made pageable. */
397 PAGED_CODE();
398
399 dfprintf(("==> "__FUNCTION__ ", context(0x%x)\n", MiniportDeviceContext));
400
401 /* @todo: */
402
403 dfprintf(("<== "__FUNCTION__ ", context(0x%x)\n", MiniportDeviceContext));
404
405 return STATUS_SUCCESS;
406}
407
408NTSTATUS DxgkDdiNotifyAcpiEvent(
409 IN CONST PVOID MiniportDeviceContext,
410 IN DXGK_EVENT_TYPE EventType,
411 IN ULONG Event,
412 IN PVOID Argument,
413 OUT PULONG AcpiFlags
414 )
415{
416 return STATUS_NOT_IMPLEMENTED;
417}
418
419VOID DxgkDdiResetDevice(
420 IN CONST PVOID MiniportDeviceContext
421 )
422{
423 /* DxgkDdiResetDevice can be called at any IRQL, so it must be in nonpageable memory. */
424 dfprintf(("==> "__FUNCTION__ ", context(0x%x)\n", MiniportDeviceContext));
425 dfprintf(("<== "__FUNCTION__ ", context(0x%x)\n", MiniportDeviceContext));
426}
427
428VOID DxgkDdiUnload(
429 VOID
430 )
431{
432 /* DxgkDdiUnload should be made pageable. */
433 PAGED_CODE();
434 dfprintf(("==> "__FUNCTION__ "\n"));
435 dfprintf(("<== "__FUNCTION__ "\n"));
436}
437
438NTSTATUS DxgkDdiQueryInterface(
439 IN CONST PVOID MiniportDeviceContext,
440 IN PQUERY_INTERFACE QueryInterface
441 )
442{
443 return STATUS_NOT_IMPLEMENTED;
444}
445
446VOID DxgkDdiControlEtwLogging(
447 IN BOOLEAN Enable,
448 IN ULONG Flags,
449 IN UCHAR Level
450 )
451{
452
453}
454
455NTSTATUS APIENTRY DxgkDdiQueryAdapterInfo(
456 CONST HANDLE hAdapter,
457 CONST DXGKARG_QUERYADAPTERINFO* pQueryAdapterInfo)
458{
459 /* The DxgkDdiQueryAdapterInfo should be made pageable. */
460 PAGED_CODE();
461
462 dfprintf(("==> "__FUNCTION__ ", context(0x%x)\n", hAdapter));
463 NTSTATUS Status = STATUS_SUCCESS;
464 PDEVICE_EXTENSION pContext = (PDEVICE_EXTENSION)hAdapter;
465
466 switch (pQueryAdapterInfo->Type)
467 {
468 case DXGKQAITYPE_DRIVERCAPS:
469 {
470 DXGK_DRIVERCAPS *pCaps = (DXGK_DRIVERCAPS*)pQueryAdapterInfo->pOutputData;
471
472 pCaps->HighestAcceptableAddress.HighPart = 0x0;
473 pCaps->HighestAcceptableAddress.LowPart = 0xffffffffUL;
474 pCaps->MaxAllocationListSlotId = 16;
475 pCaps->ApertureSegmentCommitLimit = 0;
476 pCaps->MaxPointerWidth = 64;
477 pCaps->MaxPointerHeight = 64;
478 pCaps->PointerCaps.Value = 3; /* Monochrome , Color*/ /* MaskedColor == Value | 4, dosable for now */
479 pCaps->InterruptMessageNumber = 0;
480 pCaps->NumberOfSwizzlingRanges = 0;
481 /* @todo: need to adjust this for proper 2D Accel support */
482 pCaps->MaxOverlays = 0; /* ?? how much should we support? 32 */
483 pCaps->GammaRampCaps.Value = 0;
484 pCaps->PresentationCaps.Value = 0;
485 pCaps->PresentationCaps.NoScreenToScreenBlt = 1;
486 pCaps->PresentationCaps.NoOverlapScreenBlt = 1;
487 pCaps->MaxQueuedFlipOnVSync = 0; /* do we need it? */
488 pCaps->FlipCaps.Value = 0;
489 /* ? pCaps->FlipCaps.FlipOnVSyncWithNoWait = 1; */
490 pCaps->SchedulingCaps.Value = 0;
491 /* we might need it for Aero.
492 * Setting this glag means we support DeviceContext, i.e.
493 * DxgkDdiCreateContext and DxgkDdiDestroyContext
494 */
495 pCaps->SchedulingCaps.MultiEngineAware = 1;
496 pCaps->MemoryManagementCaps.Value = 0;
497 /* @todo: this corelates with pCaps->SchedulingCaps.MultiEngineAware */
498 pCaps->MemoryManagementCaps.PagingNode = 0;
499 /* @todo: this corelates with pCaps->SchedulingCaps.MultiEngineAware */
500 pCaps->GpuEngineTopology.NbAsymetricProcessingNodes = 1;
501
502 break;
503 }
504 case DXGKQAITYPE_QUERYSEGMENT:
505 {
506 /* no need for DXGK_QUERYSEGMENTIN as it contains AGP aperture info, which (AGP aperture) we do not support
507 * DXGK_QUERYSEGMENTIN *pQsIn = (DXGK_QUERYSEGMENTIN*)pQueryAdapterInfo->pInputData; */
508 DXGK_QUERYSEGMENTOUT *pQsOut = (DXGK_QUERYSEGMENTOUT*)pQueryAdapterInfo->pOutputData;
509 if (!pQsOut->pSegmentDescriptor)
510 {
511 /* we are requested to provide the number of segments we support */
512 pQsOut->NbSegment = 1;
513 }
514 else if (pQsOut->NbSegment != 1)
515 {
516 AssertBreakpoint();
517 drprintf((__FUNCTION__ " NbSegment (%d) != 1\n", pQsOut->NbSegment));
518 Status = STATUS_INVALID_PARAMETER;
519 }
520 else
521 {
522 /* we are requested to provide segment information */
523 pQsOut->pSegmentDescriptor->BaseAddress.QuadPart = 0; /* VBE_DISPI_LFB_PHYSICAL_ADDRESS; */
524 pQsOut->pSegmentDescriptor->CpuTranslatedAddress.QuadPart = VBE_DISPI_LFB_PHYSICAL_ADDRESS;
525 /* make sure the size is page aligned */
526 /* @todo: need to setup VBVA buffers and adjust the mem size here */
527 pQsOut->pSegmentDescriptor->Size = (pContext->u.primary.cbVRAM - VBVA_ADAPTER_INFORMATION_SIZE - pContext->u.primary.cbMiniportHeap) & (~0xfffUL);
528 pQsOut->pSegmentDescriptor->NbOfBanks = 0;
529 pQsOut->pSegmentDescriptor->pBankRangeTable = 0;
530 pQsOut->pSegmentDescriptor->CommitLimit = pQsOut->pSegmentDescriptor->Size;
531 pQsOut->pSegmentDescriptor->Flags.Value = 0;
532 pQsOut->pSegmentDescriptor->Flags.CpuVisible = 1;
533 }
534 pQsOut->PagingBufferSegmentId = 0;
535 pQsOut->PagingBufferSize = 1024;
536 pQsOut->PagingBufferPrivateDataSize = 0; /* @todo: do we need a private buffer ? */
537 break;
538 }
539 case DXGKQAITYPE_UMDRIVERPRIVATE:
540 drprintf((__FUNCTION__ ": we do not support DXGKQAITYPE_UMDRIVERPRIVATE\n"));
541 AssertBreakpoint();
542 Status = STATUS_NOT_SUPPORTED;
543 break;
544 default:
545 drprintf((__FUNCTION__ ": unsupported Type (%d)\n", pQueryAdapterInfo->Type));
546 AssertBreakpoint();
547 Status = STATUS_NOT_SUPPORTED;
548 break;
549 }
550 dfprintf(("<== "__FUNCTION__ ", context(0x%x), Status(0x%x)\n", hAdapter, Status));
551 return Status;
552}
553
554NTSTATUS APIENTRY DxgkDdiCreateDevice(
555 CONST HANDLE hAdapter,
556 DXGKARG_CREATEDEVICE* pCreateDevice)
557{
558 /* DxgkDdiCreateDevice should be made pageable. */
559 PAGED_CODE();
560
561 dfprintf(("==> "__FUNCTION__ ", context(0x%x)\n", hAdapter));
562 NTSTATUS Status = STATUS_SUCCESS;
563 PDEVICE_EXTENSION pContext = (PDEVICE_EXTENSION)hAdapter;
564
565 PVBOXWDDM_DEVICE pDevice = (PVBOXWDDM_DEVICE)vboxWddmMemAllocZero(sizeof (VBOXWDDM_DEVICE));
566 pDevice->hDevice = pCreateDevice->hDevice;
567 pDevice->pAdapter = pContext;
568 pDevice->fCreationFlags = pCreateDevice->Flags;
569
570 pDevice->DeviceInfo.AllocationListSize = 1024;
571 pDevice->DeviceInfo.DmaBufferSegmentSet = 0;
572 pDevice->DeviceInfo.DmaBufferPrivateDataSize = 0;
573 pDevice->DeviceInfo.AllocationListSize = 4;
574 pDevice->DeviceInfo.PatchLocationListSize = 4;
575 pDevice->DeviceInfo.Flags.Value = 0;
576 pDevice->DeviceInfo.Flags.GuaranteedDmaBufferContract = 1;
577
578 pCreateDevice->pInfo = &pDevice->DeviceInfo;
579 pCreateDevice->hDevice = pDevice;
580
581 dfprintf(("<== "__FUNCTION__ ", context(0x%x), Status(0x%x)\n", hAdapter, Status));
582
583 return Status;
584}
585NTSTATUS vboxWddmDestroyAllocation(PDEVICE_EXTENSION pDevExt, PVBOXWDDM_ALLOCATION pAllocation)
586{
587 PAGED_CODE();
588
589 vboxWddmMemFree(pAllocation);
590 return STATUS_SUCCESS;
591}
592
593NTSTATUS vboxWddmCreateAllocation(PDEVICE_EXTENSION pDevExt, DXGK_ALLOCATIONINFO* pAllocationInfo)
594{
595 PAGED_CODE();
596
597 NTSTATUS Status = STATUS_SUCCESS;
598
599 Assert(pAllocationInfo->PrivateDriverDataSize >= VBOXWDDM_ALLOCINFO_HEADSIZE());
600 if (pAllocationInfo->PrivateDriverDataSize >= VBOXWDDM_ALLOCINFO_HEADSIZE())
601 {
602 PVBOXWDDM_ALLOCINFO pAllocInfo = (PVBOXWDDM_ALLOCINFO)pAllocationInfo->pPrivateDriverData;
603 switch (pAllocInfo->enmType)
604 {
605 case VBOXWDDM_ALLOC_STD_SHAREDPRIMARYSURFACE:
606 {
607 Assert(pAllocationInfo->PrivateDriverDataSize >= VBOXWDDM_ALLOCINFO_SIZE(VBOXWDDM_ALLOCINFO_SHAREDPRIMARYSURFACE));
608 if (pAllocationInfo->PrivateDriverDataSize >= VBOXWDDM_ALLOCINFO_SIZE(VBOXWDDM_ALLOCINFO_SHAREDPRIMARYSURFACE))
609 {
610 PVBOXWDDM_ALLOCINFO_SHAREDPRIMARYSURFACE pInfo = VBOXWDDM_ALLOCINFO_BODY(pAllocInfo, VBOXWDDM_ALLOCINFO_SHAREDPRIMARYSURFACE);
611 UINT bpp = vboxWddmCalcBitsPerPixel(pInfo->SurfData.Format);
612 Assert(bpp);
613 if (bpp != 0)
614 {
615 PVBOXWDDM_ALLOCATION pAllocation = (PVBOXWDDM_ALLOCATION)vboxWddmMemAllocZero(VBOXWDDM_ALLOCATION_SIZE(VBOXWDDM_ALLOCATION_SHAREDPRIMARYSURFACE));
616 Assert(pAllocation);
617 if (pAllocation)
618 {
619 UINT Pitch = vboxWddmCalcPitch(pInfo->SurfData.Width, bpp);
620 pAllocation->enmType = VBOXWDDM_ALLOC_STD_SHAREDPRIMARYSURFACE;
621 PVBOXWDDM_ALLOCATION_SHAREDPRIMARYSURFACE pAlloc = VBOXWDDM_ALLOCATION_BODY(pAllocInfo, VBOXWDDM_ALLOCATION_SHAREDPRIMARYSURFACE);
622 memcpy(&pAlloc->AllocInfo, pInfo, sizeof (pAlloc->AllocInfo));
623
624 pAllocationInfo->pPrivateDriverData = NULL;
625 pAllocationInfo->PrivateDriverDataSize = 0;
626 pAllocationInfo->Alignment = 0;
627 pAllocationInfo->Size = Pitch * pInfo->SurfData.Height;
628 pAllocationInfo->PitchAlignedSize = 0;
629 pAllocationInfo->HintedBank.Value = 0;
630 pAllocationInfo->PreferredSegment.Value = 0;
631 pAllocationInfo->SupportedReadSegmentSet = 1;
632 pAllocationInfo->SupportedWriteSegmentSet = 1;
633 pAllocationInfo->EvictionSegmentSet = 0;
634 pAllocationInfo->MaximumRenamingListLength = 0;
635 pAllocationInfo->hAllocation = pAlloc;
636 pAllocationInfo->Flags.Value = 0;
637 pAllocationInfo->Flags.CpuVisible = 1;
638 pAllocationInfo->pAllocationUsageHint = NULL;
639 pAllocationInfo->AllocationPriority = D3DDDI_ALLOCATIONPRIORITY_NORMAL;
640 }
641 else
642 {
643 drprintf((__FUNCTION__ ": ERROR: failed to create allocation description\n"));
644 Status = STATUS_NO_MEMORY;
645 }
646 }
647 else
648 {
649 drprintf((__FUNCTION__ ": Invalid format (%d)\n", pInfo->SurfData.Format));
650 Status = STATUS_INVALID_PARAMETER;
651 }
652 }
653 else
654 {
655 drprintf((__FUNCTION__ ": ERROR: PrivateDriverDataSize(%d) less than VBOXWDDM_ALLOC_STD_SHAREDPRIMARYSURFACE cmd size(%d)\n", pAllocationInfo->PrivateDriverDataSize, VBOXWDDM_ALLOCINFO_SIZE(VBOXWDDM_ALLOCINFO_SHADOWSURFACE)));
656 Status = STATUS_INVALID_PARAMETER;
657 }
658 break;
659 }
660 case VBOXWDDM_ALLOC_STD_SHADOWSURFACE:
661 {
662 Assert(pAllocationInfo->PrivateDriverDataSize >= VBOXWDDM_ALLOCINFO_SIZE(VBOXWDDM_ALLOCINFO_SHADOWSURFACE));
663 if (pAllocationInfo->PrivateDriverDataSize >= VBOXWDDM_ALLOCINFO_SIZE(VBOXWDDM_ALLOCINFO_SHADOWSURFACE))
664 {
665 PVBOXWDDM_ALLOCATION pAllocation = (PVBOXWDDM_ALLOCATION)vboxWddmMemAllocZero(VBOXWDDM_ALLOCATION_SIZE(VBOXWDDM_ALLOCATION_SHADOWSURFACE));
666 Assert(pAllocation);
667 if (pAllocation)
668 {
669 pAllocation->enmType = VBOXWDDM_ALLOC_STD_SHADOWSURFACE;
670 PVBOXWDDM_ALLOCATION_SHADOWSURFACE pAlloc = VBOXWDDM_ALLOCATION_BODY(pAllocInfo, VBOXWDDM_ALLOCATION_SHADOWSURFACE);
671 PVBOXWDDM_ALLOCINFO_SHADOWSURFACE pInfo = VBOXWDDM_ALLOCINFO_BODY(pAllocInfo, VBOXWDDM_ALLOCINFO_SHADOWSURFACE);
672 memcpy(&pAlloc->AllocInfo, pInfo, sizeof (pAlloc->AllocInfo));
673
674 pAllocationInfo->pPrivateDriverData = NULL;
675 pAllocationInfo->PrivateDriverDataSize = 0;
676 pAllocationInfo->Alignment = 0;
677 pAllocationInfo->Size = pInfo->SurfData.Pitch * pInfo->SurfData.Height;
678 pAllocationInfo->PitchAlignedSize = 0;
679 pAllocationInfo->HintedBank.Value = 0;
680 pAllocationInfo->PreferredSegment.Value = 0;
681 pAllocationInfo->SupportedReadSegmentSet = 1;
682 pAllocationInfo->SupportedWriteSegmentSet = 1;
683 pAllocationInfo->EvictionSegmentSet = 0;
684 pAllocationInfo->MaximumRenamingListLength = 0;
685 pAllocationInfo->hAllocation = pAlloc;
686 pAllocationInfo->Flags.Value = 0;
687 pAllocationInfo->Flags.CpuVisible = 1;
688 pAllocationInfo->pAllocationUsageHint = NULL;
689 pAllocationInfo->AllocationPriority = D3DDDI_ALLOCATIONPRIORITY_NORMAL;
690 }
691 else
692 {
693 drprintf((__FUNCTION__ ": ERROR: failed to create allocation description\n"));
694 Status = STATUS_NO_MEMORY;
695 }
696 }
697 else
698 {
699 drprintf((__FUNCTION__ ": ERROR: PrivateDriverDataSize(%d) less than VBOXWDDM_ALLOC_STD_SHADOWSURFACE cmd size(%d)\n", pAllocationInfo->PrivateDriverDataSize, VBOXWDDM_ALLOCINFO_SIZE(VBOXWDDM_ALLOCINFO_SHADOWSURFACE)));
700 Status = STATUS_INVALID_PARAMETER;
701 }
702 break;
703 }
704 case VBOXWDDM_ALLOC_STD_STAGINGSURFACE:
705 {
706 /* @todo: impl */
707 AssertBreakpoint();
708 break;
709 }
710 default:
711 drprintf((__FUNCTION__ ": ERROR: invalid alloc info type(%d)\n", pAllocInfo->enmType));
712 Status = STATUS_INVALID_PARAMETER;
713 break;
714 }
715 }
716 else
717 {
718 drprintf((__FUNCTION__ ": ERROR: PrivateDriverDataSize(%d) less than header size(%d)\n", pAllocationInfo->PrivateDriverDataSize, VBOXWDDM_ALLOCINFO_HEADSIZE()));
719 Status = STATUS_INVALID_PARAMETER;
720 }
721
722 return Status;
723}
724
725NTSTATUS APIENTRY DxgkDdiCreateAllocation(
726 CONST HANDLE hAdapter,
727 DXGKARG_CREATEALLOCATION* pCreateAllocation)
728{
729 /* DxgkDdiCreateAllocation should be made pageable. */
730 PAGED_CODE();
731
732 dfprintf(("==> "__FUNCTION__ ", context(0x%x)\n", hAdapter));
733
734 NTSTATUS Status = STATUS_SUCCESS;
735
736 for (UINT i = 0; i < pCreateAllocation->NumAllocations; ++i)
737 {
738 Status = vboxWddmCreateAllocation((PDEVICE_EXTENSION)hAdapter, &pCreateAllocation->pAllocationInfo[i]);
739 Assert(Status == STATUS_SUCCESS);
740 if (Status != STATUS_SUCCESS)
741 {
742 drprintf((__FUNCTION__ ": ERROR: vboxWddmCreateAllocation error (0x%x)\n", Status));
743 /* note: i-th allocation is expected to be cleared in a fail handling code above */
744 for (UINT j = 0; j < i; ++j)
745 {
746 vboxWddmDestroyAllocation((PDEVICE_EXTENSION)hAdapter, (PVBOXWDDM_ALLOCATION)pCreateAllocation->pAllocationInfo[j].hAllocation);
747 }
748 }
749 }
750
751 dfprintf(("<== "__FUNCTION__ ", status(0x%x), context(0x%x)\n", Status, hAdapter));
752
753 return Status;
754}
755
756NTSTATUS
757APIENTRY
758DxgkDdiDestroyAllocation(
759 CONST HANDLE hAdapter,
760 CONST DXGKARG_DESTROYALLOCATION* pDestroyAllocation)
761{
762 /* DxgkDdiDestroyAllocation should be made pageable. */
763 PAGED_CODE();
764
765 dfprintf(("==> "__FUNCTION__ ", context(0x%x)\n", hAdapter));
766 NTSTATUS Status = STATUS_SUCCESS;
767
768 for (UINT i = 0; i < pDestroyAllocation->NumAllocations; ++i)
769 {
770 vboxWddmDestroyAllocation((PDEVICE_EXTENSION)hAdapter, (PVBOXWDDM_ALLOCATION)pDestroyAllocation->pAllocationList[i]);
771 }
772
773 dfprintf(("<== "__FUNCTION__ ", status(0x%x), context(0x%x)\n", Status, hAdapter));
774
775 return Status;
776}
777
778
779NTSTATUS
780APIENTRY
781DxgkDdiDescribeAllocation(
782 CONST HANDLE hAdapter,
783 DXGKARG_DESCRIBEALLOCATION* pDescribeAllocation)
784{
785 return STATUS_NOT_IMPLEMENTED;
786}
787
788NTSTATUS
789APIENTRY
790DxgkDdiGetStandardAllocationDriverData(
791 CONST HANDLE hAdapter,
792 DXGKARG_GETSTANDARDALLOCATIONDRIVERDATA* pGetStandardAllocationDriverData)
793{
794 /* DxgkDdiGetStandardAllocationDriverData should be made pageable. */
795 PAGED_CODE();
796
797 dfprintf(("==> "__FUNCTION__ ", context(0x%x)\n", hAdapter));
798
799 NTSTATUS Status = STATUS_SUCCESS;
800 PVBOXWDDM_ALLOCINFO pAllocInfo = NULL;
801
802 switch (pGetStandardAllocationDriverData->StandardAllocationType)
803 {
804 case D3DKMDT_STANDARDALLOCATION_SHAREDPRIMARYSURFACE:
805 {
806 dfprintf((__FUNCTION__ ": D3DKMDT_STANDARDALLOCATION_SHAREDPRIMARYSURFACE\n"));
807 if(pGetStandardAllocationDriverData->pAllocationPrivateDriverData)
808 {
809 pAllocInfo = (PVBOXWDDM_ALLOCINFO)pGetStandardAllocationDriverData->pAllocationPrivateDriverData;
810 pAllocInfo->enmType = VBOXWDDM_ALLOC_STD_SHAREDPRIMARYSURFACE;
811 PVBOXWDDM_ALLOCINFO_SHAREDPRIMARYSURFACE pInfo = VBOXWDDM_ALLOCINFO_BODY(pAllocInfo, VBOXWDDM_ALLOCINFO_SHAREDPRIMARYSURFACE);
812 memcpy(&pInfo->SurfData, pGetStandardAllocationDriverData->pCreateSharedPrimarySurfaceData, sizeof (pInfo->SurfData));
813 }
814 pGetStandardAllocationDriverData->AllocationPrivateDriverDataSize = VBOXWDDM_ALLOCINFO_SIZE(VBOXWDDM_ALLOCINFO_SHAREDPRIMARYSURFACE);
815
816 pGetStandardAllocationDriverData->ResourcePrivateDriverDataSize = 0;
817 break;
818 }
819 case D3DKMDT_STANDARDALLOCATION_SHADOWSURFACE:
820 {
821 dfprintf((__FUNCTION__ ": D3DKMDT_STANDARDALLOCATION_SHADOWSURFACE\n"));
822 UINT bpp = vboxWddmCalcBitsPerPixel(pGetStandardAllocationDriverData->pCreateShadowSurfaceData->Format);
823 Assert(bpp);
824 if (bpp != 0)
825 {
826 UINT Pitch = vboxWddmCalcPitch(pGetStandardAllocationDriverData->pCreateShadowSurfaceData->Width, bpp);
827 pGetStandardAllocationDriverData->pCreateShadowSurfaceData->Pitch = Pitch;
828
829 /* @todo: need [d/q]word align?? */
830
831 if (pGetStandardAllocationDriverData->pAllocationPrivateDriverData)
832 {
833 pAllocInfo = (PVBOXWDDM_ALLOCINFO)pGetStandardAllocationDriverData->pAllocationPrivateDriverData;
834 pAllocInfo->enmType = VBOXWDDM_ALLOC_STD_SHADOWSURFACE;
835 PVBOXWDDM_ALLOCINFO_SHADOWSURFACE pInfo = VBOXWDDM_ALLOCINFO_BODY(pAllocInfo, VBOXWDDM_ALLOCINFO_SHADOWSURFACE);
836 memcpy(&pInfo->SurfData, pGetStandardAllocationDriverData->pCreateShadowSurfaceData, sizeof (pInfo->SurfData));
837 }
838 pGetStandardAllocationDriverData->AllocationPrivateDriverDataSize = VBOXWDDM_ALLOCINFO_SIZE(VBOXWDDM_ALLOCINFO_SHADOWSURFACE);
839
840 pGetStandardAllocationDriverData->ResourcePrivateDriverDataSize = 0;
841 }
842 else
843 {
844 drprintf((__FUNCTION__ ": Invalid format (%d)\n", pGetStandardAllocationDriverData->pCreateShadowSurfaceData->Format));
845 Status = STATUS_INVALID_PARAMETER;
846 }
847 break;
848 }
849 case D3DKMDT_STANDARDALLOCATION_STAGINGSURFACE:
850 {
851 dfprintf((__FUNCTION__ ": D3DKMDT_STANDARDALLOCATION_STAGINGSURFACE\n"));
852 if(pGetStandardAllocationDriverData->pAllocationPrivateDriverData)
853 {
854 pAllocInfo = (PVBOXWDDM_ALLOCINFO)pGetStandardAllocationDriverData->pAllocationPrivateDriverData;
855 pAllocInfo->enmType = VBOXWDDM_ALLOC_STD_STAGINGSURFACE;
856 PVBOXWDDM_ALLOCINFO_STAGINGSURFACE pInfo = VBOXWDDM_ALLOCINFO_BODY(pAllocInfo, VBOXWDDM_ALLOCINFO_STAGINGSURFACE);
857 memcpy(&pInfo->SurfData, pGetStandardAllocationDriverData->pCreateStagingSurfaceData, sizeof (pInfo->SurfData));
858 }
859 pGetStandardAllocationDriverData->AllocationPrivateDriverDataSize = VBOXWDDM_ALLOCINFO_SIZE(VBOXWDDM_ALLOCINFO_STAGINGSURFACE);
860
861 pGetStandardAllocationDriverData->ResourcePrivateDriverDataSize = 0;
862 break;
863 }
864//#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN7)
865// case D3DKMDT_STANDARDALLOCATION_GDISURFACE:
866// break;
867//#endif
868 default:
869 drprintf((__FUNCTION__ ": Invalid allocation type (%d)\n", pGetStandardAllocationDriverData->StandardAllocationType));
870 Status = STATUS_INVALID_PARAMETER;
871 break;
872 }
873
874 dfprintf(("<== "__FUNCTION__ ", status(0x%x), context(0x%x)\n", Status, hAdapter));
875
876 return Status;
877}
878
879NTSTATUS
880APIENTRY
881DxgkDdiAcquireSwizzlingRange(
882 CONST HANDLE hAdapter,
883 DXGKARG_ACQUIRESWIZZLINGRANGE* pAcquireSwizzlingRange)
884{
885 return STATUS_NOT_IMPLEMENTED;
886}
887
888NTSTATUS
889APIENTRY
890DxgkDdiReleaseSwizzlingRange(
891 CONST HANDLE hAdapter,
892 CONST DXGKARG_RELEASESWIZZLINGRANGE* pReleaseSwizzlingRange)
893{
894 return STATUS_NOT_IMPLEMENTED;
895}
896
897NTSTATUS
898APIENTRY
899DxgkDdiPatch(
900 CONST HANDLE hAdapter,
901 CONST DXGKARG_PATCH* pPatch)
902{
903 return STATUS_NOT_IMPLEMENTED;
904}
905
906NTSTATUS
907APIENTRY
908DxgkDdiSubmitCommand(
909 CONST HANDLE hAdapter,
910 CONST DXGKARG_SUBMITCOMMAND* pSubmitCommand)
911{
912 return STATUS_NOT_IMPLEMENTED;
913}
914
915NTSTATUS
916APIENTRY
917DxgkDdiPreemptCommand(
918 CONST HANDLE hAdapter,
919 CONST DXGKARG_PREEMPTCOMMAND* pPreemptCommand)
920{
921 return STATUS_NOT_IMPLEMENTED;
922}
923
924NTSTATUS
925APIENTRY
926DxgkDdiBuildPagingBuffer(
927 CONST HANDLE hAdapter,
928 DXGKARG_BUILDPAGINGBUFFER* pBuildPagingBuffer)
929{
930 return STATUS_NOT_IMPLEMENTED;
931}
932
933NTSTATUS
934APIENTRY
935DxgkDdiSetPalette(
936 CONST HANDLE hAdapter,
937 CONST DXGKARG_SETPALETTE* pSetPalette
938 )
939{
940 return STATUS_NOT_IMPLEMENTED;
941}
942
943NTSTATUS
944APIENTRY
945DxgkDdiSetPointerPosition(
946 CONST HANDLE hAdapter,
947 CONST DXGKARG_SETPOINTERPOSITION* pSetPointerPosition)
948{
949 return STATUS_NOT_IMPLEMENTED;
950}
951
952NTSTATUS
953APIENTRY
954DxgkDdiSetPointerShape(
955 CONST HANDLE hAdapter,
956 CONST DXGKARG_SETPOINTERSHAPE* pSetPointerShape)
957{
958 return STATUS_NOT_IMPLEMENTED;
959}
960
961NTSTATUS
962APIENTRY CALLBACK
963DxgkDdiResetFromTimeout(
964 CONST HANDLE hAdapter)
965{
966 return STATUS_NOT_IMPLEMENTED;
967}
968
969NTSTATUS
970APIENTRY
971DxgkDdiEscape(
972 CONST HANDLE hAdapter,
973 CONST DXGKARG_ESCAPE* pEscape)
974{
975 PAGED_CODE();
976
977 return STATUS_INVALID_PARAMETER;
978}
979
980NTSTATUS
981APIENTRY
982DxgkDdiCollectDbgInfo(
983 CONST HANDLE hAdapter,
984 CONST DXGKARG_COLLECTDBGINFO* pCollectDbgInfo
985 )
986{
987 return STATUS_NOT_IMPLEMENTED;
988}
989
990NTSTATUS
991APIENTRY
992DxgkDdiQueryCurrentFence(
993 CONST HANDLE hAdapter,
994 DXGKARG_QUERYCURRENTFENCE* pCurrentFence)
995{
996 return STATUS_NOT_IMPLEMENTED;
997}
998
999NTSTATUS
1000APIENTRY
1001DxgkDdiIsSupportedVidPn(
1002 CONST HANDLE hAdapter,
1003 OUT DXGKARG_ISSUPPORTEDVIDPN* pIsSupportedVidPnArg
1004 )
1005{
1006 /* The DxgkDdiIsSupportedVidPn should be made pageable. */
1007 PAGED_CODE();
1008
1009 dfprintf(("==> "__FUNCTION__ ", context(0x%x)\n", hAdapter));
1010
1011 PDEVICE_EXTENSION pContext = (PDEVICE_EXTENSION)hAdapter;
1012 BOOLEAN bSupported = TRUE;
1013 const DXGK_VIDPN_INTERFACE* pVidPnInterface = NULL;
1014 NTSTATUS Status = pContext->u.primary.DxgkInterface.DxgkCbQueryVidPnInterface(pIsSupportedVidPnArg->hDesiredVidPn, DXGK_VIDPN_INTERFACE_VERSION_V1, &pVidPnInterface);
1015 if (Status == STATUS_SUCCESS)
1016 {
1017 D3DKMDT_HVIDPNTOPOLOGY hVidPnTopology;
1018 const DXGK_VIDPNTOPOLOGY_INTERFACE* pVidPnTopologyInterface;
1019 Status = pVidPnInterface->pfnGetTopology(pIsSupportedVidPnArg->hDesiredVidPn, &hVidPnTopology, &pVidPnTopologyInterface);
1020 if (Status == STATUS_SUCCESS)
1021 {
1022 Status = vboxVidPnCheckTopology(pIsSupportedVidPnArg->hDesiredVidPn, hVidPnTopology, pVidPnTopologyInterface, &bSupported);
1023 if (Status == STATUS_SUCCESS && bSupported)
1024 {
1025 for (int id = 0; id < pContext->u.primary.cDisplays; id++)
1026 {
1027 D3DKMDT_HVIDPNSOURCEMODESET hNewVidPnSourceModeSet;
1028 const DXGK_VIDPNSOURCEMODESET_INTERFACE *pVidPnSourceModeSetInterface;
1029 Status = pVidPnInterface->pfnAcquireSourceModeSet(pIsSupportedVidPnArg->hDesiredVidPn,
1030 id,
1031 &hNewVidPnSourceModeSet,
1032 &pVidPnSourceModeSetInterface);
1033 if (Status == STATUS_SUCCESS)
1034 {
1035 Status = vboxVidPnCheckSourceModeSet(pIsSupportedVidPnArg->hDesiredVidPn, hNewVidPnSourceModeSet, pVidPnSourceModeSetInterface, &bSupported);
1036
1037 pVidPnInterface->pfnReleaseSourceModeSet(pIsSupportedVidPnArg->hDesiredVidPn, hNewVidPnSourceModeSet);
1038
1039 if (Status != STATUS_SUCCESS || !bSupported)
1040 break;
1041 }
1042 else if (Status == STATUS_GRAPHICS_INVALID_VIDEO_PRESENT_SOURCE)
1043 {
1044 drprintf(("VBoxVideoWddm: Warning: pfnAcquireSourceModeSet returned STATUS_GRAPHICS_INVALID_VIDEO_PRESENT_SOURCE, continuing\n"));
1045 Status = STATUS_SUCCESS;
1046 }
1047 else
1048 {
1049 drprintf(("VBoxVideoWddm: pfnAcquireSourceModeSet failed Status(0x%x)\n"));
1050 break;
1051 }
1052 }
1053
1054 if (Status == STATUS_SUCCESS && bSupported)
1055 {
1056 for (int id = 0; id < pContext->u.primary.cDisplays; id++)
1057 {
1058 D3DKMDT_HVIDPNTARGETMODESET hNewVidPnTargetModeSet;
1059 CONST DXGK_VIDPNTARGETMODESET_INTERFACE *pVidPnTargetModeSetInterface;
1060 Status = pVidPnInterface->pfnAcquireTargetModeSet(pIsSupportedVidPnArg->hDesiredVidPn,
1061 id, /*__in CONST D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId */
1062 &hNewVidPnTargetModeSet,
1063 &pVidPnTargetModeSetInterface);
1064 if (Status == STATUS_SUCCESS)
1065 {
1066 Status = vboxVidPnCheckTargetModeSet(pIsSupportedVidPnArg->hDesiredVidPn, hNewVidPnTargetModeSet, pVidPnTargetModeSetInterface, &bSupported);
1067
1068 pVidPnInterface->pfnReleaseTargetModeSet(pIsSupportedVidPnArg->hDesiredVidPn, hNewVidPnTargetModeSet);
1069
1070 if (Status != STATUS_SUCCESS || !bSupported)
1071 break;
1072 }
1073 else if (Status == STATUS_GRAPHICS_INVALID_VIDEO_PRESENT_SOURCE)
1074 {
1075 drprintf(("VBoxVideoWddm: Warning: pfnAcquireSourceModeSet returned STATUS_GRAPHICS_INVALID_VIDEO_PRESENT_SOURCE, continuing\n"));
1076 Status = STATUS_SUCCESS;
1077 }
1078 else
1079 {
1080 drprintf(("VBoxVideoWddm: pfnAcquireSourceModeSet failed Status(0x%x)\n"));
1081 break;
1082 }
1083 }
1084 }
1085 }
1086 }
1087 else
1088 {
1089 drprintf(("VBoxVideoWddm: pfnGetTopology failed Status(0x%x)\n"));
1090 }
1091 }
1092 else
1093 {
1094 drprintf(("VBoxVideoWddm: DxgkCbQueryVidPnInterface failed Status(0x%x)\n"));
1095 }
1096 pIsSupportedVidPnArg->IsVidPnSupported = bSupported;
1097
1098 dfprintf(("<== "__FUNCTION__ ", status(0x%x), context(0x%x)\n", Status, hAdapter));
1099
1100 return STATUS_SUCCESS;
1101}
1102
1103NTSTATUS
1104APIENTRY
1105DxgkDdiRecommendFunctionalVidPn(
1106 CONST HANDLE hAdapter,
1107 CONST DXGKARG_RECOMMENDFUNCTIONALVIDPN* CONST pRecommendFunctionalVidPnArg
1108 )
1109{
1110 /* The DxgkDdiRecommendFunctionalVidPn should be made pageable. */
1111 PAGED_CODE();
1112
1113 dfprintf(("==> "__FUNCTION__ ", context(0x%x)\n", hAdapter));
1114
1115 PDEVICE_EXTENSION pContext = (PDEVICE_EXTENSION)hAdapter;
1116 const DXGK_VIDPN_INTERFACE* pVidPnInterface = NULL;
1117 NTSTATUS Status = pContext->u.primary.DxgkInterface.DxgkCbQueryVidPnInterface(pRecommendFunctionalVidPnArg->hRecommendedFunctionalVidPn, DXGK_VIDPN_INTERFACE_VERSION_V1, &pVidPnInterface);
1118 if (Status == STATUS_SUCCESS)
1119 {
1120 D3DKMDT_HVIDPNTOPOLOGY hVidPnTopology;
1121 const DXGK_VIDPNTOPOLOGY_INTERFACE* pVidPnTopologyInterface;
1122 Status = pVidPnInterface->pfnGetTopology(pRecommendFunctionalVidPnArg->hRecommendedFunctionalVidPn, &hVidPnTopology, &pVidPnTopologyInterface);
1123 if (Status == STATUS_SUCCESS)
1124 {
1125 D3DKMDT_VIDPN_PRESENT_PATH *pNewVidPnPresentPathInfo;
1126 Status = pVidPnTopologyInterface->pfnCreateNewPathInfo(hVidPnTopology, &pNewVidPnPresentPathInfo);
1127 if (Status == STATUS_SUCCESS)
1128 {
1129 pNewVidPnPresentPathInfo->VidPnSourceId = 0;
1130 pNewVidPnPresentPathInfo->VidPnTargetId = 0;
1131 pNewVidPnPresentPathInfo->ImportanceOrdinal = D3DKMDT_VPPI_PRIMARY;
1132 pNewVidPnPresentPathInfo->ContentTransformation.Scaling = D3DKMDT_VPPS_IDENTITY;
1133 memset(&pNewVidPnPresentPathInfo->ContentTransformation.ScalingSupport,
1134 0, sizeof (pNewVidPnPresentPathInfo->ContentTransformation.ScalingSupport));
1135 pNewVidPnPresentPathInfo->ContentTransformation.ScalingSupport.Identity = 1;
1136 pNewVidPnPresentPathInfo->ContentTransformation.ScalingSupport.Centered = 1;
1137 pNewVidPnPresentPathInfo->ContentTransformation.ScalingSupport.Stretched = 0;
1138 pNewVidPnPresentPathInfo->ContentTransformation.Rotation = D3DKMDT_VPPR_IDENTITY;
1139 pNewVidPnPresentPathInfo->ContentTransformation.RotationSupport.Identity = 1;
1140 pNewVidPnPresentPathInfo->ContentTransformation.RotationSupport.Rotate180 = 0;
1141 pNewVidPnPresentPathInfo->ContentTransformation.RotationSupport.Rotate270 = 0;
1142 pNewVidPnPresentPathInfo->ContentTransformation.RotationSupport.Rotate90 = 0;
1143 pNewVidPnPresentPathInfo->VisibleFromActiveTLOffset.cx = 0;
1144 pNewVidPnPresentPathInfo->VisibleFromActiveTLOffset.cy = 0;
1145 pNewVidPnPresentPathInfo->VisibleFromActiveBROffset.cx = 0;
1146 pNewVidPnPresentPathInfo->VisibleFromActiveBROffset.cy = 0;
1147 pNewVidPnPresentPathInfo->VidPnTargetColorBasis = D3DKMDT_CB_SRGB; /* @todo: how does it matters? */
1148 pNewVidPnPresentPathInfo->VidPnTargetColorCoeffDynamicRanges.FirstChannel = 8;
1149 pNewVidPnPresentPathInfo->VidPnTargetColorCoeffDynamicRanges.SecondChannel = 8;
1150 pNewVidPnPresentPathInfo->VidPnTargetColorCoeffDynamicRanges.ThirdChannel = 8;
1151 pNewVidPnPresentPathInfo->VidPnTargetColorCoeffDynamicRanges.FourthChannel = 0;
1152 pNewVidPnPresentPathInfo->Content = D3DKMDT_VPPC_GRAPHICS;
1153 pNewVidPnPresentPathInfo->CopyProtection.CopyProtectionType = D3DKMDT_VPPMT_NOPROTECTION;
1154 pNewVidPnPresentPathInfo->CopyProtection.APSTriggerBits = 0;
1155 memset(&pNewVidPnPresentPathInfo->CopyProtection.CopyProtectionSupport, 0, sizeof (pNewVidPnPresentPathInfo->CopyProtection.CopyProtectionSupport));
1156 pNewVidPnPresentPathInfo->CopyProtection.CopyProtectionSupport.NoProtection = 1;
1157 pNewVidPnPresentPathInfo->GammaRamp.Type = D3DDDI_GAMMARAMP_DEFAULT;
1158 pNewVidPnPresentPathInfo->GammaRamp.DataSize = 0;
1159 Status = pVidPnTopologyInterface->pfnAddPath(hVidPnTopology, pNewVidPnPresentPathInfo);
1160 if (Status == STATUS_SUCCESS)
1161 {
1162 D3DKMDT_HVIDPNSOURCEMODESET hNewVidPnSourceModeSet;
1163 const DXGK_VIDPNSOURCEMODESET_INTERFACE *pVidPnSourceModeSetInterface;
1164 Status = pVidPnInterface->pfnCreateNewSourceModeSet(pRecommendFunctionalVidPnArg->hRecommendedFunctionalVidPn,
1165 0, /*__in CONST D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId */
1166 &hNewVidPnSourceModeSet,
1167 &pVidPnSourceModeSetInterface);
1168 if (Status == STATUS_SUCCESS)
1169 {
1170 D3DKMDT_VIDPN_SOURCE_MODE *pNewVidPnSourceModeInfo;
1171 Status = pVidPnSourceModeSetInterface->pfnCreateNewModeInfo(hNewVidPnSourceModeSet, &pNewVidPnSourceModeInfo);
1172 if (Status == STATUS_SUCCESS)
1173 {
1174 D3DKMDT_VIDEO_PRESENT_SOURCE_MODE_ID modeId = pNewVidPnSourceModeInfo->Id;
1175 pNewVidPnSourceModeInfo->Type = D3DKMDT_RMT_GRAPHICS;
1176 /* @todo: should we obtain the default mode from the host? */
1177 pNewVidPnSourceModeInfo->Format.Graphics.PrimSurfSize.cx = 1024;
1178 pNewVidPnSourceModeInfo->Format.Graphics.PrimSurfSize.cy = 768;
1179 pNewVidPnSourceModeInfo->Format.Graphics.VisibleRegionSize = pNewVidPnSourceModeInfo->Format.Graphics.PrimSurfSize;
1180 pNewVidPnSourceModeInfo->Format.Graphics.Stride = pNewVidPnSourceModeInfo->Format.Graphics.PrimSurfSize.cx * 4;
1181 pNewVidPnSourceModeInfo->Format.Graphics.PixelFormat = D3DDDIFMT_X8R8G8B8;
1182 pNewVidPnSourceModeInfo->Format.Graphics.ColorBasis = D3DKMDT_CB_SRGB;
1183 pNewVidPnSourceModeInfo->Format.Graphics.PixelValueAccessMode = D3DKMDT_PVAM_DIRECT;
1184 Status = pVidPnSourceModeSetInterface->pfnAddMode(hNewVidPnSourceModeSet, pNewVidPnSourceModeInfo);
1185 if (Status == STATUS_SUCCESS)
1186 {
1187 Status = pVidPnSourceModeSetInterface->pfnPinMode(hNewVidPnSourceModeSet, modeId);
1188 if (Status == STATUS_SUCCESS)
1189 {
1190 D3DKMDT_HVIDPNTARGETMODESET hNewVidPnTargetModeSet;
1191 CONST DXGK_VIDPNTARGETMODESET_INTERFACE *pVidPnTargetModeSetInterface;
1192 Status = pVidPnInterface->pfnCreateNewTargetModeSet(pRecommendFunctionalVidPnArg->hRecommendedFunctionalVidPn,
1193 0, /* __in CONST D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId */
1194 &hNewVidPnTargetModeSet,
1195 &pVidPnTargetModeSetInterface);
1196 if (Status == STATUS_SUCCESS)
1197 {
1198 D3DKMDT_VIDPN_TARGET_MODE *pNewVidPnTargetModeInfo;
1199 Status = pVidPnTargetModeSetInterface->pfnCreateNewModeInfo(hNewVidPnTargetModeSet, &pNewVidPnTargetModeInfo);
1200 if (Status == STATUS_SUCCESS)
1201 {
1202 D3DKMDT_VIDEO_PRESENT_TARGET_MODE_ID targetId = pNewVidPnTargetModeInfo->Id;
1203 pNewVidPnTargetModeInfo->VideoSignalInfo.VideoStandard = D3DKMDT_VSS_OTHER;
1204 pNewVidPnTargetModeInfo->VideoSignalInfo.TotalSize.cx = 1024;
1205 pNewVidPnTargetModeInfo->VideoSignalInfo.TotalSize.cy = 768;
1206 pNewVidPnTargetModeInfo->VideoSignalInfo.ActiveSize = pNewVidPnTargetModeInfo->VideoSignalInfo.TotalSize;
1207 pNewVidPnTargetModeInfo->VideoSignalInfo.VSyncFreq.Numerator = 60;
1208 pNewVidPnTargetModeInfo->VideoSignalInfo.VSyncFreq.Denominator = 1;
1209 pNewVidPnTargetModeInfo->VideoSignalInfo.HSyncFreq.Numerator = 63 * 768; /* @todo: do we need that? */
1210 pNewVidPnTargetModeInfo->VideoSignalInfo.HSyncFreq.Denominator = 1;
1211 pNewVidPnTargetModeInfo->VideoSignalInfo.PixelRate = 165000; /* ?? */
1212 pNewVidPnTargetModeInfo->VideoSignalInfo.ScanLineOrdering = D3DDDI_VSSLO_PROGRESSIVE;
1213 pNewVidPnTargetModeInfo->Preference = D3DKMDT_MP_PREFERRED;
1214 Status = pVidPnTargetModeSetInterface->pfnAddMode(hNewVidPnTargetModeSet, pNewVidPnTargetModeInfo);
1215 if (Status == STATUS_SUCCESS)
1216 {
1217 Status = pVidPnTargetModeSetInterface->pfnPinMode(hNewVidPnTargetModeSet, targetId);
1218 if (Status == STATUS_SUCCESS)
1219 {
1220
1221 }
1222 else
1223 {
1224 drprintf(("VBoxVideoWddm: pfnPinMode (target) failed Status(0x%x)\n"));
1225 }
1226 }
1227 else
1228 {
1229 drprintf(("VBoxVideoWddm: pfnAddMode (target) failed Status(0x%x)\n"));
1230 pVidPnTargetModeSetInterface->pfnReleaseModeInfo(hNewVidPnTargetModeSet, pNewVidPnTargetModeInfo);
1231 pNewVidPnTargetModeInfo = NULL;
1232 }
1233 }
1234 else
1235 {
1236 drprintf(("VBoxVideoWddm: pfnCreateNewModeInfo (target) failed Status(0x%x)\n"));
1237 }
1238 }
1239 else
1240 {
1241 drprintf(("VBoxVideoWddm: pfnCreateNewTargetModeSet failed Status(0x%x)\n"));
1242 }
1243 }
1244 else
1245 {
1246 drprintf(("VBoxVideoWddm: pfnPinMode failed Status(0x%x)\n"));
1247 }
1248 }
1249 else
1250 {
1251 drprintf(("VBoxVideoWddm: pfnAddMode failed Status(0x%x)\n"));
1252 pVidPnSourceModeSetInterface->pfnReleaseModeInfo(hNewVidPnSourceModeSet, pNewVidPnSourceModeInfo);
1253 pNewVidPnSourceModeInfo = NULL;
1254 }
1255 }
1256 else
1257 {
1258 drprintf(("VBoxVideoWddm: pfnCreateNewModeInfo failed Status(0x%x)\n"));
1259 }
1260 }
1261 else
1262 {
1263 drprintf(("VBoxVideoWddm: pfnCreateNewSourceModeSet failed Status(0x%x)\n"));
1264 }
1265 }
1266 else
1267 {
1268 drprintf(("VBoxVideoWddm: pfnAddPath failed Status(0x%x)\n"));
1269 pVidPnTopologyInterface->pfnReleasePathInfo(hVidPnTopology, pNewVidPnPresentPathInfo);
1270 pNewVidPnPresentPathInfo = NULL;
1271 }
1272 }
1273 else
1274 {
1275 drprintf(("VBoxVideoWddm: pfnCreateNewPathInfo failed Status(0x%x)\n"));
1276 }
1277 }
1278 else
1279 {
1280 drprintf(("VBoxVideoWddm: pfnGetTopology failed Status(0x%x)\n"));
1281 }
1282 }
1283 else
1284 {
1285 drprintf(("VBoxVideoWddm: DxgkCbQueryVidPnInterface failed Status(0x%x)\n"));
1286 }
1287
1288 dfprintf(("<== "__FUNCTION__ ", status(0x%x), context(0x%x)\n", Status, hAdapter));
1289
1290 return Status;
1291}
1292
1293NTSTATUS
1294APIENTRY
1295DxgkDdiEnumVidPnCofuncModality(
1296 CONST HANDLE hAdapter,
1297 CONST DXGKARG_ENUMVIDPNCOFUNCMODALITY* CONST pEnumCofuncModalityArg
1298 )
1299{
1300 /* The DxgkDdiEnumVidPnCofuncModality function should be made pageable. */
1301 PAGED_CODE();
1302
1303 dfprintf(("==> "__FUNCTION__ ", context(0x%x)\n", hAdapter));
1304
1305 PDEVICE_EXTENSION pContext = (PDEVICE_EXTENSION)hAdapter;
1306
1307 const DXGK_VIDPN_INTERFACE* pVidPnInterface = NULL;
1308 NTSTATUS Status = pContext->u.primary.DxgkInterface.DxgkCbQueryVidPnInterface(pEnumCofuncModalityArg->hConstrainingVidPn, DXGK_VIDPN_INTERFACE_VERSION_V1, &pVidPnInterface);
1309 if (Status == STATUS_SUCCESS)
1310 {
1311 D3DKMDT_HVIDPNTOPOLOGY hVidPnTopology;
1312 const DXGK_VIDPNTOPOLOGY_INTERFACE* pVidPnTopologyInterface;
1313 NTSTATUS Status = pVidPnInterface->pfnGetTopology(pEnumCofuncModalityArg->hConstrainingVidPn, &hVidPnTopology, &pVidPnTopologyInterface);
1314 Assert(Status == STATUS_SUCCESS);
1315 if (Status == STATUS_SUCCESS)
1316 {
1317 VBOXVIDPNCMCONTEXT CbContext = {0};
1318 CbContext.pEnumCofuncModalityArg = pEnumCofuncModalityArg;
1319 Status = vboxVidPnEnumPaths(pContext, pEnumCofuncModalityArg->hConstrainingVidPn, pVidPnInterface,
1320 hVidPnTopology, pVidPnTopologyInterface,
1321 vboxVidPnCofuncModalityPathEnum, &CbContext);
1322 Assert(Status == STATUS_SUCCESS);
1323 if (Status == STATUS_SUCCESS)
1324 {
1325 Status = CbContext.Status;
1326 Assert(Status == STATUS_SUCCESS);
1327 if (Status != STATUS_SUCCESS)
1328 drprintf((__FUNCTION__ ": vboxVidPnAdjustSourcesTargetsCallback failed Status(0x%x)\n", Status));
1329 }
1330 else
1331 drprintf((__FUNCTION__ ": vboxVidPnEnumPaths failed Status(0x%x)\n", Status));
1332 }
1333 else
1334 drprintf((__FUNCTION__ ": pfnGetTopology failed Status(0x%x)\n", Status));
1335 }
1336 else
1337 drprintf((__FUNCTION__ ": DxgkCbQueryVidPnInterface failed Status(0x%x)\n", Status));
1338
1339 dfprintf(("<== "__FUNCTION__ ", status(0x%x), context(0x%x)\n", Status, hAdapter));
1340
1341 return STATUS_NOT_IMPLEMENTED;
1342}
1343
1344NTSTATUS
1345APIENTRY
1346DxgkDdiSetVidPnSourceAddress(
1347 CONST HANDLE hAdapter,
1348 CONST DXGKARG_SETVIDPNSOURCEADDRESS* pSetVidPnSourceAddress
1349 )
1350{
1351 return STATUS_NOT_IMPLEMENTED;
1352}
1353
1354NTSTATUS
1355APIENTRY
1356DxgkDdiSetVidPnSourceVisibility(
1357 CONST HANDLE hAdapter,
1358 CONST DXGKARG_SETVIDPNSOURCEVISIBILITY* pSetVidPnSourceVisibility
1359 )
1360{
1361 return STATUS_NOT_IMPLEMENTED;
1362}
1363
1364NTSTATUS
1365APIENTRY
1366DxgkDdiCommitVidPn(
1367 CONST HANDLE hAdapter,
1368 CONST DXGKARG_COMMITVIDPN* CONST pCommitVidPnArg
1369 )
1370{
1371 return STATUS_NOT_IMPLEMENTED;
1372}
1373
1374NTSTATUS
1375APIENTRY
1376DxgkDdiUpdateActiveVidPnPresentPath(
1377 CONST HANDLE hAdapter,
1378 CONST DXGKARG_UPDATEACTIVEVIDPNPRESENTPATH* CONST pUpdateActiveVidPnPresentPathArg
1379 )
1380{
1381 return STATUS_NOT_IMPLEMENTED;
1382}
1383
1384NTSTATUS
1385APIENTRY
1386DxgkDdiRecommendMonitorModes(
1387 CONST HANDLE hAdapter,
1388 CONST DXGKARG_RECOMMENDMONITORMODES* CONST pRecommendMonitorModesArg
1389 )
1390{
1391 return STATUS_NOT_IMPLEMENTED;
1392}
1393
1394NTSTATUS
1395APIENTRY
1396DxgkDdiRecommendVidPnTopology(
1397 CONST HANDLE hAdapter,
1398 CONST DXGKARG_RECOMMENDVIDPNTOPOLOGY* CONST pRecommendVidPnTopologyArg
1399 )
1400{
1401 return STATUS_NOT_IMPLEMENTED;
1402}
1403
1404NTSTATUS
1405APIENTRY
1406DxgkDdiGetScanLine(
1407 CONST HANDLE hAdapter,
1408 DXGKARG_GETSCANLINE* pGetScanLine)
1409{
1410 return STATUS_NOT_IMPLEMENTED;
1411}
1412
1413NTSTATUS
1414APIENTRY
1415DxgkDdiStopCapture(
1416 CONST HANDLE hAdapter,
1417 CONST DXGKARG_STOPCAPTURE* pStopCapture)
1418{
1419 return STATUS_NOT_IMPLEMENTED;
1420}
1421
1422NTSTATUS
1423APIENTRY
1424DxgkDdiControlInterrupt(
1425 CONST HANDLE hAdapter,
1426 CONST DXGK_INTERRUPT_TYPE InterruptType,
1427 BOOLEAN Enable
1428 )
1429{
1430 return STATUS_NOT_IMPLEMENTED;
1431}
1432
1433NTSTATUS
1434APIENTRY
1435DxgkDdiCreateOverlay(
1436 CONST HANDLE hAdapter,
1437 DXGKARG_CREATEOVERLAY *pCreateOverlay)
1438{
1439 return STATUS_NOT_IMPLEMENTED;
1440}
1441
1442NTSTATUS
1443APIENTRY
1444DxgkDdiDestroyDevice(
1445 CONST HANDLE hDevice)
1446{
1447 /* DxgkDdiDestroyDevice should be made pageable. */
1448 PAGED_CODE();
1449
1450 dfprintf(("==> "__FUNCTION__ ", hDevice(0x%x)\n", hDevice));
1451
1452 vboxWddmMemFree(hDevice);
1453
1454 dfprintf(("<== "__FUNCTION__ ", \n"));
1455
1456 return STATUS_UNSUCCESSFUL;
1457}
1458
1459NTSTATUS
1460APIENTRY
1461DxgkDdiOpenAllocation(
1462 CONST HANDLE hDevice,
1463 CONST DXGKARG_OPENALLOCATION *pOpenAllocation)
1464{
1465 return STATUS_NOT_IMPLEMENTED;
1466}
1467
1468NTSTATUS
1469APIENTRY
1470DxgkDdiCloseAllocation(
1471 CONST HANDLE hDevice,
1472 CONST DXGKARG_CLOSEALLOCATION* pCloseAllocation)
1473{
1474 return STATUS_NOT_IMPLEMENTED;
1475}
1476
1477NTSTATUS
1478APIENTRY
1479DxgkDdiRender(
1480 CONST HANDLE hContext,
1481 DXGKARG_RENDER *pRender)
1482{
1483 return STATUS_NOT_IMPLEMENTED;
1484}
1485
1486NTSTATUS
1487APIENTRY
1488DxgkDdiPresent(
1489 CONST HANDLE hContext,
1490 DXGKARG_PRESENT *pPresent)
1491{
1492 return STATUS_NOT_IMPLEMENTED;
1493}
1494
1495NTSTATUS
1496APIENTRY
1497DxgkDdiUpdateOverlay(
1498 CONST HANDLE hOverlay,
1499 CONST DXGKARG_UPDATEOVERLAY *pUpdateOverlay)
1500{
1501 return STATUS_NOT_IMPLEMENTED;
1502}
1503
1504NTSTATUS
1505APIENTRY
1506DxgkDdiFlipOverlay(
1507 CONST HANDLE hOverlay,
1508 CONST DXGKARG_FLIPOVERLAY *pFlipOverlay)
1509{
1510 return STATUS_NOT_IMPLEMENTED;
1511}
1512
1513NTSTATUS
1514APIENTRY
1515DxgkDdiDestroyOverlay(
1516 CONST HANDLE hOverlay)
1517{
1518 return STATUS_NOT_IMPLEMENTED;
1519}
1520
1521NTSTATUS
1522APIENTRY
1523DxgkDdiCreateContext(
1524 CONST HANDLE hDevice,
1525 DXGKARG_CREATECONTEXT *pCreateContext)
1526{
1527 return STATUS_NOT_IMPLEMENTED;
1528}
1529
1530NTSTATUS
1531APIENTRY
1532DxgkDdiDestroyContext(
1533 CONST HANDLE hContext)
1534{
1535 return STATUS_NOT_IMPLEMENTED;
1536}
1537
1538NTSTATUS
1539APIENTRY
1540DxgkDdiLinkDevice(
1541 __in CONST PDEVICE_OBJECT PhysicalDeviceObject,
1542 __in CONST PVOID MiniportDeviceContext,
1543 __inout PLINKED_DEVICE LinkedDevice
1544 )
1545{
1546 return STATUS_NOT_IMPLEMENTED;
1547}
1548
1549NTSTATUS
1550APIENTRY
1551DxgkDdiSetDisplayPrivateDriverFormat(
1552 CONST HANDLE hAdapter,
1553 /*CONST*/ DXGKARG_SETDISPLAYPRIVATEDRIVERFORMAT* pSetDisplayPrivateDriverFormat
1554 )
1555{
1556 return STATUS_NOT_IMPLEMENTED;
1557}
1558
1559NTSTATUS
1560DriverEntry(
1561 IN PDRIVER_OBJECT DriverObject,
1562 IN PUNICODE_STRING RegistryPath
1563 )
1564{
1565 dprintf(("VBoxVideoWddm::DriverEntry. Built %s %s\n", __DATE__, __TIME__));
1566
1567 DRIVER_INITIALIZATION_DATA DriverInitializationData = {'\0'};
1568
1569 PAGED_CODE();
1570
1571 if (! ARGUMENT_PRESENT(DriverObject) ||
1572 ! ARGUMENT_PRESENT(RegistryPath))
1573 {
1574 return STATUS_INVALID_PARAMETER;
1575 }
1576
1577 // Fill in the DriverInitializationData structure and call DxgkInitialize()
1578 DriverInitializationData.Version = DXGKDDI_INTERFACE_VERSION;
1579
1580 DriverInitializationData.DxgkDdiAddDevice = DxgkDdiAddDevice;
1581 DriverInitializationData.DxgkDdiStartDevice = DxgkDdiStartDevice;
1582 DriverInitializationData.DxgkDdiStopDevice = DxgkDdiStopDevice;
1583 DriverInitializationData.DxgkDdiRemoveDevice = DxgkDdiRemoveDevice;
1584 DriverInitializationData.DxgkDdiDispatchIoRequest = DxgkDdiDispatchIoRequest;
1585 DriverInitializationData.DxgkDdiInterruptRoutine = DxgkDdiInterruptRoutine;
1586 DriverInitializationData.DxgkDdiDpcRoutine = DxgkDdiDpcRoutine;
1587 DriverInitializationData.DxgkDdiQueryChildRelations = DxgkDdiQueryChildRelations;
1588 DriverInitializationData.DxgkDdiQueryChildStatus = DxgkDdiQueryChildStatus;
1589 DriverInitializationData.DxgkDdiQueryDeviceDescriptor = DxgkDdiQueryDeviceDescriptor;
1590 DriverInitializationData.DxgkDdiSetPowerState = DxgkDdiSetPowerState;
1591 DriverInitializationData.DxgkDdiNotifyAcpiEvent = DxgkDdiNotifyAcpiEvent;
1592 DriverInitializationData.DxgkDdiResetDevice = DxgkDdiResetDevice;
1593 DriverInitializationData.DxgkDdiUnload = DxgkDdiUnload;
1594 DriverInitializationData.DxgkDdiQueryInterface = DxgkDdiQueryInterface;
1595 DriverInitializationData.DxgkDdiControlEtwLogging = DxgkDdiControlEtwLogging;
1596
1597 DriverInitializationData.DxgkDdiQueryAdapterInfo = DxgkDdiQueryAdapterInfo;
1598 DriverInitializationData.DxgkDdiCreateDevice = DxgkDdiCreateDevice;
1599 DriverInitializationData.DxgkDdiCreateAllocation = DxgkDdiCreateAllocation;
1600 DriverInitializationData.DxgkDdiDestroyAllocation = DxgkDdiDestroyAllocation ;
1601
1602 DriverInitializationData.DxgkDdiDescribeAllocation = DxgkDdiDescribeAllocation;
1603 DriverInitializationData.DxgkDdiGetStandardAllocationDriverData = DxgkDdiGetStandardAllocationDriverData;
1604
1605 DriverInitializationData.DxgkDdiAcquireSwizzlingRange = DxgkDdiAcquireSwizzlingRange;
1606 DriverInitializationData.DxgkDdiReleaseSwizzlingRange = DxgkDdiReleaseSwizzlingRange;
1607
1608 DriverInitializationData.DxgkDdiPatch = DxgkDdiPatch;
1609
1610 DriverInitializationData.DxgkDdiSubmitCommand = DxgkDdiSubmitCommand;
1611 DriverInitializationData.DxgkDdiPreemptCommand = DxgkDdiPreemptCommand;
1612 DriverInitializationData.DxgkDdiBuildPagingBuffer = DxgkDdiBuildPagingBuffer;
1613
1614 DriverInitializationData.DxgkDdiSetPalette = DxgkDdiSetPalette;
1615 DriverInitializationData.DxgkDdiSetPointerPosition = DxgkDdiSetPointerPosition;
1616 DriverInitializationData.DxgkDdiSetPointerShape = DxgkDdiSetPointerShape;
1617
1618 DriverInitializationData.DxgkDdiResetFromTimeout = DxgkDdiResetFromTimeout;
1619
1620 DriverInitializationData.DxgkDdiEscape = DxgkDdiEscape;
1621
1622 DriverInitializationData.DxgkDdiCollectDbgInfo = DxgkDdiCollectDbgInfo;
1623
1624 DriverInitializationData.DxgkDdiQueryCurrentFence = DxgkDdiQueryCurrentFence;
1625
1626 DriverInitializationData.DxgkDdiIsSupportedVidPn = DxgkDdiIsSupportedVidPn;
1627 DriverInitializationData.DxgkDdiRecommendFunctionalVidPn = DxgkDdiRecommendFunctionalVidPn;
1628 DriverInitializationData.DxgkDdiEnumVidPnCofuncModality = DxgkDdiEnumVidPnCofuncModality;
1629 DriverInitializationData.DxgkDdiSetVidPnSourceAddress = DxgkDdiSetVidPnSourceAddress;
1630 DriverInitializationData.DxgkDdiSetVidPnSourceVisibility = DxgkDdiSetVidPnSourceVisibility;
1631 DriverInitializationData.DxgkDdiCommitVidPn = DxgkDdiCommitVidPn;
1632 DriverInitializationData.DxgkDdiUpdateActiveVidPnPresentPath = DxgkDdiUpdateActiveVidPnPresentPath;
1633
1634 DriverInitializationData.DxgkDdiRecommendMonitorModes = DxgkDdiRecommendMonitorModes;
1635 DriverInitializationData.DxgkDdiRecommendVidPnTopology = DxgkDdiRecommendVidPnTopology;
1636
1637 DriverInitializationData.DxgkDdiGetScanLine = DxgkDdiGetScanLine;
1638
1639 DriverInitializationData.DxgkDdiStopCapture = DxgkDdiStopCapture;
1640
1641 DriverInitializationData.DxgkDdiControlInterrupt = DxgkDdiControlInterrupt;
1642
1643 DriverInitializationData.DxgkDdiCreateOverlay = DxgkDdiCreateOverlay;
1644
1645 DriverInitializationData.DxgkDdiDestroyDevice = DxgkDdiDestroyDevice;
1646
1647 DriverInitializationData.DxgkDdiOpenAllocation = DxgkDdiOpenAllocation;
1648 DriverInitializationData.DxgkDdiCloseAllocation = DxgkDdiCloseAllocation;
1649
1650 DriverInitializationData.DxgkDdiRender = DxgkDdiRender;
1651 DriverInitializationData.DxgkDdiPresent = DxgkDdiPresent;
1652
1653 DriverInitializationData.DxgkDdiUpdateOverlay = DxgkDdiUpdateOverlay;
1654 DriverInitializationData.DxgkDdiFlipOverlay = DxgkDdiFlipOverlay;
1655 DriverInitializationData.DxgkDdiDestroyOverlay = DxgkDdiDestroyOverlay;
1656
1657 DriverInitializationData.DxgkDdiCreateContext = DxgkDdiCreateContext;
1658 DriverInitializationData.DxgkDdiDestroyContext = DxgkDdiDestroyContext;
1659
1660 DriverInitializationData.DxgkDdiLinkDevice = DxgkDdiLinkDevice;
1661 DriverInitializationData.DxgkDdiSetDisplayPrivateDriverFormat = DxgkDdiSetDisplayPrivateDriverFormat;
1662
1663//#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN7)
1664// DriverInitializationData.DxgkDdiRenderKm = D3DDDIRenderKm;
1665// DriverInitializationData.DxgkDdiRestartFromTimeout = D3DDDIRestartFromTimeout;
1666// DriverInitializationData.DxgkDdiSetVidPnSourceVisibility = DxgkDdiSetVidPnSourceVisibility;
1667// DriverInitializationData.DxgkDdiUpdateActiveVidPnPresentPath = D3DDDIUpdateActiveVidPnPresentPath;
1668// DriverInitializationData.DxgkDdiQueryVidPnHWCapability = D3DDDI DxgkDdiQueryVidPnHWCapability;
1669//#endif
1670
1671 return DxgkInitialize(DriverObject,
1672 RegistryPath,
1673 &DriverInitializationData);
1674}
Note: See TracBrowser for help on using the repository browser.

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