linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] media: rcar-vin: Fix issues with NV12 on Gen3
@ 2023-02-11 20:54 Niklas Söderlund
  2023-02-11 20:54 ` [PATCH 1/2] media: rcar-vin: Gen3 can not scale NV12 Niklas Söderlund
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Niklas Söderlund @ 2023-02-11 20:54 UTC (permalink / raw)
  To: Hans Verkuil, linux-media; +Cc: linux-renesas-soc, Niklas Söderlund

Hello,

This series fixes two small issues around NV12. Patch 1/2 forbids the 
use of the scaler on Gen3 if the output format is NV12. While patch 2/2 
fixes the size alignment for NV12.

Work tested on both Gen2 and Gen3 without regressions.

Niklas Söderlund (2):
  media: rcar-vin: Gen3 can not scale NV12
  media: rcar-vin: Fix NV12 size alignment

 .../media/platform/renesas/rcar-vin/rcar-dma.c  | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

-- 
2.39.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] media: rcar-vin: Gen3 can not scale NV12
  2023-02-11 20:54 [PATCH 0/2] media: rcar-vin: Fix issues with NV12 on Gen3 Niklas Söderlund
@ 2023-02-11 20:54 ` Niklas Söderlund
  2023-02-11 20:54 ` [PATCH 2/2] media: rcar-vin: Fix NV12 size alignment Niklas Söderlund
  2023-04-15  8:00 ` [PATCH 0/2] media: rcar-vin: Fix issues with NV12 on Gen3 Niklas Söderlund
  2 siblings, 0 replies; 4+ messages in thread
From: Niklas Söderlund @ 2023-02-11 20:54 UTC (permalink / raw)
  To: Hans Verkuil, linux-media; +Cc: linux-renesas-soc, Niklas Söderlund

The VIN modules on Gen3 can not scale NV12, fail format validation if
the user tries. Currently no frames are produced if this is attempted.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
---
 drivers/media/platform/renesas/rcar-vin/rcar-dma.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/media/platform/renesas/rcar-vin/rcar-dma.c b/drivers/media/platform/renesas/rcar-vin/rcar-dma.c
index 98bfd445a649..cc6b59e5621a 100644
--- a/drivers/media/platform/renesas/rcar-vin/rcar-dma.c
+++ b/drivers/media/platform/renesas/rcar-vin/rcar-dma.c
@@ -1312,6 +1312,11 @@ static int rvin_mc_validate_format(struct rvin_dev *vin, struct v4l2_subdev *sd,
 	}
 
 	if (rvin_scaler_needed(vin)) {
+		/* Gen3 can't scale NV12 */
+		if (vin->info->model == RCAR_GEN3 &&
+		    vin->format.pixelformat == V4L2_PIX_FMT_NV12)
+			return -EPIPE;
+
 		if (!vin->scaler)
 			return -EPIPE;
 	} else {
-- 
2.39.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] media: rcar-vin: Fix NV12 size alignment
  2023-02-11 20:54 [PATCH 0/2] media: rcar-vin: Fix issues with NV12 on Gen3 Niklas Söderlund
  2023-02-11 20:54 ` [PATCH 1/2] media: rcar-vin: Gen3 can not scale NV12 Niklas Söderlund
@ 2023-02-11 20:54 ` Niklas Söderlund
  2023-04-15  8:00 ` [PATCH 0/2] media: rcar-vin: Fix issues with NV12 on Gen3 Niklas Söderlund
  2 siblings, 0 replies; 4+ messages in thread
From: Niklas Söderlund @ 2023-02-11 20:54 UTC (permalink / raw)
  To: Hans Verkuil, linux-media; +Cc: linux-renesas-soc, Niklas Söderlund

When doing format validation for NV12 the width and height should be
aligned to 32 pixels.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
---
 drivers/media/platform/renesas/rcar-vin/rcar-dma.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/media/platform/renesas/rcar-vin/rcar-dma.c b/drivers/media/platform/renesas/rcar-vin/rcar-dma.c
index cc6b59e5621a..23598e22adc7 100644
--- a/drivers/media/platform/renesas/rcar-vin/rcar-dma.c
+++ b/drivers/media/platform/renesas/rcar-vin/rcar-dma.c
@@ -1320,9 +1320,15 @@ static int rvin_mc_validate_format(struct rvin_dev *vin, struct v4l2_subdev *sd,
 		if (!vin->scaler)
 			return -EPIPE;
 	} else {
-		if (fmt.format.width != vin->format.width ||
-		    fmt.format.height != vin->format.height)
-			return -EPIPE;
+		if (vin->format.pixelformat == V4L2_PIX_FMT_NV12) {
+			if (ALIGN(fmt.format.width, 32) != vin->format.width ||
+			    ALIGN(fmt.format.height, 32) != vin->format.height)
+				return -EPIPE;
+		} else {
+			if (fmt.format.width != vin->format.width ||
+			    fmt.format.height != vin->format.height)
+				return -EPIPE;
+		}
 	}
 
 	if (fmt.format.code != vin->mbus_code)
-- 
2.39.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] media: rcar-vin: Fix issues with NV12 on Gen3
  2023-02-11 20:54 [PATCH 0/2] media: rcar-vin: Fix issues with NV12 on Gen3 Niklas Söderlund
  2023-02-11 20:54 ` [PATCH 1/2] media: rcar-vin: Gen3 can not scale NV12 Niklas Söderlund
  2023-02-11 20:54 ` [PATCH 2/2] media: rcar-vin: Fix NV12 size alignment Niklas Söderlund
@ 2023-04-15  8:00 ` Niklas Söderlund
  2 siblings, 0 replies; 4+ messages in thread
From: Niklas Söderlund @ 2023-04-15  8:00 UTC (permalink / raw)
  To: Hans Verkuil, linux-media; +Cc: linux-renesas-soc

Hi all,

A gentle ping on this series.

On 2023-02-11 21:54:30 +0100, Niklas Söderlund wrote:
> Hello,
> 
> This series fixes two small issues around NV12. Patch 1/2 forbids the 
> use of the scaler on Gen3 if the output format is NV12. While patch 2/2 
> fixes the size alignment for NV12.
> 
> Work tested on both Gen2 and Gen3 without regressions.
> 
> Niklas Söderlund (2):
>   media: rcar-vin: Gen3 can not scale NV12
>   media: rcar-vin: Fix NV12 size alignment
> 
>  .../media/platform/renesas/rcar-vin/rcar-dma.c  | 17 ++++++++++++++---
>  1 file changed, 14 insertions(+), 3 deletions(-)
> 
> -- 
> 2.39.1
> 

-- 
Kind Regards,
Niklas Söderlund

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-04-15  8:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-11 20:54 [PATCH 0/2] media: rcar-vin: Fix issues with NV12 on Gen3 Niklas Söderlund
2023-02-11 20:54 ` [PATCH 1/2] media: rcar-vin: Gen3 can not scale NV12 Niklas Söderlund
2023-02-11 20:54 ` [PATCH 2/2] media: rcar-vin: Fix NV12 size alignment Niklas Söderlund
2023-04-15  8:00 ` [PATCH 0/2] media: rcar-vin: Fix issues with NV12 on Gen3 Niklas Söderlund

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).