RPi4: add kodi gbm patches from popcornmix

picked from https://github.com/popcornmix/xbmc/tree/gbm

Signed-off-by: Matthias Reichl <hias@horus.com>
This commit is contained in:
Matthias Reichl 2020-06-01 21:28:48 +02:00
parent 97d60dea05
commit c6a853757b
3 changed files with 180 additions and 0 deletions

View File

@ -0,0 +1,27 @@
From aeba1b05a001de407ed1618ec6b8b2e961879cde Mon Sep 17 00:00:00 2001
From: popcornmix <popcornmix@gmail.com>
Date: Thu, 12 Mar 2020 18:05:20 +0000
Subject: [PATCH 4/8] DVDVideoCodecDRMPRIME: Increase thread count for hevc
rpi-vid hevc decoder works best with 3 threads
---
.../VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp | 3 +++
1 file changed, 3 insertions(+)
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp
index ba3c93d89d..f892b1140d 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp
@@ -253,6 +253,9 @@ bool CDVDVideoCodecDRMPRIME::Open(CDVDStreamInfo& hints, CDVDCodecOptions& optio
return false;
}
}
+ // rpi-vid hevc decoder works best with 3 threads
+ if (pCodec->id == AV_CODEC_ID_HEVC)
+ m_pCodecContext->thread_count = 3;
m_pCodecContext->pix_fmt = AV_PIX_FMT_DRM_PRIME;
m_pCodecContext->opaque = static_cast<void*>(this);
--
2.20.1

View File

@ -0,0 +1,104 @@
From 63c6707ac488e5bb61da045845cf533f39899dbf Mon Sep 17 00:00:00 2001
From: popcornmix <popcornmix@gmail.com>
Date: Fri, 27 Mar 2020 15:14:11 +0000
Subject: [PATCH 6/8] VideoPlayer: Add setting to disable non-hevc accel
---
addons/resource.language.en_gb/resources/strings.po | 10 ++++++++++
system/settings/gbm.xml | 6 ++++++
.../DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp | 7 +++++++
xbmc/settings/Settings.cpp | 2 ++
xbmc/settings/Settings.h | 1 +
5 files changed, 26 insertions(+)
diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po
index 35706f9f07..2ae4e31231 100644
--- a/addons/resource.language.en_gb/resources/strings.po
+++ b/addons/resource.language.en_gb/resources/strings.po
@@ -7275,6 +7275,16 @@ msgctxt "#13467"
msgid "Unlimited / 1080 (>30Hz)"
msgstr ""
+#: system/settings/settings.xml
+msgctxt "#13500"
+msgid "Only allow acceleration for HEVC"
+msgstr ""
+
+#: system/settings/settings.xml
+msgctxt "#13501"
+msgid "This option disables acceleration for other codecs as they don't currently support seeking with V4L2"
+msgstr ""
+
#empty strings from id 13468 to 13504
#: system/settings/settings.xml
diff --git a/system/settings/gbm.xml b/system/settings/gbm.xml
index cdc6c2b284..fa6a14d4c6 100644
--- a/system/settings/gbm.xml
+++ b/system/settings/gbm.xml
@@ -26,6 +26,12 @@
<default>true</default>
<control type="toggle" />
</setting>
+ <setting id="videoplayer.disablenonhevc" type="boolean" label="13500" help="13501">
+ <visible>true</visible>
+ <level>2</level>
+ <default>true</default>
+ <control type="toggle" />
+ </setting>
<setting id="videoplayer.useprimerenderer" type="integer" label="13462" help="13463">
<visible>false</visible>
<level>2</level>
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp
index f892b1140d..d25c64012c 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp
@@ -221,6 +221,13 @@ int CDVDVideoCodecDRMPRIME::GetBuffer(struct AVCodecContext* avctx, AVFrame* fra
bool CDVDVideoCodecDRMPRIME::Open(CDVDStreamInfo& hints, CDVDCodecOptions& options)
{
+ if (CServiceBroker::GetSettingsComponent()->GetSettings()->GetBool(CSettings::SETTING_VIDEOPLAYER_DISABLE_NON_HEVC) && hints.codec != AV_CODEC_ID_HEVC)
+ {
+ CLog::Log(LOGNOTICE, "CDVDVideoCodecDRMPRIME::{} - codec {} disallowed",
+ __FUNCTION__, hints.codec);
+ return false;
+ }
+
const AVCodec* pCodec = FindDecoder(hints);
if (!pCodec)
{
diff --git a/xbmc/settings/Settings.cpp b/xbmc/settings/Settings.cpp
index 67e87a53e5..2d91880849 100644
--- a/xbmc/settings/Settings.cpp
+++ b/xbmc/settings/Settings.cpp
@@ -135,6 +135,7 @@ const std::string CSettings::SETTING_VIDEOPLAYER_RENDERMETHOD = "videoplayer.ren
const std::string CSettings::SETTING_VIDEOPLAYER_HQSCALERS = "videoplayer.hqscalers";
const std::string CSettings::SETTING_VIDEOPLAYER_USEMEDIACODEC = "videoplayer.usemediacodec";
const std::string CSettings::SETTING_VIDEOPLAYER_USEMEDIACODECSURFACE = "videoplayer.usemediacodecsurface";
+const std::string CSettings::SETTING_VIDEOPLAYER_DISABLE_NON_HEVC = "videoplayer.disablenonhevc";
const std::string CSettings::SETTING_VIDEOPLAYER_USEVDPAU = "videoplayer.usevdpau";
const std::string CSettings::SETTING_VIDEOPLAYER_USEVDPAUMIXER = "videoplayer.usevdpaumixer";
const std::string CSettings::SETTING_VIDEOPLAYER_USEVDPAUMPEG2 = "videoplayer.usevdpaumpeg2";
@@ -954,6 +955,7 @@ void CSettings::InitializeISettingCallbacks()
settingSet.insert(CSettings::SETTING_VIDEOSCREEN_TESTPATTERN);
settingSet.insert(CSettings::SETTING_VIDEOPLAYER_USEMEDIACODEC);
settingSet.insert(CSettings::SETTING_VIDEOPLAYER_USEMEDIACODECSURFACE);
+ settingSet.insert(CSettings::SETTING_VIDEOPLAYER_DISABLE_NON_HEVC);
settingSet.insert(CSettings::SETTING_AUDIOOUTPUT_VOLUMESTEPS);
settingSet.insert(CSettings::SETTING_SOURCE_VIDEOS);
settingSet.insert(CSettings::SETTING_SOURCE_MUSIC);
diff --git a/xbmc/settings/Settings.h b/xbmc/settings/Settings.h
index 7280587324..3dbaeeb234 100644
--- a/xbmc/settings/Settings.h
+++ b/xbmc/settings/Settings.h
@@ -100,6 +100,7 @@ public:
static const std::string SETTING_VIDEOPLAYER_HQSCALERS;
static const std::string SETTING_VIDEOPLAYER_USEMEDIACODEC;
static const std::string SETTING_VIDEOPLAYER_USEMEDIACODECSURFACE;
+ static const std::string SETTING_VIDEOPLAYER_DISABLE_NON_HEVC;
static const std::string SETTING_VIDEOPLAYER_USEVDPAU;
static const std::string SETTING_VIDEOPLAYER_USEVDPAUMIXER;
static const std::string SETTING_VIDEOPLAYER_USEVDPAUMPEG2;
--
2.20.1

View File

@ -0,0 +1,49 @@
From 48b41250d45c98ca19c8684bc5cdf4cde208c814 Mon Sep 17 00:00:00 2001
From: popcornmix <popcornmix@gmail.com>
Date: Wed, 8 Apr 2020 11:19:22 +0100
Subject: [PATCH 7/8] pi4: hack: Try to hide pixel wrap issue
---
.../VideoRenderers/HwDecRender/VideoLayerBridgeDRMPRIME.cpp | 4 ++--
xbmc/windowing/gbm/DRMAtomic.cpp | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/VideoLayerBridgeDRMPRIME.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/VideoLayerBridgeDRMPRIME.cpp
index bcb4badb9b..4aa0230460 100644
--- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/VideoLayerBridgeDRMPRIME.cpp
+++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/VideoLayerBridgeDRMPRIME.cpp
@@ -238,11 +238,11 @@ void CVideoLayerBridgeDRMPRIME::SetVideoPlane(CVideoBufferDRMPRIME* buffer, cons
m_DRM->AddProperty(plane, "CRTC_ID", m_DRM->GetCrtc()->crtc->crtc_id);
m_DRM->AddProperty(plane, "SRC_X", 0);
m_DRM->AddProperty(plane, "SRC_Y", 0);
- m_DRM->AddProperty(plane, "SRC_W", buffer->GetWidth() << 16);
+ m_DRM->AddProperty(plane, "SRC_W", (buffer->GetWidth()-2) << 16);
m_DRM->AddProperty(plane, "SRC_H", buffer->GetHeight() << 16);
m_DRM->AddProperty(plane, "CRTC_X", static_cast<int32_t>(destRect.x1) & ~1);
m_DRM->AddProperty(plane, "CRTC_Y", static_cast<int32_t>(destRect.y1) & ~1);
- m_DRM->AddProperty(plane, "CRTC_W", (static_cast<uint32_t>(destRect.Width()) + 1) & ~1);
+ m_DRM->AddProperty(plane, "CRTC_W", (static_cast<uint32_t>(destRect.Width()) + 1) & ~1)-2;
m_DRM->AddProperty(plane, "CRTC_H", (static_cast<uint32_t>(destRect.Height()) + 1) & ~1);
}
diff --git a/xbmc/windowing/gbm/DRMAtomic.cpp b/xbmc/windowing/gbm/DRMAtomic.cpp
index 092ad3fc18..178705236c 100644
--- a/xbmc/windowing/gbm/DRMAtomic.cpp
+++ b/xbmc/windowing/gbm/DRMAtomic.cpp
@@ -69,11 +69,11 @@ void CDRMAtomic::DrmAtomicCommit(int fb_id, int flags, bool rendered, bool video
AddProperty(m_gui_plane, "CRTC_ID", m_crtc->crtc->crtc_id);
AddProperty(m_gui_plane, "SRC_X", 0);
AddProperty(m_gui_plane, "SRC_Y", 0);
- AddProperty(m_gui_plane, "SRC_W", m_width << 16);
+ AddProperty(m_gui_plane, "SRC_W", (m_width-2) << 16);
AddProperty(m_gui_plane, "SRC_H", m_height << 16);
AddProperty(m_gui_plane, "CRTC_X", 0);
AddProperty(m_gui_plane, "CRTC_Y", 0);
- AddProperty(m_gui_plane, "CRTC_W", m_mode->hdisplay);
+ AddProperty(m_gui_plane, "CRTC_W", m_mode->hdisplay-2);
AddProperty(m_gui_plane, "CRTC_H", m_mode->vdisplay);
}
else if (videoLayer && !CServiceBroker::GetGUI()->GetWindowManager().HasVisibleControls())
--
2.20.1