From 55303f4a214d80af24d75a93f102edbe02000423 Mon Sep 17 00:00:00 2001 From: Dom Cobley Date: Fri, 3 Dec 2021 16:00:50 +0000 Subject: [PATCH 2/4] gbm: Set max bpc for high bit depth videos --- .../HwDecRender/VideoLayerBridgeDRMPRIME.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/VideoLayerBridgeDRMPRIME.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/VideoLayerBridgeDRMPRIME.cpp index b91a1705ac..726a5b79b7 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/VideoLayerBridgeDRMPRIME.cpp +++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/VideoLayerBridgeDRMPRIME.cpp @@ -34,6 +34,14 @@ void CVideoLayerBridgeDRMPRIME::Disable() { // disable video plane auto plane = m_DRM->GetVideoPlane(); + auto connector = m_DRM->GetConnector(); + + // reset max bpc back to default of 8 + int bpc = 8; + bool result = m_DRM->AddProperty(connector, "max bpc", bpc); + CLog::Log(LOGDEBUG, "CVideoLayerBridgeDRMPRIME::{} - setting max bpc to {} ({})", + __FUNCTION__, bpc, result); + m_DRM->AddProperty(plane, "FB_ID", 0); m_DRM->AddProperty(plane, "CRTC_ID", 0); @@ -175,6 +183,14 @@ void CVideoLayerBridgeDRMPRIME::Configure(CVideoBufferDRMPRIME* buffer) std::tie(result, value) = plane->GetPropertyValue("COLOR_RANGE", GetColorRange(picture)); if (result) m_DRM->AddProperty(plane, "COLOR_RANGE", value); + + // set max bpc to allow the drm driver to choose a deep colour mode + int bpc = buffer->GetPicture().colorBits > 8 ? 12 : 8; + auto connector = m_DRM->GetConnector(); + result = m_DRM->AddProperty(connector, "max bpc", bpc); + CLog::Log(LOGDEBUG, "CVideoLayerBridgeDRMPRIME::{} - setting max bpc to {} ({})", __FUNCTION__, + bpc, result); + } void CVideoLayerBridgeDRMPRIME::SetVideoPlane(CVideoBufferDRMPRIME* buffer, const CRect& destRect) -- 2.34.1