From e0b8d3a8df866a9ab44f717c3e1bdd3e5e6bac24 Mon Sep 17 00:00:00 2001 From: peak3d Date: Thu, 31 Jan 2019 20:59:24 +0100 Subject: [PATCH] [Resolution] Check current mode if whitelist doesn't match --- xbmc/windowing/Resolution.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/xbmc/windowing/Resolution.cpp b/xbmc/windowing/Resolution.cpp index e28708ff065f5..8efa7d2ba96fe 100644 --- a/xbmc/windowing/Resolution.cpp +++ b/xbmc/windowing/Resolution.cpp @@ -73,6 +73,8 @@ RESOLUTION CResolutionUtils::ChooseBestResolution(float fps, int width, int heig void CResolutionUtils::FindResolutionFromWhitelist(float fps, int width, int height, bool is3D, RESOLUTION &resolution) { RESOLUTION_INFO curr = CServiceBroker::GetWinSystem()->GetGfxContext().GetResInfo(resolution); + CLog::Log(LOGNOTICE, "Whitelist search for: width: %d, height: %d, fps: %0.3f, 3D: %s", + width, height, fps, is3D ? "true" : "false"); std::vector indexList = CServiceBroker::GetSettingsComponent()->GetSettings()->GetList(CSettings::SETTING_VIDEOSCREEN_WHITELIST); if (indexList.empty()) @@ -143,6 +145,16 @@ void CResolutionUtils::FindResolutionFromWhitelist(float fps, int width, int hei CLog::Log(LOGDEBUG, "No double refresh rate whitelisted resolution matched, trying current resolution"); + if (width <= curr.iScreenWidth + && height <= curr.iScreenHeight + && (MathUtils::FloatEquals(curr.fRefreshRate, fps, 0.01f) || MathUtils::FloatEquals(curr.fRefreshRate, fps * 2, 0.01f))) + { + CLog::Log(LOGDEBUG, "Matched current Resolution %s (%d)", curr.strMode.c_str(), resolution); + return; + } + + CLog::Log(LOGDEBUG, "Current resolution doesn't match, trying default resolution"); + const RESOLUTION_INFO desktop_info = CServiceBroker::GetWinSystem()->GetGfxContext().GetResInfo(CDisplaySettings::GetInstance().GetCurrentResolution()); for (const auto &mode : indexList) @@ -161,7 +173,7 @@ void CResolutionUtils::FindResolutionFromWhitelist(float fps, int width, int hei } } - CLog::Log(LOGDEBUG, "No larger whitelisted resolution matched, trying current resolution with double refreshrate"); + CLog::Log(LOGDEBUG, "Default resolution doesn't provide reqired refreshrate, trying default resolution with double refreshrate"); for (const auto &mode : indexList) {