Linux kernel and device drivers for NXP i.MX platforms
 help / color / mirror / Atom feed
From: "Ming Qian(OSS)" <ming.qian@oss.nxp.com>
To: Nicolas Dufresne <nicolas@ndufresne.ca>,
	mchehab@kernel.org, hverkuil-cisco@xs4all.nl,
	mirela.rabulea@oss.nxp.com
Cc: shawnguo@kernel.org, s.hauer@pengutronix.de,
	kernel@pengutronix.de, festevam@gmail.com, xiahong.bao@nxp.com,
	eagle.zhou@nxp.com, linux-imx@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: imx-jpeg: Drop the first error frames
Date: Mon, 21 Apr 2025 14:37:39 +0800	[thread overview]
Message-ID: <d3668dc7-b8c8-497c-ae3a-b476a8658c40@oss.nxp.com> (raw)
In-Reply-To: <4549d9abf5f93fb6f417d0fb8f73877272d7c495.camel@ndufresne.ca>

Hi Nicolas,

On 2025/4/18 21:12, Nicolas Dufresne wrote:
> Le mercredi 05 mars 2025 à 10:25 +0800, ming.qian@oss.nxp.com a écrit :
>> From: Ming Qian <ming.qian@oss.nxp.com>
>>
>> When an output buffer contains error frame header,
>> v4l2_jpeg_parse_header() will return error, then driver will mark this
>> buffer and a capture buffer done with error flag in device_run().
>>
>> But if the error occurs in the first frames, before setup the capture
>> queue, there is no chance to schedule device_run(), and there may be no
>> capture to mark error.
>>
>> So we need to drop this buffer with error flag, and make the decoding
>> can continue.
>>
>> Signed-off-by: Ming Qian <ming.qian@oss.nxp.com>
> 
> This seems like a relatively important bug fix to be, perhaps you can
> offer "Fixes" tag to this commit ?
> 

thanks for the reminder

>> ---
>>   drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c | 9 +++++++++
>>   1 file changed, 9 insertions(+)
>>
>> diff --git a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c
>> index 1221b309a916..0e6ee997284b 100644
>> --- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c
>> +++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c
>> @@ -1921,6 +1921,15 @@ static void mxc_jpeg_buf_queue(struct vb2_buffer *vb)
>>   	if (ret)
>>   		jpeg_src_buf->jpeg_parse_error = true;
>>   
>> +	/*
>> +	 * if the capture queue is not setup, the device_run() won't be scheduled,
>> +	 * need to drop the error buffer, so that the decoding can continue
>> +	 */
>> +	if (jpeg_src_buf->jpeg_parse_error &&
>> +	    !vb2_is_streaming(v4l2_m2m_get_dst_vq(ctx->fh.m2m_ctx))) {
>> +		v4l2_m2m_buf_done(vbuf, VB2_BUF_STATE_ERROR);
>> +		return;
>> +	}
> 
> Looks good to me, an alternative implementation could have been to
> merged into the error branch above.
> 
>   	if (ret) {
>   		jpeg_src_buf->jpeg_parse_error = true;
>   
> 		/*
> 	 	 * If the capture queue is not setup, the device_run() won't
> 		 * be scheduled, drop the error buffer so that the decoding
> 		 * can continue.
> 	 	 */
> 		if (!vb2_is_streaming(v4l2_m2m_get_dst_vq(ctx->fh.m2m_ctx))) {
> 			v4l2_m2m_buf_done(vbuf, VB2_BUF_STATE_ERROR);
> 			return;
> 		}
> 	}
> 
> With or without this suggestion, but with the Fixes tag, you can include in your v2:
> 
> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
> 

I'll apply your suggestion and with the Fixes tag in V2

Regards,
Ming

>>   end:
>>   	v4l2_m2m_buf_queue(ctx->fh.m2m_ctx, vbuf);
>>   }

      reply	other threads:[~2025-04-21  6:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-05  2:25 [PATCH] media: imx-jpeg: Drop the first error frames ming.qian
2025-04-18 13:12 ` Nicolas Dufresne
2025-04-21  6:37   ` Ming Qian(OSS) [this message]

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=d3668dc7-b8c8-497c-ae3a-b476a8658c40@oss.nxp.com \
    --to=ming.qian@oss.nxp.com \
    --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=mirela.rabulea@oss.nxp.com \
    --cc=nicolas@ndufresne.ca \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    --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