Changeset 27984 in vbox
- Timestamp:
- Apr 5, 2010 1:28:29 PM (15 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideo.cpp
r27976 r27984 1239 1239 */ 1240 1240 VOID VBoxWddmGetModesTable(PDEVICE_EXTENSION DeviceExtension, bool bRebuildTable, 1241 VIDEO_MODE_INFORMATION ** ppModes, uint32_t * pcModes, uint32_t * pPreferrableMode,1241 VIDEO_MODE_INFORMATION ** ppModes, uint32_t * pcModes, int32_t * pPreferrableMode, 1242 1242 D3DKMDT_2DREGION **ppResolutions, uint32_t * pcResolutions) 1243 1243 { … … 1250 1250 *ppModes = VideoModes; 1251 1251 *pcModes = gNumVideoModes; 1252 *pPreferrableMode = gPreferredVideoMode;1252 *pPreferrableMode = (int32_t)gPreferredVideoMode; 1253 1253 *ppResolutions = g_VBoxWddmVideoResolutions; 1254 1254 *pcResolutions = g_VBoxWddmNumResolutions; … … 1258 1258 { 1259 1259 g_bModesTableInitialized = false; 1260 } 1261 1262 NTSTATUS VBoxWddmGetModesForResolution(PDEVICE_EXTENSION DeviceExtension, bool bRebuildTable, 1263 D3DKMDT_2DREGION *pResolution, 1264 VIDEO_MODE_INFORMATION * pModes, uint32_t cModes, uint32_t *pcModes, int32_t *piPreferrableMode) 1265 { 1266 VIDEO_MODE_INFORMATION *pAllModes; 1267 uint32_t cAllModes, cAllResolutions; 1268 int32_t iPreferrableMode; 1269 D3DKMDT_2DREGION *pAllResolutions; 1270 VBoxWddmGetModesTable(DeviceExtension, bRebuildTable, 1271 &pAllModes, &cAllModes, &iPreferrableMode, 1272 &pAllResolutions, &cAllResolutions); 1273 NTSTATUS Status = STATUS_SUCCESS; 1274 uint32_t cFound = 0; 1275 int iFoundPreferrableMode = -1; 1276 for (uint32_t i = 0; i < cAllModes; ++i) 1277 { 1278 VIDEO_MODE_INFORMATION *pCur = &pAllModes[i]; 1279 if (pResolution->cx == pAllModes[iPreferrableMode].VisScreenWidth 1280 && pResolution->cy == pAllModes[iPreferrableMode].VisScreenHeight) 1281 { 1282 if (pModes && cModes > cFound) 1283 { 1284 memcpy(&pModes[cFound], pCur, sizeof (VIDEO_MODE_INFORMATION)); 1285 ++pModes; 1286 } 1287 else 1288 Status = STATUS_BUFFER_TOO_SMALL; 1289 ++cFound; 1290 1291 if (i == (uint32_t)iPreferrableMode) 1292 iFoundPreferrableMode = i; 1293 } 1294 } 1295 *pcModes = cFound; 1296 if (piPreferrableMode) 1297 *piPreferrableMode = iFoundPreferrableMode; 1298 return Status; 1260 1299 } 1261 1300 -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideo.h
r27955 r27984 584 584 585 585 VOID VBoxWddmGetModesTable(PDEVICE_EXTENSION DeviceExtension, bool bRebuildTable, 586 VIDEO_MODE_INFORMATION ** ppModes, uint32_t * pcModes, uint32_t * pPreferrableMode,586 VIDEO_MODE_INFORMATION ** ppModes, uint32_t * pcModes, int32_t * pPreferrableMode, 587 587 D3DKMDT_2DREGION **ppResolutions, uint32_t * pcResolutions); 588 588 589 589 VOID VBoxWddmInvalidateModesTable(PDEVICE_EXTENSION DeviceExtension); 590 591 /* @return STATUS_BUFFER_TOO_SMALL - if buffer is too small, STATUS_SUCCESS - on success */ 592 NTSTATUS VBoxWddmGetModesForResolution(PDEVICE_EXTENSION DeviceExtension, bool bRebuildTable, 593 D3DKMDT_2DREGION *pResolution, 594 VIDEO_MODE_INFORMATION * pModes, uint32_t cModes, uint32_t *pcModes, int32_t * piPreferrableMode); 590 595 591 596 D3DDDIFORMAT vboxWddmCalcPixelFormat(VIDEO_MODE_INFORMATION *pInfo); -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoVidPn.cpp
r27547 r27984 527 527 VIDEO_MODE_INFORMATION *pModes, 528 528 uint32_t cModes, 529 uint32_t iPreferredMode)529 int iPreferredMode) 530 530 { 531 531 NTSTATUS Status = STATUS_SUCCESS; … … 546 546 if (Status == STATUS_SUCCESS) 547 547 { 548 // if (iPreferredMode == i) 549 // { 550 // Status = pNewVidPnSourceModeSetInterface->pfnPinMode(hNewVidPnSourceModeSet, modeId); 551 // Assert(Status == STATUS_SUCCESS); 552 // if (Status != STATUS_SUCCESS) 553 // { 554 // drprintf((__FUNCTION__": pfnPinMode failed, Status(0x%x)", Status)); 555 // /* don't treat it as fatal */ 556 // Status = STATUS_SUCCESS; 557 // } 558 // } 548 if (iPreferredMode == i) 549 { 550 AssertBreakpoint(); 551 Status = pNewVidPnSourceModeSetInterface->pfnPinMode(hNewVidPnSourceModeSet, modeId); 552 Assert(Status == STATUS_SUCCESS); 553 if (Status != STATUS_SUCCESS) 554 { 555 drprintf((__FUNCTION__": pfnPinMode failed, Status(0x%x)", Status)); 556 /* don't treat it as fatal */ 557 Status = STATUS_SUCCESS; 558 } 559 } 559 560 } 560 561 else … … 602 603 BOOLEAN bPreferred) 603 604 { 605 Assert(!bPreferred); 604 606 pNewVidPnTargetModeInfo->Preference = bPreferred ? D3DKMDT_MP_PREFERRED : D3DKMDT_MP_NOTPREFERRED; 605 607 606 608 return vboxVidPnPopulateVideoSignalInfo(&pNewVidPnTargetModeInfo->VideoSignalInfo, pResolution, 60 /* ULONG VSync */); 607 609 } 610 611 #define VBOXVIDPN_MODESET_NO_PIN_PREFERRED 0x00000001 612 #define VBOXVIDPN_MODESET_MARK_PREFERRED 0x00000002 608 613 609 614 NTSTATUS vboxVidPnPopulateTargetModeSetFromLegacy(PDEVICE_EXTENSION pDevExt, … … 612 617 D3DKMDT_2DREGION *pResolutions, 613 618 uint32_t cResolutions, 614 VIDEO_MODE_INFORMATION *pPreferredMode) 619 VIDEO_MODE_INFORMATION *pPreferredMode, 620 uint32_t fFlags) 615 621 { 616 622 NTSTATUS Status = STATUS_SUCCESS; … … 623 629 { 624 630 bool bPreferred = pPreferredMode ? pPreferredMode->VisScreenHeight == pResolutions[i].cx 625 && pPreferredMode->VisScreenWidth == pResolutions[i].cy : TRUE;626 Status = vboxVidPnPopulateTargetModeInfoFromLegacy(pNewVidPnTargetModeInfo, &pResolutions[i], bPreferred );631 && pPreferredMode->VisScreenWidth == pResolutions[i].cy : FALSE; 632 Status = vboxVidPnPopulateTargetModeInfoFromLegacy(pNewVidPnTargetModeInfo, &pResolutions[i], bPreferred && (fFlags & VBOXVIDPN_MODESET_MARK_PREFERRED)); 627 633 Assert(Status == STATUS_SUCCESS); 628 634 if (Status == STATUS_SUCCESS) … … 633 639 if (Status == STATUS_SUCCESS) 634 640 { 635 // if (bPreferred) 636 // { 637 // Status = pNewVidPnTargetModeSetInterface->pfnPinMode(hNewVidPnTargetModeSet, modeId); 638 // Assert(Status == STATUS_SUCCESS); 639 // if (Status != STATUS_SUCCESS) 640 // { 641 // drprintf((__FUNCTION__": pfnPinMode failed, Status(0x%x)", Status)); 642 // /* don't treat it as fatal */ 643 // Status = STATUS_SUCCESS; 644 // } 645 // } 641 if (bPreferred && !(fFlags & VBOXVIDPN_MODESET_NO_PIN_PREFERRED)) 642 { 643 AssertBreakpoint(); 644 Status = pNewVidPnTargetModeSetInterface->pfnPinMode(hNewVidPnTargetModeSet, modeId); 645 Assert(Status == STATUS_SUCCESS); 646 if (Status != STATUS_SUCCESS) 647 { 648 drprintf((__FUNCTION__": pfnPinMode failed, Status(0x%x)", Status)); 649 /* don't treat it as fatal */ 650 Status = STATUS_SUCCESS; 651 } 652 } 646 653 } 647 654 else … … 665 672 NTSTATUS vboxVidPnCreatePopulateSourceModeSetFromLegacy(PDEVICE_EXTENSION pDevExt, const D3DKMDT_HVIDPN hDesiredVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface, 666 673 D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId, 667 VIDEO_MODE_INFORMATION *pModes, uint32_t cModes, uint32_t iPreferredMode)674 VIDEO_MODE_INFORMATION *pModes, uint32_t cModes, int iPreferredMode) 668 675 { 669 676 D3DKMDT_HVIDPNSOURCEMODESET hNewVidPnSourceModeSet; … … 707 714 D3DKMDT_2DREGION *pResolutions, 708 715 uint32_t cResolutions, 709 VIDEO_MODE_INFORMATION *pPreferredMode )716 VIDEO_MODE_INFORMATION *pPreferredMode, uint32_t fFlags) 710 717 { 711 718 D3DKMDT_HVIDPNTARGETMODESET hNewVidPnTargetModeSet; … … 720 727 Status = vboxVidPnPopulateTargetModeSetFromLegacy(pDevExt, 721 728 hNewVidPnTargetModeSet, pNewVidPnTargetModeSetInterface, 722 pResolutions, cResolutions, pPreferredMode );729 pResolutions, cResolutions, pPreferredMode, fFlags); 723 730 Assert(Status == STATUS_SUCCESS); 724 731 if (Status == STATUS_SUCCESS) … … 747 754 748 755 NTSTATUS vboxVidPnCreatePopulateVidPnFromLegacy(PDEVICE_EXTENSION pDevExt, D3DKMDT_HVIDPN hVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface, 749 VIDEO_MODE_INFORMATION *pModes, uint32_t cModes, uint32_t iPreferredMode,756 VIDEO_MODE_INFORMATION *pModes, uint32_t cModes, int iPreferredMode, 750 757 D3DKMDT_2DREGION *pResolutions, uint32_t cResolutions) 751 758 { … … 753 760 D3DKMDT_HVIDPNTOPOLOGY hVidPnTopology; 754 761 const DXGK_VIDPNTOPOLOGY_INTERFACE* pVidPnTopologyInterface; 762 VIDEO_MODE_INFORMATION *pPreferredMode = iPreferredMode >= 0 ? &pModes[iPreferredMode] : NULL; 755 763 Status = pVidPnInterface->pfnGetTopology(hVidPn, &hVidPnTopology, &pVidPnTopologyInterface); 756 764 if (Status == STATUS_SUCCESS) … … 798 806 { 799 807 Status = vboxVidPnCreatePopulateTargetModeSetFromLegacy(pDevExt, hVidPn, pVidPnInterface, 0, 800 pResolutions, cResolutions, &pModes[iPreferredMode]);808 pResolutions, cResolutions, pPreferredMode, 0); 801 809 Assert(Status == STATUS_SUCCESS); 802 810 if (Status != STATUS_SUCCESS) … … 835 843 VIDEO_MODE_INFORMATION *pModes = pCbContext->pModes; 836 844 uint32_t cModes = pCbContext->cModes; 837 uint32_t iPreferredMode = pCbContext->iPreferredMode;845 int iPreferredMode = pCbContext->iPreferredMode; 838 846 uint32_t cResolutions = pCbContext->cResolutions; 839 847 D3DKMDT_2DREGION * pResolutions = pCbContext->pResolutions; … … 870 878 D3DKMDT_HVIDPNSOURCEMODESET hCurVidPnSourceModeSet; 871 879 const DXGK_VIDPNSOURCEMODESET_INTERFACE *pCurVidPnSourceModeSetInterface; 880 VIDEO_MODE_INFORMATION *pPreferredMode = iPreferredMode >= 0 ? &pModes[iPreferredMode] : NULL; 872 881 873 882 Status = pVidPnInterface->pfnAcquireSourceModeSet(hDesiredVidPn, … … 933 942 { 934 943 D3DKMDT_VIDPN_TARGET_MODE dummyMode = {0}; 935 Status = vboxVidPnPopulateTargetModeInfoFromLegacy(&dummyMode, &Resolution, TRUE);944 Status = vboxVidPnPopulateTargetModeInfoFromLegacy(&dummyMode, &Resolution, FALSE); 936 945 Assert(Status == STATUS_SUCCESS); 937 946 if (Status == STATUS_SUCCESS) … … 963 972 &Resolution, 964 973 1, 965 NULL); 974 pPreferredMode, 975 0); 966 976 Assert(Status == STATUS_SUCCESS); 967 977 if (Status != STATUS_SUCCESS) … … 997 1007 pResolutions, 998 1008 cResolutions, 999 &pModes[iPreferredMode]); 1009 pPreferredMode, 1010 0); 1000 1011 Assert(Status == STATUS_SUCCESS); 1001 1012 if (Status != STATUS_SUCCESS) -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoVidPn.h
r27239 r27984 46 46 /* legacy mode information populated by the common XPDM-WDDM layer */ 47 47 uint32_t cModes; 48 uint32_t iPreferredMode;48 int iPreferredMode; 49 49 VIDEO_MODE_INFORMATION *pModes; 50 50 uint32_t cResolutions; … … 114 114 115 115 NTSTATUS vboxVidPnCreatePopulateVidPnFromLegacy(struct _DEVICE_EXTENSION* pDevExt, D3DKMDT_HVIDPN hVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface, 116 VIDEO_MODE_INFORMATION *pModes, uint32_t cModes, uint32_t iPreferredMomde,116 VIDEO_MODE_INFORMATION *pModes, uint32_t cModes, int iPreferredMomde, 117 117 D3DKMDT_2DREGION *pResolutions, uint32_t cResolutions); 118 118 -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoWddm.cpp
r27955 r27984 2417 2417 NTSTATUS Status; 2418 2418 uint32_t cModes; 2419 uint32_t iPreferredMode;2419 int iPreferredMode; 2420 2420 VIDEO_MODE_INFORMATION *pModes; 2421 2421 uint32_t cResolutions; 2422 2422 D3DKMDT_2DREGION *pResolutions; 2423 VIDEO_MODE_INFORMATION ModeInfos[4]; 2424 VIDEO_MODE_INFORMATION *pModeInfos; 2425 D3DKMDT_2DREGION Resolution; 2426 uint32_t cModeInfos; 2427 int32_t iPreferredModeInfo; 2428 bool bFreeModes = false; 2423 2429 VBoxWddmGetModesTable(pDevExt, /* PDEVICE_EXTENSION DeviceExtension */ 2424 2430 false, /* bool bRebuildTable*/ … … 2428 2434 &pResolutions, /* D3DKMDT_2DREGION **ppResolutions */ 2429 2435 &cResolutions /* uint32_t * pcResolutions */); 2430 2431 2432 const DXGK_VIDPN_INTERFACE* pVidPnInterface = NULL; 2433 Status = pDevExt->u.primary.DxgkInterface.DxgkCbQueryVidPnInterface(pRecommendFunctionalVidPnArg->hRecommendedFunctionalVidPn, DXGK_VIDPN_INTERFACE_VERSION_V1, &pVidPnInterface); 2434 Assert(Status == STATUS_SUCCESS); 2436 Resolution.cx = pModes[iPreferredMode].VisScreenWidth; 2437 Resolution.cy = pModes[iPreferredMode].VisScreenHeight; 2438 Status = VBoxWddmGetModesForResolution(pDevExt, false, 2439 &Resolution, 2440 ModeInfos, RT_ELEMENTS(ModeInfos), &cModeInfos, &iPreferredModeInfo); 2441 Assert(Status == STATUS_SUCCESS || Status == STATUS_BUFFER_TOO_SMALL); 2435 2442 if (Status == STATUS_SUCCESS) 2436 { 2437 D3DKMDT_2DREGION PrefRegion; 2438 PrefRegion.cx = pModes[iPreferredMode].VisScreenHeight; 2439 PrefRegion.cy = pModes[iPreferredMode].VisScreenWidth; 2440 Status = vboxVidPnCreatePopulateVidPnFromLegacy(pDevExt, pRecommendFunctionalVidPnArg->hRecommendedFunctionalVidPn, pVidPnInterface, 2441 #if 0 2442 pModes, cModes, iPreferredMode, 2443 pResolutions, cResolutions 2444 #else 2445 &pModes[iPreferredMode], 1, 0, 2446 &PrefRegion, 1 2447 #endif 2448 ); 2443 pModeInfos = ModeInfos; 2444 else if (Status == STATUS_BUFFER_TOO_SMALL) 2445 { 2446 uint32_t cModeInfos2; 2447 pModeInfos = (VIDEO_MODE_INFORMATION*)vboxWddmMemAlloc(sizeof (VIDEO_MODE_INFORMATION) * cModeInfos); 2448 if (pModeInfos) 2449 { 2450 bFreeModes = true; 2451 Status = VBoxWddmGetModesForResolution(pDevExt, false, 2452 &Resolution, 2453 pModeInfos, cModeInfos, &cModeInfos2, &iPreferredModeInfo); 2454 Assert(Status == STATUS_SUCCESS); 2455 Assert(iPreferredModeInfo >= 0); /* the array should contain the preffered info */ 2456 if (Status != STATUS_SUCCESS) 2457 drprintf((__FUNCTION__": second call to VBoxWddmGetModesForResolution failed Status(0x%x), cModeInfos(%d), cModeInfos2(%d)\n", Status, cModeInfos, cModeInfos2)); 2458 } 2459 } 2460 else 2461 drprintf((__FUNCTION__": VBoxWddmGetModesForResolution failed Status(0x%x)\n", Status)); 2462 2463 if (Status == STATUS_SUCCESS) 2464 { 2465 const DXGK_VIDPN_INTERFACE* pVidPnInterface = NULL; 2466 Status = pDevExt->u.primary.DxgkInterface.DxgkCbQueryVidPnInterface(pRecommendFunctionalVidPnArg->hRecommendedFunctionalVidPn, DXGK_VIDPN_INTERFACE_VERSION_V1, &pVidPnInterface); 2449 2467 Assert(Status == STATUS_SUCCESS); 2450 if (Status != STATUS_SUCCESS) 2451 drprintf((__FUNCTION__": vboxVidPnCreatePopulateVidPnFromLegacy failed Status(0x%x)\n", Status)); 2452 } 2453 else 2454 drprintf((__FUNCTION__": DxgkCbQueryVidPnInterface failed Status(0x%x)\n", Status)); 2468 if (Status == STATUS_SUCCESS) 2469 { 2470 Assert (iPreferredModeInfo >= 0); 2471 Status = vboxVidPnCreatePopulateVidPnFromLegacy(pDevExt, pRecommendFunctionalVidPnArg->hRecommendedFunctionalVidPn, pVidPnInterface, 2472 pModeInfos, cModeInfos, iPreferredModeInfo, 2473 &Resolution, 1); 2474 Assert(Status == STATUS_SUCCESS); 2475 if (Status != STATUS_SUCCESS) 2476 drprintf((__FUNCTION__": vboxVidPnCreatePopulateVidPnFromLegacy failed Status(0x%x)\n", Status)); 2477 } 2478 else 2479 drprintf((__FUNCTION__": DxgkCbQueryVidPnInterface failed Status(0x%x)\n", Status)); 2480 } 2481 2482 if (bFreeModes) 2483 vboxWddmMemFree(pModeInfos); 2455 2484 2456 2485 dfprintf(("<== "__FUNCTION__ ", status(0x%x), context(0x%x)\n", Status, hAdapter)); … … 2494 2523 &CbContext.cResolutions /* uint32_t * pcResolutions */); 2495 2524 Assert(CbContext.cModes); 2496 Assert(CbContext.cModes > CbContext.iPreferredMode); 2525 Assert(CbContext.cModes > (uint32_t)CbContext.iPreferredMode); 2526 CbContext.iPreferredMode = -1; /* <- we do not want the modes to be pinned */ 2497 2527 Status = vboxVidPnEnumPaths(pContext, pEnumCofuncModalityArg->hConstrainingVidPn, pVidPnInterface, 2498 2528 hVidPnTopology, pVidPnTopologyInterface, … … 2737 2767 NTSTATUS Status; 2738 2768 uint32_t cModes; 2739 uint32_t iPreferredMode;2769 int32_t iPreferredMode; 2740 2770 VIDEO_MODE_INFORMATION *pModes; 2741 2771 uint32_t cResolutions; … … 2761 2791 &pResolutions[i], 2762 2792 D3DKMDT_MCO_DRIVER, 2763 true);2793 FALSE); 2764 2794 Assert(Status == STATUS_SUCCESS); 2765 2795 if (Status == STATUS_SUCCESS) -
trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxTray.h
r27955 r27984 69 69 /* with WDDM the approach is to call into WDDM miniport driver via PFND3DKMT API provided by the GDI, 70 70 * The PFND3DKMT is supposed to be used by the OpenGL ICD according to MSDN, so this approach is a bit hacky */ 71 /* open adapter */72 71 union 73 72 { 74 73 struct 75 74 { 76 PFND3DKMT_OPENADAPTERFROMHDC pfnD3DKMTOpenAdapterFromHdc; 77 PFND3DKMT_OPENADAPTERFROMGDIDISPLAYNAME pfnD3DKMTOpenAdapterFromGdiDisplayName; 78 /* close adapter */ 79 PFND3DKMT_CLOSEADAPTER pfnD3DKMTCloseAdapter; 80 /* escape */ 81 PFND3DKMT_ESCAPE pfnD3DKMTEscape; 75 /* open adapter */ 76 PFND3DKMT_OPENADAPTERFROMHDC pfnD3DKMTOpenAdapterFromHdc; 77 PFND3DKMT_OPENADAPTERFROMGDIDISPLAYNAME pfnD3DKMTOpenAdapterFromGdiDisplayName; 78 /* close adapter */ 79 PFND3DKMT_CLOSEADAPTER pfnD3DKMTCloseAdapter; 80 /* escape */ 81 PFND3DKMT_ESCAPE pfnD3DKMTEscape; 82 PFND3DKMT_INVALIDATEACTIVEVIDPN pfnD3DKMTInvalidateActiveVidPn; 82 83 } wddm; 83 84 } modeData;
Note:
See TracChangeset
for help on using the changeset viewer.