mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-24 11:16:51 +00:00
RPi: update colorspace and bpc patches to latest kodi PR
Signed-off-by: Matthias Reichl <hias@horus.com>
This commit is contained in:
parent
5dcdedf7c9
commit
38d48b2091
@ -0,0 +1,352 @@
|
||||
From 6f5646c5059e1bd23ba5dd22c9c5a404b73e5635 Mon Sep 17 00:00:00 2001
|
||||
From: Dom Cobley <popcornmix@gmail.com>
|
||||
Date: Tue, 12 Apr 2022 12:20:53 +0100
|
||||
Subject: [PATCH 1/5] DRMObject: Rename GetPropertyValue to
|
||||
GetPropertyEnumValue
|
||||
|
||||
The naming of this function is problematic for adding a function that gets a property's value
|
||||
---
|
||||
.../VideoRenderers/HwDecRender/VideoLayerBridgeDRMPRIME.cpp | 5 +++--
|
||||
xbmc/windowing/gbm/drm/DRMAtomic.cpp | 2 +-
|
||||
xbmc/windowing/gbm/drm/DRMObject.cpp | 4 ++--
|
||||
xbmc/windowing/gbm/drm/DRMObject.h | 4 ++--
|
||||
4 files changed, 8 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/VideoLayerBridgeDRMPRIME.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/VideoLayerBridgeDRMPRIME.cpp
|
||||
index a82da2225b7e..57d60f7437ae 100644
|
||||
--- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/VideoLayerBridgeDRMPRIME.cpp
|
||||
+++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/VideoLayerBridgeDRMPRIME.cpp
|
||||
@@ -165,11 +165,12 @@ void CVideoLayerBridgeDRMPRIME::Configure(CVideoBufferDRMPRIME* buffer)
|
||||
|
||||
bool result;
|
||||
uint64_t value;
|
||||
- std::tie(result, value) = plane->GetPropertyValue("COLOR_ENCODING", GetColorEncoding(picture));
|
||||
+ std::tie(result, value) =
|
||||
+ plane->GetPropertyEnumValue("COLOR_ENCODING", GetColorEncoding(picture));
|
||||
if (result)
|
||||
m_DRM->AddProperty(plane, "COLOR_ENCODING", value);
|
||||
|
||||
- std::tie(result, value) = plane->GetPropertyValue("COLOR_RANGE", GetColorRange(picture));
|
||||
+ std::tie(result, value) = plane->GetPropertyEnumValue("COLOR_RANGE", GetColorRange(picture));
|
||||
if (result)
|
||||
m_DRM->AddProperty(plane, "COLOR_RANGE", value);
|
||||
|
||||
diff --git a/xbmc/windowing/gbm/drm/DRMAtomic.cpp b/xbmc/windowing/gbm/drm/DRMAtomic.cpp
|
||||
index 5d61a699d422..80abb02cd6ee 100644
|
||||
--- a/xbmc/windowing/gbm/drm/DRMAtomic.cpp
|
||||
+++ b/xbmc/windowing/gbm/drm/DRMAtomic.cpp
|
||||
@@ -48,7 +48,7 @@ bool CDRMAtomic::SetScalingFilter(CDRMObject* object, const char* name, const ch
|
||||
{
|
||||
bool result;
|
||||
uint64_t value;
|
||||
- std::tie(result, value) = m_gui_plane->GetPropertyValue(name, type);
|
||||
+ std::tie(result, value) = m_gui_plane->GetPropertyEnumValue(name, type);
|
||||
if (!result)
|
||||
return false;
|
||||
|
||||
diff --git a/xbmc/windowing/gbm/drm/DRMObject.cpp b/xbmc/windowing/gbm/drm/DRMObject.cpp
|
||||
index 599bb61cd023..b61f41ed98f5 100644
|
||||
--- a/xbmc/windowing/gbm/drm/DRMObject.cpp
|
||||
+++ b/xbmc/windowing/gbm/drm/DRMObject.cpp
|
||||
@@ -81,8 +81,8 @@ bool CDRMObject::GetProperties(uint32_t id, uint32_t type)
|
||||
}
|
||||
|
||||
//! @todo: improve with c++17
|
||||
-std::tuple<bool, uint64_t> CDRMObject::GetPropertyValue(const std::string& name,
|
||||
- const std::string& valueName) const
|
||||
+std::tuple<bool, uint64_t> CDRMObject::GetPropertyEnumValue(const std::string& name,
|
||||
+ const std::string& valueName) const
|
||||
{
|
||||
auto property = std::find_if(m_propsInfo.begin(), m_propsInfo.end(),
|
||||
[&name](const auto& prop) { return prop->name == name; });
|
||||
diff --git a/xbmc/windowing/gbm/drm/DRMObject.h b/xbmc/windowing/gbm/drm/DRMObject.h
|
||||
index e2ae32652cae..65e6dddf424d 100644
|
||||
--- a/xbmc/windowing/gbm/drm/DRMObject.h
|
||||
+++ b/xbmc/windowing/gbm/drm/DRMObject.h
|
||||
@@ -34,8 +34,8 @@ class CDRMObject
|
||||
|
||||
uint32_t GetId() const { return m_id; }
|
||||
uint32_t GetPropertyId(const std::string& name) const;
|
||||
- std::tuple<bool, uint64_t> GetPropertyValue(const std::string& name,
|
||||
- const std::string& valueName) const;
|
||||
+ std::tuple<bool, uint64_t> GetPropertyEnumValue(const std::string& name,
|
||||
+ const std::string& valueName) const;
|
||||
|
||||
bool SetProperty(const std::string& name, uint64_t value);
|
||||
bool SupportsProperty(const std::string& name);
|
||||
|
||||
From 20c4c0a93df8ce29ecbf668e04b5baa09f198621 Mon Sep 17 00:00:00 2001
|
||||
From: Dom Cobley <popcornmix@gmail.com>
|
||||
Date: Tue, 12 Apr 2022 20:13:07 +0100
|
||||
Subject: [PATCH 2/5] DRMObject: Add method to get current property value
|
||||
|
||||
---
|
||||
xbmc/windowing/gbm/drm/DRMObject.cpp | 16 ++++++++++++++++
|
||||
xbmc/windowing/gbm/drm/DRMObject.h | 2 ++
|
||||
2 files changed, 18 insertions(+)
|
||||
|
||||
diff --git a/xbmc/windowing/gbm/drm/DRMObject.cpp b/xbmc/windowing/gbm/drm/DRMObject.cpp
|
||||
index b61f41ed98f5..4c188c8298be 100644
|
||||
--- a/xbmc/windowing/gbm/drm/DRMObject.cpp
|
||||
+++ b/xbmc/windowing/gbm/drm/DRMObject.cpp
|
||||
@@ -74,8 +74,11 @@ bool CDRMObject::GetProperties(uint32_t id, uint32_t type)
|
||||
m_type = type;
|
||||
|
||||
for (uint32_t i = 0; i < m_props->count_props; i++)
|
||||
+ {
|
||||
m_propsInfo.emplace_back(std::unique_ptr<drmModePropertyRes, DrmModePropertyResDeleter>(
|
||||
drmModeGetProperty(m_fd, m_props->props[i])));
|
||||
+ m_propsValues.emplace_back(m_props->prop_values[i]);
|
||||
+ }
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -106,6 +109,19 @@ std::tuple<bool, uint64_t> CDRMObject::GetPropertyEnumValue(const std::string& n
|
||||
return std::make_tuple(false, 0);
|
||||
}
|
||||
|
||||
+bool CDRMObject::GetPropertyValue(const std::string& name, uint64_t& val) const
|
||||
+{
|
||||
+ auto property = std::find_if(m_propsInfo.begin(), m_propsInfo.end(),
|
||||
+ [&name](auto& prop) { return prop->name == name; });
|
||||
+
|
||||
+ if (property == m_propsInfo.end())
|
||||
+ return false;
|
||||
+
|
||||
+ val = m_propsValues[property - m_propsInfo.begin()];
|
||||
+
|
||||
+ return true;
|
||||
+}
|
||||
+
|
||||
bool CDRMObject::SetProperty(const std::string& name, uint64_t value)
|
||||
{
|
||||
auto property = std::find_if(m_propsInfo.begin(), m_propsInfo.end(),
|
||||
diff --git a/xbmc/windowing/gbm/drm/DRMObject.h b/xbmc/windowing/gbm/drm/DRMObject.h
|
||||
index 65e6dddf424d..cba849c4070d 100644
|
||||
--- a/xbmc/windowing/gbm/drm/DRMObject.h
|
||||
+++ b/xbmc/windowing/gbm/drm/DRMObject.h
|
||||
@@ -36,6 +36,7 @@ class CDRMObject
|
||||
uint32_t GetPropertyId(const std::string& name) const;
|
||||
std::tuple<bool, uint64_t> GetPropertyEnumValue(const std::string& name,
|
||||
const std::string& valueName) const;
|
||||
+ bool GetPropertyValue(const std::string& name, uint64_t& val) const;
|
||||
|
||||
bool SetProperty(const std::string& name, uint64_t value);
|
||||
bool SupportsProperty(const std::string& name);
|
||||
@@ -58,6 +59,7 @@ class CDRMObject
|
||||
};
|
||||
|
||||
std::vector<std::unique_ptr<drmModePropertyRes, DrmModePropertyResDeleter>> m_propsInfo;
|
||||
+ std::vector<uint64_t> m_propsValues;
|
||||
|
||||
int m_fd{-1};
|
||||
|
||||
|
||||
From 10577c714984106ae00fdfb459d02faed8cbcbdd Mon Sep 17 00:00:00 2001
|
||||
From: Dom Cobley <popcornmix@gmail.com>
|
||||
Date: Mon, 11 Apr 2022 19:40:41 +0100
|
||||
Subject: [PATCH 3/5] DRMObject: Add GetPropertyRange accessor
|
||||
|
||||
---
|
||||
xbmc/windowing/gbm/drm/DRMObject.cpp | 19 +++++++++++++++++++
|
||||
xbmc/windowing/gbm/drm/DRMObject.h | 1 +
|
||||
2 files changed, 20 insertions(+)
|
||||
|
||||
diff --git a/xbmc/windowing/gbm/drm/DRMObject.cpp b/xbmc/windowing/gbm/drm/DRMObject.cpp
|
||||
index 4c188c8298be..d08c57950024 100644
|
||||
--- a/xbmc/windowing/gbm/drm/DRMObject.cpp
|
||||
+++ b/xbmc/windowing/gbm/drm/DRMObject.cpp
|
||||
@@ -122,6 +122,25 @@ bool CDRMObject::GetPropertyValue(const std::string& name, uint64_t& val) const
|
||||
return true;
|
||||
}
|
||||
|
||||
+bool CDRMObject::GetPropertyRange(const std::string& name, uint64_t& min, uint64_t& max) const
|
||||
+{
|
||||
+ auto property = std::find_if(m_propsInfo.begin(), m_propsInfo.end(),
|
||||
+ [&name](auto& prop) { return prop->name == name; });
|
||||
+
|
||||
+ if (property == m_propsInfo.end())
|
||||
+ return false;
|
||||
+
|
||||
+ auto prop = property->get();
|
||||
+
|
||||
+ if (!static_cast<bool>(drm_property_type_is(prop, DRM_MODE_PROP_RANGE)))
|
||||
+ return false;
|
||||
+
|
||||
+ min = prop->values[0];
|
||||
+ max = prop->values[1];
|
||||
+
|
||||
+ return true;
|
||||
+}
|
||||
+
|
||||
bool CDRMObject::SetProperty(const std::string& name, uint64_t value)
|
||||
{
|
||||
auto property = std::find_if(m_propsInfo.begin(), m_propsInfo.end(),
|
||||
diff --git a/xbmc/windowing/gbm/drm/DRMObject.h b/xbmc/windowing/gbm/drm/DRMObject.h
|
||||
index cba849c4070d..875ab5afa437 100644
|
||||
--- a/xbmc/windowing/gbm/drm/DRMObject.h
|
||||
+++ b/xbmc/windowing/gbm/drm/DRMObject.h
|
||||
@@ -37,6 +37,7 @@ class CDRMObject
|
||||
std::tuple<bool, uint64_t> GetPropertyEnumValue(const std::string& name,
|
||||
const std::string& valueName) const;
|
||||
bool GetPropertyValue(const std::string& name, uint64_t& val) const;
|
||||
+ bool GetPropertyRange(const std::string& name, uint64_t& min, uint64_t& max) const;
|
||||
|
||||
bool SetProperty(const std::string& name, uint64_t value);
|
||||
bool SupportsProperty(const std::string& name);
|
||||
|
||||
From b4677efb3809af8fe1fd9335bebfa791bba30966 Mon Sep 17 00:00:00 2001
|
||||
From: Lukas Rusak <lorusak@gmail.com>
|
||||
Date: Mon, 29 Apr 2019 18:48:45 -0700
|
||||
Subject: [PATCH 4/5] CVideoLayerBridgeDRMPRIME: add colourspace connector
|
||||
property
|
||||
|
||||
---
|
||||
.../Buffers/VideoBufferDRMPRIME.cpp | 12 ++++++++++
|
||||
.../VideoPlayer/Buffers/VideoBufferDRMPRIME.h | 1 +
|
||||
.../HwDecRender/VideoLayerBridgeDRMPRIME.cpp | 23 ++++++++++++++++++-
|
||||
3 files changed, 35 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/xbmc/cores/VideoPlayer/Buffers/VideoBufferDRMPRIME.cpp b/xbmc/cores/VideoPlayer/Buffers/VideoBufferDRMPRIME.cpp
|
||||
index b1c23ffc3dc5..a5fb7ddf44d7 100644
|
||||
--- a/xbmc/cores/VideoPlayer/Buffers/VideoBufferDRMPRIME.cpp
|
||||
+++ b/xbmc/cores/VideoPlayer/Buffers/VideoBufferDRMPRIME.cpp
|
||||
@@ -20,6 +20,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 e77f75b58bff..4de9732308ca 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 57d60f7437ae..56000cc774f3 100644
|
||||
--- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/VideoLayerBridgeDRMPRIME.cpp
|
||||
+++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/VideoLayerBridgeDRMPRIME.cpp
|
||||
@@ -35,8 +35,20 @@ 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->GetPropertyEnumValue("Colorspace", "Default");
|
||||
+ if (result)
|
||||
+ {
|
||||
+ CLog::Log(LOGDEBUG,
|
||||
+ "CVideoLayerBridgeDRMPRIME::{} - setting connector colorspace to Default ({})",
|
||||
+ __FUNCTION__, result);
|
||||
+ m_DRM->AddProperty(connector, "Colorspace", value);
|
||||
+ }
|
||||
+
|
||||
+ // disable HDR metadata
|
||||
if (connector->SupportsProperty("HDR_OUTPUT_METADATA"))
|
||||
{
|
||||
m_DRM->AddProperty(connector, "HDR_OUTPUT_METADATA", 0);
|
||||
@@ -175,6 +187,15 @@ void CVideoLayerBridgeDRMPRIME::Configure(CVideoBufferDRMPRIME* buffer)
|
||||
m_DRM->AddProperty(plane, "COLOR_RANGE", value);
|
||||
|
||||
auto connector = m_DRM->GetConnector();
|
||||
+
|
||||
+ std::tie(result, value) = connector->GetPropertyEnumValue("Colorspace", GetColorimetry(picture));
|
||||
+ if (result)
|
||||
+ {
|
||||
+ result = m_DRM->AddProperty(connector, "Colorspace", value);
|
||||
+ CLog::Log(LOGDEBUG, "CVideoLayerBridgeDRMPRIME::{} - setting connector colorspace to {} ({})",
|
||||
+ __FUNCTION__, GetColorimetry(picture), result);
|
||||
+ }
|
||||
+
|
||||
if (connector->SupportsProperty("HDR_OUTPUT_METADATA"))
|
||||
{
|
||||
m_hdr_metadata.metadata_type = HDMI_STATIC_METADATA_TYPE1;
|
||||
|
||||
From 773e4c3debca042df9313de5c97b4b227a16a8d2 Mon Sep 17 00:00:00 2001
|
||||
From: Dom Cobley <popcornmix@gmail.com>
|
||||
Date: Fri, 3 Dec 2021 16:00:50 +0000
|
||||
Subject: [PATCH 5/5] CVideoLayerBridgeDRMPRIME: Set max bpc for high bit depth
|
||||
videos
|
||||
|
||||
---
|
||||
.../HwDecRender/VideoLayerBridgeDRMPRIME.cpp | 26 +++++++++++++++++++
|
||||
.../HwDecRender/VideoLayerBridgeDRMPRIME.h | 1 +
|
||||
2 files changed, 27 insertions(+)
|
||||
|
||||
diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/VideoLayerBridgeDRMPRIME.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/VideoLayerBridgeDRMPRIME.cpp
|
||||
index 56000cc774f3..a43848e07989 100644
|
||||
--- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/VideoLayerBridgeDRMPRIME.cpp
|
||||
+++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/VideoLayerBridgeDRMPRIME.cpp
|
||||
@@ -38,6 +38,16 @@ void CVideoLayerBridgeDRMPRIME::Disable()
|
||||
auto connector = m_DRM->GetConnector();
|
||||
|
||||
bool result;
|
||||
+
|
||||
+ // reset max bpc back to default
|
||||
+ if (m_previous_bpc)
|
||||
+ {
|
||||
+ result = m_DRM->AddProperty(connector, "max bpc", m_previous_bpc);
|
||||
+ CLog::Log(LOGDEBUG, "CVideoLayerBridgeDRMPRIME::{} - setting max bpc to {} ({})", __FUNCTION__,
|
||||
+ m_previous_bpc, result);
|
||||
+ m_previous_bpc = 0;
|
||||
+ }
|
||||
+
|
||||
uint64_t value;
|
||||
std::tie(result, value) = connector->GetPropertyEnumValue("Colorspace", "Default");
|
||||
if (result)
|
||||
@@ -188,6 +198,22 @@ void CVideoLayerBridgeDRMPRIME::Configure(CVideoBufferDRMPRIME* buffer)
|
||||
|
||||
auto connector = m_DRM->GetConnector();
|
||||
|
||||
+ // set max bpc to allow the drm driver to choose a deep colour mode
|
||||
+ if (picture.colorBits > 8 && connector->SupportsProperty("max bpc"))
|
||||
+ {
|
||||
+ uint64_t bpc = 12;
|
||||
+ uint64_t min, max;
|
||||
+
|
||||
+ if (connector->GetPropertyRange("max bpc", min, max) && bpc >= min && bpc <= max &&
|
||||
+ connector->GetPropertyValue("max bpc", m_previous_bpc))
|
||||
+ {
|
||||
+
|
||||
+ result = m_DRM->AddProperty(connector, "max bpc", bpc);
|
||||
+ CLog::Log(LOGDEBUG, "CVideoLayerBridgeDRMPRIME::{} - setting max bpc to {} ({})",
|
||||
+ __FUNCTION__, bpc, result);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
std::tie(result, value) = connector->GetPropertyEnumValue("Colorspace", GetColorimetry(picture));
|
||||
if (result)
|
||||
{
|
||||
diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/VideoLayerBridgeDRMPRIME.h b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/VideoLayerBridgeDRMPRIME.h
|
||||
index 3a46a91a13e0..0cdb8d760d25 100644
|
||||
--- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/VideoLayerBridgeDRMPRIME.h
|
||||
+++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/VideoLayerBridgeDRMPRIME.h
|
||||
@@ -81,4 +81,5 @@ class CVideoLayerBridgeDRMPRIME : public KODI::WINDOWING::GBM::CVideoLayerBridge
|
||||
|
||||
uint32_t m_hdr_blob_id = 0;
|
||||
struct hdr_output_metadata m_hdr_metadata = {};
|
||||
+ uint64_t m_previous_bpc = 0;
|
||||
};
|
@ -1,47 +0,0 @@
|
||||
From 19a82e838a91fcaa122f3993a08e3036ca7786cc 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 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
|
||||
|
@ -1,86 +0,0 @@
|
||||
From 066f00577ab6fe258b5a59eb99e0839de1509988 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 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
|
||||
|
Loading…
x
Reference in New Issue
Block a user