From: Mirela Rabulea <mirela.rabulea@xxxxxxx> Streaming tests were faling on decoder, due to errors on jpeg parse. Let the error be, until device_run, there check for errors and finish job. Signed-off-by: Mirela Rabulea <mirela.rabulea@xxxxxxx> --- drivers/media/platform/imx-jpeg/mxc-jpeg.c | 25 ++++++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/drivers/media/platform/imx-jpeg/mxc-jpeg.c b/drivers/media/platform/imx-jpeg/mxc-jpeg.c index 8535da246a63..d87f99caf124 100644 --- a/drivers/media/platform/imx-jpeg/mxc-jpeg.c +++ b/drivers/media/platform/imx-jpeg/mxc-jpeg.c @@ -249,6 +249,7 @@ struct mxc_jpeg_src_buf { /* mxc-jpeg specific */ bool dht_needed; + bool jpeg_parse_error; }; static inline struct mxc_jpeg_src_buf *vb2_to_mxc_buf(struct vb2_buffer *vb) @@ -929,6 +930,7 @@ static void mxc_jpeg_device_run(void *priv) struct vb2_v4l2_buffer *src_buf, *dst_buf; unsigned long flags; struct mxc_jpeg_q_data *q_data_cap, *q_data_out; + struct mxc_jpeg_src_buf *jpeg_src_buf; spin_lock_irqsave(&ctx->mxc_jpeg->hw_lock, flags); src_buf = v4l2_m2m_next_src_buf(ctx->fh.m2m_ctx); @@ -949,6 +951,19 @@ static void mxc_jpeg_device_run(void *priv) v4l2_m2m_buf_copy_metadata(src_buf, dst_buf, true); + jpeg_src_buf = vb2_to_mxc_buf(&src_buf->vb2_buf); + if (jpeg_src_buf->jpeg_parse_error) { + jpeg->slot_data[ctx->slot].used = false; + v4l2_m2m_src_buf_remove(ctx->fh.m2m_ctx); + v4l2_m2m_dst_buf_remove(ctx->fh.m2m_ctx); + v4l2_m2m_buf_done(src_buf, VB2_BUF_STATE_ERROR); + v4l2_m2m_buf_done(dst_buf, VB2_BUF_STATE_ERROR); + spin_unlock_irqrestore(&ctx->mxc_jpeg->hw_lock, flags); + v4l2_m2m_job_finish(jpeg->m2m_dev, ctx->fh.m2m_ctx); + + return; + } + /* * TODO: this reset should be removed, once we figure out * how to overcome hardware issues both on encoder and decoder @@ -1483,17 +1498,13 @@ static void mxc_jpeg_buf_queue(struct vb2_buffer *vb) goto end; jpeg_src_buf = vb2_to_mxc_buf(vb); + jpeg_src_buf->jpeg_parse_error = false; ret = mxc_jpeg_parse(ctx, (u8 *)vb2_plane_vaddr(vb, 0), vb2_get_plane_payload(vb, 0), &jpeg_src_buf->dht_needed); - if (ret) { - v4l2_err(&ctx->mxc_jpeg->v4l2_dev, - "driver does not support this resolution/format\n"); - vb2_buffer_done(vb, VB2_BUF_STATE_ERROR); - - return; - } + if (ret) + jpeg_src_buf->jpeg_parse_error = true; end: v4l2_m2m_buf_queue(ctx->fh.m2m_ctx, vbuf); -- 2.17.1