linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil@xs4all.nl>
To: Florian Echtler <floe@butterbrot.org>, linux-media@vger.kernel.org
Cc: Martin Kaltenbrunner <modin@yuri.at>
Subject: Re: [PATCH 1/3] properly report a single frame rate of 60 FPS
Date: Mon, 23 May 2016 12:45:55 +0200	[thread overview]
Message-ID: <5742DF63.4010205@xs4all.nl> (raw)
In-Reply-To: <1463177957-8240-1-git-send-email-floe@butterbrot.org>

On 05/14/2016 12:19 AM, Florian Echtler wrote:
> The device hardware is always running at 60 FPS, so report this both via
> PARM_IOCTL and ENUM_FRAMEINTERVALS.
> 
> Signed-off-by: Martin Kaltenbrunner <modin@yuri.at>
> Signed-off-by: Florian Echtler <floe@butterbrot.org>
> ---
>  drivers/input/touchscreen/sur40.c | 17 +++++++++++++++--
>  1 file changed, 15 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/sur40.c b/drivers/input/touchscreen/sur40.c
> index 880c40b..fcc5934 100644
> --- a/drivers/input/touchscreen/sur40.c
> +++ b/drivers/input/touchscreen/sur40.c
> @@ -788,6 +788,16 @@ static int sur40_vidioc_fmt(struct file *file, void *priv,
>  	return 0;
>  }
>  
> +static int sur40_ioctl_parm(struct file *file, void *priv,
> +			    struct v4l2_streamparm *p)
> +{
> +	if (p->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) {
> +		p->parm.capture.timeperframe.numerator = 1;
> +		p->parm.capture.timeperframe.denominator = 60;
> +	}

It should return -EINVAL if it is not of type VIDEO_CAPTURE. You should also set the
V4L2_CAP_TIMEPERFRAME capability for this to work. The readbuffers field should also
be set (typically to the minimum required number of buffers).

Please check with v4l2-compliance! It would have warned about these issues.

> +	return 0;
> +}
> +
>  static int sur40_vidioc_enum_fmt(struct file *file, void *priv,
>  				 struct v4l2_fmtdesc *f)
>  {
> @@ -814,13 +824,13 @@ static int sur40_vidioc_enum_framesizes(struct file *file, void *priv,
>  static int sur40_vidioc_enum_frameintervals(struct file *file, void *priv,
>  					    struct v4l2_frmivalenum *f)
>  {
> -	if ((f->index > 1) || (f->pixel_format != V4L2_PIX_FMT_GREY)
> +	if ((f->index > 0) || (f->pixel_format != V4L2_PIX_FMT_GREY)
>  		|| (f->width  != sur40_video_format.width)
>  		|| (f->height != sur40_video_format.height))
>  			return -EINVAL;
>  
>  	f->type = V4L2_FRMIVAL_TYPE_DISCRETE;
> -	f->discrete.denominator  = 60/(f->index+1);
> +	f->discrete.denominator  = 60;
>  	f->discrete.numerator = 1;
>  	return 0;
>  }
> @@ -880,6 +890,9 @@ static const struct v4l2_ioctl_ops sur40_video_ioctl_ops = {
>  	.vidioc_enum_framesizes = sur40_vidioc_enum_framesizes,
>  	.vidioc_enum_frameintervals = sur40_vidioc_enum_frameintervals,
>  
> +	.vidioc_g_parm = sur40_ioctl_parm,
> +	.vidioc_s_parm = sur40_ioctl_parm,
> +
>  	.vidioc_enum_input	= sur40_vidioc_enum_input,
>  	.vidioc_g_input		= sur40_vidioc_g_input,
>  	.vidioc_s_input		= sur40_vidioc_s_input,
> 

Regards,

	Hans

  parent reply	other threads:[~2016-05-23 10:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-13 22:19 [PATCH 1/3] properly report a single frame rate of 60 FPS Florian Echtler
2016-05-13 22:19 ` [PATCH 2/3] lower poll interval to fix occasional FPS drops to ~56 FPS Florian Echtler
2016-05-13 22:19 ` [PATCH 3/3] fix occasional oopses on device close Florian Echtler
2016-05-23 10:45 ` Hans Verkuil [this message]
2016-05-30  7:54   ` [PATCH 1/3] properly report a single frame rate of 60 FPS Florian Echtler

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=5742DF63.4010205@xs4all.nl \
    --to=hverkuil@xs4all.nl \
    --cc=floe@butterbrot.org \
    --cc=linux-media@vger.kernel.org \
    --cc=modin@yuri.at \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).