media: imx-jpeg: Drop the first error frames
commit d52b9b7e2f10d22a49468128540533e8d76910cd upstream.
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.
Fixes: 2db16c6ed7
("media: imx-jpeg: Add V4L2 driver for i.MX8 JPEG Encoder/Decoder")
Cc: stable@vger.kernel.org
Signed-off-by: Ming Qian <ming.qian@oss.nxp.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
f6b1b0f8ba
commit
350d4af049
@@ -1913,9 +1913,19 @@ static void mxc_jpeg_buf_queue(struct vb2_buffer *vb)
|
|||||||
jpeg_src_buf = vb2_to_mxc_buf(vb);
|
jpeg_src_buf = vb2_to_mxc_buf(vb);
|
||||||
jpeg_src_buf->jpeg_parse_error = false;
|
jpeg_src_buf->jpeg_parse_error = false;
|
||||||
ret = mxc_jpeg_parse(ctx, vb);
|
ret = mxc_jpeg_parse(ctx, vb);
|
||||||
if (ret)
|
if (ret) {
|
||||||
jpeg_src_buf->jpeg_parse_error = true;
|
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 (!vb2_is_streaming(v4l2_m2m_get_dst_vq(ctx->fh.m2m_ctx))) {
|
||||||
|
v4l2_m2m_buf_done(vbuf, VB2_BUF_STATE_ERROR);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
end:
|
end:
|
||||||
v4l2_m2m_buf_queue(ctx->fh.m2m_ctx, vbuf);
|
v4l2_m2m_buf_queue(ctx->fh.m2m_ctx, vbuf);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user