mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-24 11:16:51 +00:00
rkmpp: update to c8a41a6
This commit is contained in:
parent
2c42011f74
commit
4abbfa0d50
@ -0,0 +1,168 @@
|
||||
From ed4a91d4f4bd7ab99f2be901285b20a0cde52902 Mon Sep 17 00:00:00 2001
|
||||
From: LongChair <longchair@hotmail.com>
|
||||
Date: Sat, 6 Jan 2018 09:36:58 +0100
|
||||
Subject: [PATCH] avcodec/rkmpp : Fix broken build due to missing control
|
||||
operation
|
||||
|
||||
This patch is taking care of https://trac.ffmpeg.org/ticket/6834.
|
||||
It seems that one of the control operations that was available to get
|
||||
the free decoders input slots was removed.
|
||||
|
||||
There is another control operation to retrieve the used slots. Given
|
||||
that the input slot count is hardcoded to 4 in mpp at this point,
|
||||
replacing the old control operation by the other one.
|
||||
|
||||
This was tested on Rockchip ROCK64.
|
||||
|
||||
Signed-off-by: wm4 <nfxjfg@googlemail.com>
|
||||
(cherry picked from commit c6f84106366c6f243a8b07dbffcc7880009aa904)
|
||||
---
|
||||
configure | 6 ++----
|
||||
libavcodec/rkmppdec.c | 10 ++++++----
|
||||
2 files changed, 8 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/configure b/configure
|
||||
index 1797c5dd4f..4db1c9b73f 100755
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -6077,10 +6077,8 @@ enabled openssl && { use_pkg_config openssl openssl openssl/ssl.h OPEN
|
||||
check_lib openssl openssl/ssl.h SSL_library_init -lssl32 -leay32 ||
|
||||
check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||
|
||||
die "ERROR: openssl not found"; }
|
||||
-enabled rkmpp && { { require_pkg_config rockchip_mpp rockchip_mpp rockchip/rk_mpi.h mpp_create ||
|
||||
- die "ERROR : Rockchip MPP was not found."; } &&
|
||||
- { check_func_headers rockchip/rk_mpi_cmd.h "MPP_DEC_GET_FREE_PACKET_SLOT_COUNT" ||
|
||||
- die "ERROR: Rockchip MPP is outdated, please get a more recent one."; } &&
|
||||
+enabled rkmpp && { require_pkg_config rkmpp rockchip_mpp rockchip/rk_mpi.h mpp_create &&
|
||||
+ require_pkg_config rockchip_mpp "rockchip_mpp >= 1.3.7" rockchip/rk_mpi.h mpp_create &&
|
||||
{ enabled libdrm ||
|
||||
die "ERROR: rkmpp requires --enable-libdrm"; }
|
||||
}
|
||||
diff --git a/libavcodec/rkmppdec.c b/libavcodec/rkmppdec.c
|
||||
index bdf4dc4208..ebc021e3d8 100644
|
||||
--- a/libavcodec/rkmppdec.c
|
||||
+++ b/libavcodec/rkmppdec.c
|
||||
@@ -39,6 +39,7 @@
|
||||
|
||||
#define RECEIVE_FRAME_TIMEOUT 100
|
||||
#define FRAMEGROUP_MAX_FRAMES 16
|
||||
+#define INPUT_MAX_PACKETS 4
|
||||
|
||||
typedef struct {
|
||||
MppCtx ctx;
|
||||
@@ -514,16 +515,17 @@ static int rkmpp_receive_frame(AVCodecContext *avctx, AVFrame *frame)
|
||||
RKMPPDecoder *decoder = (RKMPPDecoder *)rk_context->decoder_ref->data;
|
||||
int ret = MPP_NOK;
|
||||
AVPacket pkt = {0};
|
||||
- RK_S32 freeslots;
|
||||
+ RK_S32 usedslots, freeslots;
|
||||
|
||||
if (!decoder->eos_reached) {
|
||||
// we get the available slots in decoder
|
||||
- ret = decoder->mpi->control(decoder->ctx, MPP_DEC_GET_FREE_PACKET_SLOT_COUNT, &freeslots);
|
||||
+ ret = decoder->mpi->control(decoder->ctx, MPP_DEC_GET_STREAM_COUNT, &usedslots);
|
||||
if (ret != MPP_OK) {
|
||||
- av_log(avctx, AV_LOG_ERROR, "Failed to get decoder free slots (code = %d).\n", ret);
|
||||
+ av_log(avctx, AV_LOG_ERROR, "Failed to get decoder used slots (code = %d).\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
+ freeslots = INPUT_MAX_PACKETS - usedslots;
|
||||
if (freeslots > 0) {
|
||||
ret = ff_decode_get_packet(avctx, &pkt);
|
||||
if (ret < 0 && ret != AVERROR_EOF) {
|
||||
@@ -540,7 +542,7 @@ static int rkmpp_receive_frame(AVCodecContext *avctx, AVFrame *frame)
|
||||
}
|
||||
|
||||
// make sure we keep decoder full
|
||||
- if (freeslots > 1 && decoder->first_frame)
|
||||
+ if (freeslots > 1)
|
||||
return AVERROR(EAGAIN);
|
||||
}
|
||||
|
||||
|
||||
From 617c895d27198bb9391a001932e288d1dfe4f728 Mon Sep 17 00:00:00 2001
|
||||
From: LongChair <longchair@hotmail.com>
|
||||
Date: Tue, 2 Jan 2018 12:38:01 +0100
|
||||
Subject: [PATCH] avcodec/rkmpp : remove stream start retries before first
|
||||
frame.
|
||||
|
||||
those were needed because of some odd mpp behavior that seems to have
|
||||
been fixed.
|
||||
|
||||
Makes the code cleaner.
|
||||
|
||||
Signed-off-by: wm4 <nfxjfg@googlemail.com>
|
||||
(cherry picked from commit 2ca65fc7b74444edd51d5803a2c1e05a801a6023)
|
||||
---
|
||||
libavcodec/rkmppdec.c | 24 +++---------------------
|
||||
1 file changed, 3 insertions(+), 21 deletions(-)
|
||||
|
||||
diff --git a/libavcodec/rkmppdec.c b/libavcodec/rkmppdec.c
|
||||
index ebc021e3d8..9dfeb742ab 100644
|
||||
--- a/libavcodec/rkmppdec.c
|
||||
+++ b/libavcodec/rkmppdec.c
|
||||
@@ -46,7 +46,6 @@ typedef struct {
|
||||
MppApi *mpi;
|
||||
MppBufferGroup frame_group;
|
||||
|
||||
- char first_frame;
|
||||
char first_packet;
|
||||
char eos_reached;
|
||||
|
||||
@@ -328,28 +327,14 @@ static int rkmpp_retrieve_frame(AVCodecContext *avctx, AVFrame *frame)
|
||||
MppBuffer buffer = NULL;
|
||||
AVDRMFrameDescriptor *desc = NULL;
|
||||
AVDRMLayerDescriptor *layer = NULL;
|
||||
- int retrycount = 0;
|
||||
int mode;
|
||||
MppFrameFormat mppformat;
|
||||
uint32_t drmformat;
|
||||
|
||||
- // on start of decoding, MPP can return -1, which is supposed to be expected
|
||||
- // this is due to some internal MPP init which is not completed, that will
|
||||
- // only happen in the first few frames queries, but should not be interpreted
|
||||
- // as an error, Therefore we need to retry a couple times when we get -1
|
||||
- // in order to let it time to complete it's init, then we sleep a bit between retries.
|
||||
-retry_get_frame:
|
||||
ret = decoder->mpi->decode_get_frame(decoder->ctx, &mppframe);
|
||||
- if (ret != MPP_OK && ret != MPP_ERR_TIMEOUT && !decoder->first_frame) {
|
||||
- if (retrycount < 5) {
|
||||
- av_log(avctx, AV_LOG_DEBUG, "Failed to get a frame, retrying (code = %d, retrycount = %d)\n", ret, retrycount);
|
||||
- usleep(10000);
|
||||
- retrycount++;
|
||||
- goto retry_get_frame;
|
||||
- } else {
|
||||
- av_log(avctx, AV_LOG_ERROR, "Failed to get a frame from MPP (code = %d)\n", ret);
|
||||
- goto fail;
|
||||
- }
|
||||
+ if (ret != MPP_OK && ret != MPP_ERR_TIMEOUT) {
|
||||
+ av_log(avctx, AV_LOG_ERROR, "Failed to get a frame from MPP (code = %d)\n", ret);
|
||||
+ goto fail;
|
||||
}
|
||||
|
||||
if (mppframe) {
|
||||
@@ -365,7 +350,6 @@ retry_get_frame:
|
||||
avctx->height = mpp_frame_get_height(mppframe);
|
||||
|
||||
decoder->mpi->control(decoder->ctx, MPP_DEC_SET_INFO_CHANGE_READY, NULL);
|
||||
- decoder->first_frame = 1;
|
||||
|
||||
av_buffer_unref(&decoder->frames_ref);
|
||||
|
||||
@@ -479,7 +463,6 @@ retry_get_frame:
|
||||
goto fail;
|
||||
}
|
||||
|
||||
- decoder->first_frame = 0;
|
||||
return 0;
|
||||
} else {
|
||||
av_log(avctx, AV_LOG_ERROR, "Failed to retrieve the frame buffer, frame is dropped (code = %d)\n", ret);
|
||||
@@ -559,7 +542,6 @@ static void rkmpp_flush(AVCodecContext *avctx)
|
||||
|
||||
ret = decoder->mpi->reset(decoder->ctx);
|
||||
if (ret == MPP_OK) {
|
||||
- decoder->first_frame = 1;
|
||||
decoder->first_packet = 1;
|
||||
} else
|
||||
av_log(avctx, AV_LOG_ERROR, "Failed to reset MPI (code = %d)\n", ret);
|
@ -17,8 +17,8 @@
|
||||
################################################################################
|
||||
|
||||
PKG_NAME="rkmpp"
|
||||
PKG_VERSION="c6594ae"
|
||||
PKG_SHA256="981f7bc04677ff5135cea92e9926d5521ed38b359514d3405dd8f01c9295d147"
|
||||
PKG_VERSION="c8a41a6"
|
||||
PKG_SHA256="01b84eecde7cae98035ecce866b48f903f9deaa7e19b048ff9cb87edf6446659"
|
||||
PKG_ARCH="arm aarch64"
|
||||
PKG_LICENSE="APL"
|
||||
PKG_SITE="https://github.com/rockchip-linux/mpp"
|
||||
|
@ -1,7 +1,7 @@
|
||||
From ccb2128ace5c069ec1b904cc621bacaf82498929 Mon Sep 17 00:00:00 2001
|
||||
From e9c9f2619bb2344f9947ccbbdcf15be9d0f55b1f Mon Sep 17 00:00:00 2001
|
||||
From: Jakob Unterwurzacher <jakob.unterwurzacher@theobroma-systems.com>
|
||||
Date: Mon, 29 May 2017 14:08:43 +0200
|
||||
Subject: [PATCH 2/2] fix 32-bit mmap issue on 64-bit kernels
|
||||
Subject: [PATCH] fix 32-bit mmap issue on 64-bit kernels
|
||||
|
||||
Running 32-bit userland on a 64-bit kernel resulted in the error:
|
||||
|
@ -1,77 +0,0 @@
|
||||
From 0d5fc7b20b6997418935b422b3704b1a90ad584b Mon Sep 17 00:00:00 2001
|
||||
From: LongChair <LongChair@hotmail.com>
|
||||
Date: Wed, 26 Apr 2017 11:45:37 +0200
|
||||
Subject: [PATCH 1/2] [mpp]: retrieve available input packet free slots
|
||||
|
||||
This is something that allows to know before putting a packet into
|
||||
the decoder if it would accept it or if it is full.
|
||||
|
||||
This patch also adds a constant define for the input buffer count
|
||||
rather than having the 4 hardcoded.
|
||||
|
||||
Change-Id: I876e5d4efd0b2e38619ab87d4147a40bedee5669
|
||||
Signed-off-by: LongChair <LongChair@hotmail.com>
|
||||
Reviewed-by: ayaka <ayaka@soulik.info>
|
||||
Signed-off-by: Randy Li <randy.li@rock-chips.com>
|
||||
---
|
||||
inc/rk_mpi_cmd.h | 1 +
|
||||
mpp/mpp.cpp | 13 +++++++++----
|
||||
2 files changed, 10 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/inc/rk_mpi_cmd.h b/inc/rk_mpi_cmd.h
|
||||
index 3f2c8d71..a9c58563 100644
|
||||
--- a/inc/rk_mpi_cmd.h
|
||||
+++ b/inc/rk_mpi_cmd.h
|
||||
@@ -97,6 +97,7 @@ typedef enum {
|
||||
MPP_DEC_SET_VC1_EXTRA_DATA,
|
||||
MPP_DEC_SET_OUTPUT_FORMAT,
|
||||
MPP_DEC_SET_DISABLE_ERROR, /* When set it will disable sw/hw error (H.264 / H.265) */
|
||||
+ MPP_DEC_GET_FREE_PACKET_SLOT_COUNT,
|
||||
MPP_DEC_CMD_END,
|
||||
|
||||
MPP_ENC_CMD_BASE = CMD_MODULE_CODEC | CMD_CTX_ID_ENC,
|
||||
diff --git a/mpp/mpp.cpp b/mpp/mpp.cpp
|
||||
index 164cd60d..1357d1a0 100644
|
||||
--- a/mpp/mpp.cpp
|
||||
+++ b/mpp/mpp.cpp
|
||||
@@ -33,6 +33,7 @@
|
||||
|
||||
#define MPP_TEST_FRAME_SIZE SZ_1M
|
||||
#define MPP_TEST_PACKET_SIZE SZ_512K
|
||||
+#define MPP_MAX_INPUT_PACKETS 4
|
||||
|
||||
Mpp::Mpp()
|
||||
: mPackets(NULL),
|
||||
@@ -102,8 +103,8 @@ MPP_RET Mpp::init(MppCtxType type, MppCodingType coding)
|
||||
|
||||
mpp_task_queue_init(&mInputTaskQueue);
|
||||
mpp_task_queue_init(&mOutputTaskQueue);
|
||||
- mpp_task_queue_setup(mInputTaskQueue, 4);
|
||||
- mpp_task_queue_setup(mOutputTaskQueue, 4);
|
||||
+ mpp_task_queue_setup(mInputTaskQueue, MPP_MAX_INPUT_PACKETS);
|
||||
+ mpp_task_queue_setup(mOutputTaskQueue, MPP_MAX_INPUT_PACKETS);
|
||||
} else {
|
||||
mThreadCodec = new MppThread(mpp_dec_advanced_thread, this, "mpp_dec_parser");
|
||||
|
||||
@@ -258,7 +259,7 @@ MPP_RET Mpp::put_packet(MppPacket packet)
|
||||
AutoMutex autoLock(mPackets->mutex());
|
||||
RK_U32 eos = mpp_packet_get_eos(packet);
|
||||
|
||||
- if (mPackets->list_size() < 4 || eos) {
|
||||
+ if (mPackets->list_size() < MPP_MAX_INPUT_PACKETS || eos) {
|
||||
MppPacket pkt;
|
||||
if (MPP_OK != mpp_packet_copy_init(&pkt, packet))
|
||||
return MPP_NOK;
|
||||
@@ -742,7 +743,11 @@ MPP_RET Mpp::control_dec(MpiCmd cmd, MppParam param)
|
||||
case MPP_DEC_SET_OUTPUT_FORMAT:
|
||||
case MPP_DEC_SET_DISABLE_ERROR: {
|
||||
ret = mpp_dec_control(mDec, cmd, param);
|
||||
- }
|
||||
+ } break;
|
||||
+ case MPP_DEC_GET_FREE_PACKET_SLOT_COUNT: {
|
||||
+ *((RK_S32 *)param) = MPP_MAX_INPUT_PACKETS - mPackets->list_size();
|
||||
+ ret = MPP_OK;
|
||||
+ } break;
|
||||
default : {
|
||||
} break;
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
From 322efafd1f760c73accda1a7025b007f211916f7 Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Karlman <jonas@kwiboo.se>
|
||||
Date: Sat, 3 Mar 2018 10:10:01 +0100
|
||||
Subject: [PATCH] [mpp_dec]: sleep when there is nothing to parse
|
||||
|
||||
---
|
||||
mpp/codec/mpp_dec.cpp | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/mpp/codec/mpp_dec.cpp b/mpp/codec/mpp_dec.cpp
|
||||
index 424604e1..dded58c6 100644
|
||||
--- a/mpp/codec/mpp_dec.cpp
|
||||
+++ b/mpp/codec/mpp_dec.cpp
|
||||
@@ -600,8 +600,10 @@ void *mpp_dec_parser_thread(void *data)
|
||||
}
|
||||
parser->unlock();
|
||||
|
||||
- if (try_proc_dec_task(mpp, &task))
|
||||
+ if (try_proc_dec_task(mpp, &task)) {
|
||||
+ msleep(1);
|
||||
continue;
|
||||
+ }
|
||||
|
||||
}
|
||||
|
@ -1,16 +1,3 @@
|
||||
diff --git a/mpp/hal/rkdec/h265d/hal_h265d_reg.c b/mpp/hal/rkdec/h265d/hal_h265d_reg.c
|
||||
index a60d6c2..3d4265b 100644
|
||||
--- a/mpp/hal/rkdec/h265d/hal_h265d_reg.c
|
||||
+++ b/mpp/hal/rkdec/h265d/hal_h265d_reg.c
|
||||
@@ -1468,8 +1468,6 @@ MPP_RET hal_h265d_gen_regs(void *hal, HalTaskInfo *syn)
|
||||
}
|
||||
hw_regs->sw_interrupt.sw_dec_e = 1;
|
||||
hw_regs->sw_interrupt.sw_dec_timeout_e = 1;
|
||||
- hw_regs->sw_interrupt.sw_wr_ddr_align_en = dxva_cxt->pp.tiles_enabled_flag
|
||||
- ? 0 : 1;
|
||||
|
||||
|
||||
///find s->rps_model[i] position, and set register
|
||||
diff --git a/mpp/hal/rkdec/h265d/hal_h265d_reg.h b/mpp/hal/rkdec/h265d/hal_h265d_reg.h
|
||||
index 1bccb02..432b8db 100644
|
||||
--- a/mpp/hal/rkdec/h265d/hal_h265d_reg.h
|
||||
|
Loading…
x
Reference in New Issue
Block a user