mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-01 08:04:22 +08:00
media: coda: consolidate job_finish calls on decoder prepare_run failure
If the decoder prepare_run callback returns an error, the hardware is never started and v4l2_m2m_job_finish() is called immediately, currently in every error path. Remove the duplicated job_finish calls from the error paths and reuse the v4l2_m2m_job_finish() at the end of coda_pic_run_work instead. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
This commit is contained in:
parent
87e0ce68cc
commit
375acc17b1
@ -2176,7 +2176,6 @@ static int coda_prepare_decode(struct coda_ctx *ctx)
|
||||
(!(ctx->bit_stream_param & CODA_BIT_STREAM_END_FLAG))) {
|
||||
coda_dbg(1, ctx, "bitstream payload: %d, skipping\n",
|
||||
coda_get_bitstream_payload(ctx));
|
||||
v4l2_m2m_job_finish(ctx->dev->m2m_dev, ctx->fh.m2m_ctx);
|
||||
return -EAGAIN;
|
||||
}
|
||||
|
||||
@ -2186,7 +2185,6 @@ static int coda_prepare_decode(struct coda_ctx *ctx)
|
||||
|
||||
if (ret < 0) {
|
||||
v4l2_err(&dev->v4l2_dev, "failed to start decoding\n");
|
||||
v4l2_m2m_job_finish(ctx->dev->m2m_dev, ctx->fh.m2m_ctx);
|
||||
return -EAGAIN;
|
||||
} else {
|
||||
ctx->initialized = 1;
|
||||
|
@ -1510,12 +1510,8 @@ static void coda_pic_run_work(struct work_struct *work)
|
||||
mutex_lock(&dev->coda_mutex);
|
||||
|
||||
ret = ctx->ops->prepare_run(ctx);
|
||||
if (ret < 0 && ctx->inst_type == CODA_INST_DECODER) {
|
||||
mutex_unlock(&dev->coda_mutex);
|
||||
mutex_unlock(&ctx->buffer_mutex);
|
||||
/* job_finish scheduled by prepare_decode */
|
||||
return;
|
||||
}
|
||||
if (ret < 0 && ctx->inst_type == CODA_INST_DECODER)
|
||||
goto out;
|
||||
|
||||
if (!wait_for_completion_timeout(&ctx->completion,
|
||||
msecs_to_jiffies(1000))) {
|
||||
@ -1537,6 +1533,7 @@ static void coda_pic_run_work(struct work_struct *work)
|
||||
ctx->ops->seq_end_work)
|
||||
queue_work(dev->workqueue, &ctx->seq_end_work);
|
||||
|
||||
out:
|
||||
mutex_unlock(&dev->coda_mutex);
|
||||
mutex_unlock(&ctx->buffer_mutex);
|
||||
|
||||
|
@ -1340,10 +1340,8 @@ static int coda9_jpeg_prepare_decode(struct coda_ctx *ctx)
|
||||
vb2_plane_size(&src_buf->vb2_buf, 0));
|
||||
|
||||
chroma_format = coda9_jpeg_chroma_format(q_data_dst->fourcc);
|
||||
if (chroma_format < 0) {
|
||||
v4l2_m2m_job_finish(ctx->dev->m2m_dev, ctx->fh.m2m_ctx);
|
||||
if (chroma_format < 0)
|
||||
return chroma_format;
|
||||
}
|
||||
|
||||
ret = coda_jpeg_decode_header(ctx, &src_buf->vb2_buf);
|
||||
if (ret < 0) {
|
||||
@ -1355,7 +1353,6 @@ static int coda9_jpeg_prepare_decode(struct coda_ctx *ctx)
|
||||
v4l2_m2m_buf_done(src_buf, VB2_BUF_STATE_DONE);
|
||||
v4l2_m2m_buf_done(dst_buf, VB2_BUF_STATE_DONE);
|
||||
|
||||
v4l2_m2m_job_finish(ctx->dev->m2m_dev, ctx->fh.m2m_ctx);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -1396,7 +1393,6 @@ static int coda9_jpeg_prepare_decode(struct coda_ctx *ctx)
|
||||
if (ret < 0) {
|
||||
v4l2_err(&dev->v4l2_dev,
|
||||
"failed to set up Huffman tables: %d\n", ret);
|
||||
v4l2_m2m_job_finish(ctx->dev->m2m_dev, ctx->fh.m2m_ctx);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user