public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: linux-media@vger.kernel.org, Hans Verkuil <hans.verkuil@cisco.com>
Subject: Re: [PATCH 3/9] omap_vout: convert g/s_crop to g/s_selection.
Date: Wed, 06 Jul 2016 13:56:44 +0300	[thread overview]
Message-ID: <1954235.TnArPKMBKU@avalon> (raw)
In-Reply-To: <1467621142-8064-4-git-send-email-hverkuil@xs4all.nl>

Hi Hans,

Thank you for the patch.

On Monday 04 Jul 2016 10:32:16 Hans Verkuil wrote:
> From: Hans Verkuil <hans.verkuil@cisco.com>
> 
> This is part of a final push to convert all drivers to g/s_selection.
> 
> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
>  drivers/media/platform/omap/omap_vout.c | 54 +++++++++++++++---------------
>  1 file changed, 28 insertions(+), 26 deletions(-)
> 
> diff --git a/drivers/media/platform/omap/omap_vout.c
> b/drivers/media/platform/omap/omap_vout.c index 70c28d1..2702b17 100644
> --- a/drivers/media/platform/omap/omap_vout.c
> +++ b/drivers/media/platform/omap/omap_vout.c
> @@ -1247,36 +1247,34 @@ static int vidioc_g_fmt_vid_overlay(struct file
> *file, void *fh, return 0;
>  }
> 
> -static int vidioc_cropcap(struct file *file, void *fh,
> -		struct v4l2_cropcap *cropcap)
> +static int vidioc_g_selection(struct file *file, void *fh, struct
> v4l2_selection *sel) {
>  	struct omap_vout_device *vout = fh;
>  	struct v4l2_pix_format *pix = &vout->pix;
> 
> -	if (cropcap->type != V4L2_BUF_TYPE_VIDEO_OUTPUT)
> +	if (sel->type != V4L2_BUF_TYPE_VIDEO_OUTPUT)
>  		return -EINVAL;
> 
> -	/* Width and height are always even */
> -	cropcap->bounds.width = pix->width & ~1;
> -	cropcap->bounds.height = pix->height & ~1;
> -
> -	omap_vout_default_crop(&vout->pix, &vout->fbuf, &cropcap->defrect);
> -	cropcap->pixelaspect.numerator = 1;
> -	cropcap->pixelaspect.denominator = 1;
> -	return 0;
> -}
> -
> -static int vidioc_g_crop(struct file *file, void *fh, struct v4l2_crop
> *crop)
> -{
> -	struct omap_vout_device *vout = fh;
> -
> -	if (crop->type != V4L2_BUF_TYPE_VIDEO_OUTPUT)
> +	switch (sel->target) {
> +	case V4L2_SEL_TGT_CROP:
> +		sel->r = vout->crop;
> +		break;
> +	case V4L2_SEL_TGT_CROP_DEFAULT:
> +	case V4L2_SEL_TGT_CROP_BOUNDS:
> +		/* Width and height are always even */
> +		sel->r.width = pix->width & ~1;
> +		sel->r.height = pix->height & ~1;
> +
> +		if (sel->target == V4L2_SEL_TGT_CROP_DEFAULT)
> +			omap_vout_default_crop(&vout->pix, &vout->fbuf, &sel-
>r);

The omap_vout_default_crop() overwrites sel->r.width and sel->r.height, how 
about the gollowing code instead ?

	case V4L2_SEL_TGT_CROP_DEFAULT:
		omap_vout_default_crop(&vout->pix, &vout->fbuf, &sel-r);
		break;

	case V4L2_SEL_TGT_CROP_BOUNDS:
		/* Width and height are always even */
		sel->r.width = pix->width & ~1;
		sel->r.height = pix->height & ~1;
		break;

Apart from that the patch looks good to me.

Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> +		break;
> +	default:
>  		return -EINVAL;
> -	crop->c = vout->crop;
> +	}
>  	return 0;
>  }
> 
> -static int vidioc_s_crop(struct file *file, void *fh, const struct
> v4l2_crop *crop) +static int vidioc_s_selection(struct file *file, void
> *fh, struct v4l2_selection *sel) {
>  	int ret = -EINVAL;
>  	struct omap_vout_device *vout = fh;
> @@ -1285,6 +1283,12 @@ static int vidioc_s_crop(struct file *file, void *fh,
> const struct v4l2_crop *cr struct omap_video_timings *timing;
>  	struct omap_dss_device *dssdev;
> 
> +	if (sel->type != V4L2_BUF_TYPE_VIDEO_OUTPUT)
> +		return -EINVAL;
> +
> +	if (sel->target != V4L2_SEL_TGT_CROP)
> +		return -EINVAL;
> +
>  	if (vout->streaming)
>  		return -EBUSY;
> 
> @@ -1309,9 +1313,8 @@ static int vidioc_s_crop(struct file *file, void *fh,
> const struct v4l2_crop *cr vout->fbuf.fmt.width = timing->x_res;
>  	}
> 
> -	if (crop->type == V4L2_BUF_TYPE_VIDEO_OUTPUT)
> -		ret = omap_vout_new_crop(&vout->pix, &vout->crop, &vout->win,
> -				&vout->fbuf, &crop->c);
> +	ret = omap_vout_new_crop(&vout->pix, &vout->crop, &vout->win,
> +				 &vout->fbuf, &sel->r);
> 
>  s_crop_err:
>  	mutex_unlock(&vout->lock);
> @@ -1839,9 +1842,8 @@ static const struct v4l2_ioctl_ops vout_ioctl_ops = {
>  	.vidioc_try_fmt_vid_out_overlay		= vidioc_try_fmt_vid_overlay,
>  	.vidioc_s_fmt_vid_out_overlay		= vidioc_s_fmt_vid_overlay,
>  	.vidioc_g_fmt_vid_out_overlay		= vidioc_g_fmt_vid_overlay,
> -	.vidioc_cropcap				= vidioc_cropcap,
> -	.vidioc_g_crop				= vidioc_g_crop,
> -	.vidioc_s_crop				= vidioc_s_crop,
> +	.vidioc_g_selection			= vidioc_g_selection,
> +	.vidioc_s_selection			= vidioc_s_selection,
>  	.vidioc_reqbufs				= vidioc_reqbufs,
>  	.vidioc_querybuf			= vidioc_querybuf,
>  	.vidioc_qbuf				= vidioc_qbuf,

-- 
Regards,

Laurent Pinchart


  reply	other threads:[~2016-07-06 10:56 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-04  8:32 [PATCH 0/9] Convert g/s_crop to g/s_selection Hans Verkuil
2016-07-04  8:32 ` [PATCH 1/9] v4l2: remove g/s_crop from video ops Hans Verkuil
2016-07-04  8:32 ` [PATCH 2/9] bttv: convert g/s_crop to g/s_selection Hans Verkuil
2016-07-04  8:32 ` [PATCH 3/9] omap_vout: " Hans Verkuil
2016-07-06 10:56   ` Laurent Pinchart [this message]
2016-07-04  8:32 ` [PATCH 4/9] saa7134: " Hans Verkuil
2016-07-04  8:32 ` [PATCH 5/9] zoran: " Hans Verkuil
2016-07-04  8:32 ` [PATCH 6/9] vpfe_capture: " Hans Verkuil
2016-07-13 13:50   ` Lad, Prabhakar
2016-07-04  8:32 ` [PATCH 7/9] vpbe_display: " Hans Verkuil
2016-07-13 13:51   ` Lad, Prabhakar
2016-07-04  8:32 ` [PATCH 8/9] pvrusb2: " Hans Verkuil
2016-07-04  8:32 ` [PATCH 9/9] v4l2-subdev: rename cropcap to g_pixelaspect 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=1954235.TnArPKMBKU@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=hans.verkuil@cisco.com \
    --cc=hverkuil@xs4all.nl \
    --cc=linux-media@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox