From 8d5ebb5e1569264664b4cd7e814764a4ab4b8021 Mon Sep 17 00:00:00 2001 From: Xaver Hugl Date: Sun, 12 May 2024 20:11:47 +0200 Subject: [PATCH] backends/drm: relax direct scanout rules for color management The GL renderer currently doesn't apply any transformations except clipping, so allowing direct scanout is okay as long as colorimetry and transfer function match. --- src/backends/drm/drm_egl_layer.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/backends/drm/drm_egl_layer.cpp b/src/backends/drm/drm_egl_layer.cpp index e15dfc5519..0abd1fa1dd 100644 --- a/src/backends/drm/drm_egl_layer.cpp +++ b/src/backends/drm/drm_egl_layer.cpp @@ -90,10 +90,14 @@ bool EglGbmLayer::doAttemptScanout(GraphicsBuffer *buffer, const ColorDescriptio if (directScanoutDisabled) { return false; } - if (color != m_pipeline->colorDescription() || m_pipeline->output()->channelFactors() != QVector3D(1, 1, 1) || m_pipeline->iccProfile()) { + if (m_pipeline->output()->channelFactors() != QVector3D(1, 1, 1) || m_pipeline->iccProfile()) { // TODO use GAMMA_LUT, CTM and DEGAMMA_LUT to allow direct scanout with HDR return false; } + const auto &targetColor = m_pipeline->colorDescription(); + if (color.colorimetry() != targetColor.colorimetry() || color.transferFunction() != targetColor.transferFunction()) { + return false; + } // kernel documentation says that // "Devices that don’t support subpixel plane coordinates can ignore the fractional part." // so we need to make sure that doesn't cause a difference vs the composited result