Re: [PATCH v10 19/30] rcar-vin: set a default field to fallback on

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Niklas,

Thank you for the patch.

On Monday, 29 January 2018 18:34:24 EET Niklas Söderlund wrote:
> If the field is not supported by the driver it should not try to keep
> the current field. Instead it should set it to a default fallback. Since
> trying a format should always result in the same state regardless of the
> current state of the device.
> 
> Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@xxxxxxxxxxxx>
> ---
>  drivers/media/platform/rcar-vin/rcar-v4l2.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c
> b/drivers/media/platform/rcar-vin/rcar-v4l2.c index
> 6403650aff22a2ed..f69ae76b3fda50c7 100644
> --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
> +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
> @@ -23,6 +23,7 @@
>  #include "rcar-vin.h"
> 
>  #define RVIN_DEFAULT_FORMAT	V4L2_PIX_FMT_YUYV
> +#define RVIN_DEFAULT_FIELD	V4L2_FIELD_NONE
>  #define RVIN_DEFAULT_COLORSPACE	V4L2_COLORSPACE_SRGB
> 
>  /* ------------------------------------------------------------------------
> @@ -171,7 +172,7 @@ static int rvin_get_source_format(struct rvin_dev
> *vin, fmt.format.height *= 2;
>  		break;
>  	default:
> -		vin->format.field = V4L2_FIELD_NONE;
> +		vin->format.field = RVIN_DEFAULT_FIELD;
>  		break;
>  	}
> 
> @@ -267,9 +268,8 @@ static int __rvin_try_format(struct rvin_dev *vin,
>  {
>  	int ret;
> 
> -	/* Keep current field if no specific one is asked for */
>  	if (pix->field == V4L2_FIELD_ANY)
> -		pix->field = vin->format.field;
> +		pix->field = RVIN_DEFAULT_FIELD;

Won't this also be caught by the field check in the above function, called 
from __rvin_try_format_source() ? You could just remove this check completely.

However as mentioned in a comment for a previous patch I don't think the field 
handling belongs in rvin_get_source_format(), so you could merge both here. 
Or, if you repurpose and rename rvin_get_source_format(), then the check can 
probably be removed completely. I haven't checked the consolidated code after 
applying all patches from this series, but some refactoring might be useful. 
We'll see.

>  	/* Limit to source capabilities */
>  	ret = __rvin_try_format_source(vin, which, pix);

-- 
Regards,

Laurent Pinchart





[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux