- Timestamp:
- May 25, 2018 6:18:21 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxDispIf.cpp
r72003 r72351 1698 1698 1699 1699 return winEr; 1700 } 1701 1702 BOOL vboxDispIfWddmResizeDisplayWin7(PCVBOXDISPIF const pIf, uint32_t cModeHints, const VBOXDISPLAY_MODEHINT* paModeHints) 1703 { 1704 const VBOXDISPLAY_MODEHINT* pHint; 1705 VBOXDISPIF_OP Op; 1706 DWORD winEr = ERROR_SUCCESS; 1707 uint32_t id; 1708 int iPath; 1709 1710 vboxDispIfOpBegin(pIf, &Op); 1711 1712 for (id = 0; id < cModeHints; ++id) 1713 { 1714 pHint = &paModeHints[id]; 1715 1716 if (pHint->fModeHintFlags & VBOXDISPLAY_MODEHINT_ACTIVE) 1717 { 1718 RTRECTSIZE Size; 1719 1720 Size.cx = pHint->cx; 1721 Size.cy = pHint->cy; 1722 1723 vboxDispIfUpdateModesWDDM(&Op, id, &Size); 1724 } 1725 } 1726 1727 vboxDispIfOpEnd(&Op); 1728 1729 VBOXDISPIF_WDDM_DISPCFG DispCfg; 1730 1731 vboxDispIfWddmDcCreate(&DispCfg, QDC_ALL_PATHS); 1732 1733 for (id = 0; id < cModeHints; ++id) 1734 { 1735 DISPLAYCONFIG_PATH_INFO *pPathInfo; 1736 1737 pHint = &paModeHints[id]; 1738 iPath = vboxDispIfWddmDcSearchPath(&DispCfg, id, id); 1739 1740 if (iPath < 0) 1741 { 1742 WARN(("VBoxTray:(WDDM) Unexpected iPath(%d) between src(%d) and tgt(%d)\n", iPath, id, id)); 1743 continue; 1744 } 1745 1746 if (pHint->fModeHintFlags & VBOXDISPLAY_MODEHINT_ACTIVE) 1747 { 1748 DISPLAYCONFIG_SOURCE_MODE *pSrcMode; 1749 DISPLAYCONFIG_TARGET_MODE *pTgtMode; 1750 1751 pPathInfo = &DispCfg.pPathInfoArray[iPath]; 1752 1753 if (pPathInfo->flags & DISPLAYCONFIG_PATH_ACTIVE) 1754 { 1755 UINT iSrcMode, iTgtMode; 1756 1757 iSrcMode = pPathInfo->sourceInfo.modeInfoIdx; 1758 iTgtMode = pPathInfo->targetInfo.modeInfoIdx; 1759 1760 if (iSrcMode >= DispCfg.cModeInfoArray || iTgtMode >= DispCfg.cModeInfoArray) 1761 { 1762 WARN(("VBoxTray:(WDDM) Unexpected iSrcMode(%d) and/or iTgtMode(%d)\n", iSrcMode, iTgtMode)); 1763 continue; 1764 } 1765 1766 pSrcMode = &DispCfg.pModeInfoArray[iSrcMode].sourceMode; 1767 pTgtMode = &DispCfg.pModeInfoArray[iTgtMode].targetMode; 1768 1769 pSrcMode->width = 1770 pTgtMode->targetVideoSignalInfo.activeSize.cx = 1771 pTgtMode->targetVideoSignalInfo.totalSize.cx = pHint->cx; 1772 1773 pSrcMode->height = 1774 pTgtMode->targetVideoSignalInfo.activeSize.cy = 1775 pTgtMode->targetVideoSignalInfo.totalSize.cy = pHint->cy; 1776 1777 pSrcMode->position.x = pHint->xOrigin; 1778 pSrcMode->position.y = pHint->yOrigin; 1779 1780 switch (pHint->cBPP) 1781 { 1782 case 32: 1783 pSrcMode->pixelFormat = DISPLAYCONFIG_PIXELFORMAT_32BPP; 1784 break; 1785 case 24: 1786 pSrcMode->pixelFormat = DISPLAYCONFIG_PIXELFORMAT_24BPP; 1787 break; 1788 case 16: 1789 pSrcMode->pixelFormat = DISPLAYCONFIG_PIXELFORMAT_16BPP; 1790 break; 1791 case 8: 1792 pSrcMode->pixelFormat = DISPLAYCONFIG_PIXELFORMAT_8BPP; 1793 break; 1794 default: 1795 LogRel(("VBoxTray: (WDDM) invalid bpp %d, using 32bpp instead\n", pHint->cBPP)); 1796 pSrcMode->pixelFormat = DISPLAYCONFIG_PIXELFORMAT_32BPP; 1797 break; 1798 } 1799 } 1800 else 1801 { 1802 DISPLAYCONFIG_MODE_INFO *pModeInfo, *pModeInfoNew; 1803 1804 pModeInfo = (DISPLAYCONFIG_MODE_INFO *)realloc(DispCfg.pModeInfoArray, (DispCfg.cModeInfoArray + 2) * sizeof(DISPLAYCONFIG_MODE_INFO)); 1805 1806 if (!pModeInfo) 1807 { 1808 WARN(("VBoxTray:(WDDM) Unable to re-allocate DispCfg.pModeInfoArray\n")); 1809 continue; 1810 } 1811 1812 DispCfg.pModeInfoArray = pModeInfo; 1813 1814 *pPathInfo = DispCfg.pPathInfoArray[0]; 1815 pPathInfo->sourceInfo.id = id; 1816 pPathInfo->targetInfo.id = id; 1817 1818 pModeInfoNew = &pModeInfo[DispCfg.cModeInfoArray]; 1819 pModeInfoNew->infoType = DISPLAYCONFIG_MODE_INFO_TYPE_SOURCE; 1820 pModeInfoNew->id = id; 1821 pModeInfoNew->adapterId = pModeInfo[0].adapterId; 1822 pSrcMode = &pModeInfoNew->sourceMode; 1823 pSrcMode->width = pHint->cx; 1824 pSrcMode->height = pHint->cy; 1825 pSrcMode->pixelFormat = DISPLAYCONFIG_PIXELFORMAT_32BPP; 1826 pSrcMode->position.x = pHint->xOrigin; 1827 pSrcMode->position.y = pHint->yOrigin; 1828 pPathInfo->sourceInfo.modeInfoIdx = DispCfg.cModeInfoArray; 1829 1830 pModeInfoNew++; 1831 pModeInfoNew->infoType = DISPLAYCONFIG_MODE_INFO_TYPE_TARGET; 1832 pModeInfoNew->id = id; 1833 pModeInfoNew->adapterId = pModeInfo[0].adapterId; 1834 pModeInfoNew->targetMode = pModeInfo[0].targetMode; 1835 pTgtMode = &pModeInfoNew->targetMode; 1836 pTgtMode->targetVideoSignalInfo.activeSize.cx = pHint->cx; 1837 pTgtMode->targetVideoSignalInfo.totalSize.cx = pHint->cx; 1838 pTgtMode->targetVideoSignalInfo.activeSize.cy = pHint->cy; 1839 pTgtMode->targetVideoSignalInfo.totalSize.cy = pHint->cy; 1840 pPathInfo->targetInfo.modeInfoIdx = DispCfg.cModeInfoArray + 1; 1841 1842 DispCfg.cModeInfoArray += 2; 1843 } 1844 } 1845 else 1846 { 1847 DispCfg.pPathInfoArray[id].flags &= ~DISPLAYCONFIG_PATH_ACTIVE; 1848 } 1849 } 1850 1851 UINT fSetFlags = SDC_USE_SUPPLIED_DISPLAY_CONFIG; 1852 winEr = vboxDispIfWddmDcSet(&DispCfg, fSetFlags | SDC_VALIDATE); 1853 if (winEr != ERROR_SUCCESS) 1854 { 1855 WARN(("VBoxTray:(WDDM) pfnSetDisplayConfig Failed to validate winEr %d.\n", winEr)); 1856 fSetFlags |= SDC_ALLOW_CHANGES; 1857 } 1858 1859 winEr = vboxDispIfWddmDcSet(&DispCfg, fSetFlags | SDC_SAVE_TO_DATABASE | SDC_APPLY); 1860 if (winEr != ERROR_SUCCESS) 1861 { 1862 WARN(("VBoxTray:(WDDM) pfnSetDisplayConfig Failed to validate winEr %d.\n", winEr)); 1863 } 1864 1865 vboxDispIfWddmDcTerm(&DispCfg); 1866 1867 return (winEr == ERROR_SUCCESS); 1700 1868 } 1701 1869
Note:
See TracChangeset
for help on using the changeset viewer.