1
0
mirror of https://github.com/libretro/Lakka-LibreELEC.git synced 2024-11-24 10:16:18 +00:00
Lakka-LibreELEC/projects/Amlogic/devices/AMLGX/patches/linux/amlogic-0058-FROMLIST-v1-media-meson-vdec-esparser-check-parsing-.patch
2023-03-14 11:10:30 +00:00

56 lines
1.9 KiB
Diff

From 89e62d3e8515a1f51b415b255b7200bdf8f1209d Mon Sep 17 00:00:00 2001
From: Neil Armstrong <narmstrong@baylibre.com>
Date: Mon, 22 Nov 2021 09:15:21 +0000
Subject: [PATCH 058/120] FROMLIST(v1): media: meson: vdec: esparser: check
parsing state with hardware write pointer
Also check the hardware write pointer to check if ES Parser has stalled.
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
---
drivers/staging/media/meson/vdec/esparser.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/media/meson/vdec/esparser.c b/drivers/staging/media/meson/vdec/esparser.c
index 7b15fc54efe4..1904d58875ad 100644
--- a/drivers/staging/media/meson/vdec/esparser.c
+++ b/drivers/staging/media/meson/vdec/esparser.c
@@ -300,6 +300,7 @@ esparser_queue(struct amvdec_session *sess, struct vb2_v4l2_buffer *vbuf)
u32 num_dst_bufs = 0;
u32 offset;
u32 pad_size;
+ u32 wp, wp2;
/*
* When max ref frame is held by VP9, this should be -= 3 to prevent a
@@ -353,15 +354,21 @@ esparser_queue(struct amvdec_session *sess, struct vb2_v4l2_buffer *vbuf)
}
pad_size = esparser_pad_start_code(core, vb, payload_size);
+ wp = amvdec_read_parser(core, PARSER_VIDEO_WP);
ret = esparser_write_data(core, phy, payload_size + pad_size);
+ wp2 = amvdec_read_parser(core, PARSER_VIDEO_WP);
if (ret <= 0) {
- dev_warn(core->dev, "esparser: input parsing error\n");
- amvdec_remove_ts(sess, vb->timestamp);
- v4l2_m2m_buf_done(vbuf, VB2_BUF_STATE_ERROR);
amvdec_write_parser(core, PARSER_FETCH_CMD, 0);
- return 0;
+ if (ret < 0 || wp2 == wp) {
+ dev_err(core->dev, "esparser: input parsing error ret %d (%x <=> %x)\n",
+ ret, wp, wp2);
+ amvdec_remove_ts(sess, vb->timestamp);
+ v4l2_m2m_buf_done(vbuf, VB2_BUF_STATE_ERROR);
+
+ return 0;
+ }
}
atomic_inc(&sess->esparser_queued_bufs);
--
2.34.1