Changeset 48070 in vbox for trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm
- Timestamp:
- Aug 26, 2013 6:13:22 PM (11 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPCm.cpp
r38112 r48070 72 72 PKEVENT pUmEvent; 73 73 /* sync lock */ 74 FAST_MUTEX Mutex;74 KSPIN_LOCK SynchLock; 75 75 /* indicates whether event signaling is needed on cmd add */ 76 76 bool bEventNeeded; … … 181 181 } 182 182 183 Assert(KeGetCurrentIrql() < DISPATCH_LEVEL); 184 ExAcquireFastMutex(&pSession->Mutex); 183 Assert(KeGetCurrentIrql() <= DISPATCH_LEVEL); 184 185 KIRQL OldIrql; 186 KeAcquireSpinLock(&pSession->SynchLock, &OldIrql); 185 187 186 188 InsertHeadList(&pSession->CommandsList, &pHdr->QueueList); … … 191 193 } 192 194 193 ExReleaseFastMutex(&pSession->Mutex);195 KeReleaseSpinLock(&pSession->SynchLock, OldIrql); 194 196 195 197 if (bSignalEvent) … … 225 227 PVBOXVIDEOCM_CMD_DR pHdr; 226 228 227 ExAcquireFastMutex(&pSession->Mutex); 229 KIRQL OldIrql; 230 KeAcquireSpinLock(&pSession->SynchLock, &OldIrql); 228 231 229 232 pCurEntry = pSession->CommandsList.Blink; … … 260 263 261 264 262 ExReleaseFastMutex(&pSession->Mutex);265 KeReleaseSpinLock(&pSession->SynchLock, OldIrql); 263 266 264 267 return STATUS_SUCCESS; … … 280 283 void vboxVideoCmSessionCtxAdd(PVBOXVIDEOCM_SESSION pSession, PVBOXVIDEOCM_CTX pContext) 281 284 { 282 Assert(KeGetCurrentIrql() < DISPATCH_LEVEL); 283 ExAcquireFastMutex(&pSession->Mutex); 285 Assert(KeGetCurrentIrql() <= DISPATCH_LEVEL); 286 KIRQL OldIrql; 287 KeAcquireSpinLock(&pSession->SynchLock, &OldIrql); 288 284 289 vboxVideoCmSessionCtxAddLocked(pSession, pContext); 285 ExReleaseFastMutex(&pSession->Mutex); 286 290 291 KeReleaseSpinLock(&pSession->SynchLock, OldIrql); 292 } 293 294 void vboxVideoCmSessionSignalEvent(PVBOXVIDEOCM_SESSION pSession) 295 { 296 Assert(KeGetCurrentIrql() <= DISPATCH_LEVEL); 297 if (pSession->pUmEvent) 298 KeSetEvent(pSession->pUmEvent, 0, FALSE); 287 299 } 288 300 … … 346 358 InitializeListHead(&RemainedList); 347 359 InitializeListHead(&RemainedPpList); 348 Assert(KeGetCurrentIrql() < DISPATCH_LEVEL); 349 ExAcquireFastMutex(&pSession->Mutex); 360 Assert(KeGetCurrentIrql() <= DISPATCH_LEVEL); 361 KIRQL OldIrql; 362 KeAcquireSpinLock(&pSession->SynchLock, &OldIrql); 363 350 364 pContext->pSession = NULL; 351 365 RemoveEntryList(&pContext->SessionEntry); … … 362 376 vboxVideoCmSessionCtxDetachCmdsLocked(&pSession->PpCommandsList, pContext, &RemainedPpList); 363 377 } 364 ExReleaseFastMutex(&pSession->Mutex); 378 379 KeReleaseSpinLock(&pSession->SynchLock, OldIrql); 365 380 366 381 for (pCur = RemainedList.Flink; pCur != &RemainedList; pCur = RemainedList.Flink) … … 393 408 InitializeListHead(&pSession->PpCommandsList); 394 409 pSession->pUmEvent = pUmEvent; 395 Assert(KeGetCurrentIrql() < DISPATCH_LEVEL);396 ExInitializeFastMutex(&pSession->Mutex);410 Assert(KeGetCurrentIrql() <= DISPATCH_LEVEL); 411 KeInitializeSpinLock(&pSession->SynchLock); 397 412 pSession->bEventNeeded = true; 398 413 vboxVideoCmSessionCtxAddLocked(pSession, pContext); … … 421 436 if (Status == STATUS_SUCCESS) 422 437 { 423 Status = KeWaitForSingleObject(&pMgr->SynchEvent, Executive, KernelMode, 424 FALSE, /* BOOLEAN Alertable */ 425 NULL /* PLARGE_INTEGER Timeout */ 426 ); 427 Assert(Status == STATUS_SUCCESS); 438 KIRQL OldIrql; 439 KeAcquireSpinLock(&pMgr->SynchLock, &OldIrql); 440 441 bool bFound = false; 442 PVBOXVIDEOCM_SESSION pSession = NULL; 443 for (PLIST_ENTRY pEntry = pMgr->SessionList.Flink; pEntry != &pMgr->SessionList; pEntry = pEntry->Flink) 444 { 445 pSession = VBOXCMENTRY_2_SESSION(pEntry); 446 if (pSession->pUmEvent == pUmEvent) 447 { 448 bFound = true; 449 break; 450 } 451 } 452 453 pContext->u64UmData = u64UmData; 454 455 if (!bFound) 456 { 457 Status = vboxVideoCmSessionCreateLocked(pMgr, &pSession, pUmEvent, pContext); 458 Assert(Status == STATUS_SUCCESS); 459 } 460 else 461 { 462 /* Status = */vboxVideoCmSessionCtxAdd(pSession, pContext); 463 /*Assert(Status == STATUS_SUCCESS);*/ 464 } 465 466 KeReleaseSpinLock(&pMgr->SynchLock, OldIrql); 467 428 468 if (Status == STATUS_SUCCESS) 429 469 { 430 bool bFound = false; 431 PVBOXVIDEOCM_SESSION pSession = NULL; 432 for (PLIST_ENTRY pEntry = pMgr->SessionList.Flink; pEntry != &pMgr->SessionList; pEntry = pEntry->Flink) 433 { 434 pSession = VBOXCMENTRY_2_SESSION(pEntry); 435 if (pSession->pUmEvent == pUmEvent) 436 { 437 bFound = true; 438 break; 439 } 440 } 441 442 pContext->u64UmData = u64UmData; 443 444 if (!bFound) 445 { 446 Status = vboxVideoCmSessionCreateLocked(pMgr, &pSession, pUmEvent, pContext); 447 Assert(Status == STATUS_SUCCESS); 448 } 449 else 450 { 451 /* Status = */vboxVideoCmSessionCtxAdd(pSession, pContext); 452 /*Assert(Status == STATUS_SUCCESS);*/ 453 } 454 LONG tstL = KeSetEvent(&pMgr->SynchEvent, 0, FALSE); 455 Assert(!tstL); 456 457 if (Status == STATUS_SUCCESS) 458 { 459 return STATUS_SUCCESS; 460 } 470 return STATUS_SUCCESS; 461 471 } 462 472 … … 472 482 return STATUS_SUCCESS; 473 483 474 NTSTATUS Status = KeWaitForSingleObject(&pMgr->SynchEvent, Executive, KernelMode, 475 FALSE, /* BOOLEAN Alertable */ 476 NULL /* PLARGE_INTEGER Timeout */ 477 ); 478 Assert(Status == STATUS_SUCCESS); 479 if (Status == STATUS_SUCCESS) 480 { 481 vboxVideoCmSessionCtxRemoveLocked(pSession, pContext); 482 LONG tstL = KeSetEvent(&pMgr->SynchEvent, 0, FALSE); 483 Assert(!tstL); 484 } 485 486 return Status; 484 KIRQL OldIrql; 485 KeAcquireSpinLock(&pMgr->SynchLock, &OldIrql); 486 487 vboxVideoCmSessionCtxRemoveLocked(pSession, pContext); 488 489 KeReleaseSpinLock(&pMgr->SynchLock, OldIrql); 490 491 return STATUS_SUCCESS; 487 492 } 488 493 489 494 NTSTATUS vboxVideoCmInit(PVBOXVIDEOCM_MGR pMgr) 490 495 { 491 KeInitialize Event(&pMgr->SynchEvent, SynchronizationEvent, TRUE);496 KeInitializeSpinLock(&pMgr->SynchLock); 492 497 InitializeListHead(&pMgr->SessionList); 493 498 return STATUS_SUCCESS; … … 500 505 } 501 506 507 NTSTATUS vboxVideoCmSignalEvents(PVBOXVIDEOCM_MGR pMgr) 508 { 509 Assert(KeGetCurrentIrql() <= DISPATCH_LEVEL); 510 PVBOXVIDEOCM_SESSION pSession = NULL; 511 512 KIRQL OldIrql; 513 KeAcquireSpinLock(&pMgr->SynchLock, &OldIrql); 514 515 for (PLIST_ENTRY pEntry = pMgr->SessionList.Flink; pEntry != &pMgr->SessionList; pEntry = pEntry->Flink) 516 { 517 pSession = VBOXCMENTRY_2_SESSION(pEntry); 518 vboxVideoCmSessionSignalEvent(pSession); 519 } 520 521 KeReleaseSpinLock(&pMgr->SynchLock, OldIrql); 522 523 return STATUS_SUCCESS; 524 } 525 502 526 VOID vboxVideoCmProcessKm(PVBOXVIDEOCM_CTX pContext, PVBOXVIDEOCM_CMD_CTL_KM pCmd) 503 527 { … … 515 539 { 516 540 PVBOXVIDEOCM_CMD_DR pHdr = VBOXVIDEOCM_HEAD(pCmd); 517 ExAcquireFastMutex(&pSession->Mutex); 541 KIRQL OldIrql; 542 KeAcquireSpinLock(&pSession->SynchLock, &OldIrql); 518 543 InsertTailList(&pSession->PpCommandsList, &pHdr->QueueList); 519 ExReleaseFastMutex(&pSession->Mutex);544 KeReleaseSpinLock(&pSession->SynchLock, OldIrql); 520 545 break; 521 546 } … … 550 575 // PVBOXWDDM_GETVBOXVIDEOCMCMD_HDR *pvCmd 551 576 552 Assert(KeGetCurrentIrql() < DISPATCH_LEVEL); 553 ExAcquireFastMutex(&pSession->Mutex); 577 Assert(KeGetCurrentIrql() <= DISPATCH_LEVEL); 578 KIRQL OldIrql; 579 KeAcquireSpinLock(&pSession->SynchLock, &OldIrql); 554 580 555 581 vboxVideoCmSessionCtxDetachCmdsLocked(&pSession->PpCommandsList, pContext, &DetachedPpList); … … 606 632 } while (1); 607 633 608 ExReleaseFastMutex(&pSession->Mutex);634 KeReleaseSpinLock(&pSession->SynchLock, OldIrql); 609 635 610 636 vboxVideoCmSessionCtxPpList(pContext, &DetachedPpList); … … 647 673 } 648 674 649 VOID vboxVideoCmLock(PVBOXVIDEOCM_CTX pContext)650 {651 ExAcquireFastMutex(&pContext->pSession->Mutex);652 }653 654 VOID vboxVideoCmUnlock(PVBOXVIDEOCM_CTX pContext)655 {656 ExReleaseFastMutex(&pContext->pSession->Mutex);657 }658 659 675 static BOOLEAN vboxVideoCmHasUncompletedCmdsLocked(PVBOXVIDEOCM_MGR pMgr) 660 676 { … … 663 679 { 664 680 pSession = VBOXCMENTRY_2_SESSION(pEntry); 665 ExAcquireFastMutex(&pSession->Mutex); 681 KIRQL OldIrql; 682 KeAcquireSpinLock(&pSession->SynchLock, &OldIrql); 683 666 684 if (pSession->bEventNeeded) 667 685 { 668 686 /* commands still being processed */ 669 ExReleaseFastMutex(&pSession->Mutex);687 KeReleaseSpinLock(&pSession->SynchLock, OldIrql); 670 688 return TRUE; 671 689 } 672 ExReleaseFastMutex(&pSession->Mutex);690 KeReleaseSpinLock(&pSession->SynchLock, OldIrql); 673 691 } 674 692 return FALSE; 675 693 } 676 677 /* waits for all outstanding commands to completed by client678 * assumptions here are:679 * 1. no new commands are submitted while we are waiting680 * 2. it is assumed that a client completes all previously received commands681 * once it queries for the new set of commands */682 NTSTATUS vboxVideoCmWaitCompletedCmds(PVBOXVIDEOCM_MGR pMgr, uint32_t msTimeout)683 {684 LARGE_INTEGER Timeout;685 PLARGE_INTEGER pTimeout;686 uint32_t cIters;687 688 if (msTimeout != RT_INDEFINITE_WAIT)689 {690 uint32_t msIter = 2;691 cIters = msTimeout/msIter;692 if (!cIters)693 {694 msIter = msTimeout;695 cIters = 1;696 }697 Timeout.QuadPart = -(int64_t) msIter /* ms */ * 10000;698 pTimeout = &Timeout;699 }700 else701 {702 pTimeout = NULL;703 cIters = 1;704 }705 706 Assert(cIters);707 do708 {709 NTSTATUS Status = KeWaitForSingleObject(&pMgr->SynchEvent, Executive, KernelMode,710 FALSE, /* BOOLEAN Alertable */711 pTimeout /* PLARGE_INTEGER Timeout */712 );713 if (Status == STATUS_TIMEOUT)714 {715 --cIters;716 }717 else718 {719 if (!NT_SUCCESS(Status))720 {721 WARN(("KeWaitForSingleObject failed with Status (0x%x)", Status));722 return Status;723 }724 725 /* succeeded */726 if (!vboxVideoCmHasUncompletedCmdsLocked(pMgr))727 {728 LONG tstL = KeSetEvent(&pMgr->SynchEvent, 0, FALSE);729 Assert(!tstL);730 return STATUS_SUCCESS;731 }732 733 LONG tstL = KeSetEvent(&pMgr->SynchEvent, 0, FALSE);734 Assert(!tstL);735 }736 737 if (!cIters)738 break;739 740 KeDelayExecutionThread(KernelMode, FALSE, pTimeout);741 --cIters;742 if (!cIters)743 break;744 } while (0);745 746 return STATUS_TIMEOUT;747 }748 -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPCm.h
r38112 r48070 22 22 typedef struct VBOXVIDEOCM_MGR 23 23 { 24 K EVENT SynchEvent;24 KSPIN_LOCK SynchLock; 25 25 /* session list */ 26 26 LIST_ENTRY SessionList; … … 41 41 NTSTATUS vboxVideoCmInit(PVBOXVIDEOCM_MGR pMgr); 42 42 NTSTATUS vboxVideoCmTerm(PVBOXVIDEOCM_MGR pMgr); 43 NTSTATUS vboxVideoCmSignalEvents(PVBOXVIDEOCM_MGR pMgr); 43 44 44 45 NTSTATUS vboxVideoCmCmdSubmitCompleteEvent(PVBOXVIDEOCM_CTX pContext, PKEVENT pEvent); … … 58 59 NTSTATUS vboxVideoCmEscape(PVBOXVIDEOCM_CTX pContext, PVBOXDISPIFESCAPE_GETVBOXVIDEOCMCMD pCmd, uint32_t cbCmd); 59 60 60 NTSTATUS vboxVideoCmWaitCompletedCmds(PVBOXVIDEOCM_MGR pMgr, uint32_t msTimeout);61 62 VOID vboxVideoCmLock(PVBOXVIDEOCM_CTX pContext);63 VOID vboxVideoCmUnlock(PVBOXVIDEOCM_CTX pContext);64 65 61 #endif /* #ifndef ___VBoxMPCm_h___ */ -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPMisc.cpp
r47566 r48070 573 573 } 574 574 575 #define VBOXWDDM_REG_DRVKEY_PREFIX L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\Class\\"576 577 575 NTSTATUS vboxWddmRegQueryDrvKeyName(PVBOXMP_DEVEXT pDevExt, ULONG cbBuf, PWCHAR pBuf, PULONG pcbResult) 578 576 { … … 607 605 } 608 606 609 #define VBOXWDDM_REG_DISPLAYSETTINGSKEY_PREFIX_VISTA L"\\Registry\\Machine\\System\\CurrentControlSet\\Hardware Profiles\\Current\\System\\CurrentControlSet\\Control\\VIDEO\\"610 #define VBOXWDDM_REG_DISPLAYSETTINGSKEY_PREFIX_WIN7 L"\\Registry\\Machine\\System\\CurrentControlSet\\Hardware Profiles\\UnitedVideo\\CONTROL\\VIDEO\\"611 612 #define VBOXWDDM_REG_DISPLAYSETTINGS_ATTACH_RELX L"Attach.RelativeX"613 #define VBOXWDDM_REG_DISPLAYSETTINGS_ATTACH_RELY L"Attach.RelativeY"614 #define VBOXWDDM_REG_DISPLAYSETTINGS_ATTACH_DESKTOP L"Attach.ToDesktop"615 616 607 NTSTATUS vboxWddmRegQueryDisplaySettingsKeyName(PVBOXMP_DEVEXT pDevExt, D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId, 617 608 ULONG cbBuf, PWCHAR pBuf, PULONG pcbResult) … … 660 651 return Status; 661 652 } 662 663 #define VBOXWDDM_REG_DISPLAYSETTINGSVIDEOKEY L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\Video\\"664 #define VBOXWDDM_REG_DISPLAYSETTINGSVIDEOKEY_SUBKEY L"\\Video"665 653 666 654 NTSTATUS vboxWddmRegQueryVideoGuidString(PVBOXMP_DEVEXT pDevExt, ULONG cbBuf, PWCHAR pBuf, PULONG pcbResult) … … 891 879 } 892 880 881 NTSTATUS vboxWddmRegDrvFlagsSet(PVBOXMP_DEVEXT pDevExt, DWORD fVal) 882 { 883 HANDLE hKey = NULL; 884 NTSTATUS Status = IoOpenDeviceRegistryKey(pDevExt->pPDO, PLUGPLAY_REGKEY_DRIVER, GENERIC_WRITE, &hKey); 885 if (!NT_SUCCESS(Status)) 886 { 887 WARN(("IoOpenDeviceRegistryKey failed, Status = 0x%x", Status)); 888 return Status; 889 } 890 891 Status = vboxWddmRegSetValueDword(hKey, VBOXWDDM_REG_DRV_FLAGS_NAME, fVal); 892 if (!NT_SUCCESS(Status)) 893 WARN(("vboxWddmRegSetValueDword failed, Status = 0x%x", Status)); 894 895 NTSTATUS tmpStatus = ZwClose(hKey); 896 Assert(tmpStatus == STATUS_SUCCESS); 897 898 return Status; 899 } 900 901 DWORD vboxWddmRegDrvFlagsGet(PVBOXMP_DEVEXT pDevExt, DWORD fDefault) 902 { 903 HANDLE hKey = NULL; 904 NTSTATUS Status = IoOpenDeviceRegistryKey(pDevExt->pPDO, PLUGPLAY_REGKEY_DRIVER, GENERIC_READ, &hKey); 905 if (!NT_SUCCESS(Status)) 906 { 907 WARN(("IoOpenDeviceRegistryKey failed, Status = 0x%x", Status)); 908 return fDefault; 909 } 910 911 DWORD dwVal = 0; 912 Status = vboxWddmRegQueryValueDword(hKey, VBOXWDDM_REG_DRV_FLAGS_NAME, &dwVal); 913 if (!NT_SUCCESS(Status)) 914 { 915 WARN(("vboxWddmRegQueryValueDword failed, Status = 0x%x", Status)); 916 dwVal = fDefault; 917 } 918 919 NTSTATUS tmpStatus = ZwClose(hKey); 920 Assert(tmpStatus == STATUS_SUCCESS); 921 922 return dwVal; 923 } 924 893 925 NTSTATUS vboxWddmRegQueryValueDword(IN HANDLE hKey, IN PWCHAR pName, OUT PDWORD pDword) 894 926 { … … 920 952 } 921 953 922 NTSTATUS vboxWddmRegSetValueDword(IN HANDLE hKey, IN PWCHAR pName, OUTDWORD val)954 NTSTATUS vboxWddmRegSetValueDword(IN HANDLE hKey, IN PWCHAR pName, IN DWORD val) 923 955 { 924 956 UNICODE_STRING RtlStr; -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPMisc.h
r47566 r48070 99 99 NTSTATUS vboxWddmRegOpenKey(OUT PHANDLE phKey, IN PWCHAR pName, IN ACCESS_MASK fAccess); 100 100 NTSTATUS vboxWddmRegQueryValueDword(IN HANDLE hKey, IN PWCHAR pName, OUT PDWORD pDword); 101 NTSTATUS vboxWddmRegSetValueDword(IN HANDLE hKey, IN PWCHAR pName, OUT DWORD val); 101 NTSTATUS vboxWddmRegSetValueDword(IN HANDLE hKey, IN PWCHAR pName, IN DWORD val); 102 103 NTSTATUS vboxWddmRegDrvFlagsSet(PVBOXMP_DEVEXT pDevExt, DWORD fVal); 104 DWORD vboxWddmRegDrvFlagsGet(PVBOXMP_DEVEXT pDevExt, DWORD fDefault); 102 105 103 106 UNICODE_STRING* vboxWddmVGuidGet(PVBOXMP_DEVEXT pDevExt); … … 184 187 #endif 185 188 189 NTSTATUS vboxWddmChildStatusConnect(PVBOXMP_DEVEXT pDevExt, uint32_t iChild, BOOLEAN fConnect); 190 186 191 #endif /* #ifndef ___VBoxMPMisc_h__ */ -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPTypes.h
r47059 r48070 35 35 #include <cr_vreg.h> 36 36 37 #ifdef DEBUG_misha 38 extern DWORD g_VBoxDbgBreakModes; 39 #endif 37 40 38 41 #if 0 … … 139 142 uint32_t HeightVisible; 140 143 uint32_t HeightTotal; 144 /* since there coul be multiple state changes on auto-resize, 145 * we pend notifying host to avoi flickering */ 146 volatile bool fStateSyncPening; 147 bool fConnected; 148 bool fConfigured; 141 149 } VBOXWDDM_TARGET, *PVBOXWDDM_TARGET; 142 150 -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVidPn.cpp
r44529 r48070 1263 1263 const DXGK_VIDPNTARGETMODESET_INTERFACE *pNewVidPnTargetModeSetInterface; 1264 1264 1265 if (VidPnSourceId != VidPnTargetId || pCbContext->apPathInfos[VidPnTargetId].enmState != VBOXVIDPNPATHITEM_STATE_PRESENT) 1266 { 1267 return STATUS_SUCCESS; 1268 } 1265 Assert(VidPnSourceId == VidPnTargetId); 1269 1266 1270 1267 D3DKMDT_HVIDPNSOURCEMODESET hCurVidPnSourceModeSet; … … 1306 1303 { 1307 1304 Assert(hNewVidPnTargetModeSet); 1308 if (VidPnSourceId == VidPnTargetId && pCbContext->apPathInfos[VidPnTargetId].enmState == VBOXVIDPNPATHITEM_STATE_PRESENT) 1309 { 1310 Assert(VidPnSourceId == VidPnTargetId); 1311 1305 Assert(VidPnSourceId == VidPnTargetId); 1306 // if (VidPnSourceId == VidPnTargetId && pCbContext->apPathInfos[VidPnTargetId].enmState == VBOXVIDPNPATHITEM_STATE_PRESENT) 1307 { 1312 1308 for (uint32_t i = 0; i < pInfo->cResolutions; ++i) 1313 1309 { … … 1398 1394 const DXGK_VIDPNSOURCEMODESET_INTERFACE *pNewVidPnSourceModeSetInterface; 1399 1395 1400 if (VidPnSourceId != VidPnTargetId || pCbContext->apPathInfos[VidPnSourceId].enmState != VBOXVIDPNPATHITEM_STATE_PRESENT) 1401 { 1402 return STATUS_SUCCESS; 1403 } 1396 Assert(VidPnSourceId == VidPnTargetId); 1404 1397 1405 1398 D3DKMDT_HVIDPNTARGETMODESET hCurVidPnTargetModeSet; … … 1441 1434 { 1442 1435 Assert(hNewVidPnSourceModeSet); 1443 if (VidPnSourceId == VidPnTargetId && pCbContext->apPathInfos[VidPnSourceId].enmState == VBOXVIDPNPATHITEM_STATE_PRESENT)1444 { 1445 Assert(VidPnSourceId == VidPnTargetId);1436 Assert(VidPnSourceId == VidPnTargetId); 1437 // if (VidPnSourceId == VidPnTargetId && pCbContext->apPathInfos[VidPnSourceId].enmState == VBOXVIDPNPATHITEM_STATE_PRESENT) 1438 { 1446 1439 for (uint32_t i = 0; i < pInfo->cModes; ++i) 1447 1440 { … … 1755 1748 else 1756 1749 { 1757 AssertFailed();1750 WARN(("cItems(%d) <= VidPnSourceId(%d)", pCbContext->cItems, VidPnSourceId)); 1758 1751 Status = STATUS_BUFFER_OVERFLOW; 1759 1752 break; … … 1766 1759 else 1767 1760 { 1768 AssertFailed();1761 WARN(("cItems(%d) <= VidPnTargetId(%d)", pCbContext->cItems, VidPnTargetId)); 1769 1762 Status = STATUS_BUFFER_OVERFLOW; 1770 1763 break; … … 1775 1768 1776 1769 /* VidPnSourceId == VidPnTargetId */ 1770 Assert(VidPnSourceId == VidPnTargetId); 1777 1771 if (pCbContext->cItems > VidPnSourceId) 1778 1772 { … … 1785 1779 else 1786 1780 { 1787 AssertFailed();1781 WARN(("cItems(%d) <= VidPnSource/TargetId(%d)", pCbContext->cItems, VidPnSourceId)); 1788 1782 Status = STATUS_BUFFER_OVERFLOW; 1789 1783 break; … … 1801 1795 /* we currently support only 0 -> 0, 1 -> 1, 2 -> 2 paths, AND 0 -> 0 must be present 1802 1796 * this routine disables all paths unsupported */ 1803 NTSTATUS vboxVidPnCheckTopology(D3DKMDT_HVIDPNTOPOLOGY hVidPnTopology, const DXGK_VIDPNTOPOLOGY_INTERFACE* pVidPnTopologyInterface, 1804 BOOLEAN fBreakOnDisabled, UINT cItems, PVBOXVIDPNPATHITEM paItems, BOOLEAN *pfDisabledFound) 1805 { 1797 NTSTATUS vboxVidPnCheckTopology(D3DKMDT_HVIDPNTOPOLOGY hVidPnTopology, const DXGK_VIDPNTOPOLOGY_INTERFACE* pVidPnTopologyInterface, BOOLEAN *pfSupported) 1798 { 1799 VBOXVIDPNPATHITEM aItems[VBOX_VIDEO_MAX_SCREENS]; 1800 const uint32_t cItems = RT_ELEMENTS(aItems); 1806 1801 UINT i; 1807 1802 for (i = 0; i < cItems; ++i) 1808 1803 { 1809 paItems[i].enmState = VBOXVIDPNPATHITEM_STATE_NOT_EXISTS;1804 aItems[i].enmState = VBOXVIDPNPATHITEM_STATE_NOT_EXISTS; 1810 1805 } 1811 1806 VBOXVIDPNGETPATHSINFO CbContext = {0}; 1812 1807 CbContext.Status = STATUS_SUCCESS; 1813 CbContext.fBreakOnDisabled = fBreakOnDisabled;1808 CbContext.fBreakOnDisabled = FALSE; 1814 1809 CbContext.fDisabledFound = FALSE; 1815 1810 CbContext.cItems = cItems; 1816 CbContext.paItems = paItems;1811 CbContext.paItems = aItems; 1817 1812 NTSTATUS Status = vboxVidPnEnumPaths(hVidPnTopology, pVidPnTopologyInterface, vboxVidPnCheckTopologyEnum, &CbContext); 1818 1813 if (!NT_SUCCESS(Status)) … … 1829 1824 } 1830 1825 1831 if (pfDisabledFound)1832 *pfDisabledFound = CbContext.fDisabledFound; 1833 1834 if (!fBreakOnDisabled)1835 {1836 /* now check if 0->0 path is present and enabled, and if not, disable everything */ 1837 if (cItems && paItems[0].enmState != VBOXVIDPNPATHITEM_STATE_PRESENT)1838 {1839 LOGREL(("path 0 not set to present\n")); 1840 for (i = 0; i < cItems; ++i) 1841 { 1842 if (paItems[i].enmState == VBOXVIDPNPATHITEM_STATE_PRESENT) 1843 paItems[i].enmState = VBOXVIDPNPATHITEM_STATE_DISABLED; 1844 } 1845 }1846 }1826 BOOLEAN fSupported = !CbContext.fDisabledFound; 1827 1828 /* now check if 0->0 path is present and enabled, and if not, disable everything */ 1829 // if (cItems && aItems[0].enmState != VBOXVIDPNPATHITEM_STATE_PRESENT) 1830 // { 1831 // LOG(("path 0 not set to present\n")); 1832 //// for (i = 0; i < cItems; ++i) 1833 //// { 1834 //// if (aItems[i].enmState == VBOXVIDPNPATHITEM_STATE_PRESENT) 1835 //// aItems[i].enmState = VBOXVIDPNPATHITEM_STATE_DISABLED; 1836 //// } 1837 // fSupported = FALSE; 1838 // } 1839 1840 if (pfSupported) 1841 *pfSupported = fSupported; 1847 1842 1848 1843 return Status; … … 2063 2058 else 2064 2059 { 2065 Assert(Status == STATUS_GRAPHICS_NO_MORE_ELEMENTS_IN_DATASET);2066 2060 if (Status != STATUS_GRAPHICS_NO_MORE_ELEMENTS_IN_DATASET) 2067 LOGREL(("pfnAcquireNextPathInfo Failed Status(0x%x), ignored since callback returned false", Status));2061 WARN(("pfnAcquireNextPathInfo Failed Status(0x%x), ignored since callback returned false", Status)); 2068 2062 Status = STATUS_SUCCESS; 2069 2063 } … … 2080 2074 else 2081 2075 { 2082 AssertBreakpoint(); 2083 LOGREL(("pfnAcquireNextPathInfo Failed Status(0x%x)", Status)); 2076 WARN(("pfnAcquireNextPathInfo Failed Status(0x%x)", Status)); 2084 2077 pNewVidPnPresentPathInfo = NULL; 2085 2078 break; … … 2090 2083 Status = STATUS_SUCCESS; 2091 2084 else 2092 LOGREL(("pfnAcquireFirstModeInfo failed Status(0x%x)", Status));2085 WARN(("pfnAcquireFirstModeInfo failed Status(0x%x)", Status)); 2093 2086 2094 2087 return Status; … … 2181 2174 return Status == STATUS_SUCCESS; 2182 2175 } 2176 2177 #ifdef DEBUG_misha 2178 DWORD g_VBoxDbgBreakModes = 0; 2179 #endif 2183 2180 2184 2181 NTSTATUS vboxVidPnCommitSourceModeForSrcId(PVBOXMP_DEVEXT pDevExt, const D3DKMDT_HVIDPN hDesiredVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface, D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId, PVBOXWDDM_ALLOCATION pAllocation) … … 2235 2232 } 2236 2233 else 2237 LOGREL(("vboxVidPnEnumTargetsForSource failed Status(0x%x)", Status));2234 WARN(("vboxVidPnEnumTargetsForSource failed Status(0x%x)", Status)); 2238 2235 } 2239 2236 else 2240 LOGREL(("pfnGetTopology failed Status(0x%x)", Status));2237 WARN(("pfnGetTopology failed Status(0x%x)", Status)); 2241 2238 } 2242 2239 else 2243 LOGREL(("vboxVidPnCommitSourceMode failed Status(0x%x)", Status));2240 WARN(("vboxVidPnCommitSourceMode failed Status(0x%x)", Status)); 2244 2241 /* release */ 2245 2242 pCurVidPnSourceModeSetInterface->pfnReleaseModeInfo(hCurVidPnSourceModeSet, pPinnedVidPnSourceModeInfo); … … 2247 2244 else if (Status == STATUS_GRAPHICS_MODE_NOT_PINNED) 2248 2245 { 2246 #ifdef DEBUG_misha 2247 Assert(!g_VBoxDbgBreakModes); 2248 ++g_VBoxDbgBreakModes; 2249 #endif 2249 2250 Status = vboxVidPnCommitSourceMode(pDevExt, srcId, NULL, pAllocation); 2250 2251 Assert(Status == STATUS_SUCCESS); 2251 2252 } 2252 2253 else 2253 LOGREL(("pfnAcquirePinnedModeInfo failed Status(0x%x)", Status));2254 WARN(("pfnAcquirePinnedModeInfo failed Status(0x%x)", Status)); 2254 2255 2255 2256 pVidPnInterface->pfnReleaseSourceModeSet(hDesiredVidPn, hCurVidPnSourceModeSet); … … 2257 2258 else 2258 2259 { 2259 LOGREL(("pfnAcquireSourceModeSet failed Status(0x%x)", Status));2260 WARN(("pfnAcquireSourceModeSet failed Status(0x%x)", Status)); 2260 2261 } 2261 2262 -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVidPn.h
r37490 r48070 58 58 CONST DXGKARG_ENUMVIDPNCOFUNCMODALITY* pEnumCofuncModalityArg; 59 59 PVBOXWDDM_VIDEOMODES_INFO pInfos; 60 UINT cPathInfos;61 PVBOXVIDPNPATHITEM apPathInfos;60 // UINT cPathInfos; 61 // PVBOXVIDPNPATHITEM apPathInfos; 62 62 } VBOXVIDPNCOFUNCMODALITY, *PVBOXVIDPNCOFUNCMODALITY; 63 63 … … 146 146 NTSTATUS vboxVidPnCofuncModalityForPath(PVBOXVIDPNCOFUNCMODALITY pCbContext, D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId, D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId); 147 147 148 NTSTATUS vboxVidPnCheckTopology(D3DKMDT_HVIDPNTOPOLOGY hVidPnTopology, const DXGK_VIDPNTOPOLOGY_INTERFACE* pVidPnTopologyInterface, 149 BOOLEAN fBreakOnDisabled, UINT cItems, PVBOXVIDPNPATHITEM paItems, BOOLEAN *pfDisabledFound); 148 NTSTATUS vboxVidPnCheckTopology(D3DKMDT_HVIDPNTOPOLOGY hVidPnTopology, const DXGK_VIDPNTOPOLOGY_INTERFACE* pVidPnTopologyInterface, BOOLEAN *pfSupported); 150 149 151 150 NTSTATUS vboxVidPnPathAdd(D3DKMDT_HVIDPN hVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface, -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPWddm.cpp
r47603 r48070 31 31 #include <VBox/Hardware/VBoxVideoVBE.h> 32 32 33 #include <stdio.h> 34 33 35 DWORD g_VBoxLogUm = 0; 34 36 #ifdef VBOX_WDDM_WIN8 … … 187 189 } 188 190 191 BOOL vboxWddmGhDisplayCheckCompletePeningScreenInfo(PVBOXMP_DEVEXT pDevExt, D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId) 192 { 193 if (!ASMAtomicCmpXchgBool(&pDevExt->aTargets[VidPnTargetId].fStateSyncPening, false, true)) 194 return FALSE; 195 return vboxWddmGhDisplayCheckSetInfoFromSource(pDevExt, &pDevExt->aSources[VidPnTargetId]); 196 } 197 189 198 NTSTATUS vboxWddmGhDisplayPostInfoView(PVBOXMP_DEVEXT pDevExt, const VBOXWDDM_ALLOC_DATA *pAllocData) 190 199 { … … 302 311 } 303 312 304 bool vboxWddmGhDisplayCheckSetInfoFromSource(PVBOXMP_DEVEXT pDevExt, PVBOXWDDM_SOURCE pSource) 305 { 306 // Assert(VBOXVIDEOOFFSET_VOID != pSource->AllocData.Addr.offVram); 307 308 if (pSource->fGhSynced) 309 return false; 313 bool vboxWddmGhDisplaySetInfoFromSourceTarget(PVBOXMP_DEVEXT pDevExt, PVBOXWDDM_SOURCE pSource, PVBOXWDDM_TARGET pTarget) 314 { 315 if (!pTarget->HeightVisible) 316 { 317 vboxWddmGhDisplayHideScreen(pDevExt, pSource->AllocData.SurfDesc.VidPnSourceId); 318 pSource->fGhSynced = 1; 319 return true; 320 } 310 321 311 322 char fGhSynced = 1; … … 346 357 WARN(("vboxWddmGhDisplaySetInfo failed, Status (0x%x)", Status)); 347 358 359 vboxVideoCmSignalEvents(&pDevExt->SeamlessCtxMgr); 360 348 361 return true; 362 } 363 364 bool vboxWddmGhDisplayCheckSetInfoFromSource(PVBOXMP_DEVEXT pDevExt, PVBOXWDDM_SOURCE pSource) 365 { 366 Assert(VBOXVIDEOOFFSET_VOID != pSource->AllocData.Addr.offVram 367 || !pDevExt->aTargets[pSource->AllocData.SurfDesc.VidPnSourceId].HeightVisible); 368 369 if (pSource->fGhSynced) 370 return false; 371 372 PVBOXWDDM_TARGET pTarget = &pDevExt->aTargets[pSource->AllocData.SurfDesc.VidPnSourceId]; 373 if (ASMAtomicUoReadBool(&pTarget->fStateSyncPening)) 374 return false; 375 376 return vboxWddmGhDisplaySetInfoFromSourceTarget(pDevExt, pSource, pTarget); 349 377 } 350 378 … … 467 495 return VBOXWDDM_HGSMICMD_TYPE_CTL; 468 496 return VBOXWDDM_HGSMICMD_TYPE_UNDEFINED; 469 }470 471 static NTSTATUS vboxWddmChildStatusReportPerform(PVBOXMP_DEVEXT pDevExt, PVBOXVDMA_CHILD_STATUS pChildStatus, D3DDDI_VIDEO_PRESENT_TARGET_ID iChild)472 {473 DXGK_CHILD_STATUS DdiChildStatus;474 if (pChildStatus->fFlags & VBOXVDMA_CHILD_STATUS_F_DISCONNECTED)475 {476 /* report disconnected */477 memset(&DdiChildStatus, 0, sizeof (DdiChildStatus));478 DdiChildStatus.Type = StatusConnection;479 if (iChild != D3DDDI_ID_UNINITIALIZED)480 {481 Assert(iChild < UINT32_MAX/2);482 Assert(iChild < (UINT)VBoxCommonFromDeviceExt(pDevExt)->cDisplays);483 DdiChildStatus.ChildUid = iChild;484 }485 else486 {487 Assert(pChildStatus->iChild < UINT32_MAX/2);488 Assert(pChildStatus->iChild < (UINT)VBoxCommonFromDeviceExt(pDevExt)->cDisplays);489 DdiChildStatus.ChildUid = pChildStatus->iChild;490 }491 LOG(("Reporting DISCONNECT to child %d", DdiChildStatus.ChildUid));492 DdiChildStatus.HotPlug.Connected = FALSE;493 NTSTATUS Status = pDevExt->u.primary.DxgkInterface.DxgkCbIndicateChildStatus(pDevExt->u.primary.DxgkInterface.DeviceHandle, &DdiChildStatus);494 if (!NT_SUCCESS(Status))495 {496 WARN(("DxgkCbIndicateChildStatus failed with Status (0x%x)", Status));497 return Status;498 }499 }500 501 if (pChildStatus->fFlags & VBOXVDMA_CHILD_STATUS_F_CONNECTED)502 {503 /* report disconnected */504 memset(&DdiChildStatus, 0, sizeof (DdiChildStatus));505 DdiChildStatus.Type = StatusConnection;506 if (iChild != D3DDDI_ID_UNINITIALIZED)507 {508 Assert(iChild < UINT32_MAX/2);509 Assert(iChild < (UINT)VBoxCommonFromDeviceExt(pDevExt)->cDisplays);510 DdiChildStatus.ChildUid = iChild;511 }512 else513 {514 Assert(pChildStatus->iChild < UINT32_MAX/2);515 Assert(pChildStatus->iChild < (UINT)VBoxCommonFromDeviceExt(pDevExt)->cDisplays);516 DdiChildStatus.ChildUid = pChildStatus->iChild;517 }518 LOG(("Reporting CONNECT to child %d", DdiChildStatus.ChildUid));519 DdiChildStatus.HotPlug.Connected = TRUE;520 NTSTATUS Status = pDevExt->u.primary.DxgkInterface.DxgkCbIndicateChildStatus(pDevExt->u.primary.DxgkInterface.DeviceHandle, &DdiChildStatus);521 if (!NT_SUCCESS(Status))522 {523 WARN(("DxgkCbIndicateChildStatus failed with Status (0x%x)", Status));524 return Status;525 }526 }527 528 if (pChildStatus->fFlags & VBOXVDMA_CHILD_STATUS_F_ROTATED)529 {530 /* report disconnected */531 memset(&DdiChildStatus, 0, sizeof (DdiChildStatus));532 DdiChildStatus.Type = StatusRotation;533 if (iChild != D3DDDI_ID_UNINITIALIZED)534 {535 Assert(iChild < UINT32_MAX/2);536 Assert(iChild < (UINT)VBoxCommonFromDeviceExt(pDevExt)->cDisplays);537 DdiChildStatus.ChildUid = iChild;538 }539 else540 {541 Assert(pChildStatus->iChild < UINT32_MAX/2);542 Assert(pChildStatus->iChild < (UINT)VBoxCommonFromDeviceExt(pDevExt)->cDisplays);543 DdiChildStatus.ChildUid = pChildStatus->iChild;544 }545 LOG(("Reporting ROTATED to child %d", DdiChildStatus.ChildUid));546 DdiChildStatus.Rotation.Angle = pChildStatus->u8RotationAngle;547 NTSTATUS Status = pDevExt->u.primary.DxgkInterface.DxgkCbIndicateChildStatus(pDevExt->u.primary.DxgkInterface.DeviceHandle, &DdiChildStatus);548 if (!NT_SUCCESS(Status))549 {550 WARN(("DxgkCbIndicateChildStatus failed with Status (0x%x)", Status));551 return Status;552 }553 }554 555 return STATUS_SUCCESS;556 }557 558 static NTSTATUS vboxWddmChildStatusDoReportReconnected(PVBOXMP_DEVEXT pDevExt, VBOXVDMACMD_CHILD_STATUS_IRQ *pBody)559 {560 NTSTATUS Status = STATUS_SUCCESS;561 562 for (UINT i = 0; i < pBody->cInfos; ++i)563 {564 PVBOXVDMA_CHILD_STATUS pInfo = &pBody->aInfos[i];565 if (pBody->fFlags & VBOXVDMACMD_CHILD_STATUS_IRQ_F_APPLY_TO_ALL)566 {567 for (D3DDDI_VIDEO_PRESENT_TARGET_ID iChild = 0; iChild < (UINT)VBoxCommonFromDeviceExt(pDevExt)->cDisplays; ++iChild)568 {569 Status = vboxWddmChildStatusReportPerform(pDevExt, pInfo, iChild);570 if (!NT_SUCCESS(Status))571 {572 WARN(("vboxWddmChildStatusReportPerform failed with Status (0x%x)", Status));573 break;574 }575 }576 }577 else578 {579 Status = vboxWddmChildStatusReportPerform(pDevExt, pInfo, D3DDDI_ID_UNINITIALIZED);580 if (!NT_SUCCESS(Status))581 {582 WARN(("vboxWddmChildStatusReportPerform failed with Status (0x%x)", Status));583 break;584 }585 }586 }587 588 return Status;589 }590 591 typedef struct VBOXWDDMCHILDSTATUSCB592 {593 PVBOXVDMACBUF_DR pDr;594 PKEVENT pEvent;595 } VBOXWDDMCHILDSTATUSCB, *PVBOXWDDMCHILDSTATUSCB;596 597 static DECLCALLBACK(VOID) vboxWddmChildStatusReportCompletion(PVBOXMP_DEVEXT pDevExt, PVBOXVDMADDI_CMD pCmd, PVOID pvContext)598 {599 /* we should be called from our DPC routine */600 Assert(KeGetCurrentIrql() == DISPATCH_LEVEL);601 602 PVBOXWDDMCHILDSTATUSCB pCtx = (PVBOXWDDMCHILDSTATUSCB)pvContext;603 PVBOXVDMACBUF_DR pDr = pCtx->pDr;604 PVBOXVDMACMD pHdr = VBOXVDMACBUF_DR_TAIL(pDr, VBOXVDMACMD);605 VBOXVDMACMD_CHILD_STATUS_IRQ *pBody = VBOXVDMACMD_BODY(pHdr, VBOXVDMACMD_CHILD_STATUS_IRQ);606 607 vboxWddmChildStatusDoReportReconnected(pDevExt, pBody);608 609 vboxVdmaCBufDrFree(&pDevExt->u.primary.Vdma, pDr);610 611 if (pCtx->pEvent)612 {613 KeSetEvent(pCtx->pEvent, 0, FALSE);614 }615 }616 617 static NTSTATUS vboxWddmChildStatusReportReconnected(PVBOXMP_DEVEXT pDevExt, D3DDDI_VIDEO_PRESENT_TARGET_ID idTarget)618 {619 #ifdef VBOX_WDDM_MONITOR_REPLUG_IRQ620 NTSTATUS Status = STATUS_UNSUCCESSFUL;621 UINT cbCmd = VBOXVDMACMD_SIZE_FROMBODYSIZE(sizeof (VBOXVDMACMD_CHILD_STATUS_IRQ));622 623 PVBOXVDMACBUF_DR pDr = vboxVdmaCBufDrCreate(&pDevExt->u.primary.Vdma, cbCmd);624 if (pDr)625 {626 // vboxVdmaCBufDrCreate zero initializes the pDr627 /* the command data follows the descriptor */628 pDr->fFlags = VBOXVDMACBUF_FLAG_BUF_FOLLOWS_DR;629 pDr->cbBuf = cbCmd;630 pDr->rc = VERR_NOT_IMPLEMENTED;631 632 PVBOXVDMACMD pHdr = VBOXVDMACBUF_DR_TAIL(pDr, VBOXVDMACMD);633 pHdr->enmType = VBOXVDMACMD_TYPE_CHILD_STATUS_IRQ;634 pHdr->u32CmdSpecific = 0;635 PVBOXVDMACMD_CHILD_STATUS_IRQ pBody = VBOXVDMACMD_BODY(pHdr, VBOXVDMACMD_CHILD_STATUS_IRQ);636 pBody->cInfos = 1;637 if (idTarget == D3DDDI_ID_ALL)638 {639 pBody->fFlags |= VBOXVDMACMD_CHILD_STATUS_IRQ_F_APPLY_TO_ALL;640 }641 pBody->aInfos[0].iChild = idTarget;642 pBody->aInfos[0].fFlags = VBOXVDMA_CHILD_STATUS_F_DISCONNECTED | VBOXVDMA_CHILD_STATUS_F_CONNECTED;643 /* we're going to KeWaitForSingleObject */644 Assert(KeGetCurrentIrql() < DISPATCH_LEVEL);645 646 PVBOXVDMADDI_CMD pDdiCmd = VBOXVDMADDI_CMD_FROM_BUF_DR(pDr);647 VBOXWDDMCHILDSTATUSCB Ctx;648 KEVENT Event;649 KeInitializeEvent(&Event, NotificationEvent, FALSE);650 Ctx.pDr = pDr;651 Ctx.pEvent = &Event;652 vboxVdmaDdiCmdInit(pDdiCmd, 0, 0, vboxWddmChildStatusReportCompletion, &Ctx);653 /* mark command as submitted & invisible for the dx runtime since dx did not originate it */654 vboxVdmaDdiCmdSubmittedNotDx(pDdiCmd);655 int rc = vboxVdmaCBufDrSubmit(pDevExt, &pDevExt->u.primary.Vdma, pDr);656 Assert(rc == VINF_SUCCESS);657 if (RT_SUCCESS(rc))658 {659 Status = KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);660 Assert(Status == STATUS_SUCCESS);661 return STATUS_SUCCESS;662 }663 664 Status = STATUS_UNSUCCESSFUL;665 666 vboxVdmaCBufDrFree(&pDevExt->u.primary.Vdma, pDr);667 }668 else669 {670 Assert(0);671 /* @todo: try flushing.. */672 LOGREL(("vboxVdmaCBufDrCreate returned NULL"));673 Status = STATUS_INSUFFICIENT_RESOURCES;674 }675 676 return Status;677 #else678 VBOXVDMACMD_CHILD_STATUS_IRQ Body = {0};679 Body.cInfos = 1;680 if (idTarget == D3DDDI_ID_ALL)681 {682 Body.fFlags |= VBOXVDMACMD_CHILD_STATUS_IRQ_F_APPLY_TO_ALL;683 }684 Body.aInfos[0].iChild = idTarget;685 Body.aInfos[0].fFlags = VBOXVDMA_CHILD_STATUS_F_DISCONNECTED | VBOXVDMA_CHILD_STATUS_F_CONNECTED;686 Assert(KeGetCurrentIrql() <= DISPATCH_LEVEL);687 return vboxWddmChildStatusDoReportReconnected(pDevExt, &Body);688 #endif689 }690 691 static NTSTATUS vboxWddmChildStatusCheckByMask(PVBOXMP_DEVEXT pDevExt, PVBOXWDDM_VIDEOMODES_INFO paInfos, uint8_t *pMask)692 {693 NTSTATUS Status = STATUS_SUCCESS;694 bool bChanged[VBOX_VIDEO_MAX_SCREENS] = {0};695 int i;696 697 LOG(("checking child status.."));698 699 for (i = 0; i < VBoxCommonFromDeviceExt(pDevExt)->cDisplays; ++i)700 {701 if (pMask && !ASMBitTest(pMask, i))702 continue;703 704 LOG(("requested to change child status for display %d", i));705 706 /* @todo: check that we actually need the current source->target */707 PVBOXWDDM_VIDEOMODES_INFO pInfo = &paInfos[i];708 VIDEO_MODE_INFORMATION *pModeInfo = &pInfo->aModes[pInfo->iPreferredMode];709 BOOLEAN fMatch = FALSE;710 Status = vboxVidPnMatchMonitorModes(pDevExt, i, pInfo->aResolutions, pInfo->cResolutions, &fMatch);711 if (!NT_SUCCESS(Status))712 {713 WARN(("vboxVidPnMatchMonitorModes failed Status(0x%x)", Status));714 /* ignore the failures here, although we probably should not?? */715 break;716 }717 718 bChanged[i] = !fMatch;719 }720 721 if (!NT_SUCCESS(Status))722 {723 WARN(("updating monitor modes failed, Status(0x%x)", Status));724 return Status;725 }726 727 for (i = 0; i < VBoxCommonFromDeviceExt(pDevExt)->cDisplays; ++i)728 {729 if (bChanged[i])730 {731 LOG(("modes changed for display %d", i));732 733 NTSTATUS tmpStatus = vboxWddmChildStatusReportReconnected(pDevExt, i);734 if (!NT_SUCCESS(tmpStatus))735 {736 WARN(("vboxWddmChildStatusReportReconnected failed Status(0x%x)", Status));737 /* ignore the failures here, although we probably should not?? */738 break;739 }740 }741 }742 743 /* wait for the reconnected monitor data to be picked up */744 CONST DXGK_MONITOR_INTERFACE *pMonitorInterface;745 Status = pDevExt->u.primary.DxgkInterface.DxgkCbQueryMonitorInterface(pDevExt->u.primary.DxgkInterface.DeviceHandle, DXGK_MONITOR_INTERFACE_VERSION_V1, &pMonitorInterface);746 if (!NT_SUCCESS(Status))747 {748 WARN(("DxgkCbQueryMonitorInterface failed, Status()0x%x", Status));749 return Status;750 }751 752 for (i = 0; i < VBoxCommonFromDeviceExt(pDevExt)->cDisplays; ++i)753 {754 D3DKMDT_HMONITORSOURCEMODESET hMonitorSMS;755 CONST DXGK_MONITORSOURCEMODESET_INTERFACE *pMonitorSMSIf;756 if (!bChanged[i])757 continue;758 759 while (1)760 {761 Status = pMonitorInterface->pfnAcquireMonitorSourceModeSet(pDevExt->u.primary.DxgkInterface.DeviceHandle,762 i,763 &hMonitorSMS,764 &pMonitorSMSIf);765 if (NT_SUCCESS(Status))766 {767 NTSTATUS tmpStatus = pMonitorInterface->pfnReleaseMonitorSourceModeSet(pDevExt->u.primary.DxgkInterface.DeviceHandle, hMonitorSMS);768 if (!NT_SUCCESS(tmpStatus))769 {770 WARN(("pfnReleaseMonitorSourceModeSet failed tmpStatus(0x%x)", tmpStatus));771 }772 break;773 }774 775 if (Status != STATUS_GRAPHICS_MONITOR_NOT_CONNECTED)776 {777 WARN(("DxgkCbQueryMonitorInterface failed, Status()0x%x", Status));778 break;779 }780 781 Assert(KeGetCurrentIrql() < DISPATCH_LEVEL);782 783 LARGE_INTEGER Interval;784 Interval.QuadPart = -(int64_t) 2 /* ms */ * 10000;785 NTSTATUS tmpStatus = KeDelayExecutionThread(KernelMode, FALSE, &Interval);786 if (!NT_SUCCESS(tmpStatus))787 {788 WARN(("KeDelayExecutionThread failed tmpStatus(0x%x)", tmpStatus));789 }790 }791 }792 793 return STATUS_SUCCESS;794 497 } 795 498 … … 1154 857 vboxVdmaDdiNodesInit(pDevExt); 1155 858 vboxVideoCmInit(&pDevExt->CmMgr); 859 vboxVideoCmInit(&pDevExt->SeamlessCtxMgr); 1156 860 InitializeListHead(&pDevExt->SwapchainList3D); 1157 861 pDevExt->cContexts3D = 0; 1158 862 pDevExt->cContexts2D = 0; 863 pDevExt->cContextsDispIfResize = 0; 1159 864 pDevExt->cUnlockedVBVADisabled = 0; 1160 865 VBOXWDDM_CTXLOCK_INIT(pDevExt); … … 1162 867 1163 868 VBoxMPCmnInitCustomVideoModes(pDevExt); 1164 VBoxWddmInvalidateAllVideoModesInfos(pDevExt);1165 869 1166 870 VBoxCommonFromDeviceExt(pDevExt)->fAnyX = VBoxVideoAnyWidthAllowed(); … … 1192 896 } 1193 897 898 DWORD dwVal = VBOXWDDM_CFG_DRV_DEFAULT; 899 HANDLE hKey = NULL; 900 WCHAR aNameBuf[100]; 901 902 Status = IoOpenDeviceRegistryKey(pDevExt->pPDO, PLUGPLAY_REGKEY_DRIVER, GENERIC_READ, &hKey); 903 if (!NT_SUCCESS(Status)) 904 { 905 WARN(("IoOpenDeviceRegistryKey failed, Status = 0x%x", Status)); 906 hKey = NULL; 907 } 908 909 910 if (hKey) 911 { 912 Status = vboxWddmRegQueryValueDword(hKey, VBOXWDDM_REG_DRV_FLAGS_NAME, &dwVal); 913 if (!NT_SUCCESS(Status)) 914 { 915 LOG(("vboxWddmRegQueryValueDword failed, Status = 0x%x", Status)); 916 dwVal = VBOXWDDM_CFG_DRV_DEFAULT; 917 } 918 } 919 920 pDevExt->dwDrvCfgFlags = dwVal; 921 922 for (UINT i = 0; i < (UINT)VBoxCommonFromDeviceExt(pDevExt)->cDisplays; ++i) 923 { 924 PVBOXWDDM_TARGET pTarget = &pDevExt->aTargets[i]; 925 if (i == 0 || (pDevExt->dwDrvCfgFlags & VBOXWDDM_CFG_DRV_SECONDARY_TARGETS_CONNECTED) || !hKey) 926 { 927 pTarget->fConnected = true; 928 pTarget->fConfigured = true; 929 } 930 else if (hKey) 931 { 932 swprintf(aNameBuf, L"%s%d", VBOXWDDM_REG_DRV_DISPFLAGS_PREFIX, i); 933 Status = vboxWddmRegQueryValueDword(hKey, aNameBuf, &dwVal); 934 if (NT_SUCCESS(Status)) 935 { 936 pTarget->fConnected = !!(dwVal & VBOXWDDM_CFG_DRVTARGET_CONNECTED); 937 pTarget->fConfigured = true; 938 } 939 else 940 { 941 WARN(("vboxWddmRegQueryValueDword failed, Status = 0x%x", Status)); 942 pTarget->fConnected = false; 943 pTarget->fConfigured = false; 944 } 945 } 946 } 947 948 if (hKey) 949 { 950 NTSTATUS tmpStatus = ZwClose(hKey); 951 Assert(tmpStatus == STATUS_SUCCESS); 952 } 953 954 Status = STATUS_SUCCESS; 1194 955 #ifdef VBOX_WDDM_WIN8 1195 956 DXGK_DISPLAY_INFORMATION DisplayInfo; … … 1230 991 } 1231 992 #endif 993 994 VBoxWddmInitVideoModes(pDevExt); 1232 995 } 1233 996 else … … 1280 1043 1281 1044 vboxVideoCmTerm(&pDevExt->CmMgr); 1045 1046 vboxVideoCmTerm(&pDevExt->SeamlessCtxMgr); 1282 1047 1283 1048 /* do everything we did on DxgkDdiStartDevice in the reverse order */ … … 1691 1456 ChildRelations[i].ChildDeviceType = TypeVideoOutput; 1692 1457 ChildRelations[i].ChildCapabilities.Type.VideoOutput.InterfaceTechnology = D3DKMDT_VOT_HD15; /* VGA */ 1693 ChildRelations[i].ChildCapabilities.Type.VideoOutput.MonitorOrientationAwareness = D3DKMDT_MOA_ INTERRUPTIBLE; /* ?? D3DKMDT_MOA_NONE*/1458 ChildRelations[i].ChildCapabilities.Type.VideoOutput.MonitorOrientationAwareness = D3DKMDT_MOA_NONE; //D3DKMDT_MOA_INTERRUPTIBLE; /* ?? D3DKMDT_MOA_NONE*/ 1694 1459 ChildRelations[i].ChildCapabilities.Type.VideoOutput.SupportsSdtvModes = FALSE; 1695 1460 ChildRelations[i].ChildCapabilities.HpdAwareness = HpdAwarenessInterruptible; /* ?? HpdAwarenessAlwaysConnected; */ … … 1714 1479 LOGF(("ENTER, context(0x%x)", MiniportDeviceContext)); 1715 1480 1481 PVBOXMP_DEVEXT pDevExt = (PVBOXMP_DEVEXT)MiniportDeviceContext; 1482 1716 1483 NTSTATUS Status = STATUS_SUCCESS; 1717 1484 switch (ChildStatus->Type) 1718 1485 { 1719 1486 case StatusConnection: 1720 ChildStatus->HotPlug.Connected = TRUE;1487 { 1721 1488 LOGF(("StatusConnection")); 1489 VBOXWDDM_TARGET *pTarget = &pDevExt->aTargets[ChildStatus->ChildUid]; 1490 ChildStatus->HotPlug.Connected = !!pTarget->fConnected; 1722 1491 break; 1492 } 1723 1493 case StatusRotation: 1494 LOGF(("StatusRotation")); 1724 1495 ChildStatus->Rotation.Angle = 0; 1725 LOGF(("StatusRotation"));1726 1496 break; 1727 1497 default: 1728 LOGREL(("ERROR: status type: %d", ChildStatus->Type)); 1729 AssertBreakpoint(); 1498 WARN(("ERROR: status type: %d", ChildStatus->Type)); 1730 1499 Status = STATUS_INVALID_PARAMETER; 1731 1500 break; … … 2993 2762 VBOXWDDM_SOURCE *pSource = &pDevExt->aSources[pS2P->Shadow2Primary.VidPnSourceId]; 2994 2763 PVBOXWDDM_ALLOCATION pSrcAlloc = pS2P->Shadow2Primary.ShadowAlloc.pAlloc; 2995 vboxWddmAddrSetVram(&pSrcAlloc->AllocData.Addr, pS2P->Shadow2Primary.ShadowAlloc.segmentIdAlloc, pS2P->Shadow2Primary.ShadowAlloc.offAlloc); 2764 BOOLEAN fShadowChanged = vboxWddmAddrSetVram(&pSrcAlloc->AllocData.Addr, pS2P->Shadow2Primary.ShadowAlloc.segmentIdAlloc, pS2P->Shadow2Primary.ShadowAlloc.offAlloc); 2765 if (fShadowChanged) 2766 pSource->fGhSynced = 0; 2996 2767 vboxWddmAssignShadow(pDevExt, pSource, pSrcAlloc, pS2P->Shadow2Primary.VidPnSourceId); 2997 2768 vboxWddmModeRenderFromShadowCheckOnSubmitCommand(pDevExt, NULL); … … 3019 2790 PVBOXWDDM_ALLOCATION pDstAlloc = pBlt->Blt.DstAlloc.pAlloc; 3020 2791 PVBOXWDDM_ALLOCATION pSrcAlloc = pBlt->Blt.SrcAlloc.pAlloc; 2792 BOOLEAN fSrcChanged; 3021 2793 3022 2794 vboxWddmAddrSetVram(&pDstAlloc->AllocData.Addr, pBlt->Blt.DstAlloc.segmentIdAlloc, pBlt->Blt.DstAlloc.offAlloc); 3023 vboxWddmAddrSetVram(&pSrcAlloc->AllocData.Addr, pBlt->Blt.SrcAlloc.segmentIdAlloc, pBlt->Blt.SrcAlloc.offAlloc);2795 fSrcChanged = vboxWddmAddrSetVram(&pSrcAlloc->AllocData.Addr, pBlt->Blt.SrcAlloc.segmentIdAlloc, pBlt->Blt.SrcAlloc.offAlloc); 3024 2796 3025 2797 if (VBOXWDDM_IS_REAL_FB_ALLOCATION(pDevExt, pDstAlloc)) … … 3029 2801 3030 2802 if (pSrcAlloc->enmType == VBOXWDDM_ALLOC_TYPE_STD_SHADOWSURFACE) 2803 { 2804 if (fSrcChanged) 2805 pSource->fGhSynced = 0; 2806 3031 2807 vboxWddmAssignShadow(pDevExt, pSource, pSrcAlloc, pDstAlloc->AllocData.SurfDesc.VidPnSourceId); 2808 } 3032 2809 vboxWddmModeRenderFromShadowCheckOnSubmitCommand(pDevExt, NULL); 3033 2810 if(pContext->enmType != VBOXWDDM_CONTEXT_TYPE_CUSTOM_3D … … 3910 3687 case VBOXESC_SETVISIBLEREGION: 3911 3688 { 3689 PVBOXWDDM_CONTEXT pContext = (PVBOXWDDM_CONTEXT)pEscape->hContext; 3690 if (!pContext) 3691 { 3692 WARN(("VBOXESC_SETVISIBLEREGION no context supplied!")); 3693 Status = STATUS_INVALID_PARAMETER; 3694 break; 3695 } 3696 3697 if (pContext->enmType != VBOXWDDM_CONTEXT_TYPE_CUSTOM_DISPIF_SEAMLESS) 3698 { 3699 WARN(("VBOXESC_SETVISIBLEREGION invalid context supplied %d!", pContext->enmType)); 3700 Status = STATUS_INVALID_PARAMETER; 3701 break; 3702 } 3703 3912 3704 /* visible regions for seamless */ 3913 3705 LPRGNDATA lpRgnData = VBOXDISPIFESCAPE_DATA(pEscapeHdr, RGNDATA); … … 3948 3740 rc = VbglGRPerform (&req->header); 3949 3741 AssertRC(rc); 3950 if (!RT_SUCCESS(rc)) 3742 if (RT_SUCCESS(rc)) 3743 Status = STATUS_SUCCESS; 3744 else 3951 3745 { 3952 LOGREL(("VbglGRPerform failed rc (%d)", rc));3746 WARN(("VbglGRPerform failed rc (%d)", rc)); 3953 3747 Status = STATUS_UNSUCCESSFUL; 3954 3748 } … … 3956 3750 else 3957 3751 { 3958 LOGREL(("VbglGRAlloc failed rc (%d)", rc));3752 WARN(("VbglGRAlloc failed rc (%d)", rc)); 3959 3753 Status = STATUS_UNSUCCESSFUL; 3960 3754 } … … 3962 3756 else 3963 3757 { 3964 LOGREL(("VBOXESC_SETVISIBLEREGION: incorrect buffer size (%d), reported count (%d)", cbRects, lpRgnData->rdh.nCount)); 3965 AssertBreakpoint(); 3758 WARN(("VBOXESC_SETVISIBLEREGION: incorrect buffer size (%d), reported count (%d)", cbRects, lpRgnData->rdh.nCount)); 3966 3759 Status = STATUS_INVALID_PARAMETER; 3967 3760 } … … 4054 3847 case VBOXESC_REINITVIDEOMODES: 4055 3848 { 4056 if ( pEscape->Flags.HardwareAccess)4057 { 4058 WARN(("VBOXESC_REINITVIDEOMODES called withHardwareAccess flag set, failing"));3849 if (!pEscape->Flags.HardwareAccess) 3850 { 3851 WARN(("VBOXESC_REINITVIDEOMODESBYMASK called without HardwareAccess flag set, failing")); 4059 3852 Status = STATUS_INVALID_PARAMETER; 4060 3853 break; 4061 3854 } 4062 WARN(("VBOXESC_REINITVIDEOMODESBYMASK should be called instead")); 4063 PVBOXWDDM_VIDEOMODES_INFO pInfos = VBoxWddmUpdateAllVideoModesInfos(pDevExt); 4064 Status = vboxWddmChildStatusCheckByMask(pDevExt, pInfos, NULL); 4065 if (!NT_SUCCESS(Status)) 4066 { 4067 WARN(("vboxWddmChildStatusCheckByMask failed, Status 0x%x", Status)); 4068 } 4069 break; 4070 } 4071 case VBOXESC_REINITVIDEOMODESBYMASK: 4072 { 4073 BOOLEAN fCheckDisplayRecconect = (pEscapeHdr->u32CmdSpecific & VBOXWDDM_REINITVIDEOMODESBYMASK_F_RECONNECT_DISPLAYS_ON_CHANGE); 4074 if (fCheckDisplayRecconect && pEscape->Flags.HardwareAccess) 4075 { 4076 WARN(("VBOXESC_REINITVIDEOMODESBYMASK called with HardwareAccess flag set, failing")); 3855 3856 PVBOXWDDM_CONTEXT pContext = (PVBOXWDDM_CONTEXT)pEscape->hContext; 3857 if (!pContext) 3858 { 3859 WARN(("VBOXESC_REINITVIDEOMODES no context supplied!")); 4077 3860 Status = STATUS_INVALID_PARAMETER; 4078 3861 break; 4079 3862 } 3863 3864 if (pContext->enmType != VBOXWDDM_CONTEXT_TYPE_CUSTOM_DISPIF_RESIZE) 3865 { 3866 WARN(("VBOXESC_REINITVIDEOMODES invalid context supplied %d!", pContext->enmType)); 3867 Status = STATUS_INVALID_PARAMETER; 3868 break; 3869 } 3870 3871 WARN(("VBOXESC_REINITVIDEOMODESBYMASK should be called instead")); 3872 VBoxWddmUpdateVideoModesInfoByMask(pDevExt, NULL); 3873 Status = STATUS_SUCCESS; 3874 break; 3875 } 3876 case VBOXESC_REINITVIDEOMODESBYMASK: 3877 { 3878 if (!pEscape->Flags.HardwareAccess) 3879 { 3880 WARN(("VBOXESC_REINITVIDEOMODESBYMASK called without HardwareAccess flag set, failing")); 3881 Status = STATUS_INVALID_PARAMETER; 3882 break; 3883 } 3884 3885 PVBOXWDDM_CONTEXT pContext = (PVBOXWDDM_CONTEXT)pEscape->hContext; 3886 if (!pContext) 3887 { 3888 WARN(("VBOXESC_REINITVIDEOMODESBYMASK no context supplied!")); 3889 Status = STATUS_INVALID_PARAMETER; 3890 break; 3891 } 3892 3893 if (pContext->enmType != VBOXWDDM_CONTEXT_TYPE_CUSTOM_DISPIF_RESIZE) 3894 { 3895 WARN(("VBOXESC_REINITVIDEOMODESBYMASK invalid context supplied %d!", pContext->enmType)); 3896 Status = STATUS_INVALID_PARAMETER; 3897 break; 3898 } 3899 4080 3900 if (pEscape->PrivateDriverDataSize != sizeof (VBOXDISPIFESCAPE_REINITVIDEOMODESBYMASK)) 4081 3901 { … … 4086 3906 LOG(("=> VBOXESC_REINITVIDEOMODESBYMASK")); 4087 3907 PVBOXDISPIFESCAPE_REINITVIDEOMODESBYMASK pData = (PVBOXDISPIFESCAPE_REINITVIDEOMODESBYMASK)pEscapeHdr; 4088 PVBOXWDDM_VIDEOMODES_INFO pInfos = VBoxWddmUpdateVideoModesInfoByMask(pDevExt, pData->ScreenMask); 4089 if (fCheckDisplayRecconect) 4090 { 4091 Status = vboxWddmChildStatusCheckByMask(pDevExt, pInfos, pData->ScreenMask); 3908 VBoxWddmUpdateVideoModesInfoByMask(pDevExt, pData->ScreenMask); 3909 Status = STATUS_SUCCESS; 3910 LOG(("<= VBOXESC_REINITVIDEOMODESBYMASK")); 3911 break; 3912 } 3913 case VBOXESC_CONFIGURETARGETS: 3914 { 3915 LOG(("=> VBOXESC_CONFIGURETARGETS")); 3916 3917 if (!pEscape->Flags.HardwareAccess) 3918 { 3919 WARN(("VBOXESC_CONFIGURETARGETS called without HardwareAccess flag set, failing")); 3920 Status = STATUS_INVALID_PARAMETER; 3921 break; 3922 } 3923 3924 PVBOXWDDM_CONTEXT pContext = (PVBOXWDDM_CONTEXT)pEscape->hContext; 3925 if (!pContext) 3926 { 3927 WARN(("VBOXESC_CONFIGURETARGETS no context supplied!")); 3928 Status = STATUS_INVALID_PARAMETER; 3929 break; 3930 } 3931 3932 if (pContext->enmType != VBOXWDDM_CONTEXT_TYPE_CUSTOM_DISPIF_RESIZE) 3933 { 3934 WARN(("VBOXESC_CONFIGURETARGETS invalid context supplied %d!", pContext->enmType)); 3935 Status = STATUS_INVALID_PARAMETER; 3936 break; 3937 } 3938 3939 if (pEscape->PrivateDriverDataSize != sizeof (*pEscapeHdr)) 3940 { 3941 WARN(("VBOXESC_CONFIGURETARGETS invalid private driver size %d", pEscape->PrivateDriverDataSize)); 3942 Status = STATUS_INVALID_PARAMETER; 3943 break; 3944 } 3945 3946 if (pEscapeHdr->u32CmdSpecific) 3947 { 3948 WARN(("VBOXESC_CONFIGURETARGETS invalid command %d", pEscapeHdr->u32CmdSpecific)); 3949 Status = STATUS_INVALID_PARAMETER; 3950 break; 3951 } 3952 3953 HANDLE hKey = NULL; 3954 WCHAR aNameBuf[100]; 3955 uint32_t cAdjusted = 0; 3956 3957 for (int i = 0; i < VBoxCommonFromDeviceExt(pDevExt)->cDisplays; ++i) 3958 { 3959 VBOXWDDM_TARGET *pTarget = &pDevExt->aTargets[i]; 3960 if (pTarget->fConfigured) 3961 continue; 3962 3963 pTarget->fConfigured = true; 3964 3965 if (!pTarget->fConnected) 3966 { 3967 Status = vboxWddmChildStatusConnect(pDevExt, (uint32_t)i, TRUE); 3968 if (NT_SUCCESS(Status)) 3969 ++cAdjusted; 3970 else 3971 WARN(("VBOXESC_CONFIGURETARGETS vboxWddmChildStatusConnectSecondaries failed Status 0x%x\n", Status)); 3972 } 3973 3974 if (!hKey) 3975 { 3976 Status = IoOpenDeviceRegistryKey(pDevExt->pPDO, PLUGPLAY_REGKEY_DRIVER, GENERIC_WRITE, &hKey); 3977 if (!NT_SUCCESS(Status)) 3978 { 3979 WARN(("VBOXESC_CONFIGURETARGETS IoOpenDeviceRegistryKey failed, Status = 0x%x", Status)); 3980 hKey = NULL; 3981 continue; 3982 } 3983 } 3984 3985 Assert(hKey); 3986 3987 swprintf(aNameBuf, L"%s%d", VBOXWDDM_REG_DRV_DISPFLAGS_PREFIX, i); 3988 Status = vboxWddmRegSetValueDword(hKey, aNameBuf, VBOXWDDM_CFG_DRVTARGET_CONNECTED); 4092 3989 if (!NT_SUCCESS(Status)) 4093 { 4094 WARN(("vboxWddmChildStatusCheckByMask failed, Status 0x%x", Status)); 4095 } 4096 } 4097 LOG(("<= VBOXESC_REINITVIDEOMODESBYMASK")); 3990 WARN(("VBOXESC_CONFIGURETARGETS vboxWddmRegSetValueDword (%d) failed Status 0x%x\n", aNameBuf, Status)); 3991 3992 } 3993 3994 if (hKey) 3995 { 3996 NTSTATUS tmpStatus = ZwClose(hKey); 3997 Assert(tmpStatus == STATUS_SUCCESS); 3998 } 3999 4000 pEscapeHdr->u32CmdSpecific = cAdjusted; 4001 4002 Status = STATUS_SUCCESS; 4003 4004 LOG(("<= VBOXESC_CONFIGURETARGETS")); 4098 4005 break; 4099 4006 } … … 4221 4128 } 4222 4129 default: 4223 Assert(0); 4224 LOGREL(("unsupported escape code (0x%x)", pEscapeHdr->escapeCode)); 4130 WARN(("unsupported escape code (0x%x)", pEscapeHdr->escapeCode)); 4225 4131 break; 4226 4132 } … … 4228 4134 else 4229 4135 { 4230 LOGREL(("pEscape->PrivateDriverDataSize(%d) < (%d)", pEscape->PrivateDriverDataSize, sizeof (VBOXDISPIFESCAPE))); 4231 AssertBreakpoint(); 4136 WARN(("pEscape->PrivateDriverDataSize(%d) < (%d)", pEscape->PrivateDriverDataSize, sizeof (VBOXDISPIFESCAPE))); 4232 4137 Status = STATUS_BUFFER_TOO_SMALL; 4233 4138 } … … 4315 4220 4316 4221 NTSTATUS Status = STATUS_SUCCESS; 4317 BOOLEAN bSupported = TRUE;4318 4222 4319 4223 PVBOXMP_DEVEXT pContext = (PVBOXMP_DEVEXT)hAdapter; … … 4339 4243 } 4340 4244 4341 VBOXVIDPNPATHITEM aItems[VBOX_VIDEO_MAX_SCREENS]; 4342 BOOLEAN fDisabledFound = FALSE; 4343 Status = vboxVidPnCheckTopology(hVidPnTopology, pVidPnTopologyInterface, TRUE /* fBreakOnDisabled */, RT_ELEMENTS(aItems), aItems, &fDisabledFound); 4344 Assert(Status == STATUS_SUCCESS); 4245 BOOLEAN fSupported = FALSE; 4246 Status = vboxVidPnCheckTopology(hVidPnTopology, pVidPnTopologyInterface, &fSupported); 4345 4247 if (!NT_SUCCESS(Status)) 4346 4248 { … … 4349 4251 } 4350 4252 4351 if (fDisabledFound) 4352 { 4253 if (!fSupported) 4353 4254 LOG(("found unsupported path")); 4354 bSupported = FALSE; 4355 } 4356 4357 pIsSupportedVidPnArg->IsVidPnSupported = bSupported; 4255 4256 pIsSupportedVidPnArg->IsVidPnSupported = fSupported; 4358 4257 4359 4258 #ifdef VBOXWDDM_DEBUG_VIDPN … … 4380 4279 vboxVDbgBreakFv(); 4381 4280 4281 #ifdef DEBUG_misha 4282 Assert(0); 4283 #endif 4284 4382 4285 PVBOXMP_DEVEXT pDevExt = (PVBOXMP_DEVEXT)hAdapter; 4383 4286 NTSTATUS Status; 4384 4287 PVBOXWDDM_RECOMMENDVIDPN pVidPnInfo = pRecommendFunctionalVidPnArg->PrivateDriverDataSize >= sizeof (VBOXWDDM_RECOMMENDVIDPN) ? 4385 4288 (PVBOXWDDM_RECOMMENDVIDPN)pRecommendFunctionalVidPnArg->pPrivateDriverData : NULL; 4386 PVBOXWDDM_VIDEOMODES_INFO pInfos = VBoxWddm UpdateAllVideoModesInfos(pDevExt);4289 PVBOXWDDM_VIDEOMODES_INFO pInfos = VBoxWddmGetAllVideoModesInfos(pDevExt); 4387 4290 int i; 4388 4291 … … 4529 4432 } 4530 4433 4531 VBOXVIDPNPATHITEM aItems[VBOX_VIDEO_MAX_SCREENS]; 4532 Status = vboxVidPnCheckTopology(hVidPnTopology, pVidPnTopologyInterface, FALSE /* fBreakOnDisabled */, RT_ELEMENTS(aItems), aItems, NULL /* *pfDisabledFound */);4533 Assert(Status == STATUS_SUCCESS);4434 #ifdef DEBUG_misha 4435 BOOLEAN fSupported = FALSE; 4436 Status = vboxVidPnCheckTopology(hVidPnTopology, pVidPnTopologyInterface, &fSupported); 4534 4437 if (!NT_SUCCESS(Status)) 4535 4438 { … … 4538 4441 } 4539 4442 4443 Assert(fSupported); 4444 #endif 4540 4445 VBOXVIDPNCOFUNCMODALITY CbContext = {0}; 4541 4446 CbContext.pDevExt = pDevExt; … … 4543 4448 CbContext.pEnumCofuncModalityArg = pEnumCofuncModalityArg; 4544 4449 CbContext.pInfos = VBoxWddmGetAllVideoModesInfos(pDevExt); 4545 CbContext.cPathInfos = RT_ELEMENTS(aItems);4546 CbContext.apPathInfos = aItems;4547 4450 4548 4451 Status = vboxVidPnEnumPaths(hVidPnTopology, pVidPnTopologyInterface, 4549 4452 vboxVidPnCofuncModalityPathEnum, &CbContext); 4550 Assert(Status == STATUS_SUCCESS);4551 4453 if (!NT_SUCCESS(Status)) 4552 4454 { … … 4705 4607 } 4706 4608 4707 4708 4609 NTSTATUS 4709 4610 APIENTRY … … 4716 4617 4717 4618 PVBOXMP_DEVEXT pDevExt = (PVBOXMP_DEVEXT)hAdapter; 4718 uint32_t au32OldHeightVisible[VBOX_VIDEO_MAX_SCREENS];4719 4619 NTSTATUS Status; 4720 4620 4721 4621 vboxVDbgBreakFv(); 4722 4723 /* we first store the current visible height for each target (monitor)4724 * and then we will zero up it for targets either for the given source4725 * (in case pCommitVidPnArg->AffectedVidPnSourceId != D3DDDI_ID_ALL)4726 * or all targets otherwize.4727 * In the end we will match the old and new visible height for all targets to see if4728 * some of them become inactivated and hide them accordingly,4729 * or we will restore the old height values on failure */4730 for (int i = 0; i < VBoxCommonFromDeviceExt(pDevExt)->cDisplays; ++i)4731 {4732 PVBOXWDDM_TARGET pTarget = &pDevExt->aTargets[i];4733 au32OldHeightVisible[i] = pTarget->HeightVisible;4734 }4735 4622 4736 4623 do { … … 4840 4727 pDevExt->u.primary.hCommittedVidPn = pCommitVidPnArg->hFunctionalVidPn; 4841 4728 4842 for (int i = 1; /* <- never try to hide a primary monitor */ 4843 i < VBoxCommonFromDeviceExt(pDevExt)->cDisplays; ++i) 4729 for (int i = 0; i < VBoxCommonFromDeviceExt(pDevExt)->cDisplays; ++i) 4844 4730 { 4845 4731 PVBOXWDDM_TARGET pTarget = &pDevExt->aTargets[i]; 4846 if (!pTarget->HeightVisible && !!au32OldHeightVisible[i]) 4847 { 4848 /* the target was previously visible */ 4849 vboxWddmGhDisplayHideScreen(pDevExt, i); 4850 } 4851 } 4852 4853 //#ifdef VBOX_WDDM_WIN8 4854 // if (g_VBoxDisplayOnly) 4855 { 4856 for (int i = 0; /* <- never try to hide a primary monitor */ 4857 i < VBoxCommonFromDeviceExt(pDevExt)->cDisplays; ++i) 4858 { 4859 PVBOXWDDM_SOURCE pSource = &pDevExt->aSources[i]; 4860 if (pSource->bVisible) 4861 { 4732 PVBOXWDDM_SOURCE pSource = &pDevExt->aSources[i]; 4733 uint32_t cAutoresizes = pDevExt->cContextsDispIfResize; 4734 if (!cAutoresizes) 4735 { 4736 if (pSource->bVisible || !pTarget->HeightVisible) 4862 4737 vboxWddmGhDisplayCheckSetInfoFromSource(pDevExt, pSource); 4863 } 4864 } 4865 } 4866 //#endif 4738 } 4739 else 4740 pTarget->fStateSyncPening = true; 4741 } 4742 4867 4743 LOGF(("LEAVE, SUCCESS status(0x%x), context(0x%x)", Status, hAdapter)); 4868 4744 … … 4871 4747 4872 4748 AssertRelease(!NT_SUCCESS(Status)); 4873 /* failure branch restore original visible height values, see comments above */4874 for (int i = 0; i < VBoxCommonFromDeviceExt(pDevExt)->cDisplays; ++i)4875 {4876 PVBOXWDDM_TARGET pTarget = &pDevExt->aTargets[i];4877 pTarget->HeightVisible = au32OldHeightVisible[i];4878 }4879 4749 4880 4750 LOGF(("LEAVE, !!FAILURE!! status(0x%x), context(0x%x)", Status, hAdapter)); … … 5848 5718 break; 5849 5719 } 5720 case VBOXWDDM_CONTEXT_TYPE_CUSTOM_DISPIF_RESIZE: 5721 { 5722 pContext->enmType = pInfo->enmType; 5723 ASMAtomicIncU32(&pDevExt->cContextsDispIfResize); 5724 break; 5725 } 5726 case VBOXWDDM_CONTEXT_TYPE_CUSTOM_DISPIF_SEAMLESS: 5727 { 5728 pContext->enmType = pInfo->enmType; 5729 Status = vboxVideoCmCtxAdd(&pDevice->pAdapter->SeamlessCtxMgr, &pContext->CmContext, (HANDLE)pInfo->hUmEvent, pInfo->u64UmInfo); 5730 if (!NT_SUCCESS(Status)) 5731 { 5732 WARN(("vboxVideoCmCtxAdd failed, Status 0x%x", Status)); 5733 } 5734 break; 5735 } 5850 5736 default: 5851 5737 { 5852 Assert(0);5738 WARN(("unsupported context type %d", pInfo->enmType)); 5853 5739 Status = STATUS_INVALID_PARAMETER; 5854 5740 break; … … 5891 5777 PVBOXWDDM_CONTEXT pContext = (PVBOXWDDM_CONTEXT)hContext; 5892 5778 PVBOXMP_DEVEXT pDevExt = pContext->pDevice->pAdapter; 5779 NTSTATUS Status = STATUS_SUCCESS; 5780 5893 5781 switch(pContext->enmType) 5894 5782 { … … 5905 5793 uint32_t cContexts = ASMAtomicDecU32(&pDevExt->cContexts2D); 5906 5794 Assert(cContexts < UINT32_MAX/2); 5795 break; 5796 } 5797 case VBOXWDDM_CONTEXT_TYPE_CUSTOM_DISPIF_RESIZE: 5798 { 5799 uint32_t cContexts = ASMAtomicDecU32(&pDevExt->cContextsDispIfResize); 5800 Assert(cContexts < UINT32_MAX/2); 5801 if (!cContexts) 5802 { 5803 for (int i = 0; i < VBoxCommonFromDeviceExt(pDevExt)->cDisplays; ++i) 5804 { 5805 vboxWddmGhDisplayCheckCompletePeningScreenInfo(pDevExt, i); 5806 } 5807 } 5808 break; 5809 } 5810 case VBOXWDDM_CONTEXT_TYPE_CUSTOM_DISPIF_SEAMLESS: 5811 { 5812 Status = vboxVideoCmCtxRemove(&pContext->pDevice->pAdapter->SeamlessCtxMgr, &pContext->CmContext); 5813 if (!NT_SUCCESS(Status)) 5814 WARN(("vboxVideoCmCtxRemove failed, Status 0x%x", Status)); 5815 5816 Assert(pContext->CmContext.pSession == NULL); 5907 5817 break; 5908 5818 } … … 5923 5833 vboxWddmSwapchainCtxTerm(pDevExt, pContext); 5924 5834 5925 NTSTATUS Status = vboxVideoAMgrCtxDestroy(&pContext->AllocContext); 5926 Assert(Status == STATUS_SUCCESS); 5927 if (Status == STATUS_SUCCESS) 5835 Status = vboxVideoAMgrCtxDestroy(&pContext->AllocContext); 5836 if (NT_SUCCESS(Status)) 5928 5837 { 5929 5838 Status = vboxVideoCmCtxRemove(&pContext->pDevice->pAdapter->CmMgr, &pContext->CmContext); 5930 Assert(Status == STATUS_SUCCESS); 5931 if (Status == STATUS_SUCCESS) 5932 { 5839 if (NT_SUCCESS(Status)) 5933 5840 vboxWddmMemFree(pContext); 5934 } 5935 } 5841 else 5842 WARN(("vboxVideoCmCtxRemove failed, Status 0x%x", Status)); 5843 } 5844 else 5845 WARN(("vboxVideoAMgrCtxDestroy failed, Status 0x%x", Status)); 5936 5846 5937 5847 LOGF(("LEAVE, hContext(0x%x)", hContext)); -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPWddm.h
r47063 r48070 37 37 //#define VBOXWDDM_DEBUG_VIDPN 38 38 39 #define VBOXWDDM_CFG_DRV_DEFAULT 0 40 #define VBOXWDDM_CFG_DRV_SECONDARY_TARGETS_CONNECTED 1 41 42 #define VBOXWDDM_CFG_DRVTARGET_CONNECTED 1 43 39 44 #define VBOXWDDM_CFG_LOG_UM_BACKDOOR 0x00000001 40 45 #define VBOXWDDM_CFG_LOG_UM_DBGPRINT 0x00000002 41 46 #define VBOXWDDM_CFG_STR_LOG_UM L"VBoxLogUm" 47 48 #define VBOXWDDM_REG_DRV_FLAGS_NAME L"VBoxFlags" 49 #define VBOXWDDM_REG_DRV_DISPFLAGS_PREFIX L"VBoxDispFlags" 50 51 #define VBOXWDDM_REG_DRVKEY_PREFIX L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\Class\\" 52 53 #define VBOXWDDM_REG_DISPLAYSETTINGSVIDEOKEY L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\Video\\" 54 #define VBOXWDDM_REG_DISPLAYSETTINGSVIDEOKEY_SUBKEY L"\\Video" 55 56 57 #define VBOXWDDM_REG_DISPLAYSETTINGSKEY_PREFIX_VISTA L"\\Registry\\Machine\\System\\CurrentControlSet\\Hardware Profiles\\Current\\System\\CurrentControlSet\\Control\\VIDEO\\" 58 #define VBOXWDDM_REG_DISPLAYSETTINGSKEY_PREFIX_WIN7 L"\\Registry\\Machine\\System\\CurrentControlSet\\Hardware Profiles\\UnitedVideo\\CONTROL\\VIDEO\\" 59 60 #define VBOXWDDM_REG_DISPLAYSETTINGS_ATTACH_RELX L"Attach.RelativeX" 61 #define VBOXWDDM_REG_DISPLAYSETTINGS_ATTACH_RELY L"Attach.RelativeY" 62 #define VBOXWDDM_REG_DISPLAYSETTINGS_ATTACH_DESKTOP L"Attach.ToDesktop" 63 42 64 extern DWORD g_VBoxLogUm; 43 65 … … 81 103 } 82 104 83 DECLINLINE(VOID) vboxWddmAddrSetVram(PVBOXWDDM_ADDR pAddr, UINT SegmentId, VBOXVIDEOOFFSET offVram) 84 { 105 DECLINLINE(BOOLEAN) vboxWddmAddrSetVram(PVBOXWDDM_ADDR pAddr, UINT SegmentId, VBOXVIDEOOFFSET offVram) 106 { 107 if (pAddr->SegmentId == SegmentId && pAddr->offVram == offVram) 108 return FALSE; 109 85 110 pAddr->SegmentId = SegmentId; 86 111 pAddr->offVram = offVram; 112 return TRUE; 87 113 } 88 114 … … 191 217 return pPrimary; 192 218 } 219 220 bool vboxWddmGhDisplayCheckSetInfoFromSource(PVBOXMP_DEVEXT pDevExt, PVBOXWDDM_SOURCE pSource); 193 221 194 222 #define VBOXWDDMENTRY_2_SWAPCHAIN(_pE) ((PVBOXWDDM_SWAPCHAIN)((uint8_t*)(_pE) - RT_OFFSETOF(VBOXWDDM_SWAPCHAIN, DevExtListEntry)))
Note:
See TracChangeset
for help on using the changeset viewer.