[08/11] media: cedrus: prefer untiled capture format

Message ID 20221024201515.34129-9-jernej.skrabec@gmail.com
State New
Headers
Series media: cedrus: Format handling improvements and 10-bit HEVC support |

Commit Message

Jernej Škrabec Oct. 24, 2022, 8:15 p.m. UTC
  While all generations of display engine on Allwinner SoCs support
untiled format, only first generation supports tiled format.  Let's
move untiled format up, so it can be picked before tiled one. If
Cedrus variant doesn't support untiled format, tiled will still be
picked as default format.

Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
---
 drivers/staging/media/sunxi/cedrus/cedrus_video.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
  

Comments

Paul Kocialkowski Oct. 25, 2022, 3:05 p.m. UTC | #1
Hi Jernej,

On Mon 24 Oct 22, 22:15, Jernej Skrabec wrote:
> While all generations of display engine on Allwinner SoCs support
> untiled format, only first generation supports tiled format.  Let's
> move untiled format up, so it can be picked before tiled one. If
> Cedrus variant doesn't support untiled format, tiled will still be
> picked as default format.

Makes sense to me. Of course the order shouldn't matter to smart-enough
userspace but it doesn't hurt to serve the most generic case first.

Acked-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>

Cheers,

Paul

> Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
> ---
>  drivers/staging/media/sunxi/cedrus/cedrus_video.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_video.c b/drivers/staging/media/sunxi/cedrus/cedrus_video.c
> index 3591bf9d7d9c..f9f723ea3f79 100644
> --- a/drivers/staging/media/sunxi/cedrus/cedrus_video.c
> +++ b/drivers/staging/media/sunxi/cedrus/cedrus_video.c
> @@ -56,13 +56,13 @@ static struct cedrus_format cedrus_formats[] = {
>  		.capabilities	= CEDRUS_CAPABILITY_VP8_DEC,
>  	},
>  	{
> -		.pixelformat	= V4L2_PIX_FMT_NV12_32L32,
> +		.pixelformat	= V4L2_PIX_FMT_NV12,
>  		.directions	= CEDRUS_DECODE_DST,
> +		.capabilities	= CEDRUS_CAPABILITY_UNTILED,
>  	},
>  	{
> -		.pixelformat	= V4L2_PIX_FMT_NV12,
> +		.pixelformat	= V4L2_PIX_FMT_NV12_32L32,
>  		.directions	= CEDRUS_DECODE_DST,
> -		.capabilities	= CEDRUS_CAPABILITY_UNTILED,
>  	},
>  };
>  
> -- 
> 2.38.1
>
  
Jernej Škrabec Oct. 25, 2022, 3:15 p.m. UTC | #2
Dne torek, 25. oktober 2022 ob 17:05:16 CEST je Paul Kocialkowski napisal(a):
> Hi Jernej,
> 
> On Mon 24 Oct 22, 22:15, Jernej Skrabec wrote:
> > While all generations of display engine on Allwinner SoCs support
> > untiled format, only first generation supports tiled format.  Let's
> > move untiled format up, so it can be picked before tiled one. If
> > Cedrus variant doesn't support untiled format, tiled will still be
> > picked as default format.
> 
> Makes sense to me. Of course the order shouldn't matter to smart-enough
> userspace but it doesn't hurt to serve the most generic case first.

Per Documentation/userspace-api/media/v4l/dev-stateless-decoder.rst driver 
should select most appropriate format for current platform by default. Setting 
capture format is optional by aforementioned document.

Best regards,
Jernej

> 
> Acked-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
> 
> Cheers,
> 
> Paul
> 
> > Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
> > ---
> > 
> >  drivers/staging/media/sunxi/cedrus/cedrus_video.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_video.c
> > b/drivers/staging/media/sunxi/cedrus/cedrus_video.c index
> > 3591bf9d7d9c..f9f723ea3f79 100644
> > --- a/drivers/staging/media/sunxi/cedrus/cedrus_video.c
> > +++ b/drivers/staging/media/sunxi/cedrus/cedrus_video.c
> > @@ -56,13 +56,13 @@ static struct cedrus_format cedrus_formats[] = {
> > 
> >  		.capabilities	= CEDRUS_CAPABILITY_VP8_DEC,
> >  	
> >  	},
> >  	{
> > 
> > -		.pixelformat	= V4L2_PIX_FMT_NV12_32L32,
> > +		.pixelformat	= V4L2_PIX_FMT_NV12,
> > 
> >  		.directions	= CEDRUS_DECODE_DST,
> > 
> > +		.capabilities	= CEDRUS_CAPABILITY_UNTILED,
> > 
> >  	},
> >  	{
> > 
> > -		.pixelformat	= V4L2_PIX_FMT_NV12,
> > +		.pixelformat	= V4L2_PIX_FMT_NV12_32L32,
> > 
> >  		.directions	= CEDRUS_DECODE_DST,
> > 
> > -		.capabilities	= CEDRUS_CAPABILITY_UNTILED,
> > 
> >  	},
> >  
> >  };
  

Patch

diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_video.c b/drivers/staging/media/sunxi/cedrus/cedrus_video.c
index 3591bf9d7d9c..f9f723ea3f79 100644
--- a/drivers/staging/media/sunxi/cedrus/cedrus_video.c
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_video.c
@@ -56,13 +56,13 @@  static struct cedrus_format cedrus_formats[] = {
 		.capabilities	= CEDRUS_CAPABILITY_VP8_DEC,
 	},
 	{
-		.pixelformat	= V4L2_PIX_FMT_NV12_32L32,
+		.pixelformat	= V4L2_PIX_FMT_NV12,
 		.directions	= CEDRUS_DECODE_DST,
+		.capabilities	= CEDRUS_CAPABILITY_UNTILED,
 	},
 	{
-		.pixelformat	= V4L2_PIX_FMT_NV12,
+		.pixelformat	= V4L2_PIX_FMT_NV12_32L32,
 		.directions	= CEDRUS_DECODE_DST,
-		.capabilities	= CEDRUS_CAPABILITY_UNTILED,
 	},
 };