Changeset 63099 in vbox for trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxDispIf.cpp
- Timestamp:
- Aug 6, 2016 3:38:51 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxDispIf.cpp
r62522 r63099 24 24 #include <malloc.h> 25 25 26 /********************************************************************************************************************************* 27 * Defined Constants And Macros * 28 *********************************************************************************************************************************/ 26 29 #ifdef DEBUG_misha 27 # define WARN(_m) do { \30 # define WARN(_m) do { \ 28 31 Assert(0); \ 29 32 Log(_m); \ 30 33 } while (0) 31 # define WARN_FUNC(_m) do { \34 # define WARN_FUNC(_m) do { \ 32 35 Assert(0); \ 33 36 LogFunc(_m); \ 34 37 } while (0) 35 38 #else 36 # define WARN(_m) do { \39 # define WARN(_m) do { \ 37 40 Log(_m); \ 38 41 } while (0) 39 # define WARN_FUNC(_m) do { \42 # define WARN_FUNC(_m) do { \ 40 43 LogFunc(_m); \ 41 44 } while (0) … … 52 55 #endif 53 56 57 58 /********************************************************************************************************************************* 59 * Structures and Typedefs * 60 *********************************************************************************************************************************/ 54 61 typedef struct VBOXDISPIF_OP 55 62 { … … 59 66 VBOXDISPKMT_CONTEXT Context; 60 67 } VBOXDISPIF_OP; 61 62 static DWORD vboxDispIfWddmResizeDisplay(PCVBOXDISPIF const pIf, UINT Id, BOOL fEnable, DISPLAY_DEVICE * paDisplayDevices, DEVMODE *paDeviceMode, UINT devModes);63 static DWORD vboxDispIfResizePerform(PCVBOXDISPIF const pIf, UINT iChangedMode, BOOL fEnable, BOOL fExtDispSup, DISPLAY_DEVICE *paDisplayDevices, DEVMODE *paDeviceModes, UINT cDevModes);64 static DWORD vboxDispIfWddmEnableDisplaysTryingTopology(PCVBOXDISPIF const pIf, UINT cIds, UINT *pIds, BOOL fEnable);65 static DWORD vboxDispIfResizeStartedWDDMOp(VBOXDISPIF_OP *pOp);66 68 67 69 /* … … 89 91 } VBOXDISPIF_WDDM_DISPCFG; 90 92 93 94 /********************************************************************************************************************************* 95 * Internal Functions * 96 *********************************************************************************************************************************/ 97 static DWORD vboxDispIfWddmResizeDisplay(PCVBOXDISPIF const pIf, UINT Id, BOOL fEnable, DISPLAY_DEVICE * paDisplayDevices, 98 DEVMODE *paDeviceModes, UINT devModes); 99 static DWORD vboxDispIfResizePerform(PCVBOXDISPIF const pIf, UINT iChangedMode, BOOL fEnable, BOOL fExtDispSup, 100 DISPLAY_DEVICE *paDisplayDevices, DEVMODE *paDeviceModes, UINT cDevModes); 101 static DWORD vboxDispIfWddmEnableDisplaysTryingTopology(PCVBOXDISPIF const pIf, UINT cIds, UINT *pIds, BOOL fEnable); 102 static DWORD vboxDispIfResizeStartedWDDMOp(VBOXDISPIF_OP *pOp); 103 104 91 105 static DWORD vboxDispIfWddmDcCreate(VBOXDISPIF_WDDM_DISPCFG *pCfg, UINT32 fFlags) 92 106 { … … 217 231 } 218 232 233 #define VBOX_WDDM_DC_SEARCH_PATH_ANY (~(UINT)0) 219 234 static int vboxDispIfWddmDcSearchPath(VBOXDISPIF_WDDM_DISPCFG *pCfg, UINT srcId, UINT trgId) 220 235 { 221 236 for (UINT iter = 0; iter < pCfg->cPathInfoArray; ++iter) 222 237 { 223 if ( (srcId == ~0UL|| pCfg->pPathInfoArray[iter].sourceInfo.id == srcId)224 && (trgId == ~0UL|| pCfg->pPathInfoArray[iter].targetInfo.id == trgId))238 if ( (srcId == VBOX_WDDM_DC_SEARCH_PATH_ANY || pCfg->pPathInfoArray[iter].sourceInfo.id == srcId) 239 && (trgId == VBOX_WDDM_DC_SEARCH_PATH_ANY || pCfg->pPathInfoArray[iter].targetInfo.id == trgId)) 225 240 { 226 241 return (int)iter; … … 284 299 static DWORD vboxDispIfWddmDcSettingsUpdate(VBOXDISPIF_WDDM_DISPCFG *pCfg, int idx, DEVMODE *pDeviceMode, BOOL fInvalidateSrcMode, BOOL fEnable) 285 300 { 286 UINT Id = pCfg->pPathInfoArray[idx].sourceInfo.id;287 288 301 if (fInvalidateSrcMode) 289 302 pCfg->pPathInfoArray[idx].sourceInfo.modeInfoIdx = DISPLAYCONFIG_PATH_MODE_IDX_INVALID; … … 445 458 if (idx < 0) 446 459 { 447 idx = vboxDispIfWddmDcSearchPath(pCfg, -1, i);460 idx = vboxDispIfWddmDcSearchPath(pCfg, VBOX_WDDM_DC_SEARCH_PATH_ANY, i); 448 461 if (idx >= 0) 449 462 { … … 472 485 { 473 486 WARN(("VBoxTray:(WDDM) %d %d path not supported\n", i, i)); 474 idx = vboxDispIfWddmDcSearchPath(pCfg, -1, i);487 idx = vboxDispIfWddmDcSearchPath(pCfg, VBOX_WDDM_DC_SEARCH_PATH_ANY, i); 475 488 if (idx < 0) 476 489 { … … 605 618 static DWORD vboxDispIfEscapeXPDM(PCVBOXDISPIF pIf, PVBOXDISPIFESCAPE pEscape, int cbData, int iDirection) 606 619 { 620 RT_NOREF(pIf); 607 621 HDC hdc = GetDC(HWND_DESKTOP); 608 622 VOID *pvData = cbData ? VBOXDISPIFESCAPE_DATA(pEscape, VOID) : NULL; … … 615 629 if (iRet > 0) 616 630 return VINF_SUCCESS; 617 elseif (iRet == 0)631 if (iRet == 0) 618 632 return ERROR_NOT_SUPPORTED; 619 633 /* else */ … … 990 1004 if (!RegisterClassEx(&wc)) 991 1005 { 992 DWORD winErr = GetLastError(); 993 WARN_FUNC(("RegisterClass failed, winErr(%d)\n", winErr)); 1006 WARN_FUNC(("RegisterClass failed, winErr(%d)\n", GetLastError())); 994 1007 hr = E_FAIL; 995 1008 } … … 1014 1027 else 1015 1028 { 1016 DWORD winErr = GetLastError(); 1017 WARN_FUNC(("CreateWindowEx failed, winErr(%d)\n", winErr)); 1029 WARN_FUNC(("CreateWindowEx failed, winErr(%d)\n", GetLastError())); 1018 1030 hr = E_FAIL; 1019 1031 } … … 1044 1056 { 1045 1057 PVBOXRR pMon = &g_VBoxRr; 1046 HRESULT tmpHr= vboxRrWndDestroy(pMon->hWnd);1047 Assert( tmpHr == S_OK);1058 HRESULT hrTmp = vboxRrWndDestroy(pMon->hWnd); 1059 Assert(hrTmp == S_OK); NOREF(hrTmp); 1048 1060 1049 1061 HINSTANCE hInstance = (HINSTANCE)GetModuleHandle(NULL); … … 1078 1090 DWORD winErr = GetLastError(); 1079 1091 WARN_FUNC(("SetEvent failed, winErr = (%d)", winErr)); 1080 HRESULT tmpHr= HRESULT_FROM_WIN32(winErr);1081 Assert( tmpHr != S_OK);1092 HRESULT hrTmp = HRESULT_FROM_WIN32(winErr); 1093 Assert(hrTmp != S_OK); NOREF(hrTmp); 1082 1094 } 1083 1095 … … 1133 1145 static DWORD WINAPI vboxRrRunnerThread(void *pvUser) 1134 1146 { 1147 RT_NOREF(pvUser); 1135 1148 HRESULT hr = vboxRrWndInit(); 1136 1149 Assert(hr == S_OK); … … 1238 1251 static DWORD vboxDispIfWddmInit(PCVBOXDISPIF pIf) 1239 1252 { 1253 RT_NOREF(pIf); 1240 1254 HRESULT hr = VBoxRrInit(); 1241 1255 if (SUCCEEDED(hr)) 1242 {1243 1256 return ERROR_SUCCESS; 1244 }1245 1257 WARN(("VBoxTray: VBoxRrInit failed hr 0x%x\n", hr)); 1246 1258 return hr; … … 1249 1261 static void vboxDispIfWddmTerm(PCVBOXDISPIF pIf) 1250 1262 { 1263 RT_NOREF(pIf); 1251 1264 VBoxRrTerm(); 1252 1265 } … … 1365 1378 DWORD vboxDispIfCancelPendingResizeWDDM(PCVBOXDISPIF const pIf) 1366 1379 { 1380 RT_NOREF(pIf); 1367 1381 Log(("VBoxTray: cancelling pending resize\n")); 1368 1382 VBoxRrRetryStop(); … … 1512 1526 static DWORD vboxDispIfWddmEnableDisplays(PCVBOXDISPIF const pIf, UINT cIds, UINT *pIds, BOOL fEnabled, BOOL fSetTopology, DEVMODE *pDeviceMode) 1513 1527 { 1528 RT_NOREF(pIf); 1514 1529 VBOXDISPIF_WDDM_DISPCFG DispCfg; 1515 1530 … … 1580 1595 UINT Id = pChangeIds[i]; 1581 1596 /* re-query paths */ 1582 iPath = vboxDispIfWddmDcSearchPath(&DispCfg, -1, Id);1597 iPath = vboxDispIfWddmDcSearchPath(&DispCfg, VBOX_WDDM_DC_SEARCH_PATH_ANY, Id); 1583 1598 if (iPath < 0) 1584 1599 { … … 1663 1678 } 1664 1679 1665 static DWORD vboxDispIfWddmResizeDisplay(PCVBOXDISPIF const pIf, UINT Id, BOOL fEnable, DISPLAY_DEVICE * paDisplayDevices, DEVMODE *paDeviceMode, UINT devModes) 1666 { 1680 static DWORD vboxDispIfWddmResizeDisplay(PCVBOXDISPIF const pIf, UINT Id, BOOL fEnable, DISPLAY_DEVICE *paDisplayDevices, 1681 DEVMODE *paDeviceModes, UINT devModes) 1682 { 1683 RT_NOREF(paDisplayDevices, devModes); 1667 1684 VBOXDISPIF_WDDM_DISPCFG DispCfg; 1668 1685 DWORD winEr; … … 1730 1747 Assert(fEnable); 1731 1748 1732 winEr = vboxDispIfWddmDcSettingsUpdate(&DispCfg, iPath, &paDeviceMode [Id], FALSE, fEnable);1749 winEr = vboxDispIfWddmDcSettingsUpdate(&DispCfg, iPath, &paDeviceModes[Id], FALSE, fEnable); 1733 1750 if (winEr != ERROR_SUCCESS) 1734 1751 { … … 1977 1994 static DWORD vboxDispIfSwitchToXPDM_NT4(PVBOXDISPIF pIf) 1978 1995 { 1996 RT_NOREF(pIf); 1979 1997 return NO_ERROR; 1980 1998 } … … 2099 2117 static DWORD vboxDispIfSeamlessCreateWDDM(PCVBOXDISPIF const pIf, VBOXDISPIF_SEAMLESS *pSeamless, HANDLE hEvent) 2100 2118 { 2119 RT_NOREF(hEvent); 2101 2120 HRESULT hr = vboxDispKmtOpenAdapter(&pIf->modeData.wddm.KmtCallbacks, &pSeamless->modeData.wddm.Adapter); 2102 2121 if (SUCCEEDED(hr)) 2103 2122 { 2104 #ifdef VBOX_DISPIF_WITH_OPCONTEXT 2123 #ifndef VBOX_DISPIF_WITH_OPCONTEXT 2124 return ERROR_SUCCESS; 2125 #else 2105 2126 hr = vboxDispKmtCreateDevice(&pSeamless->modeData.wddm.Adapter, &pSeamless->modeData.wddm.Device); 2106 2127 if (SUCCEEDED(hr)) … … 2109 2130 0, 0, hEvent, 0ULL); 2110 2131 if (SUCCEEDED(hr)) 2111 #endif2112 2132 return ERROR_SUCCESS; 2113 #ifdef VBOX_DISPIF_WITH_OPCONTEXT 2114 else 2115 WARN(("VBoxTray: vboxDispKmtCreateContext failed hr 0x%x", hr)); 2133 WARN(("VBoxTray: vboxDispKmtCreateContext failed hr 0x%x", hr)); 2116 2134 2117 2135 vboxDispKmtDestroyDevice(&pSeamless->modeData.wddm.Device); … … 2121 2139 2122 2140 vboxDispKmtCloseAdapter(&pSeamless->modeData.wddm.Adapter); 2123 #endif 2141 #endif /* VBOX_DISPIF_WITH_OPCONTEXT */ 2124 2142 } 2125 2143
Note:
See TracChangeset
for help on using the changeset viewer.