diff --git a/projects/RPi/patches/kodi/kodi-002-set-max-bpc-for-high-bit-depth-videos.patch b/projects/RPi/patches/kodi/kodi-002-set-max-bpc-for-high-bit-depth-videos.patch new file mode 100644 index 0000000000..da22fdcc48 --- /dev/null +++ b/projects/RPi/patches/kodi/kodi-002-set-max-bpc-for-high-bit-depth-videos.patch @@ -0,0 +1,47 @@ +From a6ae5efa976dc0d2c3ca5cf431e6411baafdac29 Mon Sep 17 00:00:00 2001 +From: Dom Cobley +Date: Fri, 3 Dec 2021 16:00:50 +0000 +Subject: [PATCH] gbm: Set max bpc for high bit depth videos + +--- + .../HwDecRender/VideoLayerBridgeDRMPRIME.cpp | 16 +++++++++++++++- + 1 file changed, 15 insertions(+), 1 deletion(-) + +diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/VideoLayerBridgeDRMPRIME.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/VideoLayerBridgeDRMPRIME.cpp +index 4f07ffc0b8..64574b2467 100644 +--- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/VideoLayerBridgeDRMPRIME.cpp ++++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/VideoLayerBridgeDRMPRIME.cpp +@@ -35,8 +35,15 @@ void CVideoLayerBridgeDRMPRIME::Disable() + m_DRM->AddProperty(plane, "FB_ID", 0); + m_DRM->AddProperty(plane, "CRTC_ID", 0); + +- // disable HDR metadata + 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); ++ ++ // disable HDR metadata + if (connector->SupportsProperty("HDR_OUTPUT_METADATA")) + { + m_DRM->AddProperty(connector, "HDR_OUTPUT_METADATA", 0); +@@ -173,6 +180,13 @@ void CVideoLayerBridgeDRMPRIME::Configure(CVideoBufferDRMPRIME* buffer) + m_DRM->AddProperty(plane, "COLOR_RANGE", value); + + auto connector = m_DRM->GetConnector(); ++ ++ // set max bpc to allow the drm driver to choose a deep colour mode ++ int bpc = picture.colorBits > 8 ? 12 : 8; ++ result = m_DRM->AddProperty(connector, "max bpc", bpc); ++ CLog::Log(LOGDEBUG, "CVideoLayerBridgeDRMPRIME::{} - setting max bpc to {} ({})", __FUNCTION__, ++ bpc, result); ++ + if (connector->SupportsProperty("HDR_OUTPUT_METADATA")) + { + m_hdr_metadata.metadata_type = HDMI_STATIC_METADATA_TYPE1; +-- +2.30.2 +