[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190822194500.2071-9-jernej.skrabec@siol.net>
Date: Thu, 22 Aug 2019 21:45:00 +0200
From: Jernej Skrabec <jernej.skrabec@...l.net>
To: mchehab@...nel.org, hverkuil-cisco@...all.nl,
paul.kocialkowski@...tlin.com, mripard@...nel.org
Cc: pawel@...iak.com, m.szyprowski@...sung.com,
kyungmin.park@...sung.com, tfiga@...omium.org, wens@...e.org,
acourbot@...omium.org, gregkh@...uxfoundation.org,
jernej.skrabec@...l.net, linux-media@...r.kernel.org,
linux-kernel@...r.kernel.org, devel@...verdev.osuosl.org,
linux-arm-kernel@...ts.infradead.org, ezequiel@...labora.com,
jonas@...boo.se
Subject: [PATCH 8/8] media: cedrus: Add support for V4L2_DEC_CMD_FLUSH
This command is useful for explicitly flushing last decoded frame.
Signed-off-by: Jernej Skrabec <jernej.skrabec@...l.net>
---
.../staging/media/sunxi/cedrus/cedrus_video.c | 34 +++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_video.c b/drivers/staging/media/sunxi/cedrus/cedrus_video.c
index 5153b2bba21e..9eae69d5741c 100644
--- a/drivers/staging/media/sunxi/cedrus/cedrus_video.c
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_video.c
@@ -331,6 +331,37 @@ static int cedrus_s_fmt_vid_out(struct file *file, void *priv,
return 0;
}
+static int cedrus_try_decoder_cmd(struct file *file, void *fh,
+ struct v4l2_decoder_cmd *dc)
+{
+ if (dc->cmd != V4L2_DEC_CMD_FLUSH)
+ return -EINVAL;
+
+ return 0;
+}
+
+static int cedrus_decoder_cmd(struct file *file, void *fh,
+ struct v4l2_decoder_cmd *dc)
+{
+ struct cedrus_ctx *ctx = cedrus_file2ctx(file);
+ struct vb2_v4l2_buffer *out_vb, *cap_vb;
+ int ret;
+
+ ret = cedrus_try_decoder_cmd(file, fh, dc);
+ if (ret < 0)
+ return ret;
+
+ out_vb = v4l2_m2m_last_src_buf(ctx->fh.m2m_ctx);
+ cap_vb = v4l2_m2m_last_dst_buf(ctx->fh.m2m_ctx);
+
+ if (out_vb)
+ out_vb->flags &= ~V4L2_BUF_FLAG_M2M_HOLD_CAPTURE_BUF;
+ else if (cap_vb && cap_vb->is_held)
+ v4l2_m2m_buf_done(cap_vb, VB2_BUF_STATE_DONE);
+
+ return 0;
+}
+
const struct v4l2_ioctl_ops cedrus_ioctl_ops = {
.vidioc_querycap = cedrus_querycap,
@@ -355,6 +386,9 @@ const struct v4l2_ioctl_ops cedrus_ioctl_ops = {
.vidioc_streamon = v4l2_m2m_ioctl_streamon,
.vidioc_streamoff = v4l2_m2m_ioctl_streamoff,
+ .vidioc_try_decoder_cmd = cedrus_try_decoder_cmd,
+ .vidioc_decoder_cmd = cedrus_decoder_cmd,
+
.vidioc_subscribe_event = v4l2_ctrl_subscribe_event,
.vidioc_unsubscribe_event = v4l2_event_unsubscribe,
};
--
2.22.1
Powered by blists - more mailing lists