Changeset 27997 in vbox for trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm
- Timestamp:
- Apr 6, 2010 10:01:47 AM (15 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoVidPn.cpp
r27984 r27997 599 599 } 600 600 601 NTSTATUS vboxVidPnCreatePopulateMonitorSourceModeInfoFromLegacy(PDEVICE_EXTENSION pDevExt, 602 CONST D3DKMDT_HMONITORSOURCEMODESET hMonitorSMS, 603 CONST DXGK_MONITORSOURCEMODESET_INTERFACE *pMonitorSMSIf, 604 D3DKMDT_2DREGION *pResolution, 605 D3DKMDT_MONITOR_CAPABILITIES_ORIGIN enmOrigin, 606 BOOLEAN bPreferred) 607 { 608 D3DKMDT_MONITOR_SOURCE_MODE * pMonitorSMI; 609 NTSTATUS Status = pMonitorSMSIf->pfnCreateNewModeInfo(hMonitorSMS, &pMonitorSMI); 610 Assert(Status == STATUS_SUCCESS); 611 if (Status == STATUS_SUCCESS) 612 { 613 do 614 { 615 Status = vboxVidPnPopulateMonitorSourceModeInfoFromLegacy(pDevExt, 616 pMonitorSMI, 617 pResolution, 618 enmOrigin, 619 bPreferred); 620 Assert(Status == STATUS_SUCCESS); 621 if (Status == STATUS_SUCCESS) 622 { 623 Status = pMonitorSMSIf->pfnAddMode(hMonitorSMS, pMonitorSMI); 624 Assert(Status == STATUS_SUCCESS); 625 if (Status == STATUS_SUCCESS) 626 break; 627 drprintf((__FUNCTION__": pfnAddMode failed, Status(0x%x)", Status)); 628 } 629 else 630 drprintf((__FUNCTION__": vboxVidPnPopulateMonitorSourceModeInfoFromLegacy failed, Status(0x%x)", Status)); 631 632 Assert (Status != STATUS_SUCCESS); 633 /* we're here because of a failure */ 634 NTSTATUS tmpStatus = pMonitorSMSIf->pfnReleaseModeInfo(hMonitorSMS, pMonitorSMI); 635 Assert(tmpStatus == STATUS_SUCCESS); 636 if (tmpStatus != STATUS_SUCCESS) 637 drprintf((__FUNCTION__": pfnReleaseModeInfo failed tmpStatus(0x%x)\n", tmpStatus)); 638 } while (0); 639 } 640 else 641 drprintf((__FUNCTION__": pfnCreateNewModeInfo failed, Status(0x%x)", Status)); 642 643 return Status; 644 } 645 601 646 NTSTATUS vboxVidPnPopulateTargetModeInfoFromLegacy(D3DKMDT_VIDPN_TARGET_MODE *pNewVidPnTargetModeInfo, 602 647 D3DKMDT_2DREGION *pResolution, … … 753 798 } 754 799 800 typedef struct VBOXVIDPNCHECKADDMONITORMODES 801 { 802 NTSTATUS Status; 803 D3DKMDT_2DREGION *pResolutions; 804 uint32_t cResolutions; 805 } VBOXVIDPNCHECKADDMONITORMODES, *PVBOXVIDPNCHECKADDMONITORMODES; 806 807 static DECLCALLBACK(BOOLEAN) vboxVidPnCheckAddMonitorModesEnum(struct _DEVICE_EXTENSION* pDevExt, D3DKMDT_HMONITORSOURCEMODESET hMonitorSMS, CONST DXGK_MONITORSOURCEMODESET_INTERFACE *pMonitorSMSIf, 808 CONST D3DKMDT_MONITOR_SOURCE_MODE *pMonitorSMI, PVOID pContext) 809 { 810 PVBOXVIDPNCHECKADDMONITORMODES pData = (PVBOXVIDPNCHECKADDMONITORMODES)pContext; 811 NTSTATUS Status = STATUS_SUCCESS; 812 813 for (uint32_t i = 0; i < pData->cResolutions; ++i) 814 { 815 D3DKMDT_VIDPN_TARGET_MODE dummyMode = {0}; 816 Status = vboxVidPnPopulateTargetModeInfoFromLegacy(&dummyMode, &pData->pResolutions[i], FALSE); 817 Assert(Status == STATUS_SUCCESS); 818 if (Status == STATUS_SUCCESS) 819 { 820 if (vboxVidPnMatchVideoSignal(&dummyMode.VideoSignalInfo, &pMonitorSMI->VideoSignalInfo)) 821 { 822 /* mark it as unneened */ 823 pData->pResolutions[i].cx = 0; 824 break; 825 } 826 } 827 else 828 { 829 drprintf((__FUNCTION__": vboxVidPnPopulateTargetModeInfoFromLegacy failed Status(0x%x)\n", Status)); 830 break; 831 } 832 } 833 834 pMonitorSMSIf->pfnReleaseModeInfo(hMonitorSMS, pMonitorSMI); 835 836 pData->Status = Status; 837 838 return Status == STATUS_SUCCESS; 839 } 840 841 NTSTATUS vboxVidPnCheckAddMonitorModes(PDEVICE_EXTENSION pDevExt, D3DDDI_VIDEO_PRESENT_TARGET_ID targetId, D3DKMDT_MONITOR_CAPABILITIES_ORIGIN enmOrigin, D3DKMDT_2DREGION *pResolutions, uint32_t cResolutions) 842 { 843 NTSTATUS Status; 844 D3DKMDT_2DREGION *pResolutionsCopy = (D3DKMDT_2DREGION*)vboxWddmMemAlloc(cResolutions * sizeof (D3DKMDT_2DREGION)); 845 if (pResolutionsCopy) 846 { 847 memcpy(pResolutionsCopy, pResolutions, cResolutions * sizeof (D3DKMDT_2DREGION)); 848 CONST DXGK_MONITOR_INTERFACE *pMonitorInterface; 849 Status = pDevExt->u.primary.DxgkInterface.DxgkCbQueryMonitorInterface(pDevExt->u.primary.DxgkInterface.DeviceHandle, DXGK_MONITOR_INTERFACE_VERSION_V1, &pMonitorInterface); 850 Assert(Status == STATUS_SUCCESS); 851 if (Status == STATUS_SUCCESS) 852 { 853 D3DKMDT_HMONITORSOURCEMODESET hMonitorSMS; 854 CONST DXGK_MONITORSOURCEMODESET_INTERFACE *pMonitorSMSIf; 855 Status = pMonitorInterface->pfnAcquireMonitorSourceModeSet(pDevExt->u.primary.DxgkInterface.DeviceHandle, 856 targetId, 857 &hMonitorSMS, 858 &pMonitorSMSIf); 859 Assert(Status == STATUS_SUCCESS); 860 if (Status == STATUS_SUCCESS) 861 { 862 VBOXVIDPNCHECKADDMONITORMODES EnumData = {0}; 863 EnumData.cResolutions = cResolutions; 864 EnumData.pResolutions = pResolutionsCopy; 865 Status = vboxVidPnEnumMonitorSourceModes(pDevExt, hMonitorSMS, pMonitorSMSIf, 866 vboxVidPnCheckAddMonitorModesEnum, &EnumData); 867 Assert(Status == STATUS_SUCCESS); 868 if (Status == STATUS_SUCCESS) 869 { 870 Assert(EnumData.Status == STATUS_SUCCESS); 871 if (EnumData.Status == STATUS_SUCCESS) 872 { 873 for (uint32_t i = 0; i < cResolutions; ++i) 874 { 875 D3DKMDT_2DREGION *pRes = &pResolutionsCopy[i]; 876 if (pRes->cx) 877 { 878 Status = vboxVidPnCreatePopulateMonitorSourceModeInfoFromLegacy(pDevExt, 879 hMonitorSMS, 880 pMonitorSMSIf, 881 pRes, 882 enmOrigin, 883 FALSE); 884 Assert(Status == STATUS_SUCCESS); 885 if (Status != STATUS_SUCCESS) 886 { 887 drprintf((__FUNCTION__": vboxVidPnCreatePopulateMonitorSourceModeInfoFromLegacy failed Status(0x%x)\n", Status)); 888 break; 889 } 890 } 891 } 892 } 893 } 894 895 NTSTATUS tmpStatus = pMonitorInterface->pfnReleaseMonitorSourceModeSet(pDevExt->u.primary.DxgkInterface.DeviceHandle, hMonitorSMS); 896 Assert(tmpStatus == STATUS_SUCCESS); 897 if (tmpStatus != STATUS_SUCCESS) 898 drprintf((__FUNCTION__": pfnReleaseMonitorSourceModeSet failed tmpStatus(0x%x)\n", tmpStatus)); 899 } 900 else 901 drprintf((__FUNCTION__": pfnAcquireMonitorSourceModeSet failed Status(0x%x)\n", Status)); 902 } 903 else 904 drprintf((__FUNCTION__": DxgkCbQueryMonitorInterface failed Status(0x%x)\n", Status)); 905 } 906 else 907 { 908 drprintf((__FUNCTION__": failed to allocate resolution copy of size (%d)\n", cResolutions)); 909 Status = STATUS_NO_MEMORY; 910 } 911 912 return Status; 913 } 914 755 915 NTSTATUS vboxVidPnCreatePopulateVidPnFromLegacy(PDEVICE_EXTENSION pDevExt, D3DKMDT_HVIDPN hVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface, 756 916 VIDEO_MODE_INFORMATION *pModes, uint32_t cModes, int iPreferredMode, 757 917 D3DKMDT_2DREGION *pResolutions, uint32_t cResolutions) 758 918 { 759 NTSTATUS Status;760 919 D3DKMDT_HVIDPNTOPOLOGY hVidPnTopology; 761 920 const DXGK_VIDPNTOPOLOGY_INTERFACE* pVidPnTopologyInterface; 762 921 VIDEO_MODE_INFORMATION *pPreferredMode = iPreferredMode >= 0 ? &pModes[iPreferredMode] : NULL; 763 Status = pVidPnInterface->pfnGetTopology(hVidPn, &hVidPnTopology, &pVidPnTopologyInterface);922 NTSTATUS Status = pVidPnInterface->pfnGetTopology(hVidPn, &hVidPnTopology, &pVidPnTopologyInterface); 764 923 if (Status == STATUS_SUCCESS) 765 924 { … … 1043 1202 } 1044 1203 1204 NTSTATUS vboxVidPnEnumMonitorSourceModes(PDEVICE_EXTENSION pDevExt, D3DKMDT_HMONITORSOURCEMODESET hMonitorSMS, CONST DXGK_MONITORSOURCEMODESET_INTERFACE *pMonitorSMSIf, 1205 PFNVBOXVIDPNENUMMONITORSOURCEMODES pfnCallback, PVOID pContext) 1206 { 1207 CONST D3DKMDT_MONITOR_SOURCE_MODE *pMonitorSMI; 1208 NTSTATUS Status = pMonitorSMSIf->pfnAcquireFirstModeInfo(hMonitorSMS, &pMonitorSMI); 1209 Assert(Status == STATUS_SUCCESS || Status == STATUS_GRAPHICS_DATASET_IS_EMPTY); 1210 if (Status == STATUS_SUCCESS) 1211 { 1212 Assert(pMonitorSMI); 1213 while (1) 1214 { 1215 CONST D3DKMDT_MONITOR_SOURCE_MODE *pNextMonitorSMI; 1216 Status = pMonitorSMSIf->pfnAcquireNextModeInfo(hMonitorSMS, pMonitorSMI, &pNextMonitorSMI); 1217 if (!pfnCallback(pDevExt, hMonitorSMS, pMonitorSMSIf, pMonitorSMI, pContext)) 1218 { 1219 Assert(Status == STATUS_SUCCESS || Status == STATUS_GRAPHICS_NO_MORE_ELEMENTS_IN_DATASET); 1220 if (Status == STATUS_SUCCESS) 1221 pMonitorSMSIf->pfnReleaseModeInfo(hMonitorSMS, pNextMonitorSMI); 1222 else if (Status == STATUS_GRAPHICS_NO_MORE_ELEMENTS_IN_DATASET) 1223 { 1224 Status = STATUS_SUCCESS; 1225 break; 1226 } 1227 else 1228 { 1229 drprintf((__FUNCTION__": pfnAcquireNextModeInfo Failed Status(0x%x), ignored since callback returned false\n", Status)); 1230 Status = STATUS_SUCCESS; 1231 } 1232 break; 1233 } 1234 else if (Status == STATUS_SUCCESS) 1235 pMonitorSMI = pNextMonitorSMI; 1236 else if (Status == STATUS_GRAPHICS_NO_MORE_ELEMENTS_IN_DATASET) 1237 { 1238 Status = STATUS_SUCCESS; 1239 break; 1240 } 1241 else 1242 { 1243 AssertBreakpoint(); 1244 drprintf((__FUNCTION__": pfnAcquireNextModeInfo Failed Status(0x%x)\n", Status)); 1245 pNextMonitorSMI = NULL; 1246 break; 1247 } 1248 } 1249 } 1250 else if (Status == STATUS_GRAPHICS_DATASET_IS_EMPTY) 1251 Status = STATUS_SUCCESS; 1252 else 1253 drprintf((__FUNCTION__": pfnAcquireFirstModeInfo failed Status(0x%x)\n", Status)); 1254 1255 return Status; 1256 } 1045 1257 1046 1258 NTSTATUS vboxVidPnEnumSourceModes(PDEVICE_EXTENSION pDevExt, const D3DKMDT_HVIDPN hDesiredVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface, … … 1079 1291 else if (Status == STATUS_SUCCESS) 1080 1292 pNewVidPnSourceModeInfo = pNextVidPnSourceModeInfo; 1293 else if (Status == STATUS_GRAPHICS_NO_MORE_ELEMENTS_IN_DATASET) 1294 { 1295 Status = STATUS_SUCCESS; 1296 break; 1297 } 1081 1298 else 1082 1299 { … … 1131 1348 else if (Status == STATUS_SUCCESS) 1132 1349 pNewVidPnTargetModeInfo = pNextVidPnTargetModeInfo; 1350 else if (Status == STATUS_GRAPHICS_NO_MORE_ELEMENTS_IN_DATASET) 1351 { 1352 Status = STATUS_SUCCESS; 1353 break; 1354 } 1133 1355 else 1134 1356 { -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoVidPn.h
r27984 r27997 76 76 typedef FNVBOXVIDPNENUMTARGETMODES *PFNVBOXVIDPNENUMTARGETMODES; 77 77 78 /* !!!NOTE: The callback is responsible for releasing the source mode info */ 79 typedef DECLCALLBACK(BOOLEAN) FNVBOXVIDPNENUMMONITORSOURCEMODES(struct _DEVICE_EXTENSION* pDevExt, D3DKMDT_HMONITORSOURCEMODESET hMonitorSMS, CONST DXGK_MONITORSOURCEMODESET_INTERFACE *pMonitorSMSIf, 80 CONST D3DKMDT_MONITOR_SOURCE_MODE *pMonitorSMI, PVOID pContext); 81 typedef FNVBOXVIDPNENUMMONITORSOURCEMODES *PFNVBOXVIDPNENUMMONITORSOURCEMODES; 82 78 83 79 84 DECLCALLBACK(BOOLEAN) vboxVidPnCofuncModalityPathEnum(struct _DEVICE_EXTENSION* pDevExt, const D3DKMDT_HVIDPN hDesiredVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface, … … 107 112 PFNVBOXVIDPNENUMTARGETMODES pfnCallback, PVOID pContext); 108 113 114 NTSTATUS vboxVidPnEnumMonitorSourceModes(struct _DEVICE_EXTENSION* pDevExt, D3DKMDT_HMONITORSOURCEMODESET hMonitorSMS, CONST DXGK_MONITORSOURCEMODESET_INTERFACE *pMonitorSMSIf, 115 PFNVBOXVIDPNENUMMONITORSOURCEMODES pfnCallback, PVOID pContext); 116 109 117 NTSTATUS vboxVidPnPopulateMonitorSourceModeInfoFromLegacy(struct _DEVICE_EXTENSION* pDevExt, 110 118 D3DKMDT_MONITOR_SOURCE_MODE *pMonitorSourceMode, … … 117 125 D3DKMDT_2DREGION *pResolutions, uint32_t cResolutions); 118 126 127 NTSTATUS vboxVidPnCheckAddMonitorModes(struct _DEVICE_EXTENSION* pDevExt, D3DDDI_VIDEO_PRESENT_TARGET_ID targetId, D3DKMDT_MONITOR_CAPABILITIES_ORIGIN enmOrigin, D3DKMDT_2DREGION *pResolutions, uint32_t cResolutions); 119 128 #endif /* #ifndef ___VBoxVideoVidPn_h___ */ -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoWddm.cpp
r27988 r27997 2463 2463 if (Status == STATUS_SUCCESS) 2464 2464 { 2465 const DXGK_VIDPN_INTERFACE* pVidPnInterface = NULL; 2466 Status = pDevExt->u.primary.DxgkInterface.DxgkCbQueryVidPnInterface(pRecommendFunctionalVidPnArg->hRecommendedFunctionalVidPn, DXGK_VIDPN_INTERFACE_VERSION_V1, &pVidPnInterface); 2467 Assert(Status == STATUS_SUCCESS); 2468 if (Status == STATUS_SUCCESS) 2469 { 2470 Assert (iPreferredModeInfo >= 0); 2471 Status = vboxVidPnCreatePopulateVidPnFromLegacy(pDevExt, pRecommendFunctionalVidPnArg->hRecommendedFunctionalVidPn, pVidPnInterface, 2472 pModeInfos, cModeInfos, iPreferredModeInfo, 2473 &Resolution, 1); 2465 for (uint32_t i = 0; i < pDevExt->cSources; ++i) 2466 { 2467 Status = vboxVidPnCheckAddMonitorModes(pDevExt, i, D3DKMDT_MCO_DRIVER, pResolutions, cResolutions); 2474 2468 Assert(Status == STATUS_SUCCESS); 2475 2469 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)); 2470 { 2471 drprintf((__FUNCTION__": vboxVidPnCheckAddMonitorModes failed Status(0x%x)\n", Status)); 2472 break; 2473 } 2474 } 2475 2476 if (Status == STATUS_SUCCESS) 2477 { 2478 const DXGK_VIDPN_INTERFACE* pVidPnInterface = NULL; 2479 Status = pDevExt->u.primary.DxgkInterface.DxgkCbQueryVidPnInterface(pRecommendFunctionalVidPnArg->hRecommendedFunctionalVidPn, DXGK_VIDPN_INTERFACE_VERSION_V1, &pVidPnInterface); 2480 Assert(Status == STATUS_SUCCESS); 2481 if (Status == STATUS_SUCCESS) 2482 { 2483 Assert (iPreferredModeInfo >= 0); 2484 Status = vboxVidPnCreatePopulateVidPnFromLegacy(pDevExt, pRecommendFunctionalVidPnArg->hRecommendedFunctionalVidPn, pVidPnInterface, 2485 pModeInfos, cModeInfos, iPreferredModeInfo, 2486 &Resolution, 1); 2487 Assert(Status == STATUS_SUCCESS); 2488 if (Status != STATUS_SUCCESS) 2489 drprintf((__FUNCTION__": vboxVidPnCreatePopulateVidPnFromLegacy failed Status(0x%x)\n", Status)); 2490 } 2491 else 2492 drprintf((__FUNCTION__": DxgkCbQueryVidPnInterface failed Status(0x%x)\n", Status)); 2493 } 2480 2494 } 2481 2495 -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoWddm.h
r27606 r27997 26 26 27 27 #define VBOXWDDM_ROUNDBOUND(_v, _b) (((_v) + ((_b) - 1)) & ~((_b) - 1)) 28 29 PVOID vboxWddmMemAlloc(IN SIZE_T cbSize); 30 PVOID vboxWddmMemAllocZero(IN SIZE_T cbSize); 31 VOID vboxWddmMemFree(PVOID pvMem); 28 32 29 33 typedef enum
Note:
See TracChangeset
for help on using the changeset viewer.