summaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorPhilipp Zabel <p.zabel@pengutronix.de>2019-06-18 12:45:12 -0400
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>2019-06-24 14:21:39 -0400
commitcce5b73265db051e3259964f2f4e3b7faa661ab8 (patch)
tree2d3aa65d0cfc122eac90777d737826bec09c46c4 /drivers/media
parentf3775f89852d167990b0d718587774cf00d22ac2 (diff)
downloadlinux-cce5b73265db051e3259964f2f4e3b7faa661ab8.tar.bz2
media: coda: add coda_wake_up_capture_queue
Combine setting the last_buffer_dequeued flag on the capture video queue and waking up its done workqueue into a helper function. 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')
-rw-r--r--drivers/media/platform/coda/coda-common.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/drivers/media/platform/coda/coda-common.c b/drivers/media/platform/coda/coda-common.c
index b9ddf0cfdb83..095747ae1c40 100644
--- a/drivers/media/platform/coda/coda-common.c
+++ b/drivers/media/platform/coda/coda-common.c
@@ -1004,11 +1004,21 @@ static int coda_try_encoder_cmd(struct file *file, void *fh,
return v4l2_m2m_ioctl_try_encoder_cmd(file, fh, ec);
}
+static void coda_wake_up_capture_queue(struct coda_ctx *ctx)
+{
+ struct vb2_queue *dst_vq;
+
+ coda_dbg(1, ctx, "waking up capture queue\n");
+
+ dst_vq = v4l2_m2m_get_vq(ctx->fh.m2m_ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE);
+ dst_vq->last_buffer_dequeued = true;
+ wake_up(&dst_vq->done_wq);
+}
+
static int coda_encoder_cmd(struct file *file, void *fh,
struct v4l2_encoder_cmd *ec)
{
struct coda_ctx *ctx = fh_to_ctx(fh);
- struct vb2_queue *dst_vq;
int ret;
ret = coda_try_encoder_cmd(file, fh, ec);
@@ -1021,12 +1031,8 @@ static int coda_encoder_cmd(struct file *file, void *fh,
flush_work(&ctx->pic_run_work);
/* If there is no buffer in flight, wake up */
- if (!ctx->streamon_out || ctx->qsequence == ctx->osequence) {
- dst_vq = v4l2_m2m_get_vq(ctx->fh.m2m_ctx,
- V4L2_BUF_TYPE_VIDEO_CAPTURE);
- dst_vq->last_buffer_dequeued = true;
- wake_up(&dst_vq->done_wq);
- }
+ if (!ctx->streamon_out || ctx->qsequence == ctx->osequence)
+ coda_wake_up_capture_queue(ctx);
return 0;
}