RPi: update kodi patches

This fixes HW deinterlace with SW decoded videos.

Signed-off-by: Matthias Reichl <hias@horus.com>
This commit is contained in:
Matthias Reichl 2025-03-11 19:14:55 +01:00
parent dd674e2adf
commit c01145f953
13 changed files with 142 additions and 82 deletions

View File

@ -1,7 +1,7 @@
From 2875c98a194df2251715a6b48118cc1734b8d663 Mon Sep 17 00:00:00 2001
From 6a0368c3894cef146d1a22073eb0104a477d32fe Mon Sep 17 00:00:00 2001
From: Dom Cobley <popcornmix@gmail.com>
Date: Fri, 3 Dec 2021 16:00:50 +0000
Subject: [PATCH 01/12] gbm: Set max bpc for high bit depth videos
Subject: [PATCH 01/13] gbm: Set max bpc for high bit depth videos
---
.../HwDecRender/VideoLayerBridgeDRMPRIME.cpp | 15 +++++++++++++++

View File

@ -1,7 +1,7 @@
From b7c319601e58efaf840360dfa2452d7621748528 Mon Sep 17 00:00:00 2001
From df99e04b9f1d2a0ab7f4ef95b21d09fecfbf1ad7 Mon Sep 17 00:00:00 2001
From: popcornmix <popcornmix@gmail.com>
Date: Sat, 11 Sep 2021 14:03:05 +0100
Subject: [PATCH 02/12] CDVDVideoCodecDRMPRIME: Also support YUV420 buffers
Subject: [PATCH 02/13] CDVDVideoCodecDRMPRIME: Also support YUV420 buffers
CDVDVideoCodecDRMPRIME: Add support for deinterlace of sw decoded buffers
@ -11,10 +11,10 @@ Need to call SetDimensions earlier and store the drm descriptor in expected plac
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp
index 3a5154dca4b4..2fc8232e8672 100644
index 3b2a9ca91cd2..7bc37dffdc90 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp
@@ -623,7 +623,7 @@ bool CDVDVideoCodecDRMPRIME::SetPictureParams(VideoPicture* pVideoPicture)
@@ -626,7 +626,7 @@ bool CDVDVideoCodecDRMPRIME::SetPictureParams(VideoPicture* pVideoPicture)
pVideoPicture->videoBuffer = nullptr;
}
@ -23,7 +23,7 @@ index 3a5154dca4b4..2fc8232e8672 100644
{
CVideoBufferDRMPRIMEFFmpeg* buffer =
dynamic_cast<CVideoBufferDRMPRIMEFFmpeg*>(m_videoBufferPool->Get());
@@ -701,7 +701,7 @@ bool CDVDVideoCodecDRMPRIME::FilterOpen(const std::string& filters, bool test)
@@ -704,7 +704,7 @@ bool CDVDVideoCodecDRMPRIME::FilterOpen(const std::string& filters, bool test)
const AVFilter* srcFilter = avfilter_get_by_name("buffer");
const AVFilter* outFilter = avfilter_get_by_name("buffersink");
@ -32,7 +32,7 @@ index 3a5154dca4b4..2fc8232e8672 100644
std::string args = StringUtils::Format("video_size={}x{}:pix_fmt={}:time_base={}/{}:"
"pixel_aspect={}/{}",
@@ -849,6 +849,16 @@ void CDVDVideoCodecDRMPRIME::FilterClose()
@@ -852,6 +852,16 @@ void CDVDVideoCodecDRMPRIME::FilterClose()
CDVDVideoCodec::VCReturn CDVDVideoCodecDRMPRIME::ProcessFilterIn()
{

View File

@ -1,7 +1,7 @@
From 158bd0c5d0feafd6ea38f618075de1be74dfe52c Mon Sep 17 00:00:00 2001
From 55a092fd27cf445bdc401cb0f05ea6c04561dc3d Mon Sep 17 00:00:00 2001
From: Dom Cobley <popcornmix@gmail.com>
Date: Wed, 18 Jan 2023 16:41:00 +0000
Subject: [PATCH 03/12] CDVDVideoCodecDRMPRIME: Adjust av formats to match
Subject: [PATCH 03/13] CDVDVideoCodecDRMPRIME: Adjust av formats to match
recent ffmpeg changes
---
@ -9,10 +9,10 @@ Subject: [PATCH 03/12] CDVDVideoCodecDRMPRIME: Adjust av formats to match
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp
index 2fc8232e8672..088f43834731 100644
index 7bc37dffdc90..89ad921dbe3a 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp
@@ -355,6 +355,7 @@ bool CDVDVideoCodecDRMPRIME::Open(CDVDStreamInfo& hints, CDVDCodecOptions& optio
@@ -358,6 +358,7 @@ bool CDVDVideoCodecDRMPRIME::Open(CDVDStreamInfo& hints, CDVDCodecOptions& optio
m_pCodecContext->bits_per_coded_sample = hints.bitsperpixel;
m_pCodecContext->time_base.num = 1;
m_pCodecContext->time_base.den = DVD_TIME_BASE;
@ -20,7 +20,7 @@ index 2fc8232e8672..088f43834731 100644
m_pCodecContext->thread_count = CServiceBroker::GetCPUInfo()->GetCPUCount();
if (hints.extradata)
@@ -701,13 +702,13 @@ bool CDVDVideoCodecDRMPRIME::FilterOpen(const std::string& filters, bool test)
@@ -704,13 +705,13 @@ bool CDVDVideoCodecDRMPRIME::FilterOpen(const std::string& filters, bool test)
const AVFilter* srcFilter = avfilter_get_by_name("buffer");
const AVFilter* outFilter = avfilter_get_by_name("buffersink");
@ -36,7 +36,7 @@ index 2fc8232e8672..088f43834731 100644
m_pCodecContext->time_base.num ?
m_pCodecContext->time_base.num : 1,
m_pCodecContext->time_base.num ?
@@ -859,6 +860,7 @@ CDVDVideoCodec::VCReturn CDVDVideoCodecDRMPRIME::ProcessFilterIn()
@@ -862,6 +863,7 @@ CDVDVideoCodec::VCReturn CDVDVideoCodecDRMPRIME::ProcessFilterIn()
m_pFrame->data[0] = reinterpret_cast<uint8_t*>(descriptor);
}

View File

@ -1,7 +1,7 @@
From 2af0398b5aec2318c6b2c1418fc0f303047863d8 Mon Sep 17 00:00:00 2001
From 46831b421d7ac477b32a922c8ffe3ca5acc3ba4b Mon Sep 17 00:00:00 2001
From: Dom Cobley <popcornmix@gmail.com>
Date: Mon, 6 Feb 2023 15:19:51 +0000
Subject: [PATCH 04/12] DVDVideoCodecDRMPRIME: Add support for arbitrary output
Subject: [PATCH 04/13] DVDVideoCodecDRMPRIME: Add support for arbitrary output
pixel formats
This enables any ffmpeg pixel formats to be supported by DRMPRIME decoder
@ -20,10 +20,10 @@ And it happens automatically without requiring user video settings
2 files changed, 77 insertions(+), 50 deletions(-)
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp
index 088f43834731..a8edd55c92c5 100644
index 89ad921dbe3a..94c26aa29e4b 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp
@@ -219,7 +219,7 @@ enum AVPixelFormat CDVDVideoCodecDRMPRIME::GetFormat(struct AVCodecContext* avct
@@ -215,7 +215,7 @@ enum AVPixelFormat CDVDVideoCodecDRMPRIME::GetFormat(struct AVCodecContext* avct
{
for (int n = 0; fmt[n] != AV_PIX_FMT_NONE; n++)
{
@ -32,7 +32,7 @@ index 088f43834731..a8edd55c92c5 100644
{
CDVDVideoCodecDRMPRIME* ctx = static_cast<CDVDVideoCodecDRMPRIME*>(avctx->opaque);
ctx->UpdateProcessInfo(avctx, fmt[n]);
@@ -240,7 +240,8 @@ enum AVPixelFormat CDVDVideoCodecDRMPRIME::GetFormat(struct AVCodecContext* avct
@@ -236,7 +236,8 @@ enum AVPixelFormat CDVDVideoCodecDRMPRIME::GetFormat(struct AVCodecContext* avct
int CDVDVideoCodecDRMPRIME::GetBuffer(struct AVCodecContext* avctx, AVFrame* frame, int flags)
{
@ -42,7 +42,7 @@ index 088f43834731..a8edd55c92c5 100644
{
int width = frame->width;
int height = frame->height;
@@ -248,7 +249,7 @@ int CDVDVideoCodecDRMPRIME::GetBuffer(struct AVCodecContext* avctx, AVFrame* fra
@@ -244,7 +245,7 @@ int CDVDVideoCodecDRMPRIME::GetBuffer(struct AVCodecContext* avctx, AVFrame* fra
AlignedSize(avctx, width, height);
int size;
@ -51,7 +51,7 @@ index 088f43834731..a8edd55c92c5 100644
{
case AV_PIX_FMT_YUV420P:
case AV_PIX_FMT_YUVJ420P:
@@ -268,13 +269,12 @@ int CDVDVideoCodecDRMPRIME::GetBuffer(struct AVCodecContext* avctx, AVFrame* fra
@@ -264,13 +265,12 @@ int CDVDVideoCodecDRMPRIME::GetBuffer(struct AVCodecContext* avctx, AVFrame* fra
CDVDVideoCodecDRMPRIME* ctx = static_cast<CDVDVideoCodecDRMPRIME*>(avctx->opaque);
auto buffer = dynamic_cast<CVideoBufferDMA*>(
@ -67,7 +67,7 @@ index 088f43834731..a8edd55c92c5 100644
buffer->Export(frame, width, height);
buffer->SyncStart();
@@ -632,9 +632,9 @@ bool CDVDVideoCodecDRMPRIME::SetPictureParams(VideoPicture* pVideoPicture)
@@ -635,9 +635,9 @@ bool CDVDVideoCodecDRMPRIME::SetPictureParams(VideoPicture* pVideoPicture)
buffer->SetRef(m_pFrame);
pVideoPicture->videoBuffer = buffer;
}
@ -79,7 +79,7 @@ index 088f43834731..a8edd55c92c5 100644
buffer->SetPictureParams(*pVideoPicture);
buffer->Acquire();
buffer->SyncEnd();
@@ -668,13 +668,13 @@ void CDVDVideoCodecDRMPRIME::FilterTest()
@@ -671,13 +671,13 @@ void CDVDVideoCodecDRMPRIME::FilterTest()
if (name.find("deinterlace") != std::string::npos)
{
@ -96,7 +96,7 @@ index 088f43834731..a8edd55c92c5 100644
return;
}
}
@@ -684,14 +684,31 @@ void CDVDVideoCodecDRMPRIME::FilterTest()
@@ -687,14 +687,31 @@ void CDVDVideoCodecDRMPRIME::FilterTest()
__FUNCTION__);
}
@ -130,7 +130,7 @@ index 088f43834731..a8edd55c92c5 100644
return true;
if (!(m_pFilterGraph = avfilter_graph_alloc()))
@@ -702,13 +719,13 @@ bool CDVDVideoCodecDRMPRIME::FilterOpen(const std::string& filters, bool test)
@@ -705,13 +722,13 @@ bool CDVDVideoCodecDRMPRIME::FilterOpen(const std::string& filters, bool test)
const AVFilter* srcFilter = avfilter_get_by_name("buffer");
const AVFilter* outFilter = avfilter_get_by_name("buffersink");
@ -146,7 +146,7 @@ index 088f43834731..a8edd55c92c5 100644
m_pCodecContext->time_base.num ?
m_pCodecContext->time_base.num : 1,
m_pCodecContext->time_base.num ?
@@ -727,7 +744,6 @@ bool CDVDVideoCodecDRMPRIME::FilterOpen(const std::string& filters, bool test)
@@ -730,7 +747,6 @@ bool CDVDVideoCodecDRMPRIME::FilterOpen(const std::string& filters, bool test)
CLog::Log(LOGERROR,
"CDVDVideoCodecDRMPRIME::FilterOpen - avfilter_graph_create_filter: src: {} ({})",
err, result);
@ -154,7 +154,7 @@ index 088f43834731..a8edd55c92c5 100644
return false;
}
@@ -735,7 +751,6 @@ bool CDVDVideoCodecDRMPRIME::FilterOpen(const std::string& filters, bool test)
@@ -738,7 +754,6 @@ bool CDVDVideoCodecDRMPRIME::FilterOpen(const std::string& filters, bool test)
if (!par)
{
CLog::Log(LOGERROR, "CDVDVideoCodecDRMPRIME::FilterOpen - unable to alloc buffersrc");
@ -162,7 +162,7 @@ index 088f43834731..a8edd55c92c5 100644
return false;
}
@@ -751,7 +766,6 @@ bool CDVDVideoCodecDRMPRIME::FilterOpen(const std::string& filters, bool test)
@@ -754,7 +769,6 @@ bool CDVDVideoCodecDRMPRIME::FilterOpen(const std::string& filters, bool test)
CLog::Log(LOGERROR,
"CDVDVideoCodecDRMPRIME::FilterOpen - av_buffersrc_parameters_set: {} ({})",
err, result);
@ -170,7 +170,7 @@ index 088f43834731..a8edd55c92c5 100644
return false;
}
av_freep(&par);
@@ -765,7 +779,6 @@ bool CDVDVideoCodecDRMPRIME::FilterOpen(const std::string& filters, bool test)
@@ -768,7 +782,6 @@ bool CDVDVideoCodecDRMPRIME::FilterOpen(const std::string& filters, bool test)
CLog::Log(LOGERROR,
"CDVDVideoCodecDRMPRIME::FilterOpen - avfilter_graph_create_filter: out: {} ({})",
err, result);
@ -178,7 +178,7 @@ index 088f43834731..a8edd55c92c5 100644
return false;
}
@@ -774,32 +787,46 @@ bool CDVDVideoCodecDRMPRIME::FilterOpen(const std::string& filters, bool test)
@@ -777,32 +790,46 @@ bool CDVDVideoCodecDRMPRIME::FilterOpen(const std::string& filters, bool test)
if (result < 0)
{
CLog::Log(LOGERROR, "CDVDVideoCodecDRMPRIME::FilterOpen - failed settings pix formats");
@ -243,7 +243,7 @@ index 088f43834731..a8edd55c92c5 100644
}
if ((result = avfilter_graph_config(m_pFilterGraph, nullptr)) < 0)
@@ -808,15 +835,11 @@ bool CDVDVideoCodecDRMPRIME::FilterOpen(const std::string& filters, bool test)
@@ -811,15 +838,11 @@ bool CDVDVideoCodecDRMPRIME::FilterOpen(const std::string& filters, bool test)
av_strerror(result, err, AV_ERROR_MAX_STRING_SIZE);
CLog::Log(LOGERROR, "CDVDVideoCodecDRMPRIME::FilterOpen - avfilter_graph_config: {} ({})",
err, result);
@ -259,7 +259,7 @@ index 088f43834731..a8edd55c92c5 100644
m_processInfo.SetVideoDeintMethod(filters);
@@ -851,16 +874,16 @@ void CDVDVideoCodecDRMPRIME::FilterClose()
@@ -854,16 +877,16 @@ void CDVDVideoCodecDRMPRIME::FilterClose()
CDVDVideoCodec::VCReturn CDVDVideoCodecDRMPRIME::ProcessFilterIn()
{
// sw decoded buffers need cache flush and for descripter to be set
@ -279,7 +279,7 @@ index 088f43834731..a8edd55c92c5 100644
int ret = av_buffersrc_add_frame(m_pFilterIn, m_pFrame);
if (ret < 0)
{
@@ -961,25 +984,28 @@ CDVDVideoCodec::VCReturn CDVDVideoCodecDRMPRIME::GetPicture(VideoPicture* pVideo
@@ -964,25 +987,28 @@ CDVDVideoCodec::VCReturn CDVDVideoCodecDRMPRIME::GetPicture(VideoPicture* pVideo
return VC_ERROR;
}

View File

@ -1,7 +1,7 @@
From 360f3a694cfeac822b5263f2d006e47d68801148 Mon Sep 17 00:00:00 2001
From 9f6b1a30ed04a2b8d36e7bf102d8d01752053e3c Mon Sep 17 00:00:00 2001
From: Dom Cobley <popcornmix@gmail.com>
Date: Fri, 14 Apr 2023 19:59:42 +0100
Subject: [PATCH 05/12] DVDVideoCodecDRMPRIME: Remove obsolete
Subject: [PATCH 05/13] DVDVideoCodecDRMPRIME: Remove obsolete
thread_safe_callbacks
---
@ -9,10 +9,10 @@ Subject: [PATCH 05/12] DVDVideoCodecDRMPRIME: Remove obsolete
1 file changed, 1 deletion(-)
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp
index a8edd55c92c5..f64e2ff8dfb2 100644
index 94c26aa29e4b..5e97af5caaad 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp
@@ -355,7 +355,6 @@ bool CDVDVideoCodecDRMPRIME::Open(CDVDStreamInfo& hints, CDVDCodecOptions& optio
@@ -358,7 +358,6 @@ bool CDVDVideoCodecDRMPRIME::Open(CDVDStreamInfo& hints, CDVDCodecOptions& optio
m_pCodecContext->bits_per_coded_sample = hints.bitsperpixel;
m_pCodecContext->time_base.num = 1;
m_pCodecContext->time_base.den = DVD_TIME_BASE;

View File

@ -1,17 +1,17 @@
From b551c28a08d24450c6b8afa4e29f61323f9ba934 Mon Sep 17 00:00:00 2001
From c5774eefbea331af6848fb324b173fc9c54a73fe Mon Sep 17 00:00:00 2001
From: Dom Cobley <popcornmix@gmail.com>
Date: Wed, 31 May 2023 19:40:37 +0100
Subject: [PATCH 06/12] DVDVideoCodecDRMPRIME: Clear m_pFilterGraph
Subject: [PATCH 06/13] DVDVideoCodecDRMPRIME: Clear m_pFilterGraph
---
xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp | 1 +
1 file changed, 1 insertion(+)
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp
index f64e2ff8dfb2..31c28477cb58 100644
index 5e97af5caaad..cc75f6eeddde 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp
@@ -867,6 +867,7 @@ void CDVDVideoCodecDRMPRIME::FilterClose()
@@ -870,6 +870,7 @@ void CDVDVideoCodecDRMPRIME::FilterClose()
// Disposed by above code
m_pFilterIn = nullptr;
m_pFilterOut = nullptr;

View File

@ -1,7 +1,7 @@
From 9bad0c6121a228501c3cef5dd753a43d4ccb9994 Mon Sep 17 00:00:00 2001
From 4e95d57c7f67dd2a476db41b7c63f99d46e44399 Mon Sep 17 00:00:00 2001
From: Dom Cobley <popcornmix@gmail.com>
Date: Fri, 2 Jun 2023 11:34:22 +0100
Subject: [PATCH 07/12] DVDVideoCodecDRMPRIME: Move FilterTest from open to
Subject: [PATCH 07/13] DVDVideoCodecDRMPRIME: Move FilterTest from open to
first frame returned
The pixel format is not accurate until the first frame is returned
@ -12,10 +12,10 @@ and it may (later) influence the choice of deinterlacers available.
2 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp
index 31c28477cb58..a05ae3ff89e8 100644
index cc75f6eeddde..ac79a80779ab 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp
@@ -387,15 +387,7 @@ bool CDVDVideoCodecDRMPRIME::Open(CDVDStreamInfo& hints, CDVDCodecOptions& optio
@@ -390,15 +390,7 @@ bool CDVDVideoCodecDRMPRIME::Open(CDVDStreamInfo& hints, CDVDCodecOptions& optio
m_processInfo.SetVideoDAR(hints.aspect);
m_processInfo.SetVideoDeintMethod("none");
@ -32,7 +32,7 @@ index 31c28477cb58..a05ae3ff89e8 100644
return true;
}
@@ -984,6 +976,20 @@ CDVDVideoCodec::VCReturn CDVDVideoCodecDRMPRIME::GetPicture(VideoPicture* pVideo
@@ -987,6 +979,20 @@ CDVDVideoCodec::VCReturn CDVDVideoCodecDRMPRIME::GetPicture(VideoPicture* pVideo
return VC_ERROR;
}

View File

@ -1,7 +1,7 @@
From 10ef3b029eed466b1e0811024cf5a0143f5c6132 Mon Sep 17 00:00:00 2001
From 69c2b54e731ff01574adb504b945387d47efd8a5 Mon Sep 17 00:00:00 2001
From: Dom Cobley <popcornmix@gmail.com>
Date: Wed, 31 May 2023 14:19:20 +0100
Subject: [PATCH 08/12] DVDVideoCodecDRMPRIME: Rework filtering code to handle
Subject: [PATCH 08/13] DVDVideoCodecDRMPRIME: Rework filtering code to handle
sw deinterlace
---
@ -10,10 +10,10 @@ Subject: [PATCH 08/12] DVDVideoCodecDRMPRIME: Rework filtering code to handle
2 files changed, 68 insertions(+), 70 deletions(-)
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp
index a05ae3ff89e8..d07cccffddc1 100644
index ac79a80779ab..a5d340525d69 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp
@@ -207,11 +207,7 @@ static const AVCodec* FindDecoder(CDVDStreamInfo& hints)
@@ -203,11 +203,7 @@ static const AVCodec* FindDecoder(CDVDStreamInfo& hints)
return codec;
}
@ -26,7 +26,7 @@ index a05ae3ff89e8..d07cccffddc1 100644
}
enum AVPixelFormat CDVDVideoCodecDRMPRIME::GetFormat(struct AVCodecContext* avctx,
@@ -646,27 +642,33 @@ bool CDVDVideoCodecDRMPRIME::SetPictureParams(VideoPicture* pVideoPicture)
@@ -649,27 +645,33 @@ bool CDVDVideoCodecDRMPRIME::SetPictureParams(VideoPicture* pVideoPicture)
return true;
}
@ -74,7 +74,7 @@ index a05ae3ff89e8..d07cccffddc1 100644
}
}
}
@@ -692,14 +694,17 @@ AVFrame *CDVDVideoCodecDRMPRIME::alloc_filter_frame(AVFilterContext * ctx, void
@@ -695,14 +697,17 @@ AVFrame *CDVDVideoCodecDRMPRIME::alloc_filter_frame(AVFilterContext * ctx, void
return frame;
}
@ -94,7 +94,7 @@ index a05ae3ff89e8..d07cccffddc1 100644
return true;
if (!(m_pFilterGraph = avfilter_graph_alloc()))
@@ -710,13 +715,12 @@ bool CDVDVideoCodecDRMPRIME::FilterOpen(const std::string& filters, bool scale,
@@ -713,13 +718,12 @@ bool CDVDVideoCodecDRMPRIME::FilterOpen(const std::string& filters, bool scale,
const AVFilter* srcFilter = avfilter_get_by_name("buffer");
const AVFilter* outFilter = avfilter_get_by_name("buffersink");
@ -109,7 +109,7 @@ index a05ae3ff89e8..d07cccffddc1 100644
m_pCodecContext->time_base.num ?
m_pCodecContext->time_base.num : 1,
m_pCodecContext->time_base.num ?
@@ -773,6 +777,7 @@ bool CDVDVideoCodecDRMPRIME::FilterOpen(const std::string& filters, bool scale,
@@ -776,6 +780,7 @@ bool CDVDVideoCodecDRMPRIME::FilterOpen(const std::string& filters, bool scale,
return false;
}
@ -117,7 +117,7 @@ index a05ae3ff89e8..d07cccffddc1 100644
result = av_opt_set_int_list(m_pFilterOut, "pix_fmts", &pix_fmts[0],
AV_PIX_FMT_NONE, AV_OPT_SEARCH_CHILDREN);
if (result < 0)
@@ -781,43 +786,32 @@ bool CDVDVideoCodecDRMPRIME::FilterOpen(const std::string& filters, bool scale,
@@ -784,43 +789,32 @@ bool CDVDVideoCodecDRMPRIME::FilterOpen(const std::string& filters, bool scale,
return false;
}
@ -181,7 +181,7 @@ index a05ae3ff89e8..d07cccffddc1 100644
}
if ((result = avfilter_graph_config(m_pFilterGraph, nullptr)) < 0)
@@ -832,8 +826,6 @@ bool CDVDVideoCodecDRMPRIME::FilterOpen(const std::string& filters, bool scale,
@@ -835,8 +829,6 @@ bool CDVDVideoCodecDRMPRIME::FilterOpen(const std::string& filters, bool scale,
if (test)
return true;
@ -190,7 +190,7 @@ index a05ae3ff89e8..d07cccffddc1 100644
if (CServiceBroker::GetLogging().CanLogComponent(LOGVIDEO))
{
char* graphDump = avfilter_graph_dump(m_pFilterGraph, nullptr);
@@ -865,8 +857,8 @@ void CDVDVideoCodecDRMPRIME::FilterClose()
@@ -868,8 +860,8 @@ void CDVDVideoCodecDRMPRIME::FilterClose()
CDVDVideoCodec::VCReturn CDVDVideoCodecDRMPRIME::ProcessFilterIn()
{
@ -201,7 +201,7 @@ index a05ae3ff89e8..d07cccffddc1 100644
{
CVideoBufferDMA* buffer = static_cast<CVideoBufferDMA*>(av_buffer_get_opaque(m_pFrame->buf[0]));
buffer->SetDimensions(m_pFrame->width, m_pFrame->height);
@@ -976,9 +968,10 @@ CDVDVideoCodec::VCReturn CDVDVideoCodecDRMPRIME::GetPicture(VideoPicture* pVideo
@@ -979,9 +971,10 @@ CDVDVideoCodec::VCReturn CDVDVideoCodecDRMPRIME::GetPicture(VideoPicture* pVideo
return VC_ERROR;
}
@ -213,7 +213,7 @@ index a05ae3ff89e8..d07cccffddc1 100644
if (!m_deintFilterName.empty())
{
@@ -990,28 +983,33 @@ CDVDVideoCodec::VCReturn CDVDVideoCodecDRMPRIME::GetPicture(VideoPicture* pVideo
@@ -993,28 +986,33 @@ CDVDVideoCodec::VCReturn CDVDVideoCodecDRMPRIME::GetPicture(VideoPicture* pVideo
m_checkedDeinterlace = true;
}

View File

@ -1,7 +1,7 @@
From a6cd510a17a4a704c245b96734d7a44cba0e8d76 Mon Sep 17 00:00:00 2001
From c2e865be9182adc4cc78658a507fd1415fb05efb Mon Sep 17 00:00:00 2001
From: Dom Cobley <popcornmix@gmail.com>
Date: Tue, 20 Jun 2023 15:13:09 +0100
Subject: [PATCH 09/12] CDVDVideoCodecDRMPRIME: Support decoding to DRMPRIME
Subject: [PATCH 09/13] CDVDVideoCodecDRMPRIME: Support decoding to DRMPRIME
with sw deinterlace
We can map a YUV style DRM_PRIME buffer back to AV_PIX_FMT_YUV420P
@ -11,10 +11,10 @@ to allow subsquent sw deinterlace
1 file changed, 22 insertions(+)
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp
index d07cccffddc1..9439f031800a 100644
index a5d340525d69..c228a75f8b90 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp
@@ -701,6 +701,9 @@ bool CDVDVideoCodecDRMPRIME::FilterOpen(const std::string& filters, AVPixelForma
@@ -704,6 +704,9 @@ bool CDVDVideoCodecDRMPRIME::FilterOpen(const std::string& filters, AVPixelForma
if (filters.find("deinterlace") != std::string::npos && pix_fmt == AV_PIX_FMT_YUV420P)
pix_fmt = AV_PIX_FMT_DRM_PRIME;
@ -24,7 +24,7 @@ index d07cccffddc1..9439f031800a 100644
if (m_pFilterGraph)
FilterClose();
@@ -867,6 +870,25 @@ CDVDVideoCodec::VCReturn CDVDVideoCodecDRMPRIME::ProcessFilterIn()
@@ -870,6 +873,25 @@ CDVDVideoCodec::VCReturn CDVDVideoCodecDRMPRIME::ProcessFilterIn()
m_pFrame->data[0] = reinterpret_cast<uint8_t*>(descriptor);
m_pFrame->format = AV_PIX_FMT_DRM_PRIME;
}

View File

@ -1,7 +1,7 @@
From 0dbcdaef75f1513de2077bbf14825486c46b1bb8 Mon Sep 17 00:00:00 2001
From ebd3045b5395807cbd15d050b3f85b3cb4d384ec Mon Sep 17 00:00:00 2001
From: Dom Cobley <popcornmix@gmail.com>
Date: Tue, 20 Jun 2023 15:14:02 +0100
Subject: [PATCH 10/12] DVDVideoCodecDRMPRIME: Request v4l2 buffers be
Subject: [PATCH 10/13] DVDVideoCodecDRMPRIME: Request v4l2 buffers be
allocated through cache
This is an optional request, but will improve performance of sw deinterlace
@ -11,10 +11,10 @@ if supported.
1 file changed, 4 insertions(+)
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp
index 9439f031800a..4338324c931d 100644
index c228a75f8b90..77b22d610a2f 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp
@@ -367,6 +367,10 @@ bool CDVDVideoCodecDRMPRIME::Open(CDVDStreamInfo& hints, CDVDCodecOptions& optio
@@ -370,6 +370,10 @@ bool CDVDVideoCodecDRMPRIME::Open(CDVDStreamInfo& hints, CDVDCodecOptions& optio
for (auto&& option : options.m_keys)
av_opt_set(m_pCodecContext, option.m_name.c_str(), option.m_value.c_str(), 0);

View File

@ -1,7 +1,7 @@
From b28d1869b92f9876c838e288f4b4eeb357ae9e86 Mon Sep 17 00:00:00 2001
From 80010a99ca9a56a4fc0c8201031a7de657a73ca6 Mon Sep 17 00:00:00 2001
From: Dom Cobley <popcornmix@gmail.com>
Date: Wed, 21 Jun 2023 13:16:01 +0100
Subject: [PATCH 11/12] DVDVideoCodecDRMPRIME: Add setting to enable hw
Subject: [PATCH 11/13] DVDVideoCodecDRMPRIME: Add setting to enable hw
deinterlace
HW deinterlace has lower cpu, but may have higher quality,
@ -14,10 +14,10 @@ so allow user to choose appropriate setting.
4 files changed, 39 insertions(+), 1 deletion(-)
diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po
index 4e0f32669987..abbfbd767c05 100644
index 1967605a761a..d6363ca97b4b 100644
--- a/addons/resource.language.en_gb/resources/strings.po
+++ b/addons/resource.language.en_gb/resources/strings.po
@@ -7513,6 +7513,11 @@ msgctxt "#13438"
@@ -7536,6 +7536,11 @@ msgctxt "#13438"
msgid "Allow hardware acceleration with DRM PRIME"
msgstr ""
@ -29,7 +29,7 @@ index 4e0f32669987..abbfbd767c05 100644
#: system/settings/settings.xml
msgctxt "#13439"
msgid "Allow hardware acceleration - MediaCodec"
@@ -19896,6 +19901,12 @@ msgctxt "#36172"
@@ -19941,6 +19946,12 @@ msgctxt "#36172"
msgid "Enable PRIME decoding of video files"
msgstr ""
@ -66,10 +66,10 @@ index c99bd895275e..756448b8371a 100644
<requirement>HAS_GLES</requirement>
<visible>false</visible>
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp
index 4338324c931d..135a1e29af0a 100644
index 77b22d610a2f..86d94b962713 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp
@@ -41,6 +41,7 @@ namespace
@@ -40,6 +40,7 @@ namespace
{
constexpr const char* SETTING_VIDEOPLAYER_USEPRIMEDECODERFORHW{"videoplayer.useprimedecoderforhw"};
@ -77,7 +77,7 @@ index 4338324c931d..135a1e29af0a 100644
static void ReleaseBuffer(void* opaque, uint8_t* data)
{
@@ -149,6 +150,15 @@ void CDVDVideoCodecDRMPRIME::Register()
@@ -148,6 +149,15 @@ void CDVDVideoCodecDRMPRIME::Register()
setting->SetVisible(true);
@ -93,7 +93,7 @@ index 4338324c931d..135a1e29af0a 100644
CDVDFactoryCodec::RegisterHWVideoCodec("drm_prime", CDVDVideoCodecDRMPRIME::Create);
}
@@ -651,7 +661,11 @@ void CDVDVideoCodecDRMPRIME::FilterTest(AVPixelFormat pix_fmt)
@@ -654,7 +664,11 @@ void CDVDVideoCodecDRMPRIME::FilterTest(AVPixelFormat pix_fmt)
m_deintFilterName.clear();
// look twice, first for DRM_PRIME support, then for actual pixel format
@ -107,7 +107,7 @@ index 4338324c931d..135a1e29af0a 100644
const AVFilter* filter;
void* opaque{};
diff --git a/xbmc/settings/Settings.h b/xbmc/settings/Settings.h
index adf040f49c01..490513d3b9b1 100644
index c3bff84a84e2..c7b36e04e513 100644
--- a/xbmc/settings/Settings.h
+++ b/xbmc/settings/Settings.h
@@ -124,6 +124,7 @@ public:

View File

@ -1,17 +1,17 @@
From 073e3c003014827c37d142338f23674c0deab835 Mon Sep 17 00:00:00 2001
From 726b9cfa604ce8f89bf1b18d67332839a3f08c5d Mon Sep 17 00:00:00 2001
From: Dom Cobley <popcornmix@gmail.com>
Date: Tue, 17 Dec 2024 19:44:14 +0000
Subject: [PATCH 12/12] fixup! DVDVideoCodecDRMPRIME: add support for filters
Subject: [PATCH 12/13] fixup! DVDVideoCodecDRMPRIME: add support for filters
---
.../cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp
index 135a1e29af0a..014843c9e422 100644
index 86d94b962713..60f9bf28bf66 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp
@@ -772,7 +772,7 @@ bool CDVDVideoCodecDRMPRIME::FilterOpen(const std::string& filters, AVPixelForma
@@ -775,7 +775,7 @@ bool CDVDVideoCodecDRMPRIME::FilterOpen(const std::string& filters, AVPixelForma
memset(par, 0, sizeof(*par));
par->format = AV_PIX_FMT_NONE;

View File

@ -0,0 +1,60 @@
From 1acdbf34921e0fcc25c502da2cbe994554d540d9 Mon Sep 17 00:00:00 2001
From: Dom Cobley <popcornmix@gmail.com>
Date: Tue, 11 Mar 2025 17:15:42 +0000
Subject: [PATCH 13/13] DVDVideoCodecDRMPRIME: Set hwctx for v4l2 deinterlace
---
.../DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp | 18 +++++++++++++++++-
.../DVDCodecs/Video/DVDVideoCodecDRMPRIME.h | 2 ++
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp
index 60f9bf28bf66..c8385f64d83e 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp
@@ -775,7 +775,21 @@ bool CDVDVideoCodecDRMPRIME::FilterOpen(const std::string& filters, AVPixelForma
memset(par, 0, sizeof(*par));
par->format = AV_PIX_FMT_NONE;
- par->hw_frames_ctx = m_pFrame->hw_frames_ctx;
+
+ if (pix_fmt == AV_PIX_FMT_DRM_PRIME)
+ {
+ if (av_hwdevice_ctx_create(&m_hw_device_ref, AV_HWDEVICE_TYPE_DRM, NULL, NULL, 0) < 0) {
+ CLog::Log(LOGERROR, "Failed to create DRM device");
+ return false;
+ }
+ m_hw_frames_ref = av_hwframe_ctx_alloc(m_hw_device_ref);
+ if (!m_hw_frames_ref) {
+ CLog::Log(LOGERROR, "Failed to allocate hwframe context");
+ av_buffer_unref(&m_hw_device_ref);
+ return false;
+ }
+ par->hw_frames_ctx = av_buffer_ref(m_hw_frames_ref);
+ }
result = av_buffersrc_parameters_set(m_pFilterIn, par);
if (result < 0)
@@ -876,6 +890,8 @@ void CDVDVideoCodecDRMPRIME::FilterClose()
m_pFilterIn = nullptr;
m_pFilterOut = nullptr;
m_pFilterGraph = nullptr;
+ av_buffer_unref(&m_hw_frames_ref);
+ av_buffer_unref(&m_hw_device_ref);
}
}
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.h b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.h
index 55675c3c2ea8..64c6c029f3d4 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.h
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.h
@@ -64,4 +64,6 @@ protected:
AVFilterContext* m_pFilterIn = nullptr;
AVFilterContext* m_pFilterOut = nullptr;
std::shared_ptr<IVideoBufferPool> m_videoBufferPool;
+ AVBufferRef *m_hw_device_ref = nullptr;
+ AVBufferRef *m_hw_frames_ref = nullptr;
};
--
2.39.5