2020-04-15 22:57:46

by Prabhakar Mahadev Lad

[permalink] [raw]
Subject: [PATCH v4 0/3] media: rcar-vin: Enable MEDIA_BUS_FMT_SRGGB8_1X8 format

Hi,

This patch series adds support for MEDIA_BUS_FMT_SRGGB8_1X8 format for vin

Cheers,
--Prabhakar

Changed for v4:
* patch 1/3 is new patch which adds a check for conversion from input to
output.
* patch 2/3 added a comment while setting VNIS_REG for RAW format as
suggested by Niklas

Changes for v3:
* Dropped patch 1/1 from v2 as this handled neatly by patches
https://patchwork.linuxtv.org/project/linux-media/list/?series=1974
* Included Ack from Niklas for patch 2/2
* Updated commit message for patch 1/1.

Changes for v2:
* Added support for matching fwnode against endpoints/nodes.
* Separated patch for rcar-vin and rcar-csi2.c which added
MEDIA_BUS_FMT_SRGGB8_1X8.

Lad Prabhakar (3):
media: rcar-vin: Invalidate pipeline if conversion is not possible on
input formats
media: rcar-vin: Add support for MEDIA_BUS_FMT_SRGGB8_1X8 format
media: rcar-csi2: Add support for MEDIA_BUS_FMT_SRGGB8_1X8 format

drivers/media/platform/rcar-vin/rcar-csi2.c | 1 +
drivers/media/platform/rcar-vin/rcar-dma.c | 21 +++++++++++++++++++--
drivers/media/platform/rcar-vin/rcar-v4l2.c | 4 ++++
3 files changed, 24 insertions(+), 2 deletions(-)

--
2.20.1


2020-04-15 22:59:41

by Prabhakar Mahadev Lad

[permalink] [raw]
Subject: [PATCH v4 1/3] media: rcar-vin: Invalidate pipeline if conversion is not possible on input formats

Up until now the VIN was capable to convert any of its supported input mbus
formats to any of it's supported output pixel formats. With the addition of
RAW formats this is no longer true.
This patch invalidates the pipeline by adding a check if given vin input
format can be converted to supported output pixel format.

Signed-off-by: Lad Prabhakar <[email protected]>
---
drivers/media/platform/rcar-vin/rcar-dma.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/rcar-vin/rcar-dma.c b/drivers/media/platform/rcar-vin/rcar-dma.c
index 1a30cd036371..48bd9bfc3948 100644
--- a/drivers/media/platform/rcar-vin/rcar-dma.c
+++ b/drivers/media/platform/rcar-vin/rcar-dma.c
@@ -1109,13 +1109,17 @@ static int rvin_mc_validate_format(struct rvin_dev *vin, struct v4l2_subdev *sd,
case MEDIA_BUS_FMT_UYVY8_1X16:
case MEDIA_BUS_FMT_UYVY8_2X8:
case MEDIA_BUS_FMT_UYVY10_2X10:
+ break;
case MEDIA_BUS_FMT_RGB888_1X24:
- vin->mbus_code = fmt.format.code;
+ if (vin->format.pixelformat != V4L2_PIX_FMT_SRGGB8)
+ return -EPIPE;
break;
default:
return -EPIPE;
}

+ vin->mbus_code = fmt.format.code;
+
switch (fmt.format.field) {
case V4L2_FIELD_TOP:
case V4L2_FIELD_BOTTOM:
--
2.20.1

2020-04-29 22:11:37

by Lad, Prabhakar

[permalink] [raw]
Subject: Re: [PATCH v4 0/3] media: rcar-vin: Enable MEDIA_BUS_FMT_SRGGB8_1X8 format

Hi Niklas,

On Wed, Apr 15, 2020 at 11:19 AM Lad Prabhakar
<[email protected]> wrote:
>
> Hi,
>
> This patch series adds support for MEDIA_BUS_FMT_SRGGB8_1X8 format for vin
>
> Cheers,
> --Prabhakar
>
> Changed for v4:
> * patch 1/3 is new patch which adds a check for conversion from input to
> output.
> * patch 2/3 added a comment while setting VNIS_REG for RAW format as
> suggested by Niklas
>
> Changes for v3:
> * Dropped patch 1/1 from v2 as this handled neatly by patches
> https://patchwork.linuxtv.org/project/linux-media/list/?series=1974
> * Included Ack from Niklas for patch 2/2
> * Updated commit message for patch 1/1.
>
> Changes for v2:
> * Added support for matching fwnode against endpoints/nodes.
> * Separated patch for rcar-vin and rcar-csi2.c which added
> MEDIA_BUS_FMT_SRGGB8_1X8.
>
> Lad Prabhakar (3):
> media: rcar-vin: Invalidate pipeline if conversion is not possible on
> input formats
> media: rcar-vin: Add support for MEDIA_BUS_FMT_SRGGB8_1X8 format
> media: rcar-csi2: Add support for MEDIA_BUS_FMT_SRGGB8_1X8 format
>
Gentle ping.

Cheers,
--Prabhakar

> drivers/media/platform/rcar-vin/rcar-csi2.c | 1 +
> drivers/media/platform/rcar-vin/rcar-dma.c | 21 +++++++++++++++++++--
> drivers/media/platform/rcar-vin/rcar-v4l2.c | 4 ++++
> 3 files changed, 24 insertions(+), 2 deletions(-)
>
> --
> 2.20.1
>

2020-05-12 22:30:26

by Niklas Söderlund

[permalink] [raw]
Subject: Re: [PATCH v4 1/3] media: rcar-vin: Invalidate pipeline if conversion is not possible on input formats

Hi Lad,

Thanks for your work.

On 2020-04-15 11:19:06 +0100, Lad Prabhakar wrote:
> Up until now the VIN was capable to convert any of its supported input mbus
> formats to any of it's supported output pixel formats. With the addition of
> RAW formats this is no longer true.

Add blank line.

> This patch invalidates the pipeline by adding a check if given vin input
> format can be converted to supported output pixel format.
>
> Signed-off-by: Lad Prabhakar <[email protected]>

I like this patch I think there is a typo bellow and patch [1] have been
merged in the media-tree which unfortunately addes one more thing to do
in this patch. In rvin_enum_fmt_vid_cap() there is a TODO noted for what
needs to be done. In imagine the fix is simple and the end result would
look something like this.

switch (f->mbus_code) {
case 0:
case MEDIA_BUS_FMT_YUYV8_1X16:
case MEDIA_BUS_FMT_UYVY8_1X16:
case MEDIA_BUS_FMT_UYVY8_2X8:
case MEDIA_BUS_FMT_UYVY10_2X10:
case MEDIA_BUS_FMT_RGB888_1X24:
break;
case MEDIA_BUS_FMT_SRGGB8_1X8:
if (f->index)
return -EINVAL;

f->pixelformat = V4L2_PIX_FMT_SRGGB8;
return 0;
case default:
return -EINVAL;
}

1. d5f74a1eff9aef3b ("media: rcar-vin: Make use of V4L2_CAP_IO_MC")

> ---
> drivers/media/platform/rcar-vin/rcar-dma.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/media/platform/rcar-vin/rcar-dma.c b/drivers/media/platform/rcar-vin/rcar-dma.c
> index 1a30cd036371..48bd9bfc3948 100644
> --- a/drivers/media/platform/rcar-vin/rcar-dma.c
> +++ b/drivers/media/platform/rcar-vin/rcar-dma.c
> @@ -1109,13 +1109,17 @@ static int rvin_mc_validate_format(struct rvin_dev *vin, struct v4l2_subdev *sd,
> case MEDIA_BUS_FMT_UYVY8_1X16:
> case MEDIA_BUS_FMT_UYVY8_2X8:
> case MEDIA_BUS_FMT_UYVY10_2X10:
> + break;
> case MEDIA_BUS_FMT_RGB888_1X24:
> - vin->mbus_code = fmt.format.code;

This is not right is it?

Should you not add a case for MEDIA_BUS_FMT_SRGGB8_1X8 instead of taking
over MEDIA_BUS_FMT_RGB888_1X24?

> + if (vin->format.pixelformat != V4L2_PIX_FMT_SRGGB8)
> + return -EPIPE;
> break;
> default:
> return -EPIPE;
> }
>
> + vin->mbus_code = fmt.format.code;
> +
> switch (fmt.format.field) {
> case V4L2_FIELD_TOP:
> case V4L2_FIELD_BOTTOM:
> --
> 2.20.1
>

--
Regards,
Niklas S?derlund

2020-05-13 11:30:05

by Lad, Prabhakar

[permalink] [raw]
Subject: Re: [PATCH v4 1/3] media: rcar-vin: Invalidate pipeline if conversion is not possible on input formats

Hi Niklas,

Thank you for the review.

On Tue, May 12, 2020 at 11:26 PM Niklas <[email protected]> wrote:
>
> Hi Lad,
>
> Thanks for your work.
>
> On 2020-04-15 11:19:06 +0100, Lad Prabhakar wrote:
> > Up until now the VIN was capable to convert any of its supported input mbus
> > formats to any of it's supported output pixel formats. With the addition of
> > RAW formats this is no longer true.
>
> Add blank line.
>
> > This patch invalidates the pipeline by adding a check if given vin input
> > format can be converted to supported output pixel format.
> >
> > Signed-off-by: Lad Prabhakar <[email protected]>
>
> I like this patch I think there is a typo bellow and patch [1] have been
> merged in the media-tree which unfortunately addes one more thing to do
> in this patch. In rvin_enum_fmt_vid_cap() there is a TODO noted for what
> needs to be done. In imagine the fix is simple and the end result would
> look something like this.
>
> switch (f->mbus_code) {
> case 0:
> case MEDIA_BUS_FMT_YUYV8_1X16:
> case MEDIA_BUS_FMT_UYVY8_1X16:
> case MEDIA_BUS_FMT_UYVY8_2X8:
> case MEDIA_BUS_FMT_UYVY10_2X10:
> case MEDIA_BUS_FMT_RGB888_1X24:
> break;
> case MEDIA_BUS_FMT_SRGGB8_1X8:
> if (f->index)
> return -EINVAL;
>
> f->pixelformat = V4L2_PIX_FMT_SRGGB8;
> return 0;
> case default:
> return -EINVAL;
> }
>
> 1. d5f74a1eff9aef3b ("media: rcar-vin: Make use of V4L2_CAP_IO_MC")
>
Sure Ill take of care of this and just repost this patch is that OK with you ?

> > ---
> > drivers/media/platform/rcar-vin/rcar-dma.c | 6 +++++-
> > 1 file changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/media/platform/rcar-vin/rcar-dma.c b/drivers/media/platform/rcar-vin/rcar-dma.c
> > index 1a30cd036371..48bd9bfc3948 100644
> > --- a/drivers/media/platform/rcar-vin/rcar-dma.c
> > +++ b/drivers/media/platform/rcar-vin/rcar-dma.c
> > @@ -1109,13 +1109,17 @@ static int rvin_mc_validate_format(struct rvin_dev *vin, struct v4l2_subdev *sd,
> > case MEDIA_BUS_FMT_UYVY8_1X16:
> > case MEDIA_BUS_FMT_UYVY8_2X8:
> > case MEDIA_BUS_FMT_UYVY10_2X10:
> > + break;
> > case MEDIA_BUS_FMT_RGB888_1X24:
> > - vin->mbus_code = fmt.format.code;
>
> This is not right is it?
>
> Should you not add a case for MEDIA_BUS_FMT_SRGGB8_1X8 instead of taking
> over MEDIA_BUS_FMT_RGB888_1X24?
>
Agreed, I blindly took this suggestion from your previous comments [1].

[1] https://lkml.org/lkml/2020/3/19/858

Cheers,
--Prabhakar Lad

> > + if (vin->format.pixelformat != V4L2_PIX_FMT_SRGGB8)
> > + return -EPIPE;
> > break;
> > default:
> > return -EPIPE;
> > }
> >
> > + vin->mbus_code = fmt.format.code;
> > +
> > switch (fmt.format.field) {
> > case V4L2_FIELD_TOP:
> > case V4L2_FIELD_BOTTOM:
> > --
> > 2.20.1
> >
>
> --
> Regards,
> Niklas Söderlund

2020-05-19 13:15:21

by Niklas Söderlund

[permalink] [raw]
Subject: Re: [PATCH v4 1/3] media: rcar-vin: Invalidate pipeline if conversion is not possible on input formats

Hi Lad,

On 2020-05-13 12:16:00 +0100, Lad, Prabhakar wrote:
> Hi Niklas,
>
> Thank you for the review.
>
> On Tue, May 12, 2020 at 11:26 PM Niklas <[email protected]> wrote:
> >
> > Hi Lad,
> >
> > Thanks for your work.
> >
> > On 2020-04-15 11:19:06 +0100, Lad Prabhakar wrote:
> > > Up until now the VIN was capable to convert any of its supported input mbus
> > > formats to any of it's supported output pixel formats. With the addition of
> > > RAW formats this is no longer true.
> >
> > Add blank line.
> >
> > > This patch invalidates the pipeline by adding a check if given vin input
> > > format can be converted to supported output pixel format.
> > >
> > > Signed-off-by: Lad Prabhakar <[email protected]>
> >
> > I like this patch I think there is a typo bellow and patch [1] have been
> > merged in the media-tree which unfortunately addes one more thing to do
> > in this patch. In rvin_enum_fmt_vid_cap() there is a TODO noted for what
> > needs to be done. In imagine the fix is simple and the end result would
> > look something like this.
> >
> > switch (f->mbus_code) {
> > case 0:
> > case MEDIA_BUS_FMT_YUYV8_1X16:
> > case MEDIA_BUS_FMT_UYVY8_1X16:
> > case MEDIA_BUS_FMT_UYVY8_2X8:
> > case MEDIA_BUS_FMT_UYVY10_2X10:
> > case MEDIA_BUS_FMT_RGB888_1X24:
> > break;
> > case MEDIA_BUS_FMT_SRGGB8_1X8:
> > if (f->index)
> > return -EINVAL;
> >
> > f->pixelformat = V4L2_PIX_FMT_SRGGB8;
> > return 0;
> > case default:
> > return -EINVAL;
> > }
> >
> > 1. d5f74a1eff9aef3b ("media: rcar-vin: Make use of V4L2_CAP_IO_MC")
> >
> Sure Ill take of care of this and just repost this patch is that OK with you ?

Yes, also please test it as you point out bellow my last suggesting had
a typo which would break it ;-)

>
> > > ---
> > > drivers/media/platform/rcar-vin/rcar-dma.c | 6 +++++-
> > > 1 file changed, 5 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/media/platform/rcar-vin/rcar-dma.c b/drivers/media/platform/rcar-vin/rcar-dma.c
> > > index 1a30cd036371..48bd9bfc3948 100644
> > > --- a/drivers/media/platform/rcar-vin/rcar-dma.c
> > > +++ b/drivers/media/platform/rcar-vin/rcar-dma.c
> > > @@ -1109,13 +1109,17 @@ static int rvin_mc_validate_format(struct rvin_dev *vin, struct v4l2_subdev *sd,
> > > case MEDIA_BUS_FMT_UYVY8_1X16:
> > > case MEDIA_BUS_FMT_UYVY8_2X8:
> > > case MEDIA_BUS_FMT_UYVY10_2X10:
> > > + break;
> > > case MEDIA_BUS_FMT_RGB888_1X24:
> > > - vin->mbus_code = fmt.format.code;
> >
> > This is not right is it?
> >
> > Should you not add a case for MEDIA_BUS_FMT_SRGGB8_1X8 instead of taking
> > over MEDIA_BUS_FMT_RGB888_1X24?
> >
> Agreed, I blindly took this suggestion from your previous comments [1].
>
> [1] https://lkml.org/lkml/2020/3/19/858
>
> Cheers,
> --Prabhakar Lad
>
> > > + if (vin->format.pixelformat != V4L2_PIX_FMT_SRGGB8)
> > > + return -EPIPE;
> > > break;
> > > default:
> > > return -EPIPE;
> > > }
> > >
> > > + vin->mbus_code = fmt.format.code;
> > > +
> > > switch (fmt.format.field) {
> > > case V4L2_FIELD_TOP:
> > > case V4L2_FIELD_BOTTOM:
> > > --
> > > 2.20.1
> > >
> >
> > --
> > Regards,
> > Niklas S?derlund

--
Regards,
Niklas S?derlund