* [PATCH] media: cedrus: Add support for additional output formats
@ 2025-05-23 15:43 Paul Kocialkowski
2025-06-30 19:16 ` Nicolas Dufresne
0 siblings, 1 reply; 3+ messages in thread
From: Paul Kocialkowski @ 2025-05-23 15:43 UTC (permalink / raw)
To: linux-media, linux-staging, linux-arm-kernel, linux-sunxi,
linux-kernel
Cc: Paul Kocialkowski, Mauro Carvalho Chehab, Chen-Yu Tsai,
Jernej Skrabec, Samuel Holland, Hans Verkuil, Jernej Skrabec
From: Jernej Skrabec <jernej.skrabec@siol.net>
If VPU supports untiled output, it actually supports several different
YUV 4:2:0 layouts, namely NV12, NV21, YUV420 and YVU420.
Add support for all of them.
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Reviewed-by: Paul Kocialkowski <paulk@sys-base.io>
---
Looks like this patch never made it, sorry about that.
I've rebased it atop media/next and added my Reviewed-by tag.
---
drivers/staging/media/sunxi/cedrus/cedrus_hw.c | 18 +++++++++++++++++-
.../staging/media/sunxi/cedrus/cedrus_video.c | 18 ++++++++++++++++++
2 files changed, 35 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_hw.c b/drivers/staging/media/sunxi/cedrus/cedrus_hw.c
index 32af0e96e762..168d89c5a16d 100644
--- a/drivers/staging/media/sunxi/cedrus/cedrus_hw.c
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_hw.c
@@ -86,9 +86,25 @@ void cedrus_dst_format_set(struct cedrus_dev *dev,
switch (fmt->pixelformat) {
case V4L2_PIX_FMT_NV12:
+ case V4L2_PIX_FMT_NV21:
+ case V4L2_PIX_FMT_YUV420:
+ case V4L2_PIX_FMT_YVU420:
chroma_size = ALIGN(width, 16) * ALIGN(height, 16) / 2;
- reg = VE_PRIMARY_OUT_FMT_NV12;
+ switch (fmt->pixelformat) {
+ case V4L2_PIX_FMT_NV12:
+ reg = VE_PRIMARY_OUT_FMT_NV12;
+ break;
+ case V4L2_PIX_FMT_NV21:
+ reg = VE_PRIMARY_OUT_FMT_NV21;
+ break;
+ case V4L2_PIX_FMT_YUV420:
+ reg = VE_PRIMARY_OUT_FMT_YU12;
+ break;
+ case V4L2_PIX_FMT_YVU420:
+ reg = VE_PRIMARY_OUT_FMT_YV12;
+ break;
+ }
cedrus_write(dev, VE_PRIMARY_OUT_FMT, reg);
reg = chroma_size / 2;
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_video.c b/drivers/staging/media/sunxi/cedrus/cedrus_video.c
index 77f78266f406..9fae2c7493d0 100644
--- a/drivers/staging/media/sunxi/cedrus/cedrus_video.c
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_video.c
@@ -64,6 +64,21 @@ static struct cedrus_format cedrus_formats[] = {
.pixelformat = V4L2_PIX_FMT_NV12_32L32,
.directions = CEDRUS_DECODE_DST,
},
+ {
+ .pixelformat = V4L2_PIX_FMT_NV21,
+ .directions = CEDRUS_DECODE_DST,
+ .capabilities = CEDRUS_CAPABILITY_UNTILED,
+ },
+ {
+ .pixelformat = V4L2_PIX_FMT_YUV420,
+ .directions = CEDRUS_DECODE_DST,
+ .capabilities = CEDRUS_CAPABILITY_UNTILED,
+ },
+ {
+ .pixelformat = V4L2_PIX_FMT_YVU420,
+ .directions = CEDRUS_DECODE_DST,
+ .capabilities = CEDRUS_CAPABILITY_UNTILED,
+ },
};
#define CEDRUS_FORMATS_COUNT ARRAY_SIZE(cedrus_formats)
@@ -140,6 +155,9 @@ void cedrus_prepare_format(struct v4l2_pix_format *pix_fmt)
break;
case V4L2_PIX_FMT_NV12:
+ case V4L2_PIX_FMT_NV21:
+ case V4L2_PIX_FMT_YUV420:
+ case V4L2_PIX_FMT_YVU420:
/* 16-aligned stride. */
bytesperline = ALIGN(width, 16);
--
2.49.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] media: cedrus: Add support for additional output formats
2025-05-23 15:43 [PATCH] media: cedrus: Add support for additional output formats Paul Kocialkowski
@ 2025-06-30 19:16 ` Nicolas Dufresne
2025-06-30 20:33 ` Paul Kocialkowski
0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Dufresne @ 2025-06-30 19:16 UTC (permalink / raw)
To: Paul Kocialkowski, linux-media, linux-staging, linux-arm-kernel,
linux-sunxi, linux-kernel
Cc: Mauro Carvalho Chehab, Chen-Yu Tsai, Jernej Skrabec,
Samuel Holland, Hans Verkuil, Jernej Skrabec
[-- Attachment #1: Type: text/plain, Size: 3215 bytes --]
Hi Paul, Jernej,
Le vendredi 23 mai 2025 à 17:43 +0200, Paul Kocialkowski a écrit :
> From: Jernej Skrabec <jernej.skrabec@siol.net>
>
> If VPU supports untiled output, it actually supports several different
> YUV 4:2:0 layouts, namely NV12, NV21, YUV420 and YVU420.
>
> Add support for all of them.
>
> Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
> Reviewed-by: Paul Kocialkowski <paulk@sys-base.io>
> ---
>
> Looks like this patch never made it, sorry about that.
> I've rebased it atop media/next and added my Reviewed-by tag.
> ---
> drivers/staging/media/sunxi/cedrus/cedrus_hw.c | 18 +++++++++++++++++-
> .../staging/media/sunxi/cedrus/cedrus_video.c | 18 ++++++++++++++++++
> 2 files changed, 35 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_hw.c
> b/drivers/staging/media/sunxi/cedrus/cedrus_hw.c
> index 32af0e96e762..168d89c5a16d 100644
> --- a/drivers/staging/media/sunxi/cedrus/cedrus_hw.c
> +++ b/drivers/staging/media/sunxi/cedrus/cedrus_hw.c
> @@ -86,9 +86,25 @@ void cedrus_dst_format_set(struct cedrus_dev *dev,
>
> switch (fmt->pixelformat) {
> case V4L2_PIX_FMT_NV12:
> + case V4L2_PIX_FMT_NV21:
> + case V4L2_PIX_FMT_YUV420:
> + case V4L2_PIX_FMT_YVU420:
> chroma_size = ALIGN(width, 16) * ALIGN(height, 16) / 2;
>
> - reg = VE_PRIMARY_OUT_FMT_NV12;
> + switch (fmt->pixelformat) {
> + case V4L2_PIX_FMT_NV12:
> + reg = VE_PRIMARY_OUT_FMT_NV12;
> + break;
> + case V4L2_PIX_FMT_NV21:
> + reg = VE_PRIMARY_OUT_FMT_NV21;
> + break;
> + case V4L2_PIX_FMT_YUV420:
> + reg = VE_PRIMARY_OUT_FMT_YU12;
> + break;
> + case V4L2_PIX_FMT_YVU420:
Just so its recorded, Hans added a default: case here while applying.
regards,
Nicolas
> + reg = VE_PRIMARY_OUT_FMT_YV12;
> + break;
> + }
> cedrus_write(dev, VE_PRIMARY_OUT_FMT, reg);
>
> reg = chroma_size / 2;
> diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_video.c
> b/drivers/staging/media/sunxi/cedrus/cedrus_video.c
> index 77f78266f406..9fae2c7493d0 100644
> --- a/drivers/staging/media/sunxi/cedrus/cedrus_video.c
> +++ b/drivers/staging/media/sunxi/cedrus/cedrus_video.c
> @@ -64,6 +64,21 @@ static struct cedrus_format cedrus_formats[] = {
> .pixelformat = V4L2_PIX_FMT_NV12_32L32,
> .directions = CEDRUS_DECODE_DST,
> },
> + {
> + .pixelformat = V4L2_PIX_FMT_NV21,
> + .directions = CEDRUS_DECODE_DST,
> + .capabilities = CEDRUS_CAPABILITY_UNTILED,
> + },
> + {
> + .pixelformat = V4L2_PIX_FMT_YUV420,
> + .directions = CEDRUS_DECODE_DST,
> + .capabilities = CEDRUS_CAPABILITY_UNTILED,
> + },
> + {
> + .pixelformat = V4L2_PIX_FMT_YVU420,
> + .directions = CEDRUS_DECODE_DST,
> + .capabilities = CEDRUS_CAPABILITY_UNTILED,
> + },
> };
>
> #define CEDRUS_FORMATS_COUNT ARRAY_SIZE(cedrus_formats)
> @@ -140,6 +155,9 @@ void cedrus_prepare_format(struct v4l2_pix_format
> *pix_fmt)
> break;
>
> case V4L2_PIX_FMT_NV12:
> + case V4L2_PIX_FMT_NV21:
> + case V4L2_PIX_FMT_YUV420:
> + case V4L2_PIX_FMT_YVU420:
> /* 16-aligned stride. */
> bytesperline = ALIGN(width, 16);
>
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] media: cedrus: Add support for additional output formats
2025-06-30 19:16 ` Nicolas Dufresne
@ 2025-06-30 20:33 ` Paul Kocialkowski
0 siblings, 0 replies; 3+ messages in thread
From: Paul Kocialkowski @ 2025-06-30 20:33 UTC (permalink / raw)
To: Nicolas Dufresne
Cc: linux-media, linux-staging, linux-arm-kernel, linux-sunxi,
linux-kernel, Mauro Carvalho Chehab, Chen-Yu Tsai, Jernej Skrabec,
Samuel Holland, Hans Verkuil, Jernej Skrabec
[-- Attachment #1: Type: text/plain, Size: 3914 bytes --]
Hi Nicolas,
Le Mon 30 Jun 25, 15:16, Nicolas Dufresne a écrit :
>
> Hi Paul, Jernej,
>
> Le vendredi 23 mai 2025 à 17:43 +0200, Paul Kocialkowski a écrit :
> > From: Jernej Skrabec <jernej.skrabec@siol.net>
> >
> > If VPU supports untiled output, it actually supports several different
> > YUV 4:2:0 layouts, namely NV12, NV21, YUV420 and YVU420.
> >
> > Add support for all of them.
> >
> > Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
> > Reviewed-by: Paul Kocialkowski <paulk@sys-base.io>
> > ---
> >
> > Looks like this patch never made it, sorry about that.
> > I've rebased it atop media/next and added my Reviewed-by tag.
> > ---
> > drivers/staging/media/sunxi/cedrus/cedrus_hw.c | 18 +++++++++++++++++-
> > .../staging/media/sunxi/cedrus/cedrus_video.c | 18 ++++++++++++++++++
> > 2 files changed, 35 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_hw.c
> > b/drivers/staging/media/sunxi/cedrus/cedrus_hw.c
> > index 32af0e96e762..168d89c5a16d 100644
> > --- a/drivers/staging/media/sunxi/cedrus/cedrus_hw.c
> > +++ b/drivers/staging/media/sunxi/cedrus/cedrus_hw.c
> > @@ -86,9 +86,25 @@ void cedrus_dst_format_set(struct cedrus_dev *dev,
> >
> > switch (fmt->pixelformat) {
> > case V4L2_PIX_FMT_NV12:
> > + case V4L2_PIX_FMT_NV21:
> > + case V4L2_PIX_FMT_YUV420:
> > + case V4L2_PIX_FMT_YVU420:
> > chroma_size = ALIGN(width, 16) * ALIGN(height, 16) / 2;
> >
> > - reg = VE_PRIMARY_OUT_FMT_NV12;
> > + switch (fmt->pixelformat) {
> > + case V4L2_PIX_FMT_NV12:
> > + reg = VE_PRIMARY_OUT_FMT_NV12;
> > + break;
> > + case V4L2_PIX_FMT_NV21:
> > + reg = VE_PRIMARY_OUT_FMT_NV21;
> > + break;
> > + case V4L2_PIX_FMT_YUV420:
> > + reg = VE_PRIMARY_OUT_FMT_YU12;
> > + break;
> > + case V4L2_PIX_FMT_YVU420:
>
> Just so its recorded, Hans added a default: case here while applying.
Thanks for the notification! I would maybe have selected NV12 instead but
I guess it doesn't really matter all that much since there should be layers
of checking before this is reached.
All the best,
Paul
> regards,
> Nicolas
>
> > + reg = VE_PRIMARY_OUT_FMT_YV12;
> > + break;
> > + }
> > cedrus_write(dev, VE_PRIMARY_OUT_FMT, reg);
> >
> > reg = chroma_size / 2;
> > diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_video.c
> > b/drivers/staging/media/sunxi/cedrus/cedrus_video.c
> > index 77f78266f406..9fae2c7493d0 100644
> > --- a/drivers/staging/media/sunxi/cedrus/cedrus_video.c
> > +++ b/drivers/staging/media/sunxi/cedrus/cedrus_video.c
> > @@ -64,6 +64,21 @@ static struct cedrus_format cedrus_formats[] = {
> > .pixelformat = V4L2_PIX_FMT_NV12_32L32,
> > .directions = CEDRUS_DECODE_DST,
> > },
> > + {
> > + .pixelformat = V4L2_PIX_FMT_NV21,
> > + .directions = CEDRUS_DECODE_DST,
> > + .capabilities = CEDRUS_CAPABILITY_UNTILED,
> > + },
> > + {
> > + .pixelformat = V4L2_PIX_FMT_YUV420,
> > + .directions = CEDRUS_DECODE_DST,
> > + .capabilities = CEDRUS_CAPABILITY_UNTILED,
> > + },
> > + {
> > + .pixelformat = V4L2_PIX_FMT_YVU420,
> > + .directions = CEDRUS_DECODE_DST,
> > + .capabilities = CEDRUS_CAPABILITY_UNTILED,
> > + },
> > };
> >
> > #define CEDRUS_FORMATS_COUNT ARRAY_SIZE(cedrus_formats)
> > @@ -140,6 +155,9 @@ void cedrus_prepare_format(struct v4l2_pix_format
> > *pix_fmt)
> > break;
> >
> > case V4L2_PIX_FMT_NV12:
> > + case V4L2_PIX_FMT_NV21:
> > + case V4L2_PIX_FMT_YUV420:
> > + case V4L2_PIX_FMT_YVU420:
> > /* 16-aligned stride. */
> > bytesperline = ALIGN(width, 16);
> >
--
Paul Kocialkowski,
Independent contractor - sys-base - https://www.sys-base.io/
Free software developer - https://www.paulk.fr/
Expert in multimedia, graphics and embedded hardware support with Linux.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-06-30 20:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-23 15:43 [PATCH] media: cedrus: Add support for additional output formats Paul Kocialkowski
2025-06-30 19:16 ` Nicolas Dufresne
2025-06-30 20:33 ` Paul Kocialkowski
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).