From: Yunfei Dong <yunfei.dong@mediatek.com>
To: "Nícolas F . R . A . Prado" <nfraprado@collabora.com>,
"Sebastian Fricke" <sebastian.fricke@collabora.com>,
"Nicolas Dufresne" <nicolas.dufresne@collabora.com>,
"Hans Verkuil" <hverkuil-cisco@xs4all.nl>,
"AngeloGioacchino Del Regno"
<angelogioacchino.delregno@collabora.com>,
"Benjamin Gaignard" <benjamin.gaignard@collabora.com>,
"Nathan Hebert" <nhebert@chromium.org>,
"Daniel Almeida" <daniel.almeida@collabora.com>
Cc: Hsin-Yi Wang <hsinyi@chromium.org>,
Fritz Koenig <frkoenig@chromium.org>,
Daniel Vetter <daniel@ffwll.ch>,
Steve Cho <stevecho@chromium.org>,
"Yunfei Dong" <yunfei.dong@mediatek.com>,
<linux-media@vger.kernel.org>, <devicetree@vger.kernel.org>,
<linux-kernel@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-mediatek@lists.infradead.org>,
<Project_Global_Chrome_Upstream_Group@mediatek.com>
Subject: [PATCH v4 2/7] media: mediatek: vcodec: change flush decode order when stream off
Date: Wed, 7 Aug 2024 16:24:32 +0800 [thread overview]
Message-ID: <20240807082444.21280-3-yunfei.dong@mediatek.com> (raw)
In-Reply-To: <20240807082444.21280-1-yunfei.dong@mediatek.com>
The buffer remove and buffer done of output queue is separated into
two works, the value of owned_by_drv_count isn't zero when output
queue stream off before flush decode.
Changing the flush decode from capture to output when stream off to
make sure all the output queue buffers are set to done list.
Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com>
---
.../mediatek/vcodec/decoder/mtk_vcodec_dec.c | 45 +++++++++----------
1 file changed, 22 insertions(+), 23 deletions(-)
diff --git a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec.c b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec.c
index 2b787e60a1f9..7080ca3e18b0 100644
--- a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec.c
+++ b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec.c
@@ -893,32 +893,31 @@ void vb2ops_vdec_stop_streaming(struct vb2_queue *q)
v4l2_m2m_buf_done(src_buf, VB2_BUF_STATE_ERROR);
}
}
- return;
- }
-
- if (ctx->state >= MTK_STATE_HEADER) {
-
- /* Until STREAMOFF is called on the CAPTURE queue
- * (acknowledging the event), the driver operates
- * as if the resolution hasn't changed yet, i.e.
- * VIDIOC_G_FMT< etc. return previous resolution.
- * So we update picinfo here
- */
- ctx->picinfo = ctx->last_decoded_picinfo;
- mtk_v4l2_vdec_dbg(2, ctx,
- "[%d]-> new(%d,%d), old(%d,%d), real(%d,%d)",
- ctx->id, ctx->last_decoded_picinfo.pic_w,
- ctx->last_decoded_picinfo.pic_h,
- ctx->picinfo.pic_w, ctx->picinfo.pic_h,
- ctx->last_decoded_picinfo.buf_w,
- ctx->last_decoded_picinfo.buf_h);
+ if (ctx->state >= MTK_STATE_HEADER) {
+ /*
+ * The resolution hasn't been changed when STREAMOFF is called.
+ * Update the picinfo here with previous resolution if VIDIOC_G_FMT
+ * is called.
+ */
+ ctx->picinfo = ctx->last_decoded_picinfo;
+
+ mtk_v4l2_vdec_dbg(2, ctx,
+ "[%d]-> new(%d,%d), old(%d,%d), real(%d,%d)",
+ ctx->id, ctx->last_decoded_picinfo.pic_w,
+ ctx->last_decoded_picinfo.pic_h,
+ ctx->picinfo.pic_w, ctx->picinfo.pic_h,
+ ctx->last_decoded_picinfo.buf_w,
+ ctx->last_decoded_picinfo.buf_h);
+
+ ret = ctx->dev->vdec_pdata->flush_decoder(ctx);
+ if (ret)
+ mtk_v4l2_vdec_err(ctx, "DecodeFinal failed, ret=%d", ret);
+ }
- ret = ctx->dev->vdec_pdata->flush_decoder(ctx);
- if (ret)
- mtk_v4l2_vdec_err(ctx, "DecodeFinal failed, ret=%d", ret);
+ ctx->state = MTK_STATE_FLUSH;
+ return;
}
- ctx->state = MTK_STATE_FLUSH;
while ((dst_buf = v4l2_m2m_dst_buf_remove(ctx->m2m_ctx))) {
vb2_set_plane_payload(&dst_buf->vb2_buf, 0, 0);
--
2.46.0
next prev parent reply other threads:[~2024-08-07 8:25 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-07 8:24 [PATCH v4 0/7] media: mediatek: vcodec: fix v4l2_ctrl_request_complete fail Yunfei Dong
2024-08-07 8:24 ` [PATCH v4 1/7] media: mediatek: vcodec: setting request complete before buffer done Yunfei Dong
2024-08-07 8:24 ` Yunfei Dong [this message]
2024-08-22 15:32 ` [PATCH v4 2/7] media: mediatek: vcodec: change flush decode order when stream off Sebastian Fricke
2024-08-07 8:24 ` [PATCH v4 3/7] media: mediatek: vcodec: flush decoder before " Yunfei Dong
2024-08-22 16:11 ` Sebastian Fricke
2024-08-27 2:42 ` Yunfei Dong (董云飞)
2024-08-07 8:24 ` [PATCH v4 4/7] media: mediatek: vcodec: using input information to get vb2 buffer Yunfei Dong
2024-08-23 12:40 ` Sebastian Fricke
2024-08-27 2:47 ` Yunfei Dong (董云飞)
2024-08-07 8:24 ` [PATCH v4 5/7] media: mediatek: vcodec: store source " Yunfei Dong
2024-08-23 14:14 ` Sebastian Fricke
2024-08-27 2:50 ` Yunfei Dong (董云飞)
2024-08-07 8:24 ` [PATCH v4 6/7] media: mediatek: vcodec: replace v4l2_m2m_next_src_buf with v4l2_m2m_src_buf_remove Yunfei Dong
2024-08-23 15:23 ` Sebastian Fricke
2024-08-27 2:56 ` Yunfei Dong (董云飞)
2024-08-07 8:24 ` [PATCH v4 7/7] media: mediatek: vcodec: remove media request checking Yunfei Dong
2024-08-07 13:08 ` [PATCH v4 0/7] media: mediatek: vcodec: fix v4l2_ctrl_request_complete fail Nicolas Dufresne
2024-08-15 12:58 ` Yunfei Dong (董云飞)
2024-08-23 15:45 ` Sebastian Fricke
2024-08-27 2:58 ` Yunfei Dong (董云飞)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240807082444.21280-3-yunfei.dong@mediatek.com \
--to=yunfei.dong@mediatek.com \
--cc=Project_Global_Chrome_Upstream_Group@mediatek.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=benjamin.gaignard@collabora.com \
--cc=daniel.almeida@collabora.com \
--cc=daniel@ffwll.ch \
--cc=devicetree@vger.kernel.org \
--cc=frkoenig@chromium.org \
--cc=hsinyi@chromium.org \
--cc=hverkuil-cisco@xs4all.nl \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=nfraprado@collabora.com \
--cc=nhebert@chromium.org \
--cc=nicolas.dufresne@collabora.com \
--cc=sebastian.fricke@collabora.com \
--cc=stevecho@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®