Changeset 27547 in vbox for trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm
- Timestamp:
- Mar 19, 2010 5:31:32 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoVidPn.cpp
r27262 r27547 331 331 } 332 332 333 BOOLEAN vboxVidPnMatchVideoSignal(const D3DKMDT_VIDEO_SIGNAL_INFO *pVsi1, const D3DKMDT_VIDEO_SIGNAL_INFO *pVsi2) 334 { 335 if (pVsi1->VideoStandard != pVsi2->VideoStandard) 336 return FALSE; 337 if (pVsi1->TotalSize.cx != pVsi2->TotalSize.cx) 338 return FALSE; 339 if (pVsi1->TotalSize.cy != pVsi2->TotalSize.cy) 340 return FALSE; 341 if (pVsi1->ActiveSize.cx != pVsi2->ActiveSize.cx) 342 return FALSE; 343 if (pVsi1->ActiveSize.cy != pVsi2->ActiveSize.cy) 344 return FALSE; 345 if (pVsi1->VSyncFreq.Numerator != pVsi2->VSyncFreq.Numerator) 346 return FALSE; 347 if (pVsi1->VSyncFreq.Denominator != pVsi2->VSyncFreq.Denominator) 348 return FALSE; 349 if (pVsi1->HSyncFreq.Numerator != pVsi2->HSyncFreq.Numerator) 350 return FALSE; 351 if (pVsi1->HSyncFreq.Denominator != pVsi2->HSyncFreq.Denominator) 352 return FALSE; 353 if (pVsi1->PixelRate != pVsi2->PixelRate) 354 return FALSE; 355 if (pVsi1->ScanLineOrdering != pVsi2->ScanLineOrdering) 356 return FALSE; 357 358 return TRUE; 359 } 360 333 361 NTSTATUS vboxVidPnCheckTargetModeInfo(const D3DKMDT_HVIDPN hDesiredVidPn, 334 362 const D3DKMDT_VIDPN_TARGET_MODE *pNewVidPnTargetModeInfo, … … 350 378 } 351 379 352 if ( memcmp(&CmpVsi, &pNewVidPnTargetModeInfo->VideoSignalInfo, sizeof (D3DKMDT_VIDEO_SIGNAL_INFO)))380 if (!vboxVidPnMatchVideoSignal(&CmpVsi, &pNewVidPnTargetModeInfo->VideoSignalInfo)) 353 381 { 354 382 dfprintf((__FUNCTION__": VideoSignalInfos do not match!!!\n")); … … 499 527 VIDEO_MODE_INFORMATION *pModes, 500 528 uint32_t cModes, 501 uint32_t iPreferredMo mde)529 uint32_t iPreferredMode) 502 530 { 503 531 NTSTATUS Status = STATUS_SUCCESS; … … 518 546 if (Status == STATUS_SUCCESS) 519 547 { 520 if (iPreferredMomde == i)521 {522 Status = pNewVidPnSourceModeSetInterface->pfnPinMode(hNewVidPnSourceModeSet, modeId);523 Assert(Status == STATUS_SUCCESS);524 if (Status != STATUS_SUCCESS)525 {526 drprintf((__FUNCTION__": pfnPinMode failed, Status(0x%x)", Status));527 /* don't treat it as fatal */528 Status = STATUS_SUCCESS;529 }530 }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 // } 531 559 } 532 560 else … … 570 598 } 571 599 572 NTSTATUS vboxVidPnPopulateTargetModeInfoFromLegacy(PDEVICE_EXTENSION pDevExt, 573 D3DKMDT_VIDPN_TARGET_MODE *pNewVidPnTargetModeInfo, 600 NTSTATUS vboxVidPnPopulateTargetModeInfoFromLegacy(D3DKMDT_VIDPN_TARGET_MODE *pNewVidPnTargetModeInfo, 574 601 D3DKMDT_2DREGION *pResolution, 575 602 BOOLEAN bPreferred) … … 595 622 if (Status == STATUS_SUCCESS) 596 623 { 597 bool bPreferred = pPreferredMode ->VisScreenHeight == pResolutions[i].cx598 && pPreferredMode->VisScreenWidth == pResolutions[i].cy ;599 Status = vboxVidPnPopulateTargetModeInfoFromLegacy(p DevExt, pNewVidPnTargetModeInfo, &pResolutions[i], bPreferred);624 bool bPreferred = pPreferredMode ? pPreferredMode->VisScreenHeight == pResolutions[i].cx 625 && pPreferredMode->VisScreenWidth == pResolutions[i].cy : TRUE; 626 Status = vboxVidPnPopulateTargetModeInfoFromLegacy(pNewVidPnTargetModeInfo, &pResolutions[i], bPreferred); 600 627 Assert(Status == STATUS_SUCCESS); 601 628 if (Status == STATUS_SUCCESS) … … 606 633 if (Status == STATUS_SUCCESS) 607 634 { 608 if (bPreferred)609 {610 Status = pNewVidPnTargetModeSetInterface->pfnPinMode(hNewVidPnTargetModeSet, modeId);611 Assert(Status == STATUS_SUCCESS);612 if (Status != STATUS_SUCCESS)613 {614 drprintf((__FUNCTION__": pfnPinMode failed, Status(0x%x)", Status));615 /* don't treat it as fatal */616 Status = STATUS_SUCCESS;617 }618 }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 // } 619 646 } 620 647 else … … 823 850 { 824 851 AssertBreakpoint(); 825 /* todo: create a new path (if not done already) and assign a prop per info */852 /* todo: create a new path (if not done already) and assign a proper info */ 826 853 } 827 854 } … … 837 864 { 838 865 AssertBreakpoint(); 839 /* todo: create a new path (if not done already) and assign a propper info */ 840 } 841 } 842 843 if (pCbContext->pEnumCofuncModalityArg->EnumPivotType != D3DKMDT_EPT_VIDPNSOURCE 844 || pNewVidPnPresentPathInfo->VidPnSourceId != pCbContext->pEnumCofuncModalityArg->EnumPivot.VidPnSourceId) 845 { 846 D3DKMDT_HVIDPNSOURCEMODESET hCurVidPnSourceModeSet; 847 const DXGK_VIDPNSOURCEMODESET_INTERFACE *pCurVidPnSourceModeSetInterface; 848 849 Status = pVidPnInterface->pfnAcquireSourceModeSet(hDesiredVidPn, 850 pNewVidPnPresentPathInfo->VidPnSourceId, 851 &hCurVidPnSourceModeSet, 852 &pCurVidPnSourceModeSetInterface); 866 /* todo: create a new path (if not done already) and assign a proper info */ 867 } 868 } 869 870 D3DKMDT_HVIDPNSOURCEMODESET hCurVidPnSourceModeSet; 871 const DXGK_VIDPNSOURCEMODESET_INTERFACE *pCurVidPnSourceModeSetInterface; 872 873 Status = pVidPnInterface->pfnAcquireSourceModeSet(hDesiredVidPn, 874 pNewVidPnPresentPathInfo->VidPnSourceId, 875 &hCurVidPnSourceModeSet, 876 &pCurVidPnSourceModeSetInterface); 877 Assert(Status == STATUS_SUCCESS); 878 if (Status == STATUS_SUCCESS) 879 { 880 CONST D3DKMDT_VIDPN_SOURCE_MODE* pPinnedVidPnSourceModeInfo; 881 Status = pCurVidPnSourceModeSetInterface->pfnAcquirePinnedModeInfo(hCurVidPnSourceModeSet, &pPinnedVidPnSourceModeInfo); 882 Assert(Status == STATUS_SUCCESS || Status == STATUS_GRAPHICS_MODE_NOT_PINNED); 883 if (Status == STATUS_GRAPHICS_MODE_NOT_PINNED) 884 { 885 pPinnedVidPnSourceModeInfo = NULL; 886 Status = STATUS_SUCCESS; 887 } 888 else if (Status != STATUS_SUCCESS) 889 drprintf((__FUNCTION__": pfnAcquirePinnedModeInfo failed Status(0x%x)\n", Status)); 890 891 D3DKMDT_HVIDPNTARGETMODESET hCurVidPnTargetModeSet; 892 const DXGK_VIDPNTARGETMODESET_INTERFACE *pCurVidPnTargetModeSetInterface; 893 Status = pVidPnInterface->pfnAcquireTargetModeSet(hDesiredVidPn, 894 pNewVidPnPresentPathInfo->VidPnTargetId, 895 &hCurVidPnTargetModeSet, 896 &pCurVidPnTargetModeSetInterface); 853 897 Assert(Status == STATUS_SUCCESS); 854 898 if (Status == STATUS_SUCCESS) 855 899 { 856 CONST D3DKMDT_VIDPN_ SOURCE_MODE* pPinnedVidPnSourceModeInfo;857 Status = pCurVidPn SourceModeSetInterface->pfnAcquirePinnedModeInfo(hCurVidPnSourceModeSet, &pPinnedVidPnSourceModeInfo);900 CONST D3DKMDT_VIDPN_TARGET_MODE* pPinnedVidPnTargetModeInfo; 901 Status = pCurVidPnTargetModeSetInterface->pfnAcquirePinnedModeInfo(hCurVidPnTargetModeSet, &pPinnedVidPnTargetModeInfo); 858 902 Assert(Status == STATUS_SUCCESS || Status == STATUS_GRAPHICS_MODE_NOT_PINNED); 859 if (Status == STATUS_SUCCESS) 860 { 861 Assert (pPinnedVidPnSourceModeInfo); 862 /* release */ 863 pCurVidPnSourceModeSetInterface->pfnReleaseModeInfo(hCurVidPnSourceModeSet, pPinnedVidPnSourceModeInfo); 864 865 } 866 else if (Status == STATUS_GRAPHICS_MODE_NOT_PINNED) 867 { 868 /* just create and populate the new source mode set for now */ 869 Status = vboxVidPnCreatePopulateSourceModeSetFromLegacy(pDevExt, hDesiredVidPn, pVidPnInterface, 870 pNewVidPnPresentPathInfo->VidPnSourceId, 871 pModes, cModes, iPreferredMode); 872 Assert(Status == STATUS_SUCCESS); 873 if (Status != STATUS_SUCCESS) 874 drprintf((__FUNCTION__": vboxVidPnCreatePopulateSourceModeSetFromLegacy failed Status(0x%x)\n", Status)); 875 } 876 else 903 if (Status == STATUS_GRAPHICS_MODE_NOT_PINNED) 904 { 905 pPinnedVidPnTargetModeInfo = NULL; 906 Status = STATUS_SUCCESS; 907 } 908 else if (Status != STATUS_SUCCESS) 877 909 drprintf((__FUNCTION__": pfnAcquirePinnedModeInfo failed Status(0x%x)\n", Status)); 878 910 879 pVidPnInterface->pfnReleaseSourceModeSet(hDesiredVidPn, hCurVidPnSourceModeSet); 911 switch (pCbContext->pEnumCofuncModalityArg->EnumPivotType) 912 { 913 case D3DKMDT_EPT_VIDPNSOURCE: 914 if (!pPinnedVidPnTargetModeInfo) 915 { 916 if (pPinnedVidPnSourceModeInfo) 917 { 918 SIZE_T cModes; 919 Status = pCurVidPnTargetModeSetInterface->pfnGetNumModes(hCurVidPnTargetModeSet, &cModes); 920 Assert(Status == STATUS_SUCCESS); 921 if (Status == STATUS_SUCCESS) 922 { 923 D3DKMDT_2DREGION Resolution; 924 Resolution.cx = pPinnedVidPnSourceModeInfo->Format.Graphics.VisibleRegionSize.cx; 925 Resolution.cy = pPinnedVidPnSourceModeInfo->Format.Graphics.VisibleRegionSize.cy; 926 BOOLEAN bCreateTrg = FALSE; 927 if (cModes == 1) 928 { 929 const D3DKMDT_VIDPN_TARGET_MODE *pVidPnTargetModeInfo; 930 Status = pCurVidPnTargetModeSetInterface->pfnAcquireFirstModeInfo(hCurVidPnTargetModeSet, &pVidPnTargetModeInfo); 931 Assert(Status == STATUS_SUCCESS); 932 if (Status == STATUS_SUCCESS) 933 { 934 D3DKMDT_VIDPN_TARGET_MODE dummyMode = {0}; 935 Status = vboxVidPnPopulateTargetModeInfoFromLegacy(&dummyMode, &Resolution, TRUE); 936 Assert(Status == STATUS_SUCCESS); 937 if (Status == STATUS_SUCCESS) 938 { 939 if (!vboxVidPnMatchVideoSignal(&dummyMode.VideoSignalInfo, &pVidPnTargetModeInfo->VideoSignalInfo)) 940 bCreateTrg = TRUE; 941 else 942 { 943 /* do we need to check pVidPnTargetModeInfo->Preference; ? */ 944 } 945 } 946 else 947 { 948 drprintf((__FUNCTION__": trg vboxVidPnPopulateTargetModeInfoFromLegacy failed Status(0x%x), pretending success\n", Status)); 949 Status = STATUS_SUCCESS; 950 bCreateTrg = TRUE; 951 } 952 } 953 else 954 drprintf((__FUNCTION__": trg pfnAcquireFirstModeInfo failed Status(0x%x)\n", Status)); 955 } 956 else 957 bCreateTrg = TRUE; 958 959 if (bCreateTrg) 960 { 961 Status = vboxVidPnCreatePopulateTargetModeSetFromLegacy(pDevExt, hDesiredVidPn, pVidPnInterface, 962 pNewVidPnPresentPathInfo->VidPnTargetId, 963 &Resolution, 964 1, 965 NULL); 966 Assert(Status == STATUS_SUCCESS); 967 if (Status != STATUS_SUCCESS) 968 drprintf((__FUNCTION__": vboxVidPnCreatePopulateTargetModeSetFromLegacy for pinned source failed Status(0x%x)\n", Status)); } 969 } 970 else 971 drprintf((__FUNCTION__": trg pfnGetNumModes failed Status(0x%x)\n", Status)); 972 } 973 else 974 { 975 dprintf((__FUNCTION__": source pivot w/o pinned source mode\n")); 976 // AssertBreakpoint(); 977 } 978 } 979 break; 980 case D3DKMDT_EPT_VIDPNTARGET: 981 break; 982 case D3DKMDT_EPT_SCALING: 983 break; 984 case D3DKMDT_EPT_ROTATION: 985 break; 986 case D3DKMDT_EPT_NOPIVOT: 987 /* just create and populate the new source mode set for now */ 988 Status = vboxVidPnCreatePopulateSourceModeSetFromLegacy(pDevExt, hDesiredVidPn, pVidPnInterface, 989 pNewVidPnPresentPathInfo->VidPnSourceId, 990 pModes, cModes, iPreferredMode); 991 Assert(Status == STATUS_SUCCESS); 992 if (Status == STATUS_SUCCESS) 993 { 994 /* just create and populate a new target mode info for now */ 995 Status = vboxVidPnCreatePopulateTargetModeSetFromLegacy(pDevExt, hDesiredVidPn, pVidPnInterface, 996 pNewVidPnPresentPathInfo->VidPnTargetId, 997 pResolutions, 998 cResolutions, 999 &pModes[iPreferredMode]); 1000 Assert(Status == STATUS_SUCCESS); 1001 if (Status != STATUS_SUCCESS) 1002 drprintf((__FUNCTION__": vboxVidPnCreatePopulateTargetModeSetFromLegacy failed Status(0x%x)\n", Status)); 1003 } 1004 else 1005 drprintf((__FUNCTION__": vboxVidPnCreatePopulateSourceModeSetFromLegacy failed Status(0x%x)\n", Status)); 1006 1007 break; 1008 default: 1009 drprintf((__FUNCTION__": unknown EnumPivotType (%dx)\n", pCbContext->pEnumCofuncModalityArg->EnumPivotType)); 1010 break; 1011 } 1012 1013 if (pPinnedVidPnTargetModeInfo) 1014 pCurVidPnTargetModeSetInterface->pfnReleaseModeInfo(hCurVidPnTargetModeSet, pPinnedVidPnTargetModeInfo); 1015 pVidPnInterface->pfnReleaseTargetModeSet(hDesiredVidPn, hCurVidPnTargetModeSet); 880 1016 } 881 1017 else 882 { 883 drprintf((__FUNCTION__": pfnAcquireSourceModeSet failed Status(0x%x)\n", Status)); 884 } 885 } 886 887 /* ensure we didn't fail earlier */ 888 if (Status == STATUS_SUCCESS) 889 { 890 if (pCbContext->pEnumCofuncModalityArg->EnumPivotType != D3DKMDT_EPT_VIDPNTARGET 891 || pNewVidPnPresentPathInfo->VidPnTargetId != pCbContext->pEnumCofuncModalityArg->EnumPivot.VidPnTargetId) 892 { 893 D3DKMDT_HVIDPNTARGETMODESET hCurVidPnTargetModeSet; 894 const DXGK_VIDPNTARGETMODESET_INTERFACE *pCurVidPnTargetModeSetInterface; 895 Status = pVidPnInterface->pfnAcquireTargetModeSet(hDesiredVidPn, 896 pNewVidPnPresentPathInfo->VidPnTargetId, 897 &hCurVidPnTargetModeSet, 898 &pCurVidPnTargetModeSetInterface); 899 Assert(Status == STATUS_SUCCESS); 900 if (Status == STATUS_SUCCESS) 901 { 902 CONST D3DKMDT_VIDPN_TARGET_MODE* pPinnedVidPnTargetModeInfo; 903 Status = pCurVidPnTargetModeSetInterface->pfnAcquirePinnedModeInfo(hCurVidPnTargetModeSet, &pPinnedVidPnTargetModeInfo); 904 Assert(Status == STATUS_SUCCESS || Status == STATUS_GRAPHICS_MODE_NOT_PINNED); 905 if (Status == STATUS_SUCCESS) 906 { 907 Assert (pPinnedVidPnTargetModeInfo); 908 /* nothing to be done here, just release */ 909 pCurVidPnTargetModeSetInterface->pfnReleaseModeInfo(hCurVidPnTargetModeSet, pPinnedVidPnTargetModeInfo); 910 } 911 else if (Status == STATUS_GRAPHICS_MODE_NOT_PINNED) 912 { 913 /* just create and populate a new target mode info for now */ 914 Status = vboxVidPnCreatePopulateTargetModeSetFromLegacy(pDevExt, hDesiredVidPn, pVidPnInterface, 915 pNewVidPnPresentPathInfo->VidPnTargetId, 916 pResolutions, 917 cResolutions, 918 &pModes[iPreferredMode]); 919 Assert(Status == STATUS_SUCCESS); 920 if (Status != STATUS_SUCCESS) 921 drprintf((__FUNCTION__": vboxVidPnCreatePopulateTargetModeSetFromLegacy failed Status(0x%x)\n", Status)); 922 } 923 else 924 drprintf((__FUNCTION__": pfnAcquirePinnedModeInfo failed Status(0x%x)\n", Status)); 925 926 pVidPnInterface->pfnReleaseTargetModeSet(hDesiredVidPn, hCurVidPnTargetModeSet); 927 } 928 else 929 drprintf((__FUNCTION__": pfnAcquireTargetModeSet failed Status(0x%x)\n", Status)); 930 } 931 } 1018 drprintf((__FUNCTION__": pfnAcquireTargetModeSet failed Status(0x%x)\n", Status)); 1019 1020 if (pPinnedVidPnSourceModeInfo) 1021 pCurVidPnSourceModeSetInterface->pfnReleaseModeInfo(hCurVidPnSourceModeSet, pPinnedVidPnSourceModeInfo); 1022 pVidPnInterface->pfnReleaseSourceModeSet(hDesiredVidPn, hCurVidPnSourceModeSet); 1023 } 1024 else 1025 drprintf((__FUNCTION__": pfnAcquireSourceModeSet failed Status(0x%x)\n", Status)); 932 1026 933 1027 pVidPnTopologyInterface->pfnReleasePathInfo(hVidPnTopology, pNewVidPnPresentPathInfo); 934 1028 935 1029 pCbContext->Status = Status; 1030 Assert(Status == STATUS_SUCCESS); 936 1031 return Status == STATUS_SUCCESS; 937 1032 }
Note:
See TracChangeset
for help on using the changeset viewer.