All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil-cisco@xs4all.nl>
To: Jernej Skrabec <jernej.skrabec@siol.net>,
	mchehab@kernel.org, paul.kocialkowski@bootlin.com,
	mripard@kernel.org
Cc: pawel@osciak.com, m.szyprowski@samsung.com,
	kyungmin.park@samsung.com, tfiga@chromium.org, wens@csie.org,
	acourbot@chromium.org, gregkh@linuxfoundation.org,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	devel@driverdev.osuosl.org, linux-arm-kernel@lists.infradead.org,
	ezequiel@collabora.com, jonas@kwiboo.se
Subject: Re: [PATCH 8/8] media: cedrus: Add support for V4L2_DEC_CMD_FLUSH
Date: Thu, 29 Aug 2019 13:11:46 +0200	[thread overview]
Message-ID: <492894c9-4724-7bf4-6382-1efa6c8b04e3@xs4all.nl> (raw)
In-Reply-To: <20190822194500.2071-9-jernej.skrabec@siol.net>

On 8/22/19 9:45 PM, Jernej Skrabec wrote:
> This command is useful for explicitly flushing last decoded frame.
> 
> Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.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;

You need to add this line here as well:

	dc->flags = 0;

As per the decoder_cmd spec.

> +
> +	return 0;
> +}
> +
> +static int cedrus_decoder_cmd(struct file *file, void *fh,
> +			      struct v4l2_decoder_cmd *dc)
> +{
> +	struct cedrus_ctx *ctx = cedrus_file2ctx(file);

You don't need this...

> +	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);

... since you can use fh->m2m_ctx directly.

> +	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;
> +}
> +

Both these functions should be moved to v4l2-mem2mem.c and renamed to
v4l2_m2m_ioctl_stateless_(try_)decoder_cmd.

As far as I can see they are completely generic and valid for any
stateless decoder. Which is very nice :-)

>  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,
>  };
> 

Regards,

	Hans

WARNING: multiple messages have this Message-ID (diff)
From: Hans Verkuil <hverkuil-cisco@xs4all.nl>
To: Jernej Skrabec <jernej.skrabec@siol.net>,
	mchehab@kernel.org, paul.kocialkowski@bootlin.com,
	mripard@kernel.org
Cc: devel@driverdev.osuosl.org, pawel@osciak.com,
	acourbot@chromium.org, jonas@kwiboo.se,
	gregkh@linuxfoundation.org, wens@csie.org, tfiga@chromium.org,
	kyungmin.park@samsung.com, linux-arm-kernel@lists.infradead.org,
	linux-media@vger.kernel.org, ezequiel@collabora.com,
	linux-kernel@vger.kernel.org, m.szyprowski@samsung.com
Subject: Re: [PATCH 8/8] media: cedrus: Add support for V4L2_DEC_CMD_FLUSH
Date: Thu, 29 Aug 2019 13:11:46 +0200	[thread overview]
Message-ID: <492894c9-4724-7bf4-6382-1efa6c8b04e3@xs4all.nl> (raw)
In-Reply-To: <20190822194500.2071-9-jernej.skrabec@siol.net>

On 8/22/19 9:45 PM, Jernej Skrabec wrote:
> This command is useful for explicitly flushing last decoded frame.
> 
> Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.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;

You need to add this line here as well:

	dc->flags = 0;

As per the decoder_cmd spec.

> +
> +	return 0;
> +}
> +
> +static int cedrus_decoder_cmd(struct file *file, void *fh,
> +			      struct v4l2_decoder_cmd *dc)
> +{
> +	struct cedrus_ctx *ctx = cedrus_file2ctx(file);

You don't need this...

> +	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);

... since you can use fh->m2m_ctx directly.

> +	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;
> +}
> +

Both these functions should be moved to v4l2-mem2mem.c and renamed to
v4l2_m2m_ioctl_stateless_(try_)decoder_cmd.

As far as I can see they are completely generic and valid for any
stateless decoder. Which is very nice :-)

>  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,
>  };
> 

Regards,

	Hans

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2019-08-29 11:12 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-22 19:44 [PATCH 0/8] media: cedrus: h264: Support multi-slice frames Jernej Skrabec
2019-08-22 19:44 ` Jernej Skrabec
2019-08-22 19:44 ` [PATCH 1/8] vb2: add V4L2_BUF_FLAG_M2M_HOLD_CAPTURE_BUF Jernej Skrabec
2019-08-22 19:44   ` Jernej Skrabec
2019-08-22 19:44 ` [PATCH 2/8] videodev2.h: add V4L2_DEC_CMD_FLUSH Jernej Skrabec
2019-08-22 19:44   ` Jernej Skrabec
2019-08-26 18:30   ` Boris Brezillon
2019-08-26 18:30     ` Boris Brezillon
2019-08-30  9:38   ` Alexandre Courbot
2019-08-30  9:38     ` Alexandre Courbot
2019-08-30  9:44     ` Hans Verkuil
2019-08-30  9:44       ` Hans Verkuil
2019-08-30  9:48       ` Alexandre Courbot
2019-08-30  9:48         ` Alexandre Courbot
2019-08-22 19:44 ` [PATCH 3/8] media: docs-rst: Document m2m stateless video decoder interface Jernej Skrabec
2019-08-22 19:44   ` Jernej Skrabec
2019-08-22 19:44 ` [PATCH 4/8] media: docs-rst: Document memory-to-memory video encoder interface Jernej Skrabec
2019-08-22 19:44   ` Jernej Skrabec
2019-08-22 19:44 ` [PATCH 5/8] media: cedrus: Detect first slice of a frame Jernej Skrabec
2019-08-22 19:44   ` Jernej Skrabec
2019-08-26 18:28   ` Boris Brezillon
2019-08-26 18:28     ` Boris Brezillon
2019-08-26 18:47     ` Jernej Škrabec
2019-08-26 18:47       ` Jernej Škrabec
2019-08-29 19:04     ` Jernej Škrabec
2019-08-29 19:04       ` Jernej Škrabec
2019-08-30  5:48       ` Boris Brezillon
2019-08-30  5:48         ` Boris Brezillon
2019-08-30 17:19         ` Nicolas Dufresne
2019-08-30 17:19           ` Nicolas Dufresne
2019-08-30 17:19           ` Nicolas Dufresne
2019-08-30  7:28   ` Hans Verkuil
2019-08-30  7:28     ` Hans Verkuil
2019-08-22 19:44 ` [PATCH 6/8] media: cedrus: h264: Support multiple slices per frame Jernej Skrabec
2019-08-22 19:44   ` Jernej Skrabec
2019-08-22 19:44 ` [PATCH 7/8] media: cedrus: Add support for holding capture buffer Jernej Skrabec
2019-08-22 19:44   ` Jernej Skrabec
2019-08-26 18:38   ` Boris Brezillon
2019-08-26 18:38     ` Boris Brezillon
2019-08-29 11:23   ` Hans Verkuil
2019-08-29 11:23     ` Hans Verkuil
2019-09-04 23:14     ` Jernej Škrabec
2019-09-04 23:14       ` Jernej Škrabec
2019-09-04 23:14       ` Jernej Škrabec
2019-08-22 19:45 ` [PATCH 8/8] media: cedrus: Add support for V4L2_DEC_CMD_FLUSH Jernej Skrabec
2019-08-22 19:45   ` Jernej Skrabec
2019-08-26 18:55   ` Boris Brezillon
2019-08-26 18:55     ` Boris Brezillon
2019-08-29 11:11   ` Hans Verkuil [this message]
2019-08-29 11:11     ` Hans Verkuil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=492894c9-4724-7bf4-6382-1efa6c8b04e3@xs4all.nl \
    --to=hverkuil-cisco@xs4all.nl \
    --cc=acourbot@chromium.org \
    --cc=devel@driverdev.osuosl.org \
    --cc=ezequiel@collabora.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jernej.skrabec@siol.net \
    --cc=jonas@kwiboo.se \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=mchehab@kernel.org \
    --cc=mripard@kernel.org \
    --cc=paul.kocialkowski@bootlin.com \
    --cc=pawel@osciak.com \
    --cc=tfiga@chromium.org \
    --cc=wens@csie.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.