linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Niklas Söderlund" <niklas.soderlund@ragnatech.se>
To: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Cc: linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
	Kieran Bingham <kieran+renesas@ksquared.org.uk>
Subject: Re: [PATCH 06/13] v4l: vsp1: Disable cropping on WPF sink pad
Date: Wed, 14 Sep 2016 20:54:33 +0200	[thread overview]
Message-ID: <20160914185433.GJ739@bigcity.dyn.berto.se> (raw)
In-Reply-To: <1473808626-19488-7-git-send-email-laurent.pinchart+renesas@ideasonboard.com>

On 2016-09-14 02:16:59 +0300, Laurent Pinchart wrote:
> Cropping on the WPF sink pad restricts the left and top coordinates to
> 0-255. The same result can be obtained by cropping on the RPF without
> any such restriction, this feature isn't useful. Disable it.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>

Acked-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

> ---
>  drivers/media/platform/vsp1/vsp1_rwpf.c | 37 +++++++++++++++++----------------
>  drivers/media/platform/vsp1/vsp1_wpf.c  | 18 +++++++---------
>  2 files changed, 26 insertions(+), 29 deletions(-)
> 
> diff --git a/drivers/media/platform/vsp1/vsp1_rwpf.c b/drivers/media/platform/vsp1/vsp1_rwpf.c
> index 8cb87e96b78b..a3ace8df7f4d 100644
> --- a/drivers/media/platform/vsp1/vsp1_rwpf.c
> +++ b/drivers/media/platform/vsp1/vsp1_rwpf.c
> @@ -66,7 +66,6 @@ static int vsp1_rwpf_set_format(struct v4l2_subdev *subdev,
>  	struct vsp1_rwpf *rwpf = to_rwpf(subdev);
>  	struct v4l2_subdev_pad_config *config;
>  	struct v4l2_mbus_framefmt *format;
> -	struct v4l2_rect *crop;
>  	int ret = 0;
>  
>  	mutex_lock(&rwpf->entity.lock);
> @@ -103,12 +102,16 @@ static int vsp1_rwpf_set_format(struct v4l2_subdev *subdev,
>  
>  	fmt->format = *format;
>  
> -	/* Update the sink crop rectangle. */
> -	crop = vsp1_rwpf_get_crop(rwpf, config);
> -	crop->left = 0;
> -	crop->top = 0;
> -	crop->width = fmt->format.width;
> -	crop->height = fmt->format.height;
> +	if (rwpf->entity.type == VSP1_ENTITY_RPF) {
> +		struct v4l2_rect *crop;
> +
> +		/* Update the sink crop rectangle. */
> +		crop = vsp1_rwpf_get_crop(rwpf, config);
> +		crop->left = 0;
> +		crop->top = 0;
> +		crop->width = fmt->format.width;
> +		crop->height = fmt->format.height;
> +	}
>  
>  	/* Propagate the format to the source pad. */
>  	format = vsp1_entity_get_pad_format(&rwpf->entity, config,
> @@ -129,8 +132,10 @@ static int vsp1_rwpf_get_selection(struct v4l2_subdev *subdev,
>  	struct v4l2_mbus_framefmt *format;
>  	int ret = 0;
>  
> -	/* Cropping is implemented on the sink pad. */
> -	if (sel->pad != RWPF_PAD_SINK)
> +	/* Cropping is only supported on the RPF and is implemented on the sink
> +	 * pad.
> +	 */
> +	if (rwpf->entity.type == VSP1_ENTITY_WPF || sel->pad != RWPF_PAD_SINK)
>  		return -EINVAL;
>  
>  	mutex_lock(&rwpf->entity.lock);
> @@ -175,8 +180,10 @@ static int vsp1_rwpf_set_selection(struct v4l2_subdev *subdev,
>  	struct v4l2_rect *crop;
>  	int ret = 0;
>  
> -	/* Cropping is implemented on the sink pad. */
> -	if (sel->pad != RWPF_PAD_SINK)
> +	/* Cropping is only supported on the RPF and is implemented on the sink
> +	 * pad.
> +	 */
> +	if (rwpf->entity.type == VSP1_ENTITY_WPF || sel->pad != RWPF_PAD_SINK)
>  		return -EINVAL;
>  
>  	if (sel->target != V4L2_SEL_TGT_CROP)
> @@ -190,9 +197,7 @@ static int vsp1_rwpf_set_selection(struct v4l2_subdev *subdev,
>  		goto done;
>  	}
>  
> -	/* Make sure the crop rectangle is entirely contained in the image. The
> -	 * WPF top and left offsets are limited to 255.
> -	 */
> +	/* Make sure the crop rectangle is entirely contained in the image. */
>  	format = vsp1_entity_get_pad_format(&rwpf->entity, config,
>  					    RWPF_PAD_SINK);
>  
> @@ -208,10 +213,6 @@ static int vsp1_rwpf_set_selection(struct v4l2_subdev *subdev,
>  
>  	sel->r.left = min_t(unsigned int, sel->r.left, format->width - 2);
>  	sel->r.top = min_t(unsigned int, sel->r.top, format->height - 2);
> -	if (rwpf->entity.type == VSP1_ENTITY_WPF) {
> -		sel->r.left = min_t(unsigned int, sel->r.left, 255);
> -		sel->r.top = min_t(unsigned int, sel->r.top, 255);
> -	}
>  	sel->r.width = min_t(unsigned int, sel->r.width,
>  			     format->width - sel->r.left);
>  	sel->r.height = min_t(unsigned int, sel->r.height,
> diff --git a/drivers/media/platform/vsp1/vsp1_wpf.c b/drivers/media/platform/vsp1/vsp1_wpf.c
> index 748f5af90b7e..f3a593196282 100644
> --- a/drivers/media/platform/vsp1/vsp1_wpf.c
> +++ b/drivers/media/platform/vsp1/vsp1_wpf.c
> @@ -212,7 +212,6 @@ static void wpf_configure(struct vsp1_entity *entity,
>  	struct vsp1_device *vsp1 = wpf->entity.vsp1;
>  	const struct v4l2_mbus_framefmt *source_format;
>  	const struct v4l2_mbus_framefmt *sink_format;
> -	const struct v4l2_rect *crop;
>  	unsigned int i;
>  	u32 outfmt = 0;
>  	u32 srcrpf = 0;
> @@ -237,16 +236,6 @@ static void wpf_configure(struct vsp1_entity *entity,
>  		return;
>  	}
>  
> -	/* Cropping */
> -	crop = vsp1_rwpf_get_crop(wpf, wpf->entity.config);
> -
> -	vsp1_wpf_write(wpf, dl, VI6_WPF_HSZCLIP, VI6_WPF_SZCLIP_EN |
> -		       (crop->left << VI6_WPF_SZCLIP_OFST_SHIFT) |
> -		       (crop->width << VI6_WPF_SZCLIP_SIZE_SHIFT));
> -	vsp1_wpf_write(wpf, dl, VI6_WPF_VSZCLIP, VI6_WPF_SZCLIP_EN |
> -		       (crop->top << VI6_WPF_SZCLIP_OFST_SHIFT) |
> -		       (crop->height << VI6_WPF_SZCLIP_SIZE_SHIFT));
> -
>  	/* Format */
>  	sink_format = vsp1_entity_get_pad_format(&wpf->entity,
>  						 wpf->entity.config,
> @@ -255,6 +244,13 @@ static void wpf_configure(struct vsp1_entity *entity,
>  						   wpf->entity.config,
>  						   RWPF_PAD_SOURCE);
>  
> +	vsp1_wpf_write(wpf, dl, VI6_WPF_HSZCLIP, VI6_WPF_SZCLIP_EN |
> +		       (0 << VI6_WPF_SZCLIP_OFST_SHIFT) |
> +		       (source_format->width << VI6_WPF_SZCLIP_SIZE_SHIFT));
> +	vsp1_wpf_write(wpf, dl, VI6_WPF_VSZCLIP, VI6_WPF_SZCLIP_EN |
> +		       (0 << VI6_WPF_SZCLIP_OFST_SHIFT) |
> +		       (source_format->height << VI6_WPF_SZCLIP_SIZE_SHIFT));
> +
>  	if (!pipe->lif) {
>  		const struct v4l2_pix_format_mplane *format = &wpf->format;
>  		const struct vsp1_format_info *fmtinfo = wpf->fmtinfo;
> -- 
> Regards,
> 
> Laurent Pinchart
> 

-- 
Regards,
Niklas Söderlund

  reply	other threads:[~2016-09-14 18:54 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-13 23:16 [PATCH 00/13] Renesas R-Car VSP: Scaling and rotation support on Gen3 Laurent Pinchart
2016-09-13 23:16 ` [PATCH 01/13] v4l: vsp1: Prevent pipelines from running when not streaming Laurent Pinchart
2016-09-13 23:16 ` [PATCH 02/13] v4l: vsp1: Protect against race conditions between get and set format Laurent Pinchart
2016-09-14 18:23   ` Niklas Söderlund
2016-09-14 19:32     ` Niklas Söderlund
2016-09-14 19:50     ` Laurent Pinchart
2016-09-13 23:16 ` [PATCH 03/13] v4l: vsp1: Ensure pipeline locking in resume path Laurent Pinchart
2016-09-14 18:28   ` Niklas Söderlund
2016-09-13 23:16 ` [PATCH 04/13] v4l: vsp1: Repair race between frame end and qbuf handler Laurent Pinchart
2016-09-14  8:01   ` Kieran Bingham
2016-09-13 23:16 ` [PATCH 05/13] v4l: vsp1: Use DFE instead of FRE for frame end Laurent Pinchart
2016-09-14 18:39   ` Niklas Söderlund
2016-09-13 23:16 ` [PATCH 06/13] v4l: vsp1: Disable cropping on WPF sink pad Laurent Pinchart
2016-09-14 18:54   ` Niklas Söderlund [this message]
2016-09-19 17:55   ` Mauro Carvalho Chehab
2016-09-19 17:59     ` Laurent Pinchart
2016-09-19 18:26       ` Mauro Carvalho Chehab
2016-09-19 18:33         ` Laurent Pinchart
2016-09-19 19:02           ` Mauro Carvalho Chehab
2016-09-13 23:17 ` [PATCH 07/13] v4l: vsp1: Fix RPF cropping Laurent Pinchart
2016-09-13 23:17 ` [PATCH 08/13] v4l: vsp1: Pass parameter type to entity configuration operation Laurent Pinchart
2016-09-14 19:02   ` Niklas Söderlund
2016-09-13 23:17 ` [PATCH 09/13] v4l: vsp1: Replace .set_memory() with VSP1_ENTITY_PARAMS_PARTITION Laurent Pinchart
2016-09-13 23:17 ` [PATCH 10/13] v4l: vsp1: Support chained display lists Laurent Pinchart
2016-09-13 23:17 ` [PATCH 11/13] v4l: vsp1: Determine partition requirements for scaled images Laurent Pinchart
2016-09-14 19:27   ` Niklas Söderlund
2016-09-14 20:00     ` Laurent Pinchart
2016-09-15 13:19       ` Niklas Söderlund
2016-09-13 23:17 ` [PATCH 12/13] v4l: vsp1: Support multiple partitions per frame Laurent Pinchart
2016-09-13 23:17 ` [PATCH 13/13] v4l: vsp1: wpf: Implement rotation support Laurent Pinchart
2016-09-13 23:29 ` [PATCH 14/13] v4l: vsp1: Fix spinlock in mixed IRQ context function Laurent Pinchart
2016-09-14 19:30   ` Niklas Söderlund

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=20160914185433.GJ739@bigcity.dyn.berto.se \
    --to=niklas.soderlund@ragnatech.se \
    --cc=kieran+renesas@ksquared.org.uk \
    --cc=laurent.pinchart+renesas@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-renesas-soc@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;
as well as URLs for NNTP newsgroup(s).