diff --git a/src/backends/drm/drm_egl_layer_surface.cpp b/src/backends/drm/drm_egl_layer_surface.cpp index e6e23d02b7..4a9f09ba0b 100644 --- a/src/backends/drm/drm_egl_layer_surface.cpp +++ b/src/backends/drm/drm_egl_layer_surface.cpp @@ -89,12 +89,13 @@ std::optional EglGbmLayerSurface::startRendering(cons } m_surface.currentBuffer = buffer; - if (m_surface.targetColorDescription != colorDescription || m_surface.channelFactors != channelFactors) { + if (m_surface.targetColorDescription != colorDescription || m_surface.channelFactors != channelFactors || m_surface.colormanagementEnabled != enableColormanagement) { m_surface.gbmSwapchain->resetDamage(); repaint = infiniteRegion(); + m_surface.colormanagementEnabled = enableColormanagement; m_surface.targetColorDescription = colorDescription; m_surface.channelFactors = channelFactors; - if (colorDescription != ColorDescription::sRGB) { + if (enableColormanagement) { m_surface.intermediaryColorDescription = ColorDescription(colorDescription.colorimetry(), NamedTransferFunction::linear, colorDescription.sdrBrightness(), colorDescription.minHdrBrightness(), colorDescription.maxHdrBrightness(), colorDescription.maxHdrHighlightBrightness()); @@ -126,7 +127,7 @@ std::optional EglGbmLayerSurface::startRendering(cons bool EglGbmLayerSurface::endRendering(const QRegion &damagedRegion) { - if (m_surface.shadowTexture) { + if (m_surface.colormanagementEnabled) { const auto &[texture, fbo] = m_surface.textureCache[m_surface.currentBuffer->bo()]; GLFramebuffer::pushFramebuffer(fbo.get()); ShaderBinder binder(ShaderTrait::MapTexture | ShaderTrait::TransformColorspace); diff --git a/src/backends/drm/drm_egl_layer_surface.h b/src/backends/drm/drm_egl_layer_surface.h index ef09b76256..97ddd267b8 100644 --- a/src/backends/drm/drm_egl_layer_surface.h +++ b/src/backends/drm/drm_egl_layer_surface.h @@ -69,6 +69,7 @@ private: }; struct Surface { + bool colormanagementEnabled = false; std::shared_ptr shadowTexture; std::shared_ptr shadowBuffer; ColorDescription targetColorDescription = ColorDescription::sRGB;