Skip to contentSkip to conversation

fix green/pink color distortion from HDR set during vendor Uboot

PATCH In review Mathias Steiger 2 participants 4 messages Apr 19, 2021 – Apr 26, 2021

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

PATCH 1/1 fix green/pink color distortion from HDR set during vendor Uboot

I also wrote a program to set this via /dev/mem from user space: https://github.com/ballerburg9005/android-tvbox-2-linux-pc-and-server/blob/main/fix_greenpink.c .

drivers/gpu/drm/meson/meson_drv.c +0 -0
index 453d8b4c5..7d929b5b2 100644
@@ -308,6 +308,10 @@ static int meson_drv_bind_master(struct device *dev, bool has_components)

        drm->mode_config.funcs = &meson_mode_config_funcs; drm->mode_config.helper_private = &meson_mode_config_helpers;

+       /* undo settings made in vendor Uboot */
+
+       writel_bits_relaxed(15 << 13, 0, priv->io_base + _REG(OSD1_HDR2_CTRL)); // fixes green/pink color distortion - reg_only_mat must be 0 +
        /* Hardware Initialization */

        meson_vpu_init(priv);

drivers/gpu/drm/meson/meson_registers.h +0 -0
index 446e7961d..91351f9a3 100644
@@ -634,6 +634,9 @@

 #define VPP_WRAP_OSD3_MATRIX_PRE_OFFSET2 0x3dbc
 #define VPP_WRAP_OSD3_MATRIX_EN_CTRL 0x3dbd

+/* osd1 HDR */
+#define OSD1_HDR2_CTRL 0x38a0
+
 /* osd2 scaler */
 #define OSD2_VSC_PHASE_STEP 0x3d00
 #define OSD2_VSC_INI_PHASE 0x3d01

_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic

#1 lore raw

Hi,

Thanks for looking at this !

The subject should be :
"drm/meson: fix green/pink color distortion from HDR set during vendor Uboot"

Quoted 4 lines · Mathias Steiger

I also wrote a program to set this via /dev/mem from user space: https://github.com/ballerburg9005/android-tvbox-2-linux-pc-and-server/blob/main/fix_greenpink.c .

Please explicit here what the patch does, no need for the example program, the patch is self explicit.

Then add:

Fixes 728883948b0d ("drm/meson: Add G12A Support for VIU setup")

Finally, it also needs your sign-off at the end of your commit message, simply commit with "-s".

drivers/gpu/drm/meson/meson_drv.c static int meson_drv_bind_master(struct device *dev, bool has_components) · line 314

Quoted 13 lines
drivers/gpu/drm/meson/meson_drv.c +4 -0
index 453d8b4c5..7d929b5b2 100644
@@ -308,6 +308,10 @@ static int meson_drv_bind_master(struct device *dev, bool has_components)
         drm->mode_config.funcs = &meson_mode_config_funcs;
         drm->mode_config.helper_private = &meson_mode_config_helpers;
 
+       /* undo settings made in vendor Uboot */
+
+       writel_bits_relaxed(15 << 13, 0, priv->io_base + _REG(OSD1_HDR2_CTRL)); // fixes green/pink color distortion - reg_only_mat must be 0
+

This should go in meson_viu.c in meson_viu_init right after meson_viu_set_g12a_osd1_matrix() for VPU_COMPATIBLE_G12A (extend the else if case).

Please document the bits your write in meson_registers.h like:
#define OSD1_HDR2_CTRL_VDIN0_HDR2_TOP_EN BIT(13)

and same for bits mat_o_en and reg_out_fmt, then use them in writel_bits_relaxed()

Quoted 9 lines
drivers/gpu/drm/meson/meson_drv.c +0 -0
         /* Hardware Initialization */
 
         meson_vpu_init(priv);
drivers/gpu/drm/meson/meson_registers.h +0 -0
index 446e7961d..91351f9a3 100644

drivers/gpu/drm/meson/meson_registers.h line 642

Quoted 9 lines
drivers/gpu/drm/meson/meson_registers.h +3 -0
@@ -634,6 +634,9 @@
  #define VPP_WRAP_OSD3_MATRIX_PRE_OFFSET2 0x3dbc
  #define VPP_WRAP_OSD3_MATRIX_EN_CTRL 0x3dbd
 
+/* osd1 HDR */
+#define OSD1_HDR2_CTRL 0x38a0
+
  /* osd2 scaler */
  #define OSD2_VSC_PHASE_STEP 0x3d00
  #define OSD2_VSC_INI_PHASE 0x3d01

This part will be ok with the bits defined.

Quoted 5 lines

_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic

Neil

_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic

Tested-by
#2 lore raw
Quoted 13 lines · Neil Armstrong

Hi,

Thanks for looking at this !

The subject should be :
"drm/meson: fix green/pink color distortion from HDR set during vendor Uboot"

Quoted 4 lines · Mathias Steiger

I also wrote a program to set this via /dev/mem from user space: https://github.com/ballerburg9005/android-tvbox-2-linux-pc-and-server/blob/main/fix_greenpink.c .

Quoted 5 lines

Please explicit here what the patch does, no need for the example program, the patch is self explicit.

Then add:

Fixes 728883948b0d ("drm/meson: Add G12A Support for VIU setup")

I tested on a VIM3 with the vendor U-boot, and it works ! Thanks !

And please add to the v2 patch:

Thanks,
Neil

Quoted 48 lines

Finally, it also needs your sign-off at the end of your commit message, simply commit with "-s".

drivers/gpu/drm/meson/meson_drv.c static int meson_drv_bind_master(struct device *dev, bool has_components) · line 314

Quoted 13 lines
drivers/gpu/drm/meson/meson_drv.c +4 -0
index 453d8b4c5..7d929b5b2 100644
@@ -308,6 +308,10 @@ static int meson_drv_bind_master(struct device *dev, bool has_components)
         drm->mode_config.funcs = &meson_mode_config_funcs;
         drm->mode_config.helper_private = &meson_mode_config_helpers;
 
+       /* undo settings made in vendor Uboot */
+
+       writel_bits_relaxed(15 << 13, 0, priv->io_base + _REG(OSD1_HDR2_CTRL)); // fixes green/pink color distortion - reg_only_mat must be 0
+

This should go in meson_viu.c in meson_viu_init right after meson_viu_set_g12a_osd1_matrix() for VPU_COMPATIBLE_G12A (extend the else if case).

Please document the bits your write in meson_registers.h like:
#define OSD1_HDR2_CTRL_VDIN0_HDR2_TOP_EN BIT(13)

and same for bits mat_o_en and reg_out_fmt, then use them in writel_bits_relaxed()

Quoted 9 lines
drivers/gpu/drm/meson/meson_drv.c +0 -0
         /* Hardware Initialization */
 
         meson_vpu_init(priv);
drivers/gpu/drm/meson/meson_registers.h +0 -0
index 446e7961d..91351f9a3 100644

drivers/gpu/drm/meson/meson_registers.h line 642

Quoted 9 lines
drivers/gpu/drm/meson/meson_registers.h +3 -0
@@ -634,6 +634,9 @@
  #define VPP_WRAP_OSD3_MATRIX_PRE_OFFSET2 0x3dbc
  #define VPP_WRAP_OSD3_MATRIX_EN_CTRL 0x3dbd
 
+/* osd1 HDR */
+#define OSD1_HDR2_CTRL 0x38a0
+
  /* osd2 scaler */
  #define OSD2_VSC_PHASE_STEP 0x3d00
  #define OSD2_VSC_INI_PHASE 0x3d01

This part will be ok with the bits defined.

Quoted 1 line
Quoted 7 lines
Quoted 4 lines

_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic

Neil

_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic

#3 lore raw

Hi Mathias,

So you think you'll be able to send a v2 patch ?

Thanks,
Neil

Quoted 20 lines · Neil Armstrong
Quoted 13 lines · Neil Armstrong

Hi,

Thanks for looking at this !

The subject should be :
"drm/meson: fix green/pink color distortion from HDR set during vendor Uboot"

Quoted 4 lines · Mathias Steiger

I also wrote a program to set this via /dev/mem from user space: https://github.com/ballerburg9005/android-tvbox-2-linux-pc-and-server/blob/main/fix_greenpink.c .

Quoted 5 lines

Please explicit here what the patch does, no need for the example program, the patch is self explicit.

Then add:

Fixes 728883948b0d ("drm/meson: Add G12A Support for VIU setup")
Quoted 64 lines

I tested on a VIM3 with the vendor U-boot, and it works ! Thanks !

And please add to the v2 patch:

Thanks,
Neil

Quoted 55 lines

Finally, it also needs your sign-off at the end of your commit message, simply commit with "-s".

drivers/gpu/drm/meson/meson_drv.c static int meson_drv_bind_master(struct device *dev, bool has_components) · line 314

Quoted 13 lines
drivers/gpu/drm/meson/meson_drv.c +4 -0
index 453d8b4c5..7d929b5b2 100644
@@ -308,6 +308,10 @@ static int meson_drv_bind_master(struct device *dev, bool has_components)
         drm->mode_config.funcs = &meson_mode_config_funcs;
         drm->mode_config.helper_private = &meson_mode_config_helpers;
 
+       /* undo settings made in vendor Uboot */
+
+       writel_bits_relaxed(15 << 13, 0, priv->io_base + _REG(OSD1_HDR2_CTRL)); // fixes green/pink color distortion - reg_only_mat must be 0
+

This should go in meson_viu.c in meson_viu_init right after meson_viu_set_g12a_osd1_matrix() for VPU_COMPATIBLE_G12A (extend the else if case).

Please document the bits your write in meson_registers.h like:
#define OSD1_HDR2_CTRL_VDIN0_HDR2_TOP_EN BIT(13)

and same for bits mat_o_en and reg_out_fmt, then use them in writel_bits_relaxed()

Quoted 9 lines
drivers/gpu/drm/meson/meson_drv.c +0 -0
         /* Hardware Initialization */
 
         meson_vpu_init(priv);
drivers/gpu/drm/meson/meson_registers.h +0 -0
index 446e7961d..91351f9a3 100644

drivers/gpu/drm/meson/meson_registers.h line 642

Quoted 9 lines
drivers/gpu/drm/meson/meson_registers.h +3 -0
@@ -634,6 +634,9 @@
  #define VPP_WRAP_OSD3_MATRIX_PRE_OFFSET2 0x3dbc
  #define VPP_WRAP_OSD3_MATRIX_EN_CTRL 0x3dbd
 
+/* osd1 HDR */
+#define OSD1_HDR2_CTRL 0x38a0
+
  /* osd2 scaler */
  #define OSD2_VSC_PHASE_STEP 0x3d00
  #define OSD2_VSC_INI_PHASE 0x3d01

This part will be ok with the bits defined.

Quoted 5 lines

_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic

Neil

_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic