summaryrefslogtreecommitdiffstats
path: root/drivers/media/platform
diff options
context:
space:
mode:
authorPhilipp Zabel <p.zabel@pengutronix.de>2019-06-18 12:45:28 -0400
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>2019-06-24 14:43:25 -0400
commit0f8f633834357f2513d21a6468db6d5989e8c494 (patch)
tree8ac6827f4e31cbc6016eefafc134d76cdc4d7d2e /drivers/media/platform
parent0ee08a1e7b713dcf0d2526af35314dd7f21c8138 (diff)
downloadlinux-stable-0f8f633834357f2513d21a6468db6d5989e8c494.tar.gz
linux-stable-0f8f633834357f2513d21a6468db6d5989e8c494.tar.bz2
linux-stable-0f8f633834357f2513d21a6468db6d5989e8c494.zip
media: coda: only wake up capture queue if no pending buffers to encode
If there are no pending queued output buffers to be encoded, waking up the capture queue with -EPIPE signals end of stream. If there are pending buffers on the other hand, setting the V4L2_BUF_FLAG_LAST on the resulting encoded capture buffers is all that is needed. 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+samsung@kernel.org>
Diffstat (limited to 'drivers/media/platform')
-rw-r--r--drivers/media/platform/coda/coda-common.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/drivers/media/platform/coda/coda-common.c b/drivers/media/platform/coda/coda-common.c
index 46f2bb6febde..73c18be14cbf 100644
--- a/drivers/media/platform/coda/coda-common.c
+++ b/drivers/media/platform/coda/coda-common.c
@@ -1035,17 +1035,18 @@ static int coda_encoder_cmd(struct file *file, void *fh,
return ret;
buf = v4l2_m2m_last_src_buf(ctx->fh.m2m_ctx);
- if (buf)
+ if (buf) {
buf->flags |= V4L2_BUF_FLAG_LAST;
+ } else {
+ /* Set the stream-end flag on this context */
+ ctx->bit_stream_param |= CODA_BIT_STREAM_END_FLAG;
- /* Set the stream-end flag on this context */
- ctx->bit_stream_param |= CODA_BIT_STREAM_END_FLAG;
-
- flush_work(&ctx->pic_run_work);
+ flush_work(&ctx->pic_run_work);
- /* If there is no buffer in flight, wake up */
- if (!ctx->streamon_out || ctx->qsequence == ctx->osequence)
- coda_wake_up_capture_queue(ctx);
+ /* If there is no buffer in flight, wake up */
+ if (!ctx->streamon_out || ctx->qsequence == ctx->osequence)
+ coda_wake_up_capture_queue(ctx);
+ }
return 0;
}