Linux-Amlogic Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] fix green/pink color distortion from HDR set during vendor Uboot
@ 2021-04-19 14:33 Mathias Steiger
  2021-04-19 14:50 ` Neil Armstrong
  0 siblings, 1 reply; 4+ messages in thread
From: Mathias Steiger @ 2021-04-19 14:33 UTC (permalink / raw)
  To: linux-amlogic


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 
.



diff --git a/drivers/gpu/drm/meson/meson_drv.c 
b/drivers/gpu/drm/meson/meson_drv.c
index 453d8b4c5..7d929b5b2 100644
--- a/drivers/gpu/drm/meson/meson_drv.c
+++ b/drivers/gpu/drm/meson/meson_drv.c
@@ -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);
diff --git a/drivers/gpu/drm/meson/meson_registers.h 
b/drivers/gpu/drm/meson/meson_registers.h
index 446e7961d..91351f9a3 100644
--- a/drivers/gpu/drm/meson/meson_registers.h
+++ b/drivers/gpu/drm/meson/meson_registers.h
@@ -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
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [PATCH] fix green/pink color distortion from HDR set during vendor Uboot
  2021-04-19 14:33 [PATCH] fix green/pink color distortion from HDR set during vendor Uboot Mathias Steiger
@ 2021-04-19 14:50 ` Neil Armstrong
  2021-04-20 13:01   ` Neil Armstrong
  0 siblings, 1 reply; 4+ messages in thread
From: Neil Armstrong @ 2021-04-19 14:50 UTC (permalink / raw)
  To: Mathias Steiger, linux-amlogic

Hi,

Thanks for looking at this !

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

On 19/04/2021 16:33, Mathias Steiger wrote:
> 
> 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".


> 
> diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c
> index 453d8b4c5..7d929b5b2 100644
> --- a/drivers/gpu/drm/meson/meson_drv.c
> +++ b/drivers/gpu/drm/meson/meson_drv.c
> @@ -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()

>         /* Hardware Initialization */
> 
>         meson_vpu_init(priv);
> diff --git a/drivers/gpu/drm/meson/meson_registers.h b/drivers/gpu/drm/meson/meson_registers.h
> index 446e7961d..91351f9a3 100644
> --- a/drivers/gpu/drm/meson/meson_registers.h
> +++ b/drivers/gpu/drm/meson/meson_registers.h
> @@ -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.

> 
> _______________________________________________
> linux-amlogic mailing list
> linux-amlogic@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-amlogic

Neil

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [PATCH] fix green/pink color distortion from HDR set during vendor Uboot
  2021-04-19 14:50 ` Neil Armstrong
@ 2021-04-20 13:01   ` Neil Armstrong
  2021-04-26 18:01     ` Neil Armstrong
  0 siblings, 1 reply; 4+ messages in thread
From: Neil Armstrong @ 2021-04-20 13:01 UTC (permalink / raw)
  To: Mathias Steiger, linux-amlogic

On 19/04/2021 16:50, Neil Armstrong wrote:
> Hi,
> 
> Thanks for looking at this !
> 
> The subject should be :
> "drm/meson: fix green/pink color distortion from HDR set during vendor Uboot"
> 
> On 19/04/2021 16:33, Mathias Steiger wrote:
>>
>> 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")

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

And please add to the v2 patch:
Tested-by: Neil Armstrong <narmstrong@baylibre.com>

Thanks,
Neil

> 
> Finally, it also needs your sign-off at the end of your commit message, simply commit with "-s".
> 
> 
>>
>> diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c
>> index 453d8b4c5..7d929b5b2 100644
>> --- a/drivers/gpu/drm/meson/meson_drv.c
>> +++ b/drivers/gpu/drm/meson/meson_drv.c
>> @@ -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()
> 
>>         /* Hardware Initialization */
>>
>>         meson_vpu_init(priv);
>> diff --git a/drivers/gpu/drm/meson/meson_registers.h b/drivers/gpu/drm/meson/meson_registers.h
>> index 446e7961d..91351f9a3 100644
>> --- a/drivers/gpu/drm/meson/meson_registers.h
>> +++ b/drivers/gpu/drm/meson/meson_registers.h
>> @@ -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.
> 
>>
>> _______________________________________________
>> linux-amlogic mailing list
>> linux-amlogic@lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/linux-amlogic
> 
> Neil
> 


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [PATCH] fix green/pink color distortion from HDR set during vendor Uboot
  2021-04-20 13:01   ` Neil Armstrong
@ 2021-04-26 18:01     ` Neil Armstrong
  0 siblings, 0 replies; 4+ messages in thread
From: Neil Armstrong @ 2021-04-26 18:01 UTC (permalink / raw)
  To: Mathias Steiger, linux-amlogic

Hi Mathias,

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

Thanks,
Neil

On 20/04/2021 15:01, Neil Armstrong wrote:
> On 19/04/2021 16:50, Neil Armstrong wrote:
>> Hi,
>>
>> Thanks for looking at this !
>>
>> The subject should be :
>> "drm/meson: fix green/pink color distortion from HDR set during vendor Uboot"
>>
>> On 19/04/2021 16:33, Mathias Steiger wrote:
>>>
>>> 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")
> 
> I tested on a VIM3 with the vendor U-boot, and it works ! Thanks !
> 
> And please add to the v2 patch:
> Tested-by: Neil Armstrong <narmstrong@baylibre.com>
> 
> Thanks,
> Neil
> 
>>
>> Finally, it also needs your sign-off at the end of your commit message, simply commit with "-s".
>>
>>
>>>
>>> diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c
>>> index 453d8b4c5..7d929b5b2 100644
>>> --- a/drivers/gpu/drm/meson/meson_drv.c
>>> +++ b/drivers/gpu/drm/meson/meson_drv.c
>>> @@ -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()
>>
>>>         /* Hardware Initialization */
>>>
>>>         meson_vpu_init(priv);
>>> diff --git a/drivers/gpu/drm/meson/meson_registers.h b/drivers/gpu/drm/meson/meson_registers.h
>>> index 446e7961d..91351f9a3 100644
>>> --- a/drivers/gpu/drm/meson/meson_registers.h
>>> +++ b/drivers/gpu/drm/meson/meson_registers.h
>>> @@ -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.
>>
>>>
>>> _______________________________________________
>>> linux-amlogic mailing list
>>> linux-amlogic@lists.infradead.org
>>> http://lists.infradead.org/mailman/listinfo/linux-amlogic
>>
>> Neil
>>
> 


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-19 14:33 [PATCH] fix green/pink color distortion from HDR set during vendor Uboot Mathias Steiger
2021-04-19 14:50 ` Neil Armstrong
2021-04-20 13:01   ` Neil Armstrong
2021-04-26 18:01     ` Neil Armstrong

Linux-Amlogic Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-amlogic/0 linux-amlogic/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-amlogic linux-amlogic/ https://lore.kernel.org/linux-amlogic \
		linux-amlogic@lists.infradead.org
	public-inbox-index linux-amlogic

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.infradead.lists.linux-amlogic


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git