From 3bcfa94ee4189faaa4daf661949e88cf28c00d94 Mon Sep 17 00:00:00 2001 From: UjinT34 <41110182+UjinT34@users.noreply.github.com> Date: Thu, 2 Oct 2025 13:05:54 +0300 Subject: renderer: add render:non_shader_cm and fixes (#11900) --- src/helpers/Monitor.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src/helpers/Monitor.cpp') diff --git a/src/helpers/Monitor.cpp b/src/helpers/Monitor.cpp index f38f009f..273bc1c7 100644 --- a/src/helpers/Monitor.cpp +++ b/src/helpers/Monitor.cpp @@ -534,7 +534,8 @@ void CMonitor::applyCMType(eCMType cmType) { if (oldImageDescription != m_imageDescription) { m_imageDescription.updateId(); - PROTO::colorManagement->onMonitorImageDescriptionChanged(m_self); + if (PROTO::colorManagement) + PROTO::colorManagement->onMonitorImageDescriptionChanged(m_self); } } @@ -1701,6 +1702,7 @@ uint16_t CMonitor::isDSBlocked(bool full) { uint16_t reasons = 0; static auto PDIRECTSCANOUT = CConfigValue("render:direct_scanout"); static auto PPASS = CConfigValue("render:cm_fs_passthrough"); + static auto PNONSHADER = CConfigValue("render:non_shader_cm"); if (*PDIRECTSCANOUT == 0) { reasons |= DS_BLOCK_USER; @@ -1770,7 +1772,8 @@ uint16_t CMonitor::isDSBlocked(bool full) { return reasons; } - if (!canNoShaderCM() && (!inHDR() || (PSURFACE->m_colorManagement.valid() && PSURFACE->m_colorManagement->isWindowsScRGB())) && *PPASS != 1) + if (needsCM() && *PNONSHADER != CM_NS_IGNORE && !canNoShaderCM() && (!inHDR() || (PSURFACE->m_colorManagement.valid() && PSURFACE->m_colorManagement->isWindowsScRGB())) && + *PPASS != 1) reasons |= DS_BLOCK_CM; return reasons; @@ -1989,11 +1992,16 @@ std::optional CMonitor::getFSImageDescripti } bool CMonitor::needsCM() { - return getFSImageDescription() != m_imageDescription; + const auto SRC_DESC = getFSImageDescription(); + return SRC_DESC.has_value() && SRC_DESC.value() != m_imageDescription; } // TODO support more drm properties bool CMonitor::canNoShaderCM() { + static auto PNONSHADER = CConfigValue("render:non_shader_cm"); + if (*PNONSHADER == CM_NS_DISABLE) + return false; + const auto SRC_DESC = getFSImageDescription(); if (!SRC_DESC.has_value()) return false; @@ -2006,7 +2014,7 @@ bool CMonitor::canNoShaderCM() { // only primaries differ if (SRC_DESC->transferFunction == m_imageDescription.transferFunction && SRC_DESC->transferFunctionPower == m_imageDescription.transferFunctionPower && - SRC_DESC->luminances == m_imageDescription.luminances && SRC_DESC->masteringLuminances == m_imageDescription.masteringLuminances && + (!inHDR() || SRC_DESC->luminances == m_imageDescription.luminances) && SRC_DESC->masteringLuminances == m_imageDescription.masteringLuminances && SRC_DESC->maxCLL == m_imageDescription.maxCLL && SRC_DESC->maxFALL == m_imageDescription.maxFALL) return true; -- cgit v1.2.3