From a6ceeae24be61e84d42ab0733c2de2b6dd9eba80 Mon Sep 17 00:00:00 2001 From: Matthias Reichl Date: Thu, 16 Dec 2021 20:31:05 +0100 Subject: [PATCH 1/3] RPi4: drop kodi patch to set colourspace connector property Signed-off-by: Matthias Reichl --- ...02-set-colorspace-connector-property.patch | 90 ------------------- 1 file changed, 90 deletions(-) delete mode 100644 projects/RPi/devices/RPi4/patches/kodi/0002-set-colorspace-connector-property.patch diff --git a/projects/RPi/devices/RPi4/patches/kodi/0002-set-colorspace-connector-property.patch b/projects/RPi/devices/RPi4/patches/kodi/0002-set-colorspace-connector-property.patch deleted file mode 100644 index d6be8dbd73..0000000000 --- a/projects/RPi/devices/RPi4/patches/kodi/0002-set-colorspace-connector-property.patch +++ /dev/null @@ -1,90 +0,0 @@ -From a6834e2b37fa968c2cb7f57c6198d7ecb03f8583 Mon Sep 17 00:00:00 2001 -From: Lukas Rusak -Date: Mon, 29 Apr 2019 18:48:45 -0700 -Subject: [PATCH] CVideoLayerBridgeDRMPRIME add colourspace connector property - ---- - .../Buffers/VideoBufferDRMPRIME.cpp | 12 ++++++++++ - .../VideoPlayer/Buffers/VideoBufferDRMPRIME.h | 1 + - .../HwDecRender/VideoLayerBridgeDRMPRIME.cpp | 22 ++++++++++++++++++- - 3 files changed, 34 insertions(+), 1 deletion(-) - -diff --git a/xbmc/cores/VideoPlayer/Buffers/VideoBufferDRMPRIME.cpp b/xbmc/cores/VideoPlayer/Buffers/VideoBufferDRMPRIME.cpp -index b85097d37b..037f66db72 100644 ---- a/xbmc/cores/VideoPlayer/Buffers/VideoBufferDRMPRIME.cpp -+++ b/xbmc/cores/VideoPlayer/Buffers/VideoBufferDRMPRIME.cpp -@@ -19,6 +19,18 @@ extern "C" - namespace DRMPRIME - { - -+std::string GetColorimetry(const VideoPicture& picture) -+{ -+ switch (picture.color_space) -+ { -+ case AVCOL_SPC_BT2020_CL: -+ case AVCOL_SPC_BT2020_NCL: -+ return "BT2020_RGB"; -+ } -+ -+ return "Default"; -+} -+ - std::string GetColorEncoding(const VideoPicture& picture) - { - switch (picture.color_space) -diff --git a/xbmc/cores/VideoPlayer/Buffers/VideoBufferDRMPRIME.h b/xbmc/cores/VideoPlayer/Buffers/VideoBufferDRMPRIME.h -index e77f75b58b..4de9732308 100644 ---- a/xbmc/cores/VideoPlayer/Buffers/VideoBufferDRMPRIME.h -+++ b/xbmc/cores/VideoPlayer/Buffers/VideoBufferDRMPRIME.h -@@ -34,6 +34,7 @@ enum hdmi_eotf - HDMI_EOTF_BT_2100_HLG, - }; - -+std::string GetColorimetry(const VideoPicture& picture); - std::string GetColorEncoding(const VideoPicture& picture); - std::string GetColorRange(const VideoPicture& picture); - uint8_t GetEOTF(const VideoPicture& picture); -diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/VideoLayerBridgeDRMPRIME.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/VideoLayerBridgeDRMPRIME.cpp -index 4f07ffc0b8..c78636b680 100644 ---- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/VideoLayerBridgeDRMPRIME.cpp -+++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/VideoLayerBridgeDRMPRIME.cpp -@@ -35,8 +35,18 @@ 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(); -+ -+ bool result; -+ uint64_t value; -+ std::tie(result, value) = connector->GetPropertyValue("Colorspace", "Default"); -+ if (result) -+ { -+ CLog::Log(LOGDEBUG, "CVideoLayerBridgeDRMPRIME::{} - setting connector colorspace to Default", __FUNCTION__); -+ m_DRM->AddProperty(connector, "Colorspace", value); -+ } -+ -+ // disable HDR metadata - if (connector->SupportsProperty("HDR_OUTPUT_METADATA")) - { - m_DRM->AddProperty(connector, "HDR_OUTPUT_METADATA", 0); -@@ -173,6 +183,16 @@ void CVideoLayerBridgeDRMPRIME::Configure(CVideoBufferDRMPRIME* buffer) - m_DRM->AddProperty(plane, "COLOR_RANGE", value); - - auto connector = m_DRM->GetConnector(); -+ -+ std::tie(result, value) = connector->GetPropertyValue("Colorspace", GetColorimetry(picture)); -+ if (result) -+ { -+ CLog::Log(LOGDEBUG, "CVideoLayerBridgeDRMPRIME::{} - setting connector colorspace to {}", __FUNCTION__, -+ GetColorimetry(picture)); -+ m_DRM->AddProperty(connector, "Colorspace", value); -+ m_DRM->SetActive(true); -+ } -+ - if (connector->SupportsProperty("HDR_OUTPUT_METADATA")) - { - m_hdr_metadata.metadata_type = HDMI_STATIC_METADATA_TYPE1; --- -2.20.1 - From ad903848341ff7e2d8836614a1b8f33975ad6a67 Mon Sep 17 00:00:00 2001 From: Matthias Reichl Date: Thu, 16 Dec 2021 20:31:47 +0100 Subject: [PATCH 2/3] RPi: add kodi patch to set max_bpc for high bit depth videos Signed-off-by: Matthias Reichl --- ...et-max-bpc-for-high-bit-depth-videos.patch | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 projects/RPi/patches/kodi/kodi-002-set-max-bpc-for-high-bit-depth-videos.patch 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..13c4575f55 --- /dev/null +++ b/projects/RPi/patches/kodi/kodi-002-set-max-bpc-for-high-bit-depth-videos.patch @@ -0,0 +1,47 @@ +From 19a82e838a91fcaa122f3993a08e3036ca7786cc 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 a82da2225b..def417d366 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); +@@ -174,6 +181,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 + From e677cf3c4f493c5c96177fd781b9f5cdbbc87b0e Mon Sep 17 00:00:00 2001 From: Matthias Reichl Date: Thu, 16 Dec 2021 20:32:23 +0100 Subject: [PATCH 3/3] RPi: add kodi patch to set colourspace connector property Signed-off-by: Matthias Reichl --- ...3-add-colourspace-connector-property.patch | 86 +++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 projects/RPi/patches/kodi/kodi-003-add-colourspace-connector-property.patch diff --git a/projects/RPi/patches/kodi/kodi-003-add-colourspace-connector-property.patch b/projects/RPi/patches/kodi/kodi-003-add-colourspace-connector-property.patch new file mode 100644 index 0000000000..d680899bb5 --- /dev/null +++ b/projects/RPi/patches/kodi/kodi-003-add-colourspace-connector-property.patch @@ -0,0 +1,86 @@ +From 066f00577ab6fe258b5a59eb99e0839de1509988 Mon Sep 17 00:00:00 2001 +From: Lukas Rusak +Date: Mon, 29 Apr 2019 18:48:45 -0700 +Subject: [PATCH] CVideoLayerBridgeDRMPRIME add colourspace connector property + +--- + .../Buffers/VideoBufferDRMPRIME.cpp | 12 ++++++++++++ + .../VideoPlayer/Buffers/VideoBufferDRMPRIME.h | 1 + + .../HwDecRender/VideoLayerBridgeDRMPRIME.cpp | 19 +++++++++++++++++++ + 3 files changed, 32 insertions(+) + +diff --git a/xbmc/cores/VideoPlayer/Buffers/VideoBufferDRMPRIME.cpp b/xbmc/cores/VideoPlayer/Buffers/VideoBufferDRMPRIME.cpp +index b85097d37b..037f66db72 100644 +--- a/xbmc/cores/VideoPlayer/Buffers/VideoBufferDRMPRIME.cpp ++++ b/xbmc/cores/VideoPlayer/Buffers/VideoBufferDRMPRIME.cpp +@@ -19,6 +19,18 @@ extern "C" + namespace DRMPRIME + { + ++std::string GetColorimetry(const VideoPicture& picture) ++{ ++ switch (picture.color_space) ++ { ++ case AVCOL_SPC_BT2020_CL: ++ case AVCOL_SPC_BT2020_NCL: ++ return "BT2020_RGB"; ++ } ++ ++ return "Default"; ++} ++ + std::string GetColorEncoding(const VideoPicture& picture) + { + switch (picture.color_space) +diff --git a/xbmc/cores/VideoPlayer/Buffers/VideoBufferDRMPRIME.h b/xbmc/cores/VideoPlayer/Buffers/VideoBufferDRMPRIME.h +index e77f75b58b..4de9732308 100644 +--- a/xbmc/cores/VideoPlayer/Buffers/VideoBufferDRMPRIME.h ++++ b/xbmc/cores/VideoPlayer/Buffers/VideoBufferDRMPRIME.h +@@ -34,6 +34,7 @@ enum hdmi_eotf + HDMI_EOTF_BT_2100_HLG, + }; + ++std::string GetColorimetry(const VideoPicture& picture); + std::string GetColorEncoding(const VideoPicture& picture); + std::string GetColorRange(const VideoPicture& picture); + uint8_t GetEOTF(const VideoPicture& picture); +diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/VideoLayerBridgeDRMPRIME.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/VideoLayerBridgeDRMPRIME.cpp +index def417d366..fadc6a7df5 100644 +--- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/VideoLayerBridgeDRMPRIME.cpp ++++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/VideoLayerBridgeDRMPRIME.cpp +@@ -43,6 +43,16 @@ void CVideoLayerBridgeDRMPRIME::Disable() + CLog::Log(LOGDEBUG, "CVideoLayerBridgeDRMPRIME::{} - setting max bpc to {} ({})", __FUNCTION__, + bpc, result); + ++ uint64_t value; ++ std::tie(result, value) = connector->GetPropertyValue("Colorspace", "Default"); ++ if (result) ++ { ++ CLog::Log(LOGDEBUG, "CVideoLayerBridgeDRMPRIME::{} - setting connector colorspace to Default", ++ __FUNCTION__); ++ m_DRM->AddProperty(connector, "Colorspace", value); ++ m_DRM->SetActive(true); ++ } ++ + // disable HDR metadata + if (connector->SupportsProperty("HDR_OUTPUT_METADATA")) + { +@@ -188,6 +198,15 @@ void CVideoLayerBridgeDRMPRIME::Configure(CVideoBufferDRMPRIME* buffer) + CLog::Log(LOGDEBUG, "CVideoLayerBridgeDRMPRIME::{} - setting max bpc to {} ({})", __FUNCTION__, + bpc, result); + ++ std::tie(result, value) = connector->GetPropertyValue("Colorspace", GetColorimetry(picture)); ++ if (result) ++ { ++ CLog::Log(LOGDEBUG, "CVideoLayerBridgeDRMPRIME::{} - setting connector colorspace to {}", ++ __FUNCTION__, GetColorimetry(picture)); ++ m_DRM->AddProperty(connector, "Colorspace", value); ++ m_DRM->SetActive(true); ++ } ++ + if (connector->SupportsProperty("HDR_OUTPUT_METADATA")) + { + m_hdr_metadata.metadata_type = HDMI_STATIC_METADATA_TYPE1; +-- +2.30.2 +