0
0
mirror of https://github.com/libretro/Lakka-LibreELEC.git synced 2025-03-01 01:01:24 +00:00
Lakka-LibreELEC/projects/RPi/patches/kodi/kodi-002-set-max-bpc-for-high-bit-depth-videos.patch
Matthias Reichl 08bce43b12 RPi: add kodi patch to set max_bpc for high bit depth videos
Signed-off-by: Matthias Reichl <hias@horus.com>
2022-01-07 13:47:27 +01:00

48 lines
1.9 KiB
Diff

From a6ae5efa976dc0d2c3ca5cf431e6411baafdac29 Mon Sep 17 00:00:00 2001
From: Dom Cobley <popcornmix@gmail.com>
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