Skip to contentSkip to conversation

drm/sun4i: Fix DE2 YVU handling

PATCH Applied Jernej Skrabec 3 participants 5 messages Sep 1, 2020 – Sep 4, 2020

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/sun4i: Fix DE2 YVU handling

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")
---
 drivers/gpu/drm/sun4i/sun8i_vi_layer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/sun4i/sun8i_vi_layer.c +1 -1
index 22c8c5375d0d..c0147af6a840 100644
@@ -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;
Signature · 1 line
2.28.0
#1 lore raw

ср, 2 сент. 2020 г. в 00:58, Jernej Skrabec <[email protected]>:

Quoted 26 lines

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")
---
 drivers/gpu/drm/sun4i/sun8i_vi_layer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/sun4i/sun8i_vi_layer.c +1 -2
index 22c8c5375d0d..c0147af6a840 100644
@@ -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;
--
Quoted 2 lines

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

#2 lore raw

Dne sreda, 02. september 2020 ob 09:01:17 CEST je Roman Stratiienko napisal(a):

Quoted 34 lines

ср, 2 сент. 2020 г. в 00:58, Jernej Skrabec <[email protected]>:

Quoted 33 lines

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
<[email protected]>

---

 drivers/gpu/drm/sun4i/sun8i_vi_layer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/sun4i/sun8i_vi_layer.c index 22c8c5375d0d..c0147af6a840 100644

drivers/gpu/drm/sun4i/sun8i_vi_layer.c +0 -0
@@ -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;
Quoted 7 lines
Quoted 2 lines

--
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?

Quoted 6 lines

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

Quoted 3 lines

Regards,
Roman

#3 lore raw

ср, 2 сент. 2020 г. в 19:46, Jernej Škrabec <[email protected]>:

Quoted 42 lines

Dne sreda, 02. september 2020 ob 09:01:17 CEST je Roman Stratiienko napisal(a):

Quoted 39 lines

ср, 2 сент. 2020 г. в 00:58, Jernej Skrabec <[email protected]>:

Quoted 29 lines

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
<[email protected]>

---

 drivers/gpu/drm/sun4i/sun8i_vi_layer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/sun4i/sun8i_vi_layer.c index 22c8c5375d0d..c0147af6a840 100644

drivers/gpu/drm/sun4i/sun8i_vi_layer.c +0 -0
@@ -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)>
{

Quoted 6 lines
        if (!format->is_yuv)

                return SUN8I_CSC_MODE_OFF;

--
2.28.0

Hi Jernej,

Quoted 4 lines
Quoted 2 lines

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.

Quoted 8 lines
Quoted 7 lines

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.

Quoted 6 lines

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

Quoted 11 lines

Best regards,
Jernej

Quoted 3 lines

Regards,
Roman

#4 lore raw
In reply to Jernej Skrabec
Quoted 7 lines · Jernej Skrabec

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

Applied, thanks!
Maxime