Changeset 44149 in vbox
- Timestamp:
- Dec 18, 2012 2:05:27 PM (12 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/common/VBoxMPCommon.h
r42217 r44149 33 33 void VBoxMPCmnInitCustomVideoModes(PVBOXMP_DEVEXT pExt); 34 34 VIDEO_MODE_INFORMATION* VBoxMPCmnGetCustomVideoModeInfo(ULONG ulIndex); 35 VIDEO_MODE_INFORMATION* VBoxMPCmnGetVideoModeInfo(ULONG ulIndex);36 35 37 36 #ifdef VBOX_XPDM_MINIPORT 37 VIDEO_MODE_INFORMATION* VBoxMPCmnGetVideoModeInfo(ULONG ulIndex); 38 38 VIDEO_MODE_INFORMATION* VBoxMPXpdmCurrentVideoMode(PVBOXMP_DEVEXT pExt); 39 39 ULONG VBoxMPXpdmGetVideoModesCount(); -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/common/VBoxMPVidModes.cpp
r44040 r44149 24 24 #endif 25 25 #include <wchar.h> 26 #include <VBox/Hardware/VBoxVideoVBE.h> 26 27 27 28 #ifdef VBOX_WITH_WDDM … … 30 31 31 32 /* Custom video modes which are being read from registry at driver startup. */ 32 static VIDEO_MODE_INFORMATION g_CustomVideoModes[64] = { 0 }; 33 33 static VIDEO_MODE_INFORMATION g_CustomVideoModes[VBOX_VIDEO_MAX_SCREENS] = { 0 }; 34 35 #ifdef VBOX_XPDM_MINIPORT 34 36 /* Standart video modes list. 35 * Additional space is reserved for custom video modes for 64guest monitors.37 * Additional space is reserved for custom video modes for VBOX_VIDEO_MAX_SCREENS guest monitors. 36 38 * The custom video mode index is alternating and 2 indexes are reserved for the last custom mode. 37 39 */ 38 static VIDEO_MODE_INFORMATION g_VideoModes[VBOXMP_MAX_VIDEO_MODES + 64+ 2] = { 0 };40 static VIDEO_MODE_INFORMATION g_VideoModes[VBOXMP_MAX_VIDEO_MODES + VBOX_VIDEO_MAX_SCREENS + 2] = { 0 }; 39 41 40 42 /* Number of available video modes, set by VBoxMPCmnBuildVideoModesTable. */ 41 43 static uint32_t g_NumVideoModes = 0; 44 #endif 42 45 43 46 static BOOLEAN … … 210 213 } 211 214 215 #ifdef VBOX_XPDM_MINIPORT 212 216 VIDEO_MODE_INFORMATION* VBoxMPCmnGetVideoModeInfo(ULONG ulIndex) 213 217 { 214 218 return (ulIndex<RT_ELEMENTS(g_VideoModes)) ? &g_VideoModes[ulIndex] : NULL; 215 219 } 220 #endif 216 221 217 222 static bool VBoxMPVideoModesMatch(const PVIDEO_MODE_INFORMATION pMode1, const PVIDEO_MODE_INFORMATION pMode2) … … 963 968 Assert(pModes->cModes<=RT_ELEMENTS(pModes->aModes)); 964 969 970 if (!VBoxMPIsStartingUp(pExt, VidPnTargetId)) 971 { 972 /* make sure we keep the current mode to avoid mode flickering */ 973 PVBOXWDDM_ALLOC_DATA pAllocData = pExt->aSources[VidPnTargetId].pPrimaryAllocation ? 974 &pExt->aSources[VidPnTargetId].pPrimaryAllocation->AllocData 975 : &pExt->aSources[VidPnTargetId].AllocData; 976 if (pModes->cModes < RT_ELEMENTS(pModes->aModes)) 977 { 978 int foundIdx; 979 VBoxFillVidModeInfo(&pModes->aModes[pModes->cModes], pAllocData->SurfDesc.width, pAllocData->SurfDesc.height, pAllocData->SurfDesc.bpp, 1/*index*/, 0); 980 if ((foundIdx=VBoxMPFindVideoMode(pModes->aModes, pModes->cModes, &pModes->aModes[pModes->cModes]))>=0) 981 { 982 pModes->iPreferredMode = foundIdx; 983 } 984 else 985 { 986 pModes->iPreferredMode = pModes->cModes; 987 ++pModes->cModes; 988 } 989 990 #ifdef VBOX_WITH_8BPP_MODES 991 int bytesPerPixel=1; 992 #else 993 int bytesPerPixel=2; 994 #endif 995 for (; bytesPerPixel<=4; bytesPerPixel++) 996 { 997 int bpp = 8*bytesPerPixel; 998 999 if (bpp == pAllocData->SurfDesc.bpp) 1000 continue; 1001 1002 if (!VBoxMPValidateVideoModeParamsGuest(pExt, VidPnTargetId, 1003 pAllocData->SurfDesc.width, pAllocData->SurfDesc.height, 1004 bpp)) 1005 continue; 1006 1007 if (pModes->cModes >= RT_ELEMENTS(pModes->aModes)) 1008 { 1009 WARN(("ran out of video modes 2")); 1010 break; 1011 } 1012 1013 VBoxFillVidModeInfo(&pModes->aModes[pModes->cModes], 1014 pAllocData->SurfDesc.width, pAllocData->SurfDesc.height, 1015 bpp, pModes->cModes, 0); 1016 if (VBoxMPFindVideoMode(pModes->aModes, pModes->cModes, &pModes->aModes[pModes->cModes]) < 0) 1017 { 1018 ++pModes->cModes; 1019 } 1020 } 1021 } 1022 else 1023 { 1024 WARN(("ran out of video modes 1")); 1025 } 1026 } 1027 965 1028 /* Check if there's a pending display change request for this adapter */ 966 1029 VIDEO_MODE_INFORMATION specialMode; -
trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxDispIf.cpp
r44136 r44149 120 120 bSupported &= !!(pIf->modeData.wddm.pfnD3DKMTInvalidateActiveVidPn); 121 121 122 pIf->modeData.wddm.pfnD3DKMTPollDisplayChildren = (PFND3DKMT_POLLDISPLAYCHILDREN)GetProcAddress(hGdi32, "D3DKMTPollDisplayChildren"); 123 Log((__FUNCTION__": pfnD3DKMTPollDisplayChildren = %p\n", pIf->modeData.wddm.pfnD3DKMTPollDisplayChildren)); 124 bSupported &= !!(pIf->modeData.wddm.pfnD3DKMTPollDisplayChildren); 125 122 126 if (!bSupported) 123 127 { … … 953 957 } 954 958 959 typedef struct VBOXDISPIF_REINITMODES_OP 960 { 961 VBOXDISPIFESCAPE_REINITVIDEOMODESBYMASK EscData; 962 } VBOXDISPIF_REINITMODES_OP, *PVBOXDISPIF_REINITMODES_OP; 963 964 static DECLCALLBACK(BOOLEAN) vboxDispIfReninitModesWDDMOp(PCVBOXDISPIF pIf, D3DKMT_HANDLE hAdapter, DISPLAY_DEVICE *pDev, PVOID pContext) 965 { 966 PVBOXDISPIF_REINITMODES_OP pData = (PVBOXDISPIF_REINITMODES_OP)pContext; 967 VBOXDISPIFWDDM_ESCAPEOP_CONTEXT Ctx = {0}; 968 Ctx.pEscape = &pData->EscData.EscapeHdr; 969 Ctx.cbData = sizeof (pData->EscData) - sizeof (pData->EscData.EscapeHdr); 970 // Ctx.EscapeFlags.HardwareAccess = 0; 971 DWORD err = vboxDispIfWDDMAdapterOp(pIf, -1 /* iDisplay, -1 means primary */, vboxDispIfEscapeWDDMOp, &Ctx); 972 if (err == NO_ERROR) 973 { 974 if (!Ctx.Status) 975 err = NO_ERROR; 976 else 977 { 978 if (Ctx.Status == 0xC00000BBL) /* not supported */ 979 err = ERROR_NOT_SUPPORTED; 980 else 981 err = ERROR_GEN_FAILURE; 982 Log((__FUNCTION__": pfnD3DKMTEscape failed, Status (0x%x)\n", Ctx.Status)); 983 } 984 } 985 else 986 Log((__FUNCTION__": vboxDispIfWDDMAdapterOp failed, err (%d)\n", err)); 987 988 D3DKMT_POLLDISPLAYCHILDREN PollData = {0}; 989 PollData.hAdapter = hAdapter; 990 PollData.NonDestructiveOnly = 1; 991 NTSTATUS Status = pIf->modeData.wddm.pfnD3DKMTPollDisplayChildren(&PollData); 992 if (Status != 0) 993 { 994 Log((__FUNCTION__": pfnD3DKMTPollDisplayChildren failed, Status (0x%x)\n", Status)); 995 } 996 return TRUE; 997 } 998 955 999 static DWORD vboxDispIfReninitModesWDDM(PCVBOXDISPIF const pIf, uint8_t *pScreenIdMask, BOOL fReconnectDisplaysOnChange) 956 1000 { 957 VBOXDISPIF ESCAPE_REINITVIDEOMODESBYMASKData = {0};958 Data.EscapeHdr.escapeCode = VBOXESC_REINITVIDEOMODESBYMASK;1001 VBOXDISPIF_REINITMODES_OP OpData = {0}; 1002 OpData.EscData.EscapeHdr.escapeCode = VBOXESC_REINITVIDEOMODESBYMASK; 959 1003 if (fReconnectDisplaysOnChange) 960 Data.EscapeHdr.u32CmdSpecific = VBOXWDDM_REINITVIDEOMODESBYMASK_F_RECONNECT_DISPLAYS_ON_CHANGE; 961 962 memcpy(Data.ScreenMask, pScreenIdMask, sizeof (Data.ScreenMask)); 963 964 DWORD err = vboxDispIfEscapeWDDM(pIf, &Data.EscapeHdr, sizeof (Data) - sizeof (Data.EscapeHdr), fReconnectDisplaysOnChange ? FALSE /* hw access must be false here, 965 * otherwise the miniport driver would fail 966 * request to prevent a deadlock */ 967 : TRUE); 968 if (err != NO_ERROR) 969 { 970 Log((__FUNCTION__": VBoxDispIfEscape failed with err (%d)\n", err)); 971 } 1004 OpData.EscData.EscapeHdr.u32CmdSpecific = VBOXWDDM_REINITVIDEOMODESBYMASK_F_RECONNECT_DISPLAYS_ON_CHANGE; 1005 1006 memcpy(OpData.EscData.ScreenMask, pScreenIdMask, sizeof (OpData.EscData.ScreenMask)); 1007 1008 DWORD err = vboxDispIfWDDMAdapterOp(pIf, -1 /* iDisplay, -1 means primary */, vboxDispIfReninitModesWDDMOp, &OpData); 972 1009 return err; 973 1010 } … … 1152 1189 vboxDispIfReninitModesWDDM(pIf, ScreenMask, TRUE); 1153 1190 1154 for (UINT i = 0; i < 4; ++i) 1155 { 1156 WaitForSingleObject(g_VBoxDispIfWddm.hResizeEvent, 500); 1157 winEr = vboxDispIfWddmValidateFixResize(pIf, paDisplayDevices, paDeviceModes, cDevModes); 1158 if (winEr == NO_ERROR) 1159 break; 1160 } 1191 winEr = vboxDispIfWddmValidateFixResize(pIf, paDisplayDevices, paDeviceModes, cDevModes); 1192 1193 // for (UINT i = 0; i < 4; ++i) 1194 // { 1195 // WaitForSingleObject(g_VBoxDispIfWddm.hResizeEvent, 500); 1196 // winEr = vboxDispIfWddmValidateFixResize(pIf, paDisplayDevices, paDeviceModes, cDevModes); 1197 // if (winEr == NO_ERROR) 1198 // break; 1199 // } 1161 1200 1162 1201 Assert(winEr == NO_ERROR); -
trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxDispIf.h
r42232 r44149 68 68 /* auto resize support */ 69 69 PFND3DKMT_INVALIDATEACTIVEVIDPN pfnD3DKMTInvalidateActiveVidPn; 70 PFND3DKMT_POLLDISPLAYCHILDREN pfnD3DKMTPollDisplayChildren; 70 71 } wddm; 71 72 #endif
Note:
See TracChangeset
for help on using the changeset viewer.