From a20669a56e3e0998fe226882593608fa83fa8d26 Mon Sep 17 00:00:00 2001 From: Xaver Hugl Date: Wed, 25 Sep 2024 14:15:00 +0000 Subject: [PATCH] backends/drm: block the colorspace capability by default on NVidia There have been many reports that enabling HDR on NVidia can lead to KWin's atomic commits being rejected on login, which means KWin can't display anything. To prevent users from falling into that trap, this commit disables the colorspace capability unless the KWIN_DRM_ALLOW_NVIDIA_COLORSPACE=1 environment variable is set. This commit should be reverted once the driver problem causing the issue has been fixed. CCBUG: 488941 (cherry picked from commit 67d9529951147d2ca9aeaf483b3e6ba2714ae2c5) Co-authored-by: Xaver Hugl --- src/backends/drm/drm_output.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/backends/drm/drm_output.cpp b/src/backends/drm/drm_output.cpp index 3ee49d269d..4a841fecf8 100644 --- a/src/backends/drm/drm_output.cpp +++ b/src/backends/drm/drm_output.cpp @@ -243,6 +243,7 @@ void DrmOutput::updateConnectorProperties() } static const bool s_allowColorspaceIntel = qEnvironmentVariableIntValue("KWIN_DRM_ALLOW_INTEL_COLORSPACE") == 1; +static const bool s_allowColorspaceNVidia = qEnvironmentVariableIntValue("KWIN_DRM_ALLOW_NVIDIA_COLORSPACE") == 1; Output::Capabilities DrmOutput::computeCapabilities() const { @@ -263,7 +264,13 @@ Output::Capabilities DrmOutput::computeCapabilities() const capabilities |= Capability::HighDynamicRange; } if (m_connector->colorspace.isValid() && m_connector->colorspace.hasEnum(DrmConnector::Colorspace::BT2020_RGB) && m_connector->edid()->supportsBT2020()) { - if (!m_gpu->isI915() || s_allowColorspaceIntel) { + bool allowColorspace = true; + if (m_gpu->isI915()) { + allowColorspace &= s_allowColorspaceIntel; + } else if (m_gpu->isNVidia()) { + allowColorspace &= s_allowColorspaceNVidia; + } + if (allowColorspace) { capabilities |= Capability::WideColorGamut; } }