Skip to content

Commit

Permalink
Generic: new device BT2020 with patches from HDR on x86 Hardware thread
Browse files Browse the repository at this point in the history
  • Loading branch information
sky42src committed Jul 23, 2023
1 parent 93c5e8e commit fe9d270
Show file tree
Hide file tree
Showing 4 changed files with 123 additions and 1 deletion.
1 change: 1 addition & 0 deletions projects/Generic/devices/Generic-BT2020/options
@@ -0,0 +1,96 @@
From c51dc4b07dbcbbe49ae0cf24b4fba2079ca63425 Mon Sep 17 00:00:00 2001
From: Lukas Rusak <lorusak@gmail.com>
Date: Thu, 16 Sep 2021 16:39:36 -0700
Subject: [PATCH] CWinSystemGbm: add colourspace connector property

---
.../Buffers/VideoBufferDRMPRIME.cpp | 12 ++++++++
.../VideoPlayer/Buffers/VideoBufferDRMPRIME.h | 1 +
xbmc/windowing/gbm/WinSystemGbm.cpp | 30 +++++++++++++++++--
3 files changed, 41 insertions(+), 2 deletions(-)

diff --git a/xbmc/cores/VideoPlayer/Buffers/VideoBufferDRMPRIME.cpp b/xbmc/cores/VideoPlayer/Buffers/VideoBufferDRMPRIME.cpp
index b1c23ffc3dc55..a5fb7ddf44d72 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 e77f75b58bff4..4de9732308caa 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/windowing/gbm/WinSystemGbm.cpp b/xbmc/windowing/gbm/WinSystemGbm.cpp
index 4fd2da4ca8d57..3fc778ed4b77c 100644
--- a/xbmc/windowing/gbm/WinSystemGbm.cpp
+++ b/xbmc/windowing/gbm/WinSystemGbm.cpp
@@ -330,9 +330,23 @@ bool CWinSystemGbm::SetHDR(const VideoPicture* videoPicture)
if (!drm)
return false;

+ auto connector = drm->GetConnector();
+ if (!connector)
+ return false;
+
if (!videoPicture)
{
- auto connector = drm->GetConnector();
+ if (connector->SupportsProperty("Colorspace"))
+ {
+ auto [result, value] = connector->GetPropertyValue("Colorspace", "Default");
+ if (result)
+ {
+ CLog::Log(LOGDEBUG, "CWinSystemGbm::{} - setting connector colorspace to Default",
+ __FUNCTION__);
+ drm->AddProperty(connector, "Colorspace", value);
+ }
+ }
+
if (connector->SupportsProperty("HDR_OUTPUT_METADATA"))
{
drm->AddProperty(connector, "HDR_OUTPUT_METADATA", 0);
@@ -346,7 +360,19 @@ bool CWinSystemGbm::SetHDR(const VideoPicture* videoPicture)
return true;
}

- auto connector = drm->GetConnector();
+ if (connector->SupportsProperty("Colorspace"))
+ {
+ auto [result, value] =
+ connector->GetPropertyValue("Colorspace", DRMPRIME::GetColorimetry(*videoPicture));
+ if (result)
+ {
+ CLog::Log(LOGDEBUG, "CWinSystemGbm::{} - setting connector colorspace to {}", __FUNCTION__,
+ DRMPRIME::GetColorimetry(*videoPicture));
+ drm->AddProperty(connector, "Colorspace", value);
+ drm->SetActive(true);
+ }
+ }
+
if (connector->SupportsProperty("HDR_OUTPUT_METADATA"))
{
hdr_output_metadata hdr_metadata = {};
@@ -0,0 +1,25 @@
From 3ac2b8d4ff6741d29bb73a7874f1fda6a0c660b5 Mon Sep 17 00:00:00 2001
From: sarbes <sarbes@kodi.tv>
Date: Sun, 12 Mar 2023 13:48:45 +0100
Subject: [PATCH] Force screen clear when playing a video on GLES

---
xbmc/video/windows/GUIWindowFullScreen.cpp | 2 ++
1 file changed, 2 insertions(+)

diff --git a/xbmc/video/windows/GUIWindowFullScreen.cpp b/xbmc/video/windows/GUIWindowFullScreen.cpp
index 7cebc5fa07..7e139fd22b 100644
--- a/xbmc/video/windows/GUIWindowFullScreen.cpp
+++ b/xbmc/video/windows/GUIWindowFullScreen.cpp
@@ -180,6 +180,8 @@ void CGUIWindowFullScreen::ClearBackground()
const auto appPlayer = components.GetComponent<CApplicationPlayer>();
if (appPlayer->IsRenderingVideoLayer())
CServiceBroker::GetWinSystem()->GetGfxContext().Clear(0);
+ else
+ CServiceBroker::GetWinSystem()->GetGfxContext().Clear(0xff000000);
}

void CGUIWindowFullScreen::OnWindowLoaded()
--
2.39.2

Expand Up @@ -2,7 +2,7 @@
# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv)

# Allow upgrades between different Generic builds
if [ "$1" = "Virtual.x86_64" -o "$1" = "Generic.x86_64" -o "$1" = "Generic-legacy.x86_64" -o "$1" = "gbm.x86_64" -o "$1" = "wayland.x86_64" -o "$1" = "x11.x86_64" ]; then
if [ "$1" = "Virtual.x86_64" -o "$1" = "Generic.x86_64" -o "$1" = "Generic-legacy.x86_64" -o "$1" = "gbm.x86_64" -o "$1" = "wayland.x86_64" -o "$1" = "x11.x86_64" -o "$1" = "Generic-BT2020.x86_64" ]; then
exit 0
else
exit 1
Expand Down

0 comments on commit fe9d270

Please sign in to comment.