From 33044c3816ce99db849aa50a9c97353056535968 Mon Sep 17 00:00:00 2001 From: davc0n <57829860+davc0n@users.noreply.github.com> Date: Mon, 4 May 2026 17:08:27 +0200 Subject: render: scale background to monitor resolution (#14250) * render: scale background to monitor resolution Currently the background is not scaled, e.g. 8k size image always uses ~128Mb of VRAM. We could reduce the consumption for low-end devices and monitors with lower resolution: - ~8Mb for 1080p - ~16Mb for 2k - ~32Mb for 4k * render: use gpu to scale bgtex and fix missing reset on size change --- src/helpers/Monitor.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'src/helpers/Monitor.cpp') diff --git a/src/helpers/Monitor.cpp b/src/helpers/Monitor.cpp index a5195a94..b2e94a31 100644 --- a/src/helpers/Monitor.cpp +++ b/src/helpers/Monitor.cpp @@ -7,12 +7,10 @@ #include "../protocols/ColorManagement.hpp" #include "../Compositor.hpp" #include "../config/ConfigValue.hpp" -#include "../config/ConfigManager.hpp" #include "../config/shared/monitor/MonitorRuleManager.hpp" #include "../config/shared/workspace/WorkspaceRuleManager.hpp" #include "../config/shared/animation/AnimationTree.hpp" #include "../protocols/GammaControl.hpp" -#include "../devices/ITouch.hpp" #include "../protocols/LayerShell.hpp" #include "../protocols/PresentationTime.hpp" #include "../protocols/DRMLease.hpp" @@ -34,7 +32,6 @@ #include "../layout/LayoutManager.hpp" #include "../i18n/Engine.hpp" #include "../helpers/cm/ColorManagement.hpp" -#include "sync/SyncTimeline.hpp" #include "time/Time.hpp" #include "../desktop/view/LayerSurface.hpp" #include "../desktop/state/FocusState.hpp" @@ -799,9 +796,10 @@ bool CMonitor::applyMonitorRule(Config::CMonitorRule&& pMonitorRule, bool force) } } - const auto WAS10B = m_enabled10bit; - const auto OLDRES = m_pixelSize; - bool success = false; + const auto WAS10B = m_enabled10bit; + const auto OLDPIXELSIZE = m_pixelSize; + const auto OLDTRANSFORMEDSIZE = m_transformedSize; + bool success = false; // Needed in case we are switching from a custom modeline to a standard mode m_customDrmMode = {}; @@ -1067,13 +1065,18 @@ bool CMonitor::applyMonitorRule(Config::CMonitorRule&& pMonitorRule, bool force) updateMatrix(); - if ((WAS10B != m_enabled10bit || OLDRES != m_pixelSize)) { + if ((WAS10B != m_enabled10bit || OLDPIXELSIZE != m_pixelSize)) { m_resources.reset(); // TODO skip for 10bit change and fp16? if (g_pHyprRenderer && g_pHyprRenderer->glBackend()) g_pHyprRenderer->glBackend()->destroyMonitorResources(m_self); } + if (m_background && (OLDPIXELSIZE != m_pixelSize || OLDTRANSFORMEDSIZE != m_transformedSize)) { + Log::logger->log(Log::DEBUG, "{} reset BGTex: pixelSize {} -> {}, transformedSize {} -> {}", m_name, OLDPIXELSIZE, m_pixelSize, OLDTRANSFORMEDSIZE, m_transformedSize); + m_background.reset(); + } + g_pCompositor->scheduleMonitorStateRecheck(); m_damage.setSize(m_transformedSize); -- cgit v1.2.3