diff mbox

[v9,11/28] rcar-vin: do not allow changing scaling and composing while streaming

Message ID 20171208010842.20047-12-niklas.soderlund+renesas@ragnatech.se (mailing list archive)
State New, archived
Headers show

Commit Message

Niklas Söderlund Dec. 8, 2017, 1:08 a.m. UTC
It is possible on Gen2 to change the registers controlling composing and
scaling while the stream is running. It is however not a good idea to do
so and could result in trouble. There are also no good reasons to allow
this, remove immediate reflection in hardware registers from
vidioc_s_selection and only configure scaling and composing when the
stream starts.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Hans Verkuil <hans.verkuil@cisco.com>
---
 drivers/media/platform/rcar-vin/rcar-dma.c  | 2 +-
 drivers/media/platform/rcar-vin/rcar-v4l2.c | 3 ---
 drivers/media/platform/rcar-vin/rcar-vin.h  | 3 ---
 3 files changed, 1 insertion(+), 7 deletions(-)

Comments

Laurent Pinchart Dec. 8, 2017, 9:04 a.m. UTC | #1
Hi Niklas,

Thank you for the patch.

On Friday, 8 December 2017 03:08:25 EET Niklas Söderlund wrote:
> It is possible on Gen2 to change the registers controlling composing and
> scaling while the stream is running. It is however not a good idea to do
> so and could result in trouble. There are also no good reasons to allow
> this, remove immediate reflection in hardware registers from
> vidioc_s_selection and only configure scaling and composing when the
> stream starts.

There is a good reason: digital zoom.

> Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
> Reviewed-by: Hans Verkuil <hans.verkuil@cisco.com>
> ---
>  drivers/media/platform/rcar-vin/rcar-dma.c  | 2 +-
>  drivers/media/platform/rcar-vin/rcar-v4l2.c | 3 ---
>  drivers/media/platform/rcar-vin/rcar-vin.h  | 3 ---
>  3 files changed, 1 insertion(+), 7 deletions(-)
> 
> diff --git a/drivers/media/platform/rcar-vin/rcar-dma.c
> b/drivers/media/platform/rcar-vin/rcar-dma.c index
> fd14be20a6604d7a..7be5080f742825fb 100644
> --- a/drivers/media/platform/rcar-vin/rcar-dma.c
> +++ b/drivers/media/platform/rcar-vin/rcar-dma.c
> @@ -514,7 +514,7 @@ static void rvin_set_coeff(struct rvin_dev *vin,
> unsigned short xs) rvin_write(vin, p_set->coeff_set[23], VNC8C_REG);
>  }
> 
> -void rvin_crop_scale_comp(struct rvin_dev *vin)
> +static void rvin_crop_scale_comp(struct rvin_dev *vin)
>  {
>  	u32 xs, ys;
> 
> diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c
> b/drivers/media/platform/rcar-vin/rcar-v4l2.c index
> 254fa1c8770275a5..d6298c684ab2d731 100644
> --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
> +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
> @@ -436,9 +436,6 @@ static int rvin_s_selection(struct file *file, void *fh,
> return -EINVAL;
>  	}
> 
> -	/* HW supports modifying configuration while running */
> -	rvin_crop_scale_comp(vin);
> -
>  	return 0;
>  }
> 
> diff --git a/drivers/media/platform/rcar-vin/rcar-vin.h
> b/drivers/media/platform/rcar-vin/rcar-vin.h index
> 36d0f0cc4ce01a6e..67541b483ee43c52 100644
> --- a/drivers/media/platform/rcar-vin/rcar-vin.h
> +++ b/drivers/media/platform/rcar-vin/rcar-vin.h
> @@ -175,7 +175,4 @@ void rvin_v4l2_unregister(struct rvin_dev *vin);
> 
>  const struct rvin_video_format *rvin_format_from_pixel(u32 pixelformat);
> 
> -/* Cropping, composing and scaling */
> -void rvin_crop_scale_comp(struct rvin_dev *vin);
> -
>  #endif
Niklas Söderlund Dec. 8, 2017, 2:14 p.m. UTC | #2
Hi Laurent,

Thanks for your feedback.

On 2017-12-08 11:04:26 +0200, Laurent Pinchart wrote:
> Hi Niklas,
> 
> Thank you for the patch.
> 
> On Friday, 8 December 2017 03:08:25 EET Niklas Söderlund wrote:
> > It is possible on Gen2 to change the registers controlling composing and
> > scaling while the stream is running. It is however not a good idea to do
> > so and could result in trouble. There are also no good reasons to allow
> > this, remove immediate reflection in hardware registers from
> > vidioc_s_selection and only configure scaling and composing when the
> > stream starts.
> 
> There is a good reason: digital zoom.

OK, so you would recommend me to drop this patch to keep the current 
behavior?

> 
> > Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
> > Reviewed-by: Hans Verkuil <hans.verkuil@cisco.com>
> > ---
> >  drivers/media/platform/rcar-vin/rcar-dma.c  | 2 +-
> >  drivers/media/platform/rcar-vin/rcar-v4l2.c | 3 ---
> >  drivers/media/platform/rcar-vin/rcar-vin.h  | 3 ---
> >  3 files changed, 1 insertion(+), 7 deletions(-)
> > 
> > diff --git a/drivers/media/platform/rcar-vin/rcar-dma.c
> > b/drivers/media/platform/rcar-vin/rcar-dma.c index
> > fd14be20a6604d7a..7be5080f742825fb 100644
> > --- a/drivers/media/platform/rcar-vin/rcar-dma.c
> > +++ b/drivers/media/platform/rcar-vin/rcar-dma.c
> > @@ -514,7 +514,7 @@ static void rvin_set_coeff(struct rvin_dev *vin,
> > unsigned short xs) rvin_write(vin, p_set->coeff_set[23], VNC8C_REG);
> >  }
> > 
> > -void rvin_crop_scale_comp(struct rvin_dev *vin)
> > +static void rvin_crop_scale_comp(struct rvin_dev *vin)
> >  {
> >  	u32 xs, ys;
> > 
> > diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c
> > b/drivers/media/platform/rcar-vin/rcar-v4l2.c index
> > 254fa1c8770275a5..d6298c684ab2d731 100644
> > --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
> > +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
> > @@ -436,9 +436,6 @@ static int rvin_s_selection(struct file *file, void *fh,
> > return -EINVAL;
> >  	}
> > 
> > -	/* HW supports modifying configuration while running */
> > -	rvin_crop_scale_comp(vin);
> > -
> >  	return 0;
> >  }
> > 
> > diff --git a/drivers/media/platform/rcar-vin/rcar-vin.h
> > b/drivers/media/platform/rcar-vin/rcar-vin.h index
> > 36d0f0cc4ce01a6e..67541b483ee43c52 100644
> > --- a/drivers/media/platform/rcar-vin/rcar-vin.h
> > +++ b/drivers/media/platform/rcar-vin/rcar-vin.h
> > @@ -175,7 +175,4 @@ void rvin_v4l2_unregister(struct rvin_dev *vin);
> > 
> >  const struct rvin_video_format *rvin_format_from_pixel(u32 pixelformat);
> > 
> > -/* Cropping, composing and scaling */
> > -void rvin_crop_scale_comp(struct rvin_dev *vin);
> > -
> >  #endif
> 
> -- 
> Regards,
> 
> Laurent Pinchart
>
Laurent Pinchart Dec. 8, 2017, 7:20 p.m. UTC | #3
Hi Niklas,

On Friday, 8 December 2017 16:14:23 EET Niklas Söderlund wrote:
> On 2017-12-08 11:04:26 +0200, Laurent Pinchart wrote:
> > On Friday, 8 December 2017 03:08:25 EET Niklas Söderlund wrote:
> >> It is possible on Gen2 to change the registers controlling composing and
> >> scaling while the stream is running. It is however not a good idea to do
> >> so and could result in trouble. There are also no good reasons to allow
> >> this, remove immediate reflection in hardware registers from
> >> vidioc_s_selection and only configure scaling and composing when the
> >> stream starts.
> > 
> > There is a good reason: digital zoom.
> 
> OK, so you would recommend me to drop this patch to keep the current
> behavior?

Yes, unless you don't care about breaking use cases for Gen2, but in that case 
I'd recommend dropping Gen2 support altogether :-)

> >> Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
> >> Reviewed-by: Hans Verkuil <hans.verkuil@cisco.com>
> >> ---
> >> 
> >>  drivers/media/platform/rcar-vin/rcar-dma.c  | 2 +-
> >>  drivers/media/platform/rcar-vin/rcar-v4l2.c | 3 ---
> >>  drivers/media/platform/rcar-vin/rcar-vin.h  | 3 ---
> >>  3 files changed, 1 insertion(+), 7 deletions(-)

[snip]
Niklas Söderlund Dec. 20, 2017, 4:26 p.m. UTC | #4
Hi Laurent,

On 2017-12-08 21:20:48 +0200, Laurent Pinchart wrote:
> Hi Niklas,
> 
> On Friday, 8 December 2017 16:14:23 EET Niklas Söderlund wrote:
> > On 2017-12-08 11:04:26 +0200, Laurent Pinchart wrote:
> > > On Friday, 8 December 2017 03:08:25 EET Niklas Söderlund wrote:
> > >> It is possible on Gen2 to change the registers controlling composing and
> > >> scaling while the stream is running. It is however not a good idea to do
> > >> so and could result in trouble. There are also no good reasons to allow
> > >> this, remove immediate reflection in hardware registers from
> > >> vidioc_s_selection and only configure scaling and composing when the
> > >> stream starts.
> > > 
> > > There is a good reason: digital zoom.
> > 
> > OK, so you would recommend me to drop this patch to keep the current
> > behavior?
> 
> Yes, unless you don't care about breaking use cases for Gen2, but in that case 
> I'd recommend dropping Gen2 support altogether :-)

Well I don't want to do that so I will drop this patch for the next 
version. Thanks for clarifying the use-case for this.

> 
> > >> Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
> > >> Reviewed-by: Hans Verkuil <hans.verkuil@cisco.com>
> > >> ---
> > >> 
> > >>  drivers/media/platform/rcar-vin/rcar-dma.c  | 2 +-
> > >>  drivers/media/platform/rcar-vin/rcar-v4l2.c | 3 ---
> > >>  drivers/media/platform/rcar-vin/rcar-vin.h  | 3 ---
> > >>  3 files changed, 1 insertion(+), 7 deletions(-)
> 
> [snip]
> 
> -- 
> Regards,
> 
> Laurent Pinchart
>
diff mbox

Patch

diff --git a/drivers/media/platform/rcar-vin/rcar-dma.c b/drivers/media/platform/rcar-vin/rcar-dma.c
index fd14be20a6604d7a..7be5080f742825fb 100644
--- a/drivers/media/platform/rcar-vin/rcar-dma.c
+++ b/drivers/media/platform/rcar-vin/rcar-dma.c
@@ -514,7 +514,7 @@  static void rvin_set_coeff(struct rvin_dev *vin, unsigned short xs)
 	rvin_write(vin, p_set->coeff_set[23], VNC8C_REG);
 }
 
-void rvin_crop_scale_comp(struct rvin_dev *vin)
+static void rvin_crop_scale_comp(struct rvin_dev *vin)
 {
 	u32 xs, ys;
 
diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c b/drivers/media/platform/rcar-vin/rcar-v4l2.c
index 254fa1c8770275a5..d6298c684ab2d731 100644
--- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
+++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
@@ -436,9 +436,6 @@  static int rvin_s_selection(struct file *file, void *fh,
 		return -EINVAL;
 	}
 
-	/* HW supports modifying configuration while running */
-	rvin_crop_scale_comp(vin);
-
 	return 0;
 }
 
diff --git a/drivers/media/platform/rcar-vin/rcar-vin.h b/drivers/media/platform/rcar-vin/rcar-vin.h
index 36d0f0cc4ce01a6e..67541b483ee43c52 100644
--- a/drivers/media/platform/rcar-vin/rcar-vin.h
+++ b/drivers/media/platform/rcar-vin/rcar-vin.h
@@ -175,7 +175,4 @@  void rvin_v4l2_unregister(struct rvin_dev *vin);
 
 const struct rvin_video_format *rvin_format_from_pixel(u32 pixelformat);
 
-/* Cropping, composing and scaling */
-void rvin_crop_scale_comp(struct rvin_dev *vin);
-
 #endif