- Timestamp:
- Jun 16, 2011 10:58:27 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/VBoxVideo.h
r36882 r37490 1097 1097 VBOXVDMACMD_TYPE_DMA_PRESENT_FLIP, 1098 1098 VBOXVDMACMD_TYPE_DMA_NOP, 1099 VBOXVDMACMD_TYPE_CHROMIUM_CMD, 1100 VBOXVDMACMD_TYPE_DMA_BPB_TRANSFER_VRAMSYS 1099 VBOXVDMACMD_TYPE_CHROMIUM_CMD, /* chromium cmd */ 1100 VBOXVDMACMD_TYPE_DMA_BPB_TRANSFER_VRAMSYS, 1101 VBOXVDMACMD_TYPE_CHILD_STATUS_IRQ /* make the device notify child (monitor) state change IRQ */ 1101 1102 } VBOXVDMACMD_TYPE; 1102 1103 … … 1340 1341 } VBOXVDMACMD_DMA_BPB_FILL, *PVBOXVDMACMD_DMA_BPB_FILL; 1341 1342 1343 #define VBOXVDMA_CHILD_STATUS_F_CONNECTED 0x01 1344 #define VBOXVDMA_CHILD_STATUS_F_DISCONNECTED 0x02 1345 #define VBOXVDMA_CHILD_STATUS_F_ROTATED 0x04 1346 1347 typedef struct VBOXVDMA_CHILD_STATUS 1348 { 1349 uint32_t iChild; 1350 uint8_t fFlags; 1351 uint8_t u8RotationAngle; 1352 uint16_t u16Reserved; 1353 } VBOXVDMA_CHILD_STATUS, *PVBOXVDMA_CHILD_STATUS; 1354 1355 /* apply the aInfos are applied to all targets, the iTarget is ignored */ 1356 #define VBOXVDMACMD_CHILD_STATUS_IRQ_F_APPLY_TO_ALL 0x00000001 1357 1358 typedef struct VBOXVDMACMD_CHILD_STATUS_IRQ 1359 { 1360 uint32_t cInfos; 1361 uint32_t fFlags; 1362 VBOXVDMA_CHILD_STATUS aInfos[1]; 1363 } VBOXVDMACMD_CHILD_STATUS_IRQ, *PVBOXVDMACMD_CHILD_STATUS_IRQ; 1364 1342 1365 # pragma pack() 1343 1366 #endif /* #ifdef VBOX_WITH_VDMA */ -
trunk/src/VBox/Additions/WINNT/Graphics/Video/common/VBoxVideoLog.h
r37207 r37490 44 44 #endif 45 45 46 #define _LOGMSG_EXACT(_logger, _a) \ 47 do \ 48 { \ 49 _logger(_a); \ 50 } while (0) 51 46 52 #define _LOGMSG(_logger, _a) \ 47 53 do \ … … 66 72 #define LOGF_ENTER() LOGF(("ENTER")) 67 73 #define LOGF_LEAVE() LOGF(("LEAVE")) 74 #define LOGREL_EXACT(_a) _LOGMSG_EXACT(Log, _a) 68 75 69 76 #endif /*VBOXVIDEOLOG_H*/ -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/common/VBoxMPVidModes.cpp
r37423 r37490 25 25 #include <wchar.h> 26 26 27 #ifdef VBOX_WITH_WDDM 28 # define VBOX_WITHOUT_24BPP_MODES 29 #endif 30 27 31 /* Custom video modes which are being read from registry at driver startup. */ 28 32 static VIDEO_MODE_INFORMATION g_CustomVideoModes[64] = { 0 }; … … 36 40 /* Number of available video modes, set by VBoxMPCmnBuildVideoModesTable. */ 37 41 static uint32_t g_NumVideoModes = 0; 42 43 static BOOLEAN 44 VBoxMPValidateVideoModeParamsGuest(PVBOXMP_DEVEXT pExt, uint32_t iDisplay, uint32_t xres, uint32_t yres, uint32_t bpp) 45 { 46 switch (bpp) 47 { 48 case 32: 49 break; 50 case 24: 51 #ifdef VBOX_WITHOUT_24BPP_MODES 52 return FALSE; 53 #else 54 break; 55 #endif 56 case 16: 57 break; 58 case 8: 59 #ifndef VBOX_WITH_8BPP_MODES 60 return FALSE; 61 #else 62 break; 63 #endif 64 default: 65 WARN(("Unexpected bpp (%d)", bpp)); 66 return FALSE; 67 } 68 return TRUE; 69 } 38 70 39 71 /* Fills given video mode BPP related fields */ … … 161 193 } 162 194 163 VBoxFillVidModeInfo(&g_CustomVideoModes[iMode], CustomXRes, CustomYRes, CustomBPP, 0, 0); 195 if (VBoxMPValidateVideoModeParamsGuest(pExt, iMode, CustomXRes, CustomYRes, CustomBPP)) 196 { 197 VBoxFillVidModeInfo(&g_CustomVideoModes[iMode], CustomXRes, CustomYRes, CustomBPP, 0, 0); 198 } 164 199 } 165 200 } … … 271 306 } 272 307 308 if (!VBoxMPValidateVideoModeParamsGuest(pExt, iMode, 800, 600, bitsPerPixel)) 309 continue; 310 273 311 VBoxFillVidModeInfo(&pModesTable[iMode], 800, 600, bitsPerPixel, iMode+1, 0); 274 312 … … 311 349 { 312 350 /* host doesn't like this mode */ 351 continue; 352 } 353 354 if (!VBoxMPValidateVideoModeParamsGuest(pExt, iDisplay, resolutionMatrix[resIndex].xRes, resolutionMatrix[resIndex].yRes, bitsPerPixel)) 355 { 356 /* guest does not like this mode */ 313 357 continue; 314 358 } … … 389 433 /* host doesn't like this mode */ 390 434 break; 435 } 436 437 if (!VBoxMPValidateVideoModeParamsGuest(pExt, iDisplay, xres, yres, bpp)) 438 { 439 /* guest does not like this mode */ 440 continue; 391 441 } 392 442 … … 479 529 bpp=32; 480 530 } 531 532 if (!VBoxMPValidateVideoModeParamsGuest(pExt, iDisplay, xres, yres, bpp)) 533 return FALSE; 481 534 482 535 /* Check if host likes this mode */ … … 767 820 static VBOXWDDM_VIDEOMODES_INFO g_aVBoxVideoModeInfos[VBOX_VIDEO_MAX_SCREENS] = {0}; 768 821 769 bool VBoxWddmFillMode( VIDEO_MODE_INFORMATION *pInfo, D3DDDIFORMAT enmFormat, ULONG w, ULONG h)822 bool VBoxWddmFillMode(PVBOXMP_DEVEXT pExt, uint32_t iDisplay, VIDEO_MODE_INFORMATION *pInfo, D3DDDIFORMAT enmFormat, ULONG w, ULONG h) 770 823 { 771 824 switch (enmFormat) 772 825 { 773 826 case D3DDDIFMT_A8R8G8B8: 827 if (!VBoxMPValidateVideoModeParamsGuest(pExt, iDisplay, w, h, 32)) 828 { 829 WARN(("unsupported mode info for format(%d)", enmFormat)); 830 return false; 831 } 774 832 VBoxFillVidModeInfo(pInfo, w, h, 32, 0, 0); 775 833 return true; 776 834 case D3DDDIFMT_R8G8B8: 835 if (!VBoxMPValidateVideoModeParamsGuest(pExt, iDisplay, w, h, 24)) 836 { 837 WARN(("unsupported mode info for format(%d)", enmFormat)); 838 return false; 839 } 777 840 VBoxFillVidModeInfo(pInfo, w, h, 24, 0, 0); 778 841 return true; 779 842 case D3DDDIFMT_R5G6B5: 843 if (!VBoxMPValidateVideoModeParamsGuest(pExt, iDisplay, w, h, 16)) 844 { 845 WARN(("unsupported mode info for format(%d)", enmFormat)); 846 return false; 847 } 780 848 VBoxFillVidModeInfo(pInfo, w, h, 16, 0, 0); 781 849 return true; 782 850 case D3DDDIFMT_P8: 851 if (!VBoxMPValidateVideoModeParamsGuest(pExt, iDisplay, w, h, 8)) 852 { 853 WARN(("unsupported mode info for format(%d)", enmFormat)); 854 return false; 855 } 783 856 VBoxFillVidModeInfo(pInfo, w, h, 8, 0, 0); 784 857 return true; … … 793 866 794 867 static void 795 VBoxWddmBuildResolutionTable(PVIDEO_MODE_INFORMATION pModesTable, size_t tableSize, 796 SIZE *pResolutions, uint32_t * pcResolutions )868 VBoxWddmBuildResolutionTable(PVIDEO_MODE_INFORMATION pModesTable, size_t tableSize, int iPreferredMode, 869 SIZE *pResolutions, uint32_t * pcResolutions, int *piPreferredResolution) 797 870 { 798 871 uint32_t cResolutionsArray = *pcResolutions; 799 872 uint32_t cResolutions = 0; 800 873 874 *piPreferredResolution = -1; 875 801 876 for (uint32_t i=0; i<tableSize; ++i) 802 877 { 803 878 PVIDEO_MODE_INFORMATION pMode = &pModesTable[i]; 804 BOOLEAN bFound = FALSE;879 int iResolution = -1; 805 880 806 881 for (uint32_t j=0; j<cResolutions; ++j) … … 809 884 && pResolutions[j].cy == pMode->VisScreenHeight) 810 885 { 811 bFound = TRUE;886 iResolution = j; 812 887 break; 813 888 } 814 889 } 815 890 816 if ( !bFound)891 if (iResolution < 0) 817 892 { 818 893 if (cResolutions == cResolutionsArray) … … 822 897 } 823 898 899 iResolution = cResolutions; 824 900 pResolutions[cResolutions].cx = pMode->VisScreenWidth; 825 901 pResolutions[cResolutions].cy = pMode->VisScreenHeight; 826 902 ++cResolutions; 827 903 } 904 905 Assert(iResolution >= 0); 906 if (i == iPreferredMode) 907 { 908 Assert(*piPreferredResolution == -1); 909 *piPreferredResolution = iResolution; 910 } 828 911 } 829 912 830 913 *pcResolutions = cResolutions; 914 Assert(*piPreferredResolution >= 0); 915 } 916 917 static void VBoxWddmBuildResolutionTableForModes(PVBOXWDDM_VIDEOMODES_INFO pModes) 918 { 919 pModes->cResolutions = RT_ELEMENTS(pModes->aResolutions); 920 VBoxWddmBuildResolutionTable(pModes->aModes, pModes->cModes, pModes->iPreferredMode, 921 (SIZE*)((void*)pModes->aResolutions), &pModes->cResolutions, &pModes->iPreferredResolution); 922 Assert(pModes->aResolutions[pModes->iPreferredResolution].cx == pModes->aModes[pModes->iPreferredMode].VisScreenWidth 923 && pModes->aResolutions[pModes->iPreferredResolution].cy == pModes->aModes[pModes->iPreferredMode].VisScreenHeight); 831 924 } 832 925 … … 913 1006 AssertRelease(RT_ELEMENTS(pModes->aModes) > pModes->cModes); /* if not - the driver state is screwed up, @todo: better do KeBugCheckEx here */ 914 1007 915 if (pModes->aModes[pModes->iPreferredMode].BitsPerPlane != bpp) 916 { 917 VBoxFillVidModeInfo(&pModes->aModes[pModes->cModes], 1008 if (pModes->aModes[pModes->iPreferredMode].BitsPerPlane == bpp) 1009 continue; 1010 1011 if (!VBoxMPValidateVideoModeParamsGuest(pExt, VidPnTargetId, 1012 pModes->aModes[pModes->iPreferredMode].VisScreenWidth, 1013 pModes->aModes[pModes->iPreferredMode].VisScreenHeight, 1014 bpp)) 1015 continue; 1016 1017 VBoxFillVidModeInfo(&pModes->aModes[pModes->cModes], 918 1018 pModes->aModes[pModes->iPreferredMode].VisScreenWidth, 919 1019 pModes->aModes[pModes->iPreferredMode].VisScreenHeight, 920 1020 bpp, pModes->cModes, 0); 921 if (VBoxMPFindVideoMode(pModes->aModes, pModes->cModes, &pModes->aModes[pModes->cModes]) < 0) 922 { 923 ++pModes->cModes; 924 } 1021 if (VBoxMPFindVideoMode(pModes->aModes, pModes->cModes, &pModes->aModes[pModes->cModes]) < 0) 1022 { 1023 ++pModes->cModes; 925 1024 } 926 1025 } … … 973 1072 } 974 1073 975 pModes->cPrevModes = pModes->cModes;976 977 1074 /* Build resolution table */ 978 VBoxWddmBuildResolutionTable (pModes->aModes, pModes->cModes, (SIZE*)((void*)pModes->aResolutions), &pModes->cResolutions);1075 VBoxWddmBuildResolutionTableForModes(pModes); 979 1076 } 980 1077 … … 1023 1120 if (enmFormat != D3DDDIFMT_UNKNOWN) 1024 1121 { 1025 if (VBoxWddmFillMode( &ModeInfo, enmFormat, pScreenInfo->Width, pScreenInfo->Height))1122 if (VBoxWddmFillMode(pExt, pScreenInfo->Id, &ModeInfo, enmFormat, pScreenInfo->Width, pScreenInfo->Height)) 1026 1123 { 1027 1124 VBoxWddmBuildVideoModesInfo(pExt, pScreenInfo->Id, pInfo, &ModeInfo, 1); … … 1074 1171 } 1075 1172 1173 static PVBOXWDDM_VIDEOMODES_INFO vboxWddmGetVideoModesInfoInternal(PVBOXMP_DEVEXT pExt, D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId) 1174 { 1175 Assert(VidPnTargetId < (D3DDDI_VIDEO_PRESENT_TARGET_ID)VBoxCommonFromDeviceExt(pExt)->cDisplays); 1176 if (VidPnTargetId >= (D3DDDI_VIDEO_PRESENT_TARGET_ID)VBoxCommonFromDeviceExt(pExt)->cDisplays) 1177 { 1178 return NULL; 1179 } 1180 1181 PVBOXWDDM_VIDEOMODES_INFO pInfo = &g_aVBoxVideoModeInfos[VidPnTargetId]; 1182 1183 if (!pInfo->cModes) 1184 { 1185 VBoxWddmBuildVideoModesInfo(pExt, VidPnTargetId, pInfo, NULL, 0); 1186 Assert(pInfo->cModes); 1187 } 1188 1189 return pInfo; 1190 } 1191 1192 static VOID vboxWddmAddVideoModes(PVBOXMP_DEVEXT pExt, PVBOXWDDM_VIDEOMODES_INFO pDstInfo, PVBOXWDDM_VIDEOMODES_INFO pSrcInfo) 1193 { 1194 for (int i = 0; i < (int)pSrcInfo->cModes; ++i) 1195 { 1196 int foundIdx = VBoxMPFindVideoMode(pDstInfo->aModes, pDstInfo->cModes, &pSrcInfo->aModes[i]); 1197 if (foundIdx >= 0) 1198 continue; 1199 1200 Assert(0); 1201 pDstInfo->aModes[pDstInfo->cModes] = pSrcInfo->aModes[i]; 1202 ++pDstInfo->cModes; 1203 } 1204 1205 VBoxWddmBuildResolutionTableForModes(pDstInfo); 1206 } 1207 1076 1208 PVBOXWDDM_VIDEOMODES_INFO VBoxWddmGetAllVideoModesInfos(PVBOXMP_DEVEXT pExt) 1077 1209 { … … 1079 1211 for (int i = 0; i < VBoxCommonFromDeviceExt(pExt)->cDisplays; ++i) 1080 1212 { 1081 VBoxWddmGetVideoModesInfo(pExt, (D3DDDI_VIDEO_PRESENT_TARGET_ID)i);1213 vboxWddmGetVideoModesInfoInternal(pExt, (D3DDDI_VIDEO_PRESENT_TARGET_ID)i); 1082 1214 } 1083 1215 … … 1087 1219 PVBOXWDDM_VIDEOMODES_INFO VBoxWddmGetVideoModesInfo(PVBOXMP_DEVEXT pExt, D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId) 1088 1220 { 1089 Assert(VidPnTargetId < (D3DDDI_VIDEO_PRESENT_TARGET_ID)VBoxCommonFromDeviceExt(pExt)->cDisplays); 1090 if (VidPnTargetId >= (D3DDDI_VIDEO_PRESENT_TARGET_ID)VBoxCommonFromDeviceExt(pExt)->cDisplays) 1091 { 1092 return NULL; 1093 } 1094 1095 PVBOXWDDM_VIDEOMODES_INFO pInfo = &g_aVBoxVideoModeInfos[VidPnTargetId]; 1096 1097 if (!pInfo->cModes) 1098 { 1099 VBoxWddmBuildVideoModesInfo(pExt, VidPnTargetId, pInfo, NULL, 0); 1100 Assert(pInfo->cModes); 1101 } 1102 1103 return pInfo; 1221 return &VBoxWddmGetAllVideoModesInfos(pExt)[VidPnTargetId]; 1104 1222 } 1105 1223 -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPCm.cpp
r36867 r37490 225 225 static void vboxVideoCmSessionDestroy(PVBOXVIDEOCM_SESSION pSession) 226 226 { 227 /* signal event so that user-space client can figure out the context is destroyed 228 * in case the context destroyal is caused by Graphics device reset or miniport driver update */ 229 KeSetEvent(pSession->pUmEvent, 0, FALSE); 227 230 ObDereferenceObject(pSession->pUmEvent); 228 231 Assert(IsListEmpty(&pSession->ContextList)); -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPMisc.cpp
r37300 r37490 1180 1180 static DECLCALLBACK(VOID) vboxVideoAMgrAllocSubmitCompletion(PVBOXMP_DEVEXT pDevExt, PVBOXVDMADDI_CMD pCmd, PVOID pvContext) 1181 1181 { 1182 /* we should be called from our DPC routine */ 1183 Assert(KeGetCurrentIrql() == DISPATCH_LEVEL); 1184 1182 1185 PVBOXVDMACBUF_DR pDr = (PVBOXVDMACBUF_DR)pvContext; 1183 1186 PVBOXVDMACMD pHdr = VBOXVDMACBUF_DR_TAIL(pDr, VBOXVDMACMD); … … 1215 1218 } 1216 1219 1220 /* submits a set of chromium uhgsmi buffers to host for processing */ 1217 1221 NTSTATUS vboxVideoAMgrCtxAllocSubmit(PVBOXMP_DEVEXT pDevExt, PVBOXVIDEOCM_ALLOC_CONTEXT pContext, UINT cBuffers, VBOXWDDM_UHGSMI_BUFFER_UI_INFO_ESCAPE *paBuffers) 1218 1222 { … … 1257 1261 PVBOXVDMADDI_CMD pDdiCmd = VBOXVDMADDI_CMD_FROM_BUF_DR(pDr); 1258 1262 vboxVdmaDdiCmdInit(pDdiCmd, 0, NULL, vboxVideoAMgrAllocSubmitCompletion, pDr); 1263 /* mark command as submitted & invisible for the dx runtime since dx did not originate it */ 1259 1264 vboxVdmaDdiCmdSubmittedNotDx(pDdiCmd); 1260 1265 int rc = vboxVdmaCBufDrSubmit(pDevExt, &pDevExt->u.primary.Vdma, pDr); -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPTypes.h
r37300 r37490 258 258 int32_t iPreferredMode; 259 259 uint32_t cModes; 260 uint32_t cPrevModes;261 260 VIDEO_MODE_INFORMATION aModes[VBOXWDDM_MAX_VIDEOMODES]; 261 int32_t iPreferredResolution; 262 262 uint32_t cResolutions; 263 263 D3DKMDT_2DREGION aResolutions[VBOXWDDM_MAX_VIDEOMODES]; -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVdma.h
r36867 r37490 78 78 } 79 79 80 /* marks the command a submitted in a way that it is invisible for dx runtime, 81 * i.e. the dx runtime won't be notified about the command completion 82 * this is used to submit commands initiated by the driver, but not by the dx runtime */ 80 83 DECLINLINE(VOID) vboxVdmaDdiCmdSubmittedNotDx(PVBOXVDMADDI_CMD pCmd) 81 84 { -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVidPn.cpp
r37207 r37490 395 395 pMonitorSourceMode->ColorCoeffDynamicRanges.FourthChannel = 0; 396 396 pMonitorSourceMode->Origin = enmOrigin; 397 Assert(!bPreferred); 398 // pMonitorSourceMode->Preference = bPreferred ? D3DKMDT_MP_PREFERRED : D3DKMDT_MP_NOTPREFERRED; 399 pMonitorSourceMode->Preference = D3DKMDT_MP_PREFERRED; 397 pMonitorSourceMode->Preference = bPreferred ? D3DKMDT_MP_PREFERRED : D3DKMDT_MP_NOTPREFERRED; 400 398 } 401 399 … … 451 449 } 452 450 453 NTSTATUS vboxVidPnPopulateTargetModeInfoFromLegacy(D3DKMDT_VIDPN_TARGET_MODE *pNewVidPnTargetModeInfo, D3DKMDT_2DREGION *pResolution )454 { 455 pNewVidPnTargetModeInfo->Preference = D3DKMDT_MP_NOTPREFERRED;451 NTSTATUS vboxVidPnPopulateTargetModeInfoFromLegacy(D3DKMDT_VIDPN_TARGET_MODE *pNewVidPnTargetModeInfo, D3DKMDT_2DREGION *pResolution, BOOLEAN fPreferred) 452 { 453 pNewVidPnTargetModeInfo->Preference = fPreferred ? D3DKMDT_MP_PREFERRED : D3DKMDT_MP_NOTPREFERRED; 456 454 return vboxVidPnPopulateVideoSignalInfo(&pNewVidPnTargetModeInfo->VideoSignalInfo, pResolution, 60 /* ULONG VSync */); 457 455 } … … 473 471 { 474 472 D3DKMDT_VIDPN_TARGET_MODE dummyMode = {0}; 475 Status = vboxVidPnPopulateTargetModeInfoFromLegacy(&dummyMode, &pData->pResolutions[i] );473 Status = vboxVidPnPopulateTargetModeInfoFromLegacy(&dummyMode, &pData->pResolutions[i], FALSE /* preference does not matter for now */); 476 474 Assert(Status == STATUS_SUCCESS); 477 475 if (Status == STATUS_SUCCESS) … … 525 523 } 526 524 525 typedef struct VBOXVIDPNMATCHMONMODESENUM 526 { 527 D3DKMDT_2DREGION *paResolutions; 528 uint32_t cResolutions; 529 BOOLEAN fMatch; 530 } VBOXVIDPNMATCHMONMODESENUM, *PVBOXVIDPNMATCHMONMODESENUM; 531 532 static DECLCALLBACK(BOOLEAN) vboxFidPnMatchMonitorModesEnum(D3DKMDT_HMONITORSOURCEMODESET hMonitorSMS, CONST DXGK_MONITORSOURCEMODESET_INTERFACE *pMonitorSMSIf, 533 CONST D3DKMDT_MONITOR_SOURCE_MODE *pMonitorSMI, PVOID pContext) 534 { 535 PVBOXVIDPNMATCHMONMODESENUM pInfo = (PVBOXVIDPNMATCHMONMODESENUM)pContext; 536 537 Assert(pInfo->fMatch); 538 539 for (UINT i = 0; i < pInfo->cResolutions; ++i) 540 { 541 D3DKMDT_2DREGION *pResolution = &pInfo->paResolutions[i]; 542 if (pMonitorSMI->VideoSignalInfo.ActiveSize.cx != pResolution->cx 543 || pMonitorSMI->VideoSignalInfo.ActiveSize.cy != pResolution->cy) 544 { 545 pInfo->fMatch = FALSE; 546 break; 547 } 548 } 549 550 pMonitorSMSIf->pfnReleaseModeInfo(hMonitorSMS, pMonitorSMI); 551 552 return pInfo->fMatch; 553 } 554 555 /* matches the monitor mode set for the given target id with the resolution set, and sets the pfMatch to true if they match, otherwise sets it to false */ 556 NTSTATUS vboxVidPnMatchMonitorModes(PVBOXMP_DEVEXT pDevExt, D3DDDI_VIDEO_PRESENT_TARGET_ID targetId, 557 D3DKMDT_2DREGION *pResolutions, uint32_t cResolutions, BOOLEAN *pfMatch) 558 { 559 *pfMatch = FALSE; 560 CONST DXGK_MONITOR_INTERFACE *pMonitorInterface; 561 NTSTATUS Status = pDevExt->u.primary.DxgkInterface.DxgkCbQueryMonitorInterface(pDevExt->u.primary.DxgkInterface.DeviceHandle, DXGK_MONITOR_INTERFACE_VERSION_V1, &pMonitorInterface); 562 if (!NT_SUCCESS(Status)) 563 { 564 WARN(("DxgkCbQueryMonitorInterface failed, Status (0x%x)", Status)); 565 return Status; 566 } 567 568 D3DKMDT_HMONITORSOURCEMODESET hMonitorSMS; 569 CONST DXGK_MONITORSOURCEMODESET_INTERFACE *pMonitorSMSIf; 570 Status = pMonitorInterface->pfnAcquireMonitorSourceModeSet(pDevExt->u.primary.DxgkInterface.DeviceHandle, 571 targetId, 572 &hMonitorSMS, 573 &pMonitorSMSIf); 574 if (!NT_SUCCESS(Status)) 575 { 576 WARN(("pfnAcquireMonitorSourceModeSet failed, Status (0x%x)", Status)); 577 if (Status == STATUS_GRAPHICS_MONITOR_NOT_CONNECTED) 578 { 579 /* this is ok in case we replug the monitor to pick up the monitor modes properly, 580 * so pretend success */ 581 *pfMatch = TRUE; 582 Status = STATUS_SUCCESS; 583 } 584 return Status; 585 } 586 587 VBOXVIDPNMATCHMONMODESENUM Info; 588 Info.paResolutions = pResolutions; 589 Info.cResolutions = cResolutions; 590 Info.fMatch = TRUE; 591 592 Status = vboxVidPnEnumMonitorSourceModes(hMonitorSMS, pMonitorSMSIf, vboxFidPnMatchMonitorModesEnum, &Info); 593 if (NT_SUCCESS(Status)) 594 { 595 *pfMatch = Info.fMatch; 596 } 597 598 NTSTATUS tmpStatus = pMonitorInterface->pfnReleaseMonitorSourceModeSet(pDevExt->u.primary.DxgkInterface.DeviceHandle, hMonitorSMS); 599 if (!NT_SUCCESS(tmpStatus)) 600 WARN(("pfnReleaseMonitorSourceModeSet failed tmpStatus(0x%x)", tmpStatus)); 601 602 return Status; 603 } 604 527 605 NTSTATUS vboxVidPnCheckAddMonitorModes(PVBOXMP_DEVEXT pDevExt, 528 606 D3DDDI_VIDEO_PRESENT_TARGET_ID targetId, D3DKMDT_MONITOR_CAPABILITIES_ORIGIN enmOrigin, 529 D3DKMDT_2DREGION *pResolutions, uint32_t cResolutions )607 D3DKMDT_2DREGION *pResolutions, uint32_t cResolutions, int iPreferred) 530 608 { 531 609 NTSTATUS Status; 532 610 CONST DXGK_MONITOR_INTERFACE *pMonitorInterface; 533 611 Status = pDevExt->u.primary.DxgkInterface.DxgkCbQueryMonitorInterface(pDevExt->u.primary.DxgkInterface.DeviceHandle, DXGK_MONITOR_INTERFACE_VERSION_V1, &pMonitorInterface); 534 Assert(Status == STATUS_SUCCESS); 535 if (Status == STATUS_SUCCESS) 536 { 537 D3DKMDT_HMONITORSOURCEMODESET hMonitorSMS; 538 CONST DXGK_MONITORSOURCEMODESET_INTERFACE *pMonitorSMSIf; 539 Status = pMonitorInterface->pfnAcquireMonitorSourceModeSet(pDevExt->u.primary.DxgkInterface.DeviceHandle, 612 if (!NT_SUCCESS(Status)) 613 { 614 WARN(("DxgkCbQueryMonitorInterface failed, Status()0x%x", Status)); 615 return Status; 616 } 617 618 D3DKMDT_HMONITORSOURCEMODESET hMonitorSMS; 619 CONST DXGK_MONITORSOURCEMODESET_INTERFACE *pMonitorSMSIf; 620 621 Status = pMonitorInterface->pfnAcquireMonitorSourceModeSet(pDevExt->u.primary.DxgkInterface.DeviceHandle, 540 622 targetId, 541 623 &hMonitorSMS, 542 624 &pMonitorSMSIf); 625 if (!NT_SUCCESS(Status)) 626 { 627 WARN(("DxgkCbQueryMonitorInterface failed, Status()0x%x", Status)); 628 if (Status == STATUS_GRAPHICS_MONITOR_NOT_CONNECTED) 629 { 630 /* this is ok in case we replug the monitor to pick up the monitor modes properly, 631 * so pretend success */ 632 Status = STATUS_SUCCESS; 633 } 634 return Status; 635 } 636 637 for (uint32_t i = 0; i < cResolutions; ++i) 638 { 639 D3DKMDT_2DREGION *pRes = &pResolutions[i]; 640 641 Status = vboxVidPnCreatePopulateMonitorSourceModeInfoFromLegacy(pDevExt, 642 hMonitorSMS, 643 pMonitorSMSIf, 644 pRes, 645 enmOrigin, 646 iPreferred == i 647 ); 543 648 Assert(Status == STATUS_SUCCESS); 544 if (Status == STATUS_SUCCESS) 545 { 546 for (uint32_t i = 0; i < cResolutions; ++i) 547 { 548 D3DKMDT_2DREGION *pRes = &pResolutions[i]; 549 // VBOXVIDPNCHECKMONMODESENUM ChkInfo = {0}; 550 // ChkInfo.Region = *pRes; 551 // Status = vboxVidPnEnumMonitorSourceModes(hMonitorSMS, pMonitorSMSIf, 552 // vboxFidPnCheckMonitorModesEnum, &ChkInfo); 553 // Assert(Status == STATUS_SUCCESS); 554 // if (Status == STATUS_SUCCESS) 555 // { 556 // if (!ChkInfo.pMonitorSMI) 557 // { 558 Status = vboxVidPnCreatePopulateMonitorSourceModeInfoFromLegacy(pDevExt, 559 hMonitorSMS, 560 pMonitorSMSIf, 561 pRes, 562 enmOrigin, 563 FALSE 564 ); 565 Assert(Status == STATUS_SUCCESS); 566 if (Status != STATUS_SUCCESS) 567 { 568 LOGREL(("vboxVidPnCreatePopulateMonitorSourceModeInfoFromLegacy failed Status(0x%x)", Status)); 569 break; 570 } 571 // } 572 // else 573 // { 574 // pMonitorSMSIf->pfnReleaseModeInfo(hMonitorSMS, ChkInfo.pMonitorSMI); 575 // } 576 // } 577 // else 578 // { 579 // LOGREL(("vboxVidPnEnumMonitorSourceModes failed Status(0x%x)", Status)); 580 // break; 581 // } 582 } 583 NTSTATUS tmpStatus = pMonitorInterface->pfnReleaseMonitorSourceModeSet(pDevExt->u.primary.DxgkInterface.DeviceHandle, hMonitorSMS); 584 Assert(tmpStatus == STATUS_SUCCESS); 585 if (tmpStatus != STATUS_SUCCESS) 586 LOGREL(("pfnReleaseMonitorSourceModeSet failed tmpStatus(0x%x)", tmpStatus)); 587 } 588 else 589 LOGREL(("pfnAcquireMonitorSourceModeSet failed Status(0x%x)", Status)); 590 } 591 else 592 LOGREL(("DxgkCbQueryMonitorInterface failed Status(0x%x)", Status)); 649 if (Status != STATUS_SUCCESS) 650 { 651 LOGREL(("vboxVidPnCreatePopulateMonitorSourceModeInfoFromLegacy failed Status(0x%x)", Status)); 652 break; 653 } 654 } 655 656 NTSTATUS tmpStatus = pMonitorInterface->pfnReleaseMonitorSourceModeSet(pDevExt->u.primary.DxgkInterface.DeviceHandle, hMonitorSMS); 657 if (!NT_SUCCESS(tmpStatus)) 658 { 659 WARN(("pfnReleaseMonitorSourceModeSet failed tmpStatus(0x%x)", tmpStatus)); 660 } 593 661 594 662 return Status; 595 663 } 596 664 597 staticNTSTATUS vboxVidPnPathAdd(D3DKMDT_HVIDPN hVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface,665 NTSTATUS vboxVidPnPathAdd(D3DKMDT_HVIDPN hVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface, 598 666 const D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId, const D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId) 599 667 { … … 704 772 if (NT_SUCCESS(Status)) 705 773 { 706 707 774 /* success */ 708 775 continue; … … 766 833 VIDEO_MODE_INFORMATION *pModeToPin, 767 834 D3DKMDT_VIDEO_PRESENT_TARGET_MODE_ID *pModeIdToPin, 835 BOOLEAN fSetPreferred, 768 836 BOOLEAN fDoPin 769 837 ) … … 798 866 } 799 867 800 Status = vboxVidPnPopulateTargetModeInfoFromLegacy(pNewVidPnTargetModeInfo, pResolution); 868 BOOLEAN fIsPinMode = pModeToPin && pModeToPin->VisScreenWidth == pResolution->cx 869 && pModeToPin->VisScreenHeight == pResolution->cy; 870 871 Status = vboxVidPnPopulateTargetModeInfoFromLegacy(pNewVidPnTargetModeInfo, pResolution, fIsPinMode && fSetPreferred); 801 872 if (NT_SUCCESS(Status)) 802 873 { 803 if (pModeToPin && pModeToPin->VisScreenWidth == pResolution->cx 804 && pModeToPin->VisScreenHeight == pResolution->cy) 874 if (fIsPinMode) 805 875 { 806 876 targetModeId = pNewVidPnTargetModeInfo->Id; … … 875 945 NTSTATUS Status; 876 946 947 #if 0 877 948 Status = vboxVidPnPathAdd(hVidPn, pVidPnInterface, VidPnSourceId, VidPnTargetId); 878 949 if (!NT_SUCCESS(Status)) … … 881 952 return Status; 882 953 } 954 #endif 883 955 884 956 VIDEO_MODE_INFORMATION *pModeToPin = iModeToPin >= 0 ? &pModes[iModeToPin] : NULL; 885 Status = vboxVidPnCreatePopulateTargetModeInfoFromLegacy(hVidPn, pVidPnInterface, VidPnTargetId, pResolutions, cResolutions, pModeToPin, NULL, TRUE );957 Status = vboxVidPnCreatePopulateTargetModeInfoFromLegacy(hVidPn, pVidPnInterface, VidPnTargetId, pResolutions, cResolutions, pModeToPin, NULL, TRUE, TRUE); 886 958 if (!NT_SUCCESS(Status)) 887 959 { … … 1162 1234 const DXGK_VIDPNTARGETMODESET_INTERFACE *pNewVidPnTargetModeSetInterface; 1163 1235 1236 if (VidPnSourceId != VidPnTargetId || pCbContext->apPathInfos[VidPnTargetId].enmState != VBOXVIDPNPATHITEM_STATE_PRESENT) 1237 { 1238 return STATUS_SUCCESS; 1239 } 1240 1164 1241 D3DKMDT_HVIDPNSOURCEMODESET hCurVidPnSourceModeSet; 1165 1242 const DXGK_VIDPNSOURCEMODESET_INTERFACE *pCurVidPnSourceModeSetInterface; … … 1200 1277 { 1201 1278 Assert(hNewVidPnTargetModeSet); 1202 if ( pCbContext->apPathInfos[VidPnSourceId].enmState == VBOXVIDPNPATHITEM_STATE_PRESENT)1279 if (VidPnSourceId == VidPnTargetId && pCbContext->apPathInfos[VidPnTargetId].enmState == VBOXVIDPNPATHITEM_STATE_PRESENT) 1203 1280 { 1204 1281 Assert(VidPnSourceId == VidPnTargetId); … … 1221 1298 if (NT_SUCCESS(Status)) 1222 1299 { 1223 Status = vboxVidPnPopulateTargetModeInfoFromLegacy(pNewVidPnTargetModeInfo, pResolution );1300 Status = vboxVidPnPopulateTargetModeInfoFromLegacy(pNewVidPnTargetModeInfo, pResolution, i == pInfo->iPreferredResolution); 1224 1301 Assert(Status == STATUS_SUCCESS); 1225 1302 if (NT_SUCCESS(Status)) … … 1268 1345 if (!NT_SUCCESS(Status)) 1269 1346 { 1270 AssertFailed();1347 WARN(("\n\n!!!!!!!\n\n pfnAssignTargetModeSet failed, Status(0x%x)", Status)); 1271 1348 tmpStatus = pVidPnInterface->pfnReleaseTargetModeSet(hVidPn, hNewVidPnTargetModeSet); 1272 1349 Assert(tmpStatus == STATUS_SUCCESS); … … 1286 1363 D3DKMDT_HVIDPNSOURCEMODESET hNewVidPnSourceModeSet = NULL; 1287 1364 const DXGK_VIDPNSOURCEMODESET_INTERFACE *pNewVidPnSourceModeSetInterface; 1365 1366 if (VidPnSourceId != VidPnTargetId || pCbContext->apPathInfos[VidPnSourceId].enmState != VBOXVIDPNPATHITEM_STATE_PRESENT) 1367 { 1368 return STATUS_SUCCESS; 1369 } 1288 1370 1289 1371 D3DKMDT_HVIDPNTARGETMODESET hCurVidPnTargetModeSet; … … 1325 1407 { 1326 1408 Assert(hNewVidPnSourceModeSet); 1327 if ( pCbContext->apPathInfos[VidPnSourceId].enmState == VBOXVIDPNPATHITEM_STATE_PRESENT)1409 if (VidPnSourceId == VidPnTargetId && pCbContext->apPathInfos[VidPnSourceId].enmState == VBOXVIDPNPATHITEM_STATE_PRESENT) 1328 1410 { 1329 1411 Assert(VidPnSourceId == VidPnTargetId); … … 1392 1474 if (!NT_SUCCESS(Status)) 1393 1475 { 1394 AssertFailed();1476 WARN(("\n\n!!!!!!!\n\n pfnAssignSourceModeSet failed, Status(0x%x)", Status)); 1395 1477 tmpStatus = pVidPnInterface->pfnReleaseSourceModeSet(hVidPn, hNewVidPnSourceModeSet); 1396 1478 Assert(tmpStatus == STATUS_SUCCESS); … … 2423 2505 void vboxVidPnDumpCopyProtectoin(const char *pPrefix, const D3DKMDT_VIDPN_PRESENT_PATH_COPYPROTECTION *pCopyProtection, const char *pSuffix) 2424 2506 { 2425 LOGREL (("%sType(%s), TODO%s", pPrefix,2507 LOGREL_EXACT(("%sType(%s), TODO%s", pPrefix, 2426 2508 vboxVidPnDumpStrCopyProtectionType(pCopyProtection->CopyProtectionType), pSuffix)); 2427 2509 } … … 2430 2512 void vboxVidPnDumpPathTransformation(const D3DKMDT_VIDPN_PRESENT_PATH_TRANSFORMATION *pContentTransformation) 2431 2513 { 2432 LOGREL ((" --Transformation: Scaling(%s), ScalingSupport(%d), Rotation(%s), RotationSupport(%d)--",2514 LOGREL_EXACT((" --Transformation: Scaling(%s), ScalingSupport(%d), Rotation(%s), RotationSupport(%d)--", 2433 2515 vboxVidPnDumpStrScaling(pContentTransformation->Scaling), pContentTransformation->ScalingSupport, 2434 2516 vboxVidPnDumpStrRotation(pContentTransformation->Rotation), pContentTransformation->RotationSupport)); … … 2437 2519 void vboxVidPnDumpRegion(const char *pPrefix, const D3DKMDT_2DREGION *pRegion, const char *pSuffix) 2438 2520 { 2439 LOGREL (("%s%dX%d%s", pPrefix, pRegion->cx, pRegion->cy, pSuffix));2521 LOGREL_EXACT(("%s%dX%d%s", pPrefix, pRegion->cx, pRegion->cy, pSuffix)); 2440 2522 } 2441 2523 2442 2524 void vboxVidPnDumpRational(const char *pPrefix, const D3DDDI_RATIONAL *pRational, const char *pSuffix) 2443 2525 { 2444 LOGREL (("%s%d/%d=%d%s", pPrefix, pRational->Numerator, pRational->Denominator, pRational->Numerator/pRational->Denominator, pSuffix));2526 LOGREL_EXACT(("%s%d/%d=%d%s", pPrefix, pRational->Numerator, pRational->Denominator, pRational->Numerator/pRational->Denominator, pSuffix)); 2445 2527 } 2446 2528 2447 2529 void vboxVidPnDumpRanges(const char *pPrefix, const D3DKMDT_COLOR_COEFF_DYNAMIC_RANGES *pDynamicRanges, const char *pSuffix) 2448 2530 { 2449 LOGREL (("%sFirstChannel(%d), SecondChannel(%d), ThirdChannel(%d), FourthChannel(%d)%s", pPrefix,2531 LOGREL_EXACT(("%sFirstChannel(%d), SecondChannel(%d), ThirdChannel(%d), FourthChannel(%d)%s", pPrefix, 2450 2532 pDynamicRanges->FirstChannel, 2451 2533 pDynamicRanges->SecondChannel, … … 2457 2539 void vboxVidPnDumpGammaRamp(const char *pPrefix, const D3DKMDT_GAMMA_RAMP *pGammaRamp, const char *pSuffix) 2458 2540 { 2459 LOGREL (("%sType(%s), DataSize(%d), TODO: dump the rest%s", pPrefix,2541 LOGREL_EXACT(("%sType(%s), DataSize(%d), TODO: dump the rest%s", pPrefix, 2460 2542 vboxVidPnDumpStrGammaRampType(pGammaRamp->Type), pGammaRamp->DataSize, 2461 2543 pSuffix)); … … 2464 2546 void vboxVidPnDumpSourceMode(const char *pPrefix, const D3DKMDT_VIDPN_SOURCE_MODE* pVidPnSourceModeInfo, const char *pSuffix) 2465 2547 { 2466 LOGREL (("%sType(%s), ", pPrefix, vboxVidPnDumpStrSourceModeType(pVidPnSourceModeInfo->Type)));2548 LOGREL_EXACT(("%sType(%s), ", pPrefix, vboxVidPnDumpStrSourceModeType(pVidPnSourceModeInfo->Type))); 2467 2549 vboxVidPnDumpRegion("surf(", &pVidPnSourceModeInfo->Format.Graphics.PrimSurfSize, "), "); 2468 2550 vboxVidPnDumpRegion("vis(", &pVidPnSourceModeInfo->Format.Graphics.VisibleRegionSize, "), "); 2469 LOGREL (("stride(%d), ", pVidPnSourceModeInfo->Format.Graphics.Stride));2470 LOGREL (("format(%s), ", vboxVidPnDumpStrPixFormat(pVidPnSourceModeInfo->Format.Graphics.PixelFormat)));2471 LOGREL (("clrBasis(%s), ", vboxVidPnDumpStrColorBasis(pVidPnSourceModeInfo->Format.Graphics.ColorBasis)));2472 LOGREL (("pvam(%s)%s", vboxVidPnDumpStrPvam(pVidPnSourceModeInfo->Format.Graphics.PixelValueAccessMode), pSuffix));2551 LOGREL_EXACT(("stride(%d), ", pVidPnSourceModeInfo->Format.Graphics.Stride)); 2552 LOGREL_EXACT(("format(%s), ", vboxVidPnDumpStrPixFormat(pVidPnSourceModeInfo->Format.Graphics.PixelFormat))); 2553 LOGREL_EXACT(("clrBasis(%s), ", vboxVidPnDumpStrColorBasis(pVidPnSourceModeInfo->Format.Graphics.ColorBasis))); 2554 LOGREL_EXACT(("pvam(%s)%s", vboxVidPnDumpStrPvam(pVidPnSourceModeInfo->Format.Graphics.PixelValueAccessMode), pSuffix)); 2473 2555 } 2474 2556 2475 2557 void vboxVidPnDumpSignalInfo(const char *pPrefix, const D3DKMDT_VIDEO_SIGNAL_INFO *pVideoSignalInfo, const char *pSuffix) 2476 2558 { 2477 LOGREL (("%sVStd(%s), ", pPrefix, vboxVidPnDumpStrSignalStandard(pVideoSignalInfo->VideoStandard)));2559 LOGREL_EXACT(("%sVStd(%s), ", pPrefix, vboxVidPnDumpStrSignalStandard(pVideoSignalInfo->VideoStandard))); 2478 2560 vboxVidPnDumpRegion("totSize(", &pVideoSignalInfo->TotalSize, "), "); 2479 2561 vboxVidPnDumpRegion("activeSize(", &pVideoSignalInfo->ActiveSize, "), "); 2480 2562 vboxVidPnDumpRational("VSynch(", &pVideoSignalInfo->VSyncFreq, "), "); 2481 LOGREL (("PixelRate(%d), ScanLineOrdering(%s)%s", pVideoSignalInfo->PixelRate, vboxVidPnDumpStrScanLineOrdering(pVideoSignalInfo->ScanLineOrdering), pSuffix));2563 LOGREL_EXACT(("PixelRate(%d), ScanLineOrdering(%s)%s", pVideoSignalInfo->PixelRate, vboxVidPnDumpStrScanLineOrdering(pVideoSignalInfo->ScanLineOrdering), pSuffix)); 2482 2564 } 2483 2565 2484 2566 void vboxVidPnDumpTargetMode(const char *pPrefix, const D3DKMDT_VIDPN_TARGET_MODE* CONST pVidPnTargetModeInfo, const char *pSuffix) 2485 2567 { 2486 LOGREL (("%s", pPrefix));2568 LOGREL_EXACT(("%s", pPrefix)); 2487 2569 vboxVidPnDumpSignalInfo("VSI: ", &pVidPnTargetModeInfo->VideoSignalInfo, ", "); 2488 LOGREL (("Preference(%s)%s", vboxVidPnDumpStrModePreference(pVidPnTargetModeInfo->Preference), pSuffix));2570 LOGREL_EXACT(("Preference(%s)%s", vboxVidPnDumpStrModePreference(pVidPnTargetModeInfo->Preference), pSuffix)); 2489 2571 } 2490 2572 … … 2512 2594 else if (Status == STATUS_GRAPHICS_MODE_NOT_PINNED) 2513 2595 { 2514 LOGREL (("Source NOT Pinned"));2596 LOGREL_EXACT(("Source NOT Pinned\n")); 2515 2597 } 2516 2598 else 2517 2599 { 2518 LOGREL (("ERROR getting piined Source Mode(0x%x)", Status));2600 LOGREL_EXACT(("ERROR getting piined Source Mode(0x%x)\n", Status)); 2519 2601 } 2520 2602 pVidPnInterface->pfnReleaseSourceModeSet(hVidPn, hCurVidPnSourceModeSet); … … 2522 2604 else 2523 2605 { 2524 LOGREL (("ERROR getting SourceModeSet(0x%x)", Status));2525 } 2526 } 2527 2528 2529 staticDECLCALLBACK(BOOLEAN) vboxVidPnDumpSourceModeSetEnum(D3DKMDT_HVIDPNSOURCEMODESET hNewVidPnSourceModeSet, const DXGK_VIDPNSOURCEMODESET_INTERFACE *pVidPnSourceModeSetInterface,2606 LOGREL_EXACT(("ERROR getting SourceModeSet(0x%x)\n", Status)); 2607 } 2608 } 2609 2610 2611 DECLCALLBACK(BOOLEAN) vboxVidPnDumpSourceModeSetEnum(D3DKMDT_HVIDPNSOURCEMODESET hNewVidPnSourceModeSet, const DXGK_VIDPNSOURCEMODESET_INTERFACE *pVidPnSourceModeSetInterface, 2530 2612 const D3DKMDT_VIDPN_SOURCE_MODE *pNewVidPnSourceModeInfo, PVOID pContext) 2531 2613 { … … 2536 2618 void vboxVidPnDumpSourceModeSet(PVBOXMP_DEVEXT pDevExt, const D3DKMDT_HVIDPN hVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface, D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId) 2537 2619 { 2538 LOGREL ((" >>>+++SourceMode Set for Source(%d)+++", VidPnSourceId));2620 LOGREL_EXACT((" >>>+++SourceMode Set for Source(%d)+++\n", VidPnSourceId)); 2539 2621 D3DKMDT_HVIDPNSOURCEMODESET hCurVidPnSourceModeSet; 2540 2622 const DXGK_VIDPNSOURCEMODESET_INTERFACE *pCurVidPnSourceModeSetInterface; … … 2553 2635 if (Status != STATUS_SUCCESS) 2554 2636 { 2555 LOGREL (("ERROR enumerating Source Modes(0x%x)", Status));2637 LOGREL_EXACT(("ERROR enumerating Source Modes(0x%x)\n", Status)); 2556 2638 } 2557 2639 pVidPnInterface->pfnReleaseSourceModeSet(hVidPn, hCurVidPnSourceModeSet); … … 2559 2641 else 2560 2642 { 2561 LOGREL (("ERROR getting SourceModeSet for Source(%d), Status(0x%x)", VidPnSourceId, Status));2562 } 2563 2564 LOGREL ((" <<<+++End Of SourceMode Set for Source(%d)+++", VidPnSourceId));2643 LOGREL_EXACT(("ERROR getting SourceModeSet for Source(%d), Status(0x%x)\n", VidPnSourceId, Status)); 2644 } 2645 2646 LOGREL_EXACT((" <<<+++End Of SourceMode Set for Source(%d)+++", VidPnSourceId)); 2565 2647 } 2566 2648 … … 2574 2656 void vboxVidPnDumpTargetModeSet(PVBOXMP_DEVEXT pDevExt, const D3DKMDT_HVIDPN hVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface, D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId) 2575 2657 { 2576 LOGREL ((" >>>---TargetMode Set for Target(%d)---", VidPnTargetId));2658 LOGREL_EXACT((" >>>---TargetMode Set for Target(%d)---\n", VidPnTargetId)); 2577 2659 D3DKMDT_HVIDPNTARGETMODESET hCurVidPnTargetModeSet; 2578 2660 const DXGK_VIDPNTARGETMODESET_INTERFACE *pCurVidPnTargetModeSetInterface; … … 2591 2673 if (Status != STATUS_SUCCESS) 2592 2674 { 2593 LOGREL (("ERROR enumerating Target Modes(0x%x)", Status));2675 LOGREL_EXACT(("ERROR enumerating Target Modes(0x%x)\n", Status)); 2594 2676 } 2595 2677 pVidPnInterface->pfnReleaseTargetModeSet(hVidPn, hCurVidPnTargetModeSet); … … 2597 2679 else 2598 2680 { 2599 LOGREL (("ERROR getting TargetModeSet for Target(%d), Status(0x%x)", VidPnTargetId, Status));2600 } 2601 2602 LOGREL ((" <<<---End Of TargetMode Set for Target(%d)---", VidPnTargetId));2681 LOGREL_EXACT(("ERROR getting TargetModeSet for Target(%d), Status(0x%x)\n", VidPnTargetId, Status)); 2682 } 2683 2684 LOGREL_EXACT((" <<<---End Of TargetMode Set for Target(%d)---", VidPnTargetId)); 2603 2685 } 2604 2686 … … 2627 2709 else if (Status == STATUS_GRAPHICS_MODE_NOT_PINNED) 2628 2710 { 2629 LOGREL (("Target NOT Pinned"));2711 LOGREL_EXACT(("Target NOT Pinned\n")); 2630 2712 } 2631 2713 else 2632 2714 { 2633 LOGREL (("ERROR getting piined Target Mode(0x%x)", Status));2715 LOGREL_EXACT(("ERROR getting piined Target Mode(0x%x)\n", Status)); 2634 2716 } 2635 2717 pVidPnInterface->pfnReleaseTargetModeSet(hVidPn, hCurVidPnTargetModeSet); … … 2637 2719 else 2638 2720 { 2639 LOGREL (("ERROR getting TargetModeSet(0x%x)", Status));2721 LOGREL_EXACT(("ERROR getting TargetModeSet(0x%x)\n", Status)); 2640 2722 } 2641 2723 } … … 2643 2725 void vboxVidPnDumpCofuncModalityArg(const char *pPrefix, CONST DXGKARG_ENUMVIDPNCOFUNCMODALITY* CONST pEnumCofuncModalityArg, const char *pSuffix) 2644 2726 { 2645 LOGREL (("%sPivotType(%s), SourceId(0x%x), TargetId(0x%x),%s", pPrefix, vboxVidPnDumpStrCFMPivotType(pEnumCofuncModalityArg->EnumPivotType),2727 LOGREL_EXACT(("%sPivotType(%s), SourceId(0x%x), TargetId(0x%x),%s", pPrefix, vboxVidPnDumpStrCFMPivotType(pEnumCofuncModalityArg->EnumPivotType), 2646 2728 pEnumCofuncModalityArg->EnumPivot.VidPnSourceId, pEnumCofuncModalityArg->EnumPivot.VidPnTargetId, pSuffix)); 2647 2729 } … … 2649 2731 void vboxVidPnDumpPath(const D3DKMDT_HVIDPN hVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface, const D3DKMDT_VIDPN_PRESENT_PATH *pVidPnPresentPathInfo) 2650 2732 { 2651 LOGREL ((" >>**** Start Dump VidPn Path ****>>"));2652 LOGREL (("VidPnSourceId(%d), VidPnTargetId(%d)",2733 LOGREL_EXACT((" >>**** Start Dump VidPn Path ****>>\n")); 2734 LOGREL_EXACT(("VidPnSourceId(%d), VidPnTargetId(%d)\n", 2653 2735 pVidPnPresentPathInfo->VidPnSourceId, pVidPnPresentPathInfo->VidPnTargetId)); 2654 2736 … … 2658 2740 vboxVidPnDumpPathTransformation(&pVidPnPresentPathInfo->ContentTransformation); 2659 2741 2660 LOGREL (("Importance(%s), TargetColorBasis(%s), Content(%s), ",2742 LOGREL_EXACT(("Importance(%s), TargetColorBasis(%s), Content(%s), ", 2661 2743 vboxVidPnDumpStrImportance(pVidPnPresentPathInfo->ImportanceOrdinal), 2662 2744 vboxVidPnDumpStrColorBasis(pVidPnPresentPathInfo->VidPnTargetColorBasis), … … 2668 2750 vboxVidPnDumpGammaRamp("GammaRamp: ", &pVidPnPresentPathInfo->GammaRamp, "\n"); 2669 2751 2670 LOGREL ((" <<**** Stop Dump VidPn Path ****<<"));2752 LOGREL_EXACT((" <<**** Stop Dump VidPn Path ****<<")); 2671 2753 } 2672 2754 … … 2689 2771 void vboxVidPnDumpVidPn(const char * pPrefix, PVBOXMP_DEVEXT pDevExt, D3DKMDT_HVIDPN hVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface, const char * pSuffix) 2690 2772 { 2691 LOGREL (("%s", pPrefix));2773 LOGREL_EXACT(("%s", pPrefix)); 2692 2774 2693 2775 VBOXVIDPNDUMPPATHENUM CbData; … … 2711 2793 } 2712 2794 2713 LOGREL (("%s", pSuffix));2714 } 2795 LOGREL_EXACT(("%s", pSuffix)); 2796 } -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVidPn.h
r37207 r37490 139 139 NTSTATUS vboxVidPnCheckAddMonitorModes(PVBOXMP_DEVEXT pDevExt, 140 140 D3DDDI_VIDEO_PRESENT_TARGET_ID targetId, D3DKMDT_MONITOR_CAPABILITIES_ORIGIN enmOrigin, 141 D3DKMDT_2DREGION *pResolutions, uint32_t cResolutions); 141 D3DKMDT_2DREGION *pResolutions, uint32_t cResolutions, int iPreferred); 142 143 NTSTATUS vboxVidPnMatchMonitorModes(PVBOXMP_DEVEXT pDevExt, D3DDDI_VIDEO_PRESENT_TARGET_ID targetId, 144 D3DKMDT_2DREGION *pResolutions, uint32_t cResolutions, BOOLEAN *pfMatch); 142 145 143 146 NTSTATUS vboxVidPnCofuncModalityForPath(PVBOXVIDPNCOFUNCMODALITY pCbContext, D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId, D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId); … … 146 149 BOOLEAN fBreakOnDisabled, UINT cItems, PVBOXVIDPNPATHITEM paItems, BOOLEAN *pfDisabledFound); 147 150 151 NTSTATUS vboxVidPnPathAdd(D3DKMDT_HVIDPN hVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface, 152 const D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId, const D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId); 153 148 154 void vboxVidPnDumpVidPn(const char * pPrefix, PVBOXMP_DEVEXT pDevExt, D3DKMDT_HVIDPN hVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface, const char * pSuffix); 149 155 void vboxVidPnDumpCofuncModalityArg(const char *pPrefix, CONST DXGKARG_ENUMVIDPNCOFUNCMODALITY* CONST pEnumCofuncModalityArg, const char *pSuffix); 156 DECLCALLBACK(BOOLEAN) vboxVidPnDumpSourceModeSetEnum(D3DKMDT_HVIDPNSOURCEMODESET hNewVidPnSourceModeSet, const DXGK_VIDPNSOURCEMODESET_INTERFACE *pVidPnSourceModeSetInterface, 157 const D3DKMDT_VIDPN_SOURCE_MODE *pNewVidPnSourceModeInfo, PVOID pContext); 158 DECLCALLBACK(BOOLEAN) vboxVidPnDumpTargetModeSetEnum(D3DKMDT_HVIDPNTARGETMODESET hNewVidPnTargetModeSet, const DXGK_VIDPNTARGETMODESET_INTERFACE *pVidPnTargetModeSetInterface, 159 const D3DKMDT_VIDPN_TARGET_MODE *pNewVidPnTargetModeInfo, PVOID pContext); 160 150 161 #endif /* #ifndef ___VBoxMPVidPn_h___ */ -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPWddm.cpp
r37300 r37490 91 91 } 92 92 93 //VBOXVIDEOOFFSET vboxWddmVRAMAddressToOffset(PVBOXMP_DEVEXT pDevExt, PHYSICAL_ADDRESS phAddress)94 //{95 // Assert(phAddress.QuadPart >= VBE_DISPI_LFB_PHYSICAL_ADDRESS);96 // if (phAddress.QuadPart < VBE_DISPI_LFB_PHYSICAL_ADDRESS)97 // return VBOXVIDEOOFFSET_VOID;98 //99 // VBOXVIDEOOFFSET off = phAddress.QuadPart - VBE_DISPI_LFB_PHYSICAL_ADDRESS;100 // Assert(off < pDevExt->u.primary.cbVRAM);101 // if (off >= pDevExt->u.primary.cbVRAM)102 // return VBOXVIDEOOFFSET_VOID;103 //104 // return off;105 //}106 107 93 VBOXVIDEOOFFSET vboxWddmValidatePrimary(PVBOXWDDM_ALLOCATION pAllocation) 108 94 { … … 330 316 return VBOXWDDM_HGSMICMD_TYPE_CTL; 331 317 return VBOXWDDM_HGSMICMD_TYPE_UNDEFINED; 318 } 319 320 static NTSTATUS vboxWddmChildStatusReportPerform(PVBOXMP_DEVEXT pDevExt, PVBOXVDMA_CHILD_STATUS pChildStatus, D3DDDI_VIDEO_PRESENT_TARGET_ID iChild) 321 { 322 DXGK_CHILD_STATUS DdiChildStatus; 323 if (pChildStatus->fFlags & VBOXVDMA_CHILD_STATUS_F_DISCONNECTED) 324 { 325 /* report disconnected */ 326 memset(&DdiChildStatus, 0, sizeof (DdiChildStatus)); 327 DdiChildStatus.Type = StatusConnection; 328 if (iChild != D3DDDI_ID_UNINITIALIZED) 329 { 330 Assert(iChild < UINT32_MAX/2); 331 Assert(iChild < (UINT)VBoxCommonFromDeviceExt(pDevExt)->cDisplays); 332 DdiChildStatus.ChildUid = iChild; 333 } 334 else 335 { 336 Assert(pChildStatus->iChild < UINT32_MAX/2); 337 Assert(pChildStatus->iChild < (UINT)VBoxCommonFromDeviceExt(pDevExt)->cDisplays); 338 DdiChildStatus.ChildUid = pChildStatus->iChild; 339 } 340 DdiChildStatus.HotPlug.Connected = FALSE; 341 NTSTATUS Status = pDevExt->u.primary.DxgkInterface.DxgkCbIndicateChildStatus(pDevExt->u.primary.DxgkInterface.DeviceHandle, &DdiChildStatus); 342 if (!NT_SUCCESS(Status)) 343 { 344 WARN(("DxgkCbIndicateChildStatus failed with Status (0x%x)", Status)); 345 return Status; 346 } 347 } 348 349 if (pChildStatus->fFlags & VBOXVDMA_CHILD_STATUS_F_CONNECTED) 350 { 351 /* report disconnected */ 352 memset(&DdiChildStatus, 0, sizeof (DdiChildStatus)); 353 DdiChildStatus.Type = StatusConnection; 354 if (iChild != D3DDDI_ID_UNINITIALIZED) 355 { 356 Assert(iChild < UINT32_MAX/2); 357 Assert(iChild < (UINT)VBoxCommonFromDeviceExt(pDevExt)->cDisplays); 358 DdiChildStatus.ChildUid = iChild; 359 } 360 else 361 { 362 Assert(pChildStatus->iChild < UINT32_MAX/2); 363 Assert(pChildStatus->iChild < (UINT)VBoxCommonFromDeviceExt(pDevExt)->cDisplays); 364 DdiChildStatus.ChildUid = pChildStatus->iChild; 365 } 366 DdiChildStatus.HotPlug.Connected = TRUE; 367 NTSTATUS Status = pDevExt->u.primary.DxgkInterface.DxgkCbIndicateChildStatus(pDevExt->u.primary.DxgkInterface.DeviceHandle, &DdiChildStatus); 368 if (!NT_SUCCESS(Status)) 369 { 370 WARN(("DxgkCbIndicateChildStatus failed with Status (0x%x)", Status)); 371 return Status; 372 } 373 } 374 375 if (pChildStatus->fFlags & VBOXVDMA_CHILD_STATUS_F_ROTATED) 376 { 377 /* report disconnected */ 378 memset(&DdiChildStatus, 0, sizeof (DdiChildStatus)); 379 DdiChildStatus.Type = StatusRotation; 380 if (iChild != D3DDDI_ID_UNINITIALIZED) 381 { 382 Assert(iChild < UINT32_MAX/2); 383 Assert(iChild < (UINT)VBoxCommonFromDeviceExt(pDevExt)->cDisplays); 384 DdiChildStatus.ChildUid = iChild; 385 } 386 else 387 { 388 Assert(pChildStatus->iChild < UINT32_MAX/2); 389 Assert(pChildStatus->iChild < (UINT)VBoxCommonFromDeviceExt(pDevExt)->cDisplays); 390 DdiChildStatus.ChildUid = pChildStatus->iChild; 391 } 392 DdiChildStatus.Rotation.Angle = pChildStatus->u8RotationAngle; 393 NTSTATUS Status = pDevExt->u.primary.DxgkInterface.DxgkCbIndicateChildStatus(pDevExt->u.primary.DxgkInterface.DeviceHandle, &DdiChildStatus); 394 if (!NT_SUCCESS(Status)) 395 { 396 WARN(("DxgkCbIndicateChildStatus failed with Status (0x%x)", Status)); 397 return Status; 398 } 399 } 400 401 return STATUS_SUCCESS; 402 } 403 404 typedef struct VBOXWDDMCHILDSTATUSCB 405 { 406 PVBOXVDMACBUF_DR pDr; 407 PKEVENT pEvent; 408 } VBOXWDDMCHILDSTATUSCB, *PVBOXWDDMCHILDSTATUSCB; 409 410 static DECLCALLBACK(VOID) vboxWddmChildStatusReportCompletion(PVBOXMP_DEVEXT pDevExt, PVBOXVDMADDI_CMD pCmd, PVOID pvContext) 411 { 412 /* we should be called from our DPC routine */ 413 Assert(KeGetCurrentIrql() == DISPATCH_LEVEL); 414 415 PVBOXWDDMCHILDSTATUSCB pCtx = (PVBOXWDDMCHILDSTATUSCB)pvContext; 416 PVBOXVDMACBUF_DR pDr = pCtx->pDr; 417 PVBOXVDMACMD pHdr = VBOXVDMACBUF_DR_TAIL(pDr, VBOXVDMACMD); 418 VBOXVDMACMD_CHILD_STATUS_IRQ *pBody = VBOXVDMACMD_BODY(pHdr, VBOXVDMACMD_CHILD_STATUS_IRQ); 419 420 for (UINT i = 0; i < pBody->cInfos; ++i) 421 { 422 PVBOXVDMA_CHILD_STATUS pInfo = &pBody->aInfos[i]; 423 if (pBody->fFlags & VBOXVDMACMD_CHILD_STATUS_IRQ_F_APPLY_TO_ALL) 424 { 425 for (D3DDDI_VIDEO_PRESENT_TARGET_ID iChild = 0; iChild < (UINT)VBoxCommonFromDeviceExt(pDevExt)->cDisplays; ++iChild) 426 { 427 NTSTATUS Status = vboxWddmChildStatusReportPerform(pDevExt, pInfo, iChild); 428 if (!NT_SUCCESS(Status)) 429 { 430 WARN(("vboxWddmChildStatusReportPerform failed with Status (0x%x)", Status)); 431 break; 432 } 433 } 434 } 435 else 436 { 437 NTSTATUS Status = vboxWddmChildStatusReportPerform(pDevExt, pInfo, D3DDDI_ID_UNINITIALIZED); 438 if (!NT_SUCCESS(Status)) 439 { 440 WARN(("vboxWddmChildStatusReportPerform failed with Status (0x%x)", Status)); 441 break; 442 } 443 } 444 } 445 446 vboxVdmaCBufDrFree(&pDevExt->u.primary.Vdma, pDr); 447 448 if (pCtx->pEvent) 449 { 450 KeSetEvent(pCtx->pEvent, 0, FALSE); 451 } 452 } 453 454 static NTSTATUS vboxWddmChildStatusReportReconnected(PVBOXMP_DEVEXT pDevExt, D3DDDI_VIDEO_PRESENT_TARGET_ID idTarget) 455 { 456 NTSTATUS Status = STATUS_UNSUCCESSFUL; 457 UINT cbCmd = VBOXVDMACMD_SIZE_FROMBODYSIZE(sizeof (VBOXVDMACMD_CHILD_STATUS_IRQ)); 458 459 PVBOXVDMACBUF_DR pDr = vboxVdmaCBufDrCreate(&pDevExt->u.primary.Vdma, cbCmd); 460 if (pDr) 461 { 462 // vboxVdmaCBufDrCreate zero initializes the pDr 463 /* the command data follows the descriptor */ 464 pDr->fFlags = VBOXVDMACBUF_FLAG_BUF_FOLLOWS_DR; 465 pDr->cbBuf = cbCmd; 466 pDr->rc = VERR_NOT_IMPLEMENTED; 467 468 PVBOXVDMACMD pHdr = VBOXVDMACBUF_DR_TAIL(pDr, VBOXVDMACMD); 469 pHdr->enmType = VBOXVDMACMD_TYPE_CHILD_STATUS_IRQ; 470 pHdr->u32CmdSpecific = 0; 471 PVBOXVDMACMD_CHILD_STATUS_IRQ pBody = VBOXVDMACMD_BODY(pHdr, VBOXVDMACMD_CHILD_STATUS_IRQ); 472 pBody->cInfos = 1; 473 if (idTarget == D3DDDI_ID_ALL) 474 { 475 pBody->fFlags |= VBOXVDMACMD_CHILD_STATUS_IRQ_F_APPLY_TO_ALL; 476 } 477 pBody->aInfos[0].iChild = idTarget; 478 pBody->aInfos[0].fFlags = VBOXVDMA_CHILD_STATUS_F_DISCONNECTED | VBOXVDMA_CHILD_STATUS_F_CONNECTED; 479 480 /* we're going to KeWaitForSingleObject */ 481 Assert(KeGetCurrentIrql() < DISPATCH_LEVEL); 482 483 PVBOXVDMADDI_CMD pDdiCmd = VBOXVDMADDI_CMD_FROM_BUF_DR(pDr); 484 VBOXWDDMCHILDSTATUSCB Ctx; 485 KEVENT Event; 486 KeInitializeEvent(&Event, NotificationEvent, FALSE); 487 Ctx.pDr = pDr; 488 Ctx.pEvent = &Event; 489 vboxVdmaDdiCmdInit(pDdiCmd, 0, NULL, vboxWddmChildStatusReportCompletion, &Ctx); 490 /* mark command as submitted & invisible for the dx runtime since dx did not originate it */ 491 vboxVdmaDdiCmdSubmittedNotDx(pDdiCmd); 492 int rc = vboxVdmaCBufDrSubmit(pDevExt, &pDevExt->u.primary.Vdma, pDr); 493 Assert(rc == VINF_SUCCESS); 494 if (RT_SUCCESS(rc)) 495 { 496 Status = KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL); 497 Assert(Status == STATUS_SUCCESS); 498 return STATUS_SUCCESS; 499 } 500 501 Status = STATUS_UNSUCCESSFUL; 502 503 vboxVdmaCBufDrFree(&pDevExt->u.primary.Vdma, pDr); 504 } 505 else 506 { 507 Assert(0); 508 /* @todo: try flushing.. */ 509 LOGREL(("vboxVdmaCBufDrCreate returned NULL")); 510 Status = STATUS_INSUFFICIENT_RESOURCES; 511 } 512 513 return Status; 514 } 515 516 static NTSTATUS vboxWddmChildStatusCheck(PVBOXMP_DEVEXT pDevExt, PVBOXWDDM_VIDEOMODES_INFO paInfos) 517 { 518 NTSTATUS Status = STATUS_SUCCESS; 519 bool bChanged[VBOX_VIDEO_MAX_SCREENS] = {}; 520 int i; 521 522 Assert(!bChanged[0]); 523 for (i = 1; i < VBoxCommonFromDeviceExt(pDevExt)->cDisplays; ++i) 524 { 525 /* @todo: check that we actually need the current source->target */ 526 PVBOXWDDM_VIDEOMODES_INFO pInfo = &paInfos[i]; 527 VIDEO_MODE_INFORMATION *pModeInfo = &pInfo->aModes[pInfo->iPreferredMode]; 528 BOOLEAN fMatch = FALSE; 529 Status = vboxVidPnMatchMonitorModes(pDevExt, i, pInfo->aResolutions, pInfo->cResolutions, &fMatch); 530 if (!NT_SUCCESS(Status)) 531 { 532 WARN(("vboxVidPnMatchMonitorModes failed Status(0x%x)", Status)); 533 /* ignore the failures here, although we probably should not?? */ 534 break; 535 } 536 537 bChanged[i] = !fMatch; 538 539 if (!fMatch) 540 { 541 Status = vboxWddmChildStatusReportReconnected(pDevExt, i); 542 if (!NT_SUCCESS(Status)) 543 { 544 WARN(("vboxWddmChildStatusReportReconnected failed Status(0x%x)", Status)); 545 /* ignore the failures here, although we probably should not?? */ 546 break; 547 } 548 } 549 } 550 551 if (!NT_SUCCESS(Status)) 552 { 553 WARN(("updating monitor modes failed, Status(0x%x)", Status)); 554 return Status; 555 } 556 557 /* wait for the reconnected monitor data to be picked up */ 558 CONST DXGK_MONITOR_INTERFACE *pMonitorInterface; 559 Status = pDevExt->u.primary.DxgkInterface.DxgkCbQueryMonitorInterface(pDevExt->u.primary.DxgkInterface.DeviceHandle, DXGK_MONITOR_INTERFACE_VERSION_V1, &pMonitorInterface); 560 if (!NT_SUCCESS(Status)) 561 { 562 WARN(("DxgkCbQueryMonitorInterface failed, Status()0x%x", Status)); 563 return Status; 564 } 565 566 for (i = 0; i < VBoxCommonFromDeviceExt(pDevExt)->cDisplays; ++i) 567 { 568 D3DKMDT_HMONITORSOURCEMODESET hMonitorSMS; 569 CONST DXGK_MONITORSOURCEMODESET_INTERFACE *pMonitorSMSIf; 570 if (!bChanged[i]) 571 continue; 572 573 while (1) 574 { 575 Status = pMonitorInterface->pfnAcquireMonitorSourceModeSet(pDevExt->u.primary.DxgkInterface.DeviceHandle, 576 i, 577 &hMonitorSMS, 578 &pMonitorSMSIf); 579 if (NT_SUCCESS(Status)) 580 { 581 NTSTATUS tmpStatus = pMonitorInterface->pfnReleaseMonitorSourceModeSet(pDevExt->u.primary.DxgkInterface.DeviceHandle, hMonitorSMS); 582 if (!NT_SUCCESS(tmpStatus)) 583 { 584 WARN(("pfnReleaseMonitorSourceModeSet failed tmpStatus(0x%x)", tmpStatus)); 585 } 586 break; 587 } 588 589 if (Status != STATUS_GRAPHICS_MONITOR_NOT_CONNECTED) 590 { 591 WARN(("DxgkCbQueryMonitorInterface failed, Status()0x%x", Status)); 592 break; 593 } 594 595 Assert(KeGetCurrentIrql() < DISPATCH_LEVEL); 596 597 LARGE_INTEGER Interval; 598 Interval.QuadPart = -(int64_t) 2 /* ms */ * 10000; 599 NTSTATUS tmpStatus = KeDelayExecutionThread(KernelMode, FALSE, &Interval); 600 if (!NT_SUCCESS(tmpStatus)) 601 { 602 WARN(("KeDelayExecutionThread failed tmpStatus(0x%x)", tmpStatus)); 603 } 604 } 605 } 606 607 return STATUS_SUCCESS; 332 608 } 333 609 … … 1109 1385 ChildRelations[i].ChildCapabilities.Type.VideoOutput.MonitorOrientationAwareness = D3DKMDT_MOA_INTERRUPTIBLE; /* ?? D3DKMDT_MOA_NONE*/ 1110 1386 ChildRelations[i].ChildCapabilities.Type.VideoOutput.SupportsSdtvModes = FALSE; 1111 ChildRelations[i].ChildCapabilities.HpdAwareness = HpdAwareness AlwaysConnected; //HpdAwarenessInterruptible; /* ?? HpdAwarenessAlwaysConnected; */1387 ChildRelations[i].ChildCapabilities.HpdAwareness = HpdAwarenessInterruptible; /* ?? HpdAwarenessAlwaysConnected; */ 1112 1388 ChildRelations[i].AcpiUid = 0; /* */ 1113 1389 ChildRelations[i].ChildUid = i; /* should be == target id */ … … 2796 3072 ) 2797 3073 { 2798 /* we do no wcare about the others for now */3074 /* we do not care about the others for now */ 2799 3075 Status = STATUS_SUCCESS; 2800 3076 break; … … 3414 3690 /* ensure the last char is \0*/ 3415 3691 *((uint8_t*)pDbgPrint + pEscape->PrivateDriverDataSize - 1) = '\0'; 3416 DbgPrint(pDbgPrint->aStringBuf);3692 LOGREL(("%s", pDbgPrint->aStringBuf)); 3417 3693 } 3418 3694 Status = STATUS_SUCCESS; … … 3584 3860 (PVBOXWDDM_RECOMMENDVIDPN)pRecommendFunctionalVidPnArg->pPrivateDriverData : NULL; 3585 3861 PVBOXWDDM_VIDEOMODES_INFO pInfos = VBoxWddmUpdateVideoModesInfo(pDevExt, NULL /*pVidPnInfo*/); 3862 int i; 3863 3864 for (i = 0; i < VBoxCommonFromDeviceExt(pDevExt)->cDisplays; ++i) 3865 { 3866 /* @todo: check that we actually need the current source->target */ 3867 PVBOXWDDM_VIDEOMODES_INFO pInfo = &pInfos[i]; 3868 VIDEO_MODE_INFORMATION *pModeInfo = &pInfo->aModes[pInfo->iPreferredMode]; 3869 #if 0 3870 D3DKMDT_2DREGION Resolution; 3871 Resolution.cx = pModeInfo->VisScreenWidth; 3872 Resolution.cy = pModeInfo->VisScreenHeight; 3873 Status = vboxVidPnCheckAddMonitorModes(pDevExt, i, D3DKMDT_MCO_DRIVER, &Resolution, 1, 0); 3874 #else 3875 Status = vboxVidPnCheckAddMonitorModes(pDevExt, i, D3DKMDT_MCO_DRIVER, pInfo->aResolutions, pInfo->cResolutions, pInfo->iPreferredResolution); 3876 #endif 3877 Assert(Status == STATUS_SUCCESS); 3878 if (Status != STATUS_SUCCESS) 3879 { 3880 LOGREL(("vboxVidPnCheckAddMonitorModes failed Status(0x%x)", Status)); 3881 break; 3882 } 3883 } 3884 3586 3885 const DXGK_VIDPN_INTERFACE* pVidPnInterface = NULL; 3587 3886 Status = pDevExt->u.primary.DxgkInterface.DxgkCbQueryVidPnInterface(pRecommendFunctionalVidPnArg->hRecommendedFunctionalVidPn, DXGK_VIDPN_INTERFACE_VERSION_V1, &pVidPnInterface); 3588 Assert(Status == STATUS_SUCCESS); 3589 if (Status == STATUS_SUCCESS) 3590 { 3591 VIDEO_MODE_INFORMATION *pResModes = NULL; 3592 uint32_t cResModes = 0; 3593 int i; 3594 for (i = 0; i < VBoxCommonFromDeviceExt(pDevExt)->cDisplays; ++i) 3595 { 3596 /* @todo: check that we actually need the current source->target */ 3597 PVBOXWDDM_VIDEOMODES_INFO pInfo = &pInfos[i]; 3598 VIDEO_MODE_INFORMATION *pModeInfo = &pInfo->aModes[pInfo->iPreferredMode]; 3599 #if 1 3600 D3DKMDT_2DREGION Resolution; 3601 Resolution.cx = pModeInfo->VisScreenWidth; 3602 Resolution.cy = pModeInfo->VisScreenHeight; 3603 Status = vboxVidPnCheckAddMonitorModes(pDevExt, i, D3DKMDT_MCO_DRIVER, &Resolution, 1); 3604 #else 3605 Status = vboxVidPnCheckAddMonitorModes(pDevExt, i, D3DKMDT_MCO_DRIVER, pInfo->aResolutions, pInfo->cResolutions); 3606 #endif 3887 if (!NT_SUCCESS(Status)) 3888 { 3889 WARN(("DxgkCbQueryVidPnInterface failed Status(0x%x)", Status)); 3890 return Status; 3891 } 3892 3893 for (i = 0; i < VBoxCommonFromDeviceExt(pDevExt)->cDisplays; ++i) 3894 { 3895 Status = vboxVidPnPathAdd(pRecommendFunctionalVidPnArg->hRecommendedFunctionalVidPn, pVidPnInterface, i, i); 3896 if (!NT_SUCCESS(Status)) 3897 { 3898 WARN(("vboxVidPnPathAdd failed Status(0x%x)", Status)); 3899 return Status; 3900 } 3901 } 3902 3903 VIDEO_MODE_INFORMATION *pResModes = NULL; 3904 uint32_t cResModes = 0; 3905 3906 for (i = 0; i < VBoxCommonFromDeviceExt(pDevExt)->cDisplays; ++i) 3907 { 3908 D3DKMDT_2DREGION Resolution; 3909 PVBOXWDDM_VIDEOMODES_INFO pInfo = &pInfos[i]; 3910 VIDEO_MODE_INFORMATION *pModeInfo = &pInfo->aModes[pInfo->iPreferredMode]; 3911 Resolution.cx = pModeInfo->VisScreenWidth; 3912 Resolution.cy = pModeInfo->VisScreenHeight; 3913 int32_t iPreferableResMode; 3914 uint32_t cActualResModes; 3915 3916 Status = VBoxWddmGetModesForResolution(pInfo->aModes, pInfo->cModes, pInfo->iPreferredMode, &Resolution, 3917 pResModes, cResModes, &cActualResModes, &iPreferableResMode); 3918 Assert(Status == STATUS_SUCCESS || Status == STATUS_BUFFER_TOO_SMALL); 3919 if (Status == STATUS_BUFFER_TOO_SMALL) 3920 { 3921 Assert(cResModes < cActualResModes); 3922 if (pResModes) 3923 { 3924 vboxWddmMemFree(pResModes); 3925 } 3926 pResModes = (VIDEO_MODE_INFORMATION*)vboxWddmMemAllocZero(sizeof (*pResModes) * cActualResModes); 3927 Assert(pResModes); 3928 if (!pResModes) 3929 { 3930 Status = STATUS_NO_MEMORY; 3931 break; 3932 } 3933 cResModes = cActualResModes; 3934 Status = VBoxWddmGetModesForResolution(pInfo->aModes, pInfo->cModes, pInfo->iPreferredMode, &Resolution, 3935 pResModes, cResModes, &cActualResModes, &iPreferableResMode); 3607 3936 Assert(Status == STATUS_SUCCESS); 3608 3937 if (Status != STATUS_SUCCESS) 3609 {3610 LOGREL(("vboxVidPnCheckAddMonitorModes failed Status(0x%x)", Status));3611 3938 break; 3612 } 3613 } 3614 3615 for (i = 0; i < VBoxCommonFromDeviceExt(pDevExt)->cDisplays; ++i) 3616 { 3617 D3DKMDT_2DREGION Resolution; 3618 PVBOXWDDM_VIDEOMODES_INFO pInfo = &pInfos[i]; 3619 VIDEO_MODE_INFORMATION *pModeInfo = &pInfo->aModes[pInfo->iPreferredMode]; 3620 Resolution.cx = pModeInfo->VisScreenWidth; 3621 Resolution.cy = pModeInfo->VisScreenHeight; 3622 int32_t iPreferableResMode; 3623 uint32_t cActualResModes; 3624 3625 Status = VBoxWddmGetModesForResolution(pInfo->aModes, pInfo->cModes, pInfo->iPreferredMode, &Resolution, 3626 pResModes, cResModes, &cActualResModes, &iPreferableResMode); 3627 Assert(Status == STATUS_SUCCESS || Status == STATUS_BUFFER_TOO_SMALL); 3628 if (Status == STATUS_BUFFER_TOO_SMALL) 3629 { 3630 Assert(cResModes < cActualResModes); 3631 if (pResModes) 3632 { 3633 vboxWddmMemFree(pResModes); 3634 } 3635 pResModes = (VIDEO_MODE_INFORMATION*)vboxWddmMemAllocZero(sizeof (*pResModes) * cActualResModes); 3636 Assert(pResModes); 3637 if (!pResModes) 3638 { 3639 Status = STATUS_NO_MEMORY; 3640 break; 3641 } 3642 cResModes = cActualResModes; 3643 Status = VBoxWddmGetModesForResolution(pInfo->aModes, pInfo->cModes, pInfo->iPreferredMode, &Resolution, 3644 pResModes, cResModes, &cActualResModes, &iPreferableResMode); 3645 Assert(Status == STATUS_SUCCESS); 3646 if (Status != STATUS_SUCCESS) 3647 break; 3648 } 3649 else if (Status != STATUS_SUCCESS) 3650 break; 3651 3652 Assert(iPreferableResMode >= 0); 3653 Assert(cActualResModes); 3654 3655 Status = vboxVidPnCreatePopulateVidPnPathFromLegacy(pDevExt, pRecommendFunctionalVidPnArg->hRecommendedFunctionalVidPn, pVidPnInterface, 3656 pResModes, cActualResModes, iPreferableResMode, 3657 &Resolution, 1 /* cResolutions */, 3658 i, i); /* srcId, tgtId */ 3659 Assert(Status == STATUS_SUCCESS); 3660 if (Status != STATUS_SUCCESS) 3661 { 3662 LOGREL(("vboxVidPnCreatePopulateVidPnFromLegacy failed Status(0x%x)", Status)); 3663 break; 3664 } 3665 } 3666 3667 if(pResModes) 3668 vboxWddmMemFree(pResModes); 3939 } 3940 else if (Status != STATUS_SUCCESS) 3941 break; 3942 3943 Assert(iPreferableResMode >= 0); 3944 Assert(cActualResModes); 3945 3946 Status = vboxVidPnCreatePopulateVidPnPathFromLegacy(pDevExt, pRecommendFunctionalVidPnArg->hRecommendedFunctionalVidPn, pVidPnInterface, 3947 pResModes, cActualResModes, iPreferableResMode, 3948 &Resolution, 1 /* cResolutions */, 3949 i, i); /* srcId, tgtId */ 3950 Assert(Status == STATUS_SUCCESS); 3951 if (Status != STATUS_SUCCESS) 3952 { 3953 LOGREL(("vboxVidPnCreatePopulateVidPnFromLegacy failed Status(0x%x)", Status)); 3954 break; 3955 } 3956 } 3957 3958 if(pResModes) 3959 vboxWddmMemFree(pResModes); 3669 3960 3670 3961 #ifdef VBOXWDDM_DEBUG_VIDPN 3671 3962 vboxVidPnDumpVidPn("\n>>>>Recommended VidPN: >>>>", pDevExt, pRecommendFunctionalVidPnArg->hRecommendedFunctionalVidPn, pVidPnInterface, "<<<<<<<<<<<<<<<<<<<<\n"); 3672 3963 #endif 3673 }3674 3964 3675 3965 LOGF(("LEAVE, status(0x%x), context(0x%x)", Status, hAdapter)); … … 4028 4318 NTSTATUS Status; 4029 4319 PVBOXWDDM_VIDEOMODES_INFO pInfo = VBoxWddmGetVideoModesInfo(pDevExt, pRecommendMonitorModesArg->VideoPresentTargetId); 4320 PVIDEO_MODE_INFORMATION pPreferredMode = &pInfo->aModes[pInfo->iPreferredMode]; 4321 4030 4322 4031 4323 for (uint32_t i = 0; i < pInfo->cResolutions; i++) … … 4041 4333 &pInfo->aResolutions[i], 4042 4334 D3DKMDT_MCO_DRIVER, 4043 FALSE); 4335 pPreferredMode->VisScreenWidth == pInfo->aResolutions[i].cx 4336 && pPreferredMode->VisScreenHeight == pInfo->aResolutions[i].cy); 4044 4337 Assert(Status == STATUS_SUCCESS); 4045 4338 if (Status == STATUS_SUCCESS) -
trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxDispIf.cpp
r34780 r37490 265 265 { 266 266 PVBOXDISPIFWDDM_RESIZEOP_CONTEXT pCtx = (PVBOXDISPIFWDDM_RESIZEOP_CONTEXT)pContext; 267 268 267 D3DKMT_INVALIDATEACTIVEVIDPN IAVidPnData = {0}; 269 268 uint32_t cbData = VBOXWDDM_RECOMMENDVIDPN_SIZE(1); -
trunk/src/VBox/Devices/Graphics/DevVGA_VDMA.cpp
r36045 r37490 674 674 break; 675 675 } 676 case VBOXVDMACMD_TYPE_DMA_NOP: 677 return VINF_SUCCESS; 678 case VBOXVDMACMD_TYPE_CHILD_STATUS_IRQ: 679 return VINF_SUCCESS; 676 680 default: 677 681 AssertBreakpoint(); … … 1263 1267 { 1264 1268 #ifdef VBOX_WITH_CRHGSMI 1269 /* chromium commands are processed by crhomium hgcm thread independently from our internal cmd processing pipeline 1270 * this is why we process them specially */ 1265 1271 if (vboxVDMACmdCheckCrCmd(pVdma, pCmd)) 1266 1272 return; 1267 1273 #endif 1268 1274 1275 #ifndef VBOX_VDMA_WITH_WORKERTHREAD 1276 vboxVDMACommandProcess(pVdma, pCmd); 1277 #else 1269 1278 int rc = VERR_NOT_IMPLEMENTED; 1270 1279 1271 #ifdef VBOX_VDMA_WITH_WORKERTHREAD 1272 1273 #ifdef DEBUG_misha 1280 # ifdef DEBUG_misha 1274 1281 Assert(0); 1275 # endif1282 # endif 1276 1283 1277 1284 VBOXVDMACMD_SUBMIT_CONTEXT Context; … … 1292 1299 rc = VERR_OUT_OF_RESOURCES; 1293 1300 } 1294 #endif1295 1301 /* failure */ 1296 1302 Assert(RT_FAILURE(rc)); … … 1299 1305 int tmpRc = VBoxSHGSMICommandComplete (pIns, pCmd); 1300 1306 AssertRC(tmpRc); 1301 } 1307 #endif 1308 } -
trunk/src/VBox/Devices/Graphics/HGSMI/HGSMIHost.cpp
r35346 r37490 1740 1740 LogFlowFunc(("pIns = %p, pvMem = %p\n", pIns, pvMem)); 1741 1741 1742 VM_ASSERT_OTHER_THREAD(pIns->pVM);1743 1744 1742 int rc = VINF_SUCCESS; 1745 1743 HGSMIOFFSET offBuffer = HGSMIHeapBufferOffset (&pIns->hostHeap, pvMem); -
trunk/src/VBox/GuestHost/OpenGL/util/vboxhgcm.c
r36317 r37490 2103 2103 hgcm_buffer = (CRVBOXHGCMBUFFER *) *bufp - 1; 2104 2104 CRASSERT(hgcm_buffer->magic == CR_VBOXHGCM_BUFFER_MAGIC); 2105 if (hgcm_buffer->magic != CR_VBOXHGCM_BUFFER_MAGIC) 2106 { 2107 crError("HGCM buffer magic mismatch"); 2108 } 2109 2110 2105 2111 if (hgcm_buffer->kind != CR_VBOXHGCM_UHGSMI_BUFFER) 2106 2112 { … … 2126 2132 2127 2133 pClient = (PCRVBOXHGSMI_CLIENT)pBuf->pvUserData; 2134 if (pClient != &conn->HgsmiClient) 2135 { 2136 crError("HGSMI client mismatch"); 2137 } 2128 2138 2129 2139 /* Length would be passed as part of HGCM pointer description -
trunk/src/VBox/HostDrivers/VBoxUSB/win/cmn/VBoxDrvTool.cpp
r37047 r37490 187 187 Assert(cRefs < UINT32_MAX/2); 188 188 189 KeDelayExecutionThread(KernelMode, TRUE, &Interval);189 KeDelayExecutionThread(KernelMode, FALSE, &Interval); 190 190 } 191 191 }
Note:
See TracChangeset
for help on using the changeset viewer.