public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/sun4i: Fix DE2 YVU handling
@ 2020-09-01 22:03 Jernej Skrabec
  2020-09-02  7:01 ` Roman Stratiienko
  2020-09-04  9:06 ` Maxime Ripard
  0 siblings, 2 replies; 5+ messages in thread
From: Jernej Skrabec @ 2020-09-01 22:03 UTC (permalink / raw)
  To: mripard, wens
  Cc: jernej.skrabec, irlied, daniel, dri-devel, linux-arm-kernel,
	linux-kernel, Roman Stratiienko

Function sun8i_vi_layer_get_csc_mode() is supposed to return CSC mode
but due to inproper return type (bool instead of u32) it returns just 0
or 1. Colors are wrong for YVU formats because of that.

Fixes: daab3d0e8e2b ("drm/sun4i: de2: csc_mode in de2 format struct is mostly redundant")
Reported-by: Roman Stratiienko <r.stratiienko@gmail.com>
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
---
 drivers/gpu/drm/sun4i/sun8i_vi_layer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/sun4i/sun8i_vi_layer.c b/drivers/gpu/drm/sun4i/sun8i_vi_layer.c
index 22c8c5375d0d..c0147af6a840 100644
--- a/drivers/gpu/drm/sun4i/sun8i_vi_layer.c
+++ b/drivers/gpu/drm/sun4i/sun8i_vi_layer.c
@@ -211,7 +211,7 @@ static int sun8i_vi_layer_update_coord(struct sun8i_mixer *mixer, int channel,
 	return 0;
 }
 
-static bool sun8i_vi_layer_get_csc_mode(const struct drm_format_info *format)
+static u32 sun8i_vi_layer_get_csc_mode(const struct drm_format_info *format)
 {
 	if (!format->is_yuv)
 		return SUN8I_CSC_MODE_OFF;
-- 
2.28.0


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

* Re: [PATCH] drm/sun4i: Fix DE2 YVU handling
  2020-09-01 22:03 [PATCH] drm/sun4i: Fix DE2 YVU handling Jernej Skrabec
@ 2020-09-02  7:01 ` Roman Stratiienko
  2020-09-02 16:51   ` Jernej Škrabec
  2020-09-04  9:06 ` Maxime Ripard
  1 sibling, 1 reply; 5+ messages in thread
From: Roman Stratiienko @ 2020-09-02  7:01 UTC (permalink / raw)
  To: Jernej Skrabec
  Cc: mripard, wens, irlied, daniel, dri-devel, linux-arm-kernel,
	linux-kernel

ср, 2 сент. 2020 г. в 00:58, Jernej Skrabec <jernej.skrabec@siol.net>:
>
> Function sun8i_vi_layer_get_csc_mode() is supposed to return CSC mode
> but due to inproper return type (bool instead of u32) it returns just 0
> or 1. Colors are wrong for YVU formats because of that.
>
> Fixes: daab3d0e8e2b ("drm/sun4i: de2: csc_mode in de2 format struct is mostly redundant")
> Reported-by: Roman Stratiienko <r.stratiienko@gmail.com>
> Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
> ---
>  drivers/gpu/drm/sun4i/sun8i_vi_layer.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/sun4i/sun8i_vi_layer.c b/drivers/gpu/drm/sun4i/sun8i_vi_layer.c
> index 22c8c5375d0d..c0147af6a840 100644
> --- a/drivers/gpu/drm/sun4i/sun8i_vi_layer.c
> +++ b/drivers/gpu/drm/sun4i/sun8i_vi_layer.c
> @@ -211,7 +211,7 @@ static int sun8i_vi_layer_update_coord(struct sun8i_mixer *mixer, int channel,
>         return 0;
>  }
>
> -static bool sun8i_vi_layer_get_csc_mode(const struct drm_format_info *format)
> +static u32 sun8i_vi_layer_get_csc_mode(const struct drm_format_info *format)
>  {
>         if (!format->is_yuv)
>                 return SUN8I_CSC_MODE_OFF;
> --
> 2.28.0
>

Hi Jernej,

Thank you for the fix.
I can confirm this patch fixes the issue with wrong colors.

Let me share my thoughts:
I've looked into csc code, and it seems to me reordering U, V offsets
should be a much simpler solution than applying
color transformation matrices.It should also simplify adding more
color encodings in the future.

Regards,
Roman

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

* Re: [PATCH] drm/sun4i: Fix DE2 YVU handling
  2020-09-02  7:01 ` Roman Stratiienko
@ 2020-09-02 16:51   ` Jernej Škrabec
  2020-09-02 16:55     ` Roman Stratiienko
  0 siblings, 1 reply; 5+ messages in thread
From: Jernej Škrabec @ 2020-09-02 16:51 UTC (permalink / raw)
  To: Roman Stratiienko
  Cc: mripard, wens, irlied, daniel, dri-devel, linux-arm-kernel,
	linux-kernel

Dne sreda, 02. september 2020 ob 09:01:17 CEST je Roman Stratiienko 
napisal(a):
> ср, 2 сент. 2020 г. в 00:58, Jernej Skrabec <jernej.skrabec@siol.net>:
> > Function sun8i_vi_layer_get_csc_mode() is supposed to return CSC mode
> > but due to inproper return type (bool instead of u32) it returns just 0
> > or 1. Colors are wrong for YVU formats because of that.
> > 
> > Fixes: daab3d0e8e2b ("drm/sun4i: de2: csc_mode in de2 format struct is
> > mostly redundant") Reported-by: Roman Stratiienko
> > <r.stratiienko@gmail.com>
> > Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
> > ---
> > 
> >  drivers/gpu/drm/sun4i/sun8i_vi_layer.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/sun4i/sun8i_vi_layer.c
> > b/drivers/gpu/drm/sun4i/sun8i_vi_layer.c index 22c8c5375d0d..c0147af6a840
> > 100644
> > --- a/drivers/gpu/drm/sun4i/sun8i_vi_layer.c
> > +++ b/drivers/gpu/drm/sun4i/sun8i_vi_layer.c
> > @@ -211,7 +211,7 @@ static int sun8i_vi_layer_update_coord(struct
> > sun8i_mixer *mixer, int channel,> 
> >         return 0;
> >  
> >  }
> > 
> > -static bool sun8i_vi_layer_get_csc_mode(const struct drm_format_info
> > *format) +static u32 sun8i_vi_layer_get_csc_mode(const struct
> > drm_format_info *format)> 
> >  {
> >  
> >         if (!format->is_yuv)
> >         
> >                 return SUN8I_CSC_MODE_OFF;
> > 
> > --
> > 2.28.0
> 
> Hi Jernej,
> 
> Thank you for the fix.
> I can confirm this patch fixes the issue with wrong colors.

Thanks! Can I assume that this means your Tested-by tag can be added?

> 
> Let me share my thoughts:
> I've looked into csc code, and it seems to me reordering U, V offsets
> should be a much simpler solution than applying
> color transformation matrices.It should also simplify adding more
> color encodings in the future.

Switching offsets assumes that you have separate planes for U and V which may 
not be true in the future. I agree that CSC matrices are needlessly duplicated 
for handling U/V switch. I have a patch which reorganize matrix on the fly when 
coefficients are written in registers but since it's a part of a bigger, 
unfinished series, I didn't sent it out yet. Only difference in YUV and YVU CSC 
matrices are switched 2nd and 3rd column.

Best regards,
Jernej

> 
> Regards,
> Roman





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

* Re: [PATCH] drm/sun4i: Fix DE2 YVU handling
  2020-09-02 16:51   ` Jernej Škrabec
@ 2020-09-02 16:55     ` Roman Stratiienko
  0 siblings, 0 replies; 5+ messages in thread
From: Roman Stratiienko @ 2020-09-02 16:55 UTC (permalink / raw)
  To: Jernej Škrabec
  Cc: mripard, wens, irlied, Daniel Vetter, dri-devel, linux-arm-kernel,
	linux-kernel

ср, 2 сент. 2020 г. в 19:46, Jernej Škrabec <jernej.skrabec@siol.net>:
>
> Dne sreda, 02. september 2020 ob 09:01:17 CEST je Roman Stratiienko
> napisal(a):
> > ср, 2 сент. 2020 г. в 00:58, Jernej Skrabec <jernej.skrabec@siol.net>:
> > > Function sun8i_vi_layer_get_csc_mode() is supposed to return CSC mode
> > > but due to inproper return type (bool instead of u32) it returns just 0
> > > or 1. Colors are wrong for YVU formats because of that.
> > >
> > > Fixes: daab3d0e8e2b ("drm/sun4i: de2: csc_mode in de2 format struct is
> > > mostly redundant") Reported-by: Roman Stratiienko
> > > <r.stratiienko@gmail.com>
> > > Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
> > > ---
> > >
> > >  drivers/gpu/drm/sun4i/sun8i_vi_layer.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/gpu/drm/sun4i/sun8i_vi_layer.c
> > > b/drivers/gpu/drm/sun4i/sun8i_vi_layer.c index 22c8c5375d0d..c0147af6a840
> > > 100644
> > > --- a/drivers/gpu/drm/sun4i/sun8i_vi_layer.c
> > > +++ b/drivers/gpu/drm/sun4i/sun8i_vi_layer.c
> > > @@ -211,7 +211,7 @@ static int sun8i_vi_layer_update_coord(struct
> > > sun8i_mixer *mixer, int channel,>
> > >         return 0;
> > >
> > >  }
> > >
> > > -static bool sun8i_vi_layer_get_csc_mode(const struct drm_format_info
> > > *format) +static u32 sun8i_vi_layer_get_csc_mode(const struct
> > > drm_format_info *format)>
> > >  {
> > >
> > >         if (!format->is_yuv)
> > >
> > >                 return SUN8I_CSC_MODE_OFF;
> > >
> > > --
> > > 2.28.0
> >
> > Hi Jernej,
> >
> > Thank you for the fix.
> > I can confirm this patch fixes the issue with wrong colors.
>
> Thanks! Can I assume that this means your Tested-by tag can be added?

Sure.

Tested-by: Roman Stratiienko <r.stratiienko@gmail.com>

>
> >
> > Let me share my thoughts:
> > I've looked into csc code, and it seems to me reordering U, V offsets
> > should be a much simpler solution than applying
> > color transformation matrices.It should also simplify adding more
> > color encodings in the future.
>
> Switching offsets assumes that you have separate planes for U and V which may
> not be true in the future. I agree that CSC matrices are needlessly duplicated
> for handling U/V switch. I have a patch which reorganize matrix on the fly when
> coefficients are written in registers but since it's a part of a bigger,
> unfinished series, I didn't sent it out yet. Only difference in YUV and YVU CSC
> matrices are switched 2nd and 3rd column.

This sounds reasonable. Thank you for your explanation.

Regards,
Roman

>
> Best regards,
> Jernej
>
> >
> > Regards,
> > Roman
>
>
>
>

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

* Re: [PATCH] drm/sun4i: Fix DE2 YVU handling
  2020-09-01 22:03 [PATCH] drm/sun4i: Fix DE2 YVU handling Jernej Skrabec
  2020-09-02  7:01 ` Roman Stratiienko
@ 2020-09-04  9:06 ` Maxime Ripard
  1 sibling, 0 replies; 5+ messages in thread
From: Maxime Ripard @ 2020-09-04  9:06 UTC (permalink / raw)
  To: Jernej Skrabec
  Cc: wens, irlied, daniel, dri-devel, linux-arm-kernel, linux-kernel,
	Roman Stratiienko

[-- Attachment #1: Type: text/plain, Size: 516 bytes --]

On Wed, Sep 02, 2020 at 12:03:05AM +0200, Jernej Skrabec wrote:
> Function sun8i_vi_layer_get_csc_mode() is supposed to return CSC mode
> but due to inproper return type (bool instead of u32) it returns just 0
> or 1. Colors are wrong for YVU formats because of that.
> 
> Fixes: daab3d0e8e2b ("drm/sun4i: de2: csc_mode in de2 format struct is mostly redundant")
> Reported-by: Roman Stratiienko <r.stratiienko@gmail.com>
> Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>

Applied, thanks!
Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

end of thread, other threads:[~2020-09-04  9:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-01 22:03 [PATCH] drm/sun4i: Fix DE2 YVU handling Jernej Skrabec
2020-09-02  7:01 ` Roman Stratiienko
2020-09-02 16:51   ` Jernej Škrabec
2020-09-02 16:55     ` Roman Stratiienko
2020-09-04  9:06 ` Maxime Ripard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox