From: Nicolas Dufresne <nicolas@ndufresne.ca>
To: Ming Qian <ming.qian@nxp.com>,
mchehab@kernel.org, hverkuil-cisco@xs4all.nl
Cc: shawnguo@kernel.org, robh+dt@kernel.org, s.hauer@pengutronix.de,
kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com,
xiahong.bao@nxp.com, eagle.zhou@nxp.com, tao.jiang_2@nxp.com,
ming.qian@oss.nxp.com, imx@lists.linux.dev,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] media: amphion: Start decoding job when both queue are on
Date: Tue, 22 Apr 2025 15:46:57 -0400 [thread overview]
Message-ID: <39053a9e0767289cf822beb350819d366994dd0a.camel@ndufresne.ca> (raw)
In-Reply-To: <20240719075007.384342-1-ming.qian@nxp.com>
Hi,
Le vendredi 19 juillet 2024 à 16:50 +0900, Ming Qian a écrit :
> Start the decoding job when both queue are on, except the for the
> initialization sequence.
>
> Especially when seeking, the capture streamon may be called after output
> streamon, driver will start to decode job immediately after output
> streamo, if seek to a new resolution, then the source change flow may be
> mixed with the seek, it will cause confusion, then may led to pipeline
> hang.
>
> When both output and capture queue are on, it's ready to start the
> decoding job, and it can avoid the above potential problem.
This commit message needs some work and I'm unsure I understand its
meaning. After reading the change, I am under the impression that you
simply say that once the seq_hdr is found, the driver should keep
delaying the processing of output buffer until the capture queue is
ready ?
>
> Signed-off-by: Ming Qian <ming.qian@nxp.com>
> ---
> drivers/media/platform/amphion/vdec.c | 18 +++++++++++++++++-
> 1 file changed, 17 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/media/platform/amphion/vdec.c b/drivers/media/platform/amphion/vdec.c
> index 6a38a0fa0e2d..ca8f7319503a 100644
> --- a/drivers/media/platform/amphion/vdec.c
> +++ b/drivers/media/platform/amphion/vdec.c
> @@ -1363,6 +1363,12 @@ static int vdec_process_output(struct vpu_inst *inst, struct vb2_buffer *vb)
> if (inst->state == VPU_CODEC_STATE_STARTED)
> vdec_update_state(inst, VPU_CODEC_STATE_ACTIVE, 0);
>
> + if (vdec->seq_hdr_found &&
> + !vb2_start_streaming_called((v4l2_m2m_get_dst_vq(inst->fh.m2m_ctx)))) {
> + vpu_trace(inst->dev, "[%d] capture is not ready, pend input frame\n", inst->id);
> + return -EINVAL;
I got really confused by this error return value. Its clearly not an
error, but just a delay. I think before we add more on top, you should
turn all these function for which the return value is unused to void.
And use a plain "return;" here. That applies to all similar ops.
> + }
> +
> ret = vpu_iface_get_stream_buffer_desc(inst, &desc);
> if (ret)
> return ret;
> @@ -1555,6 +1561,16 @@ static int vdec_start(struct vpu_inst *inst)
> return ret;
> }
>
> +static void vdec_enqueue_pending_frames(struct vpu_inst *inst)
> +{
> + int i;
> +
> + for (i = 0; i < v4l2_m2m_num_src_bufs_ready(inst->fh.m2m_ctx); i++) {
> + if (vpu_process_output_buffer(inst))
> + break;
How well does this work ? Previous you made good care of interleaving
the processing output and capture, which I could imaging prevents the
hardware from starving ?
> + }
> +}
> +
> static int vdec_start_session(struct vpu_inst *inst, u32 type)
> {
> struct vdec_t *vdec = inst->priv;
> @@ -1573,10 +1589,10 @@ static int vdec_start_session(struct vpu_inst *inst, u32 type)
> if (V4L2_TYPE_IS_OUTPUT(type)) {
> vdec_update_state(inst, vdec->state, 1);
> vdec->eos_received = 0;
> - vpu_process_output_buffer(inst);
> } else {
> vdec_cmd_start(inst);
> }
> + vdec_enqueue_pending_frames(inst);
Was this intentional to reverse the STREAMON(CAPTURE) call flow to:
- process_capture() (inside vdec_cmd_start())
- proces_output() x n
Nicolas
> if (inst->state == VPU_CODEC_STATE_ACTIVE)
> vdec_response_fs_request(inst, false);
>
next prev parent reply other threads:[~2025-04-22 19:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-19 7:50 Ming Qian
2024-07-19 7:50 ` [PATCH] media: amphion: Add H264 and HEVC profile and level control Ming Qian
2025-04-22 19:46 ` Nicolas Dufresne [this message]
2025-04-25 2:51 ` [PATCH] media: amphion: Start decoding job when both queue are on Ming Qian(OSS)
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=39053a9e0767289cf822beb350819d366994dd0a.camel@ndufresne.ca \
--to=nicolas@ndufresne.ca \
--cc=eagle.zhou@nxp.com \
--cc=festevam@gmail.com \
--cc=hverkuil-cisco@xs4all.nl \
--cc=imx@lists.linux.dev \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-imx@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=ming.qian@nxp.com \
--cc=ming.qian@oss.nxp.com \
--cc=robh+dt@kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.org \
--cc=tao.jiang_2@nxp.com \
--cc=xiahong.bao@nxp.com \
/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®