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 67d9529951)

Co-authored-by: Xaver Hugl <xaver.hugl@gmail.com>
wilder/Plasma/6.2
Xaver Hugl 1 year ago
parent 6f35149695
commit a20669a56e
  1. 9
      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;
}
}

Loading…
Cancel
Save