1
0
This repository has been archived on 2024-11-10. You can view files and clone it, but cannot push or open issues or pull requests.
Lakka-rk322x/projects/RPi/patches/kodi/kodi-003-add-colourspace-connector-property.patch
Matthias Reichl 03feddc522 RPi: add kodi patch to set colourspace connector property
Signed-off-by: Matthias Reichl <hias@horus.com>
2022-01-07 13:47:27 +01:00

87 lines
3.3 KiB
Diff

From 74142da97eddf6792146d4b2641a46f88cf37123 Mon Sep 17 00:00:00 2001
From: Lukas Rusak <lorusak@gmail.com>
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 64574b2467..efb3938080 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"))
{
@@ -187,6 +197,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