From af301312d5b9d69a39fd0a7584d2891f34d40430 Mon Sep 17 00:00:00 2001 From: Ikalco <73481042+ikalco@users.noreply.github.com> Date: Mon, 30 Dec 2024 12:45:42 -0600 Subject: [PATCH] core: fix custom resolutions (#8897) --- src/helpers/Monitor.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/helpers/Monitor.cpp b/src/helpers/Monitor.cpp index 3fb90959..01bb79ac 100644 --- a/src/helpers/Monitor.cpp +++ b/src/helpers/Monitor.cpp @@ -479,6 +479,12 @@ bool CMonitor::applyMonitorRule(SMonitorRule* pMonitorRule, bool force) { return false; }); + // if the best mode isnt close to requested, then try requested as custom mode first + auto bestMode = requestedModes.back(); + if (!DELTALESSTHAN(bestMode->pixelSize.x, RULE->resolution.x, 1) || !DELTALESSTHAN(bestMode->pixelSize.y, RULE->resolution.y, 1) || + !DELTALESSTHAN(bestMode->refreshRate / 1000.f, RULE->refreshRate, 1)) + requestedModes.push_back(makeShared(Aquamarine::SOutputMode{.pixelSize = RULE->resolution, .refreshRate = RULE->refreshRate * 1000.f})); + // then if requested is custom, try custom mode first if (RULE->drmMode.type == DRM_MODE_TYPE_USERDEF) { if (output->getBackend()->type() != Aquamarine::eBackendType::AQ_BACKEND_DRM)