[PATCH] drm/amd/display: Fix COLOR_SPACE_YCBCR2020_TYPE matrix

2023-01-10 Thread Joshua Ashton
The YCC conversion matrix for RGB -> COLOR_SPACE_YCBCR2020_TYPE is
missing the values for the fourth column of the matrix.

The fourth column of the matrix is essentially just a value that is
added given that the color is 3 components in size.
These values are needed to bias the chroma from the [-1, 1] -> [0, 1]
range.

This fixes color being very green when using Gamescope HDR on HDMI
output which prefers YCC 4:4:4.

Signed-off-by: Joshua Ashton 
---
 drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c 
b/drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c
index 471078fc3900..652270a0b498 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c
@@ -90,8 +90,8 @@ static const struct out_csc_color_matrix_type 
output_csc_matrix[] = {
{ 0xE00, 0xF349, 0xFEB7, 0x1000, 0x6CE, 0x16E3,
0x24F, 0x200, 0xFCCB, 0xF535, 0xE00, 0x1000} },
{ COLOR_SPACE_YCBCR2020_TYPE,
-   { 0x1000, 0xF149, 0xFEB7, 0x, 0x0868, 0x15B2,
-   0x01E6, 0x, 0xFB88, 0xF478, 0x1000, 0x} 
},
+   { 0x1000, 0xF149, 0xFEB7, 0x1004, 0x0868, 0x15B2,
+   0x01E6, 0x201, 0xFB88, 0xF478, 0x1000, 0x1004} 
},
{ COLOR_SPACE_YCBCR709_BLACK_TYPE,
{ 0x, 0x, 0x, 0x1000, 0x, 0x,
0x, 0x0200, 0x, 0x, 0x, 0x1000} 
},
-- 
2.39.0



Re: [PATCH] drm/amd/display: Fix COLOR_SPACE_YCBCR2020_TYPE matrix

2023-01-16 Thread Melissa Wen

On 01/10, Joshua Ashton wrote:

The YCC conversion matrix for RGB -> COLOR_SPACE_YCBCR2020_TYPE is
missing the values for the fourth column of the matrix.

The fourth column of the matrix is essentially just a value that is
added given that the color is 3 components in size.
These values are needed to bias the chroma from the [-1, 1] -> [0, 1]
range.

This fixes color being very green when using Gamescope HDR on HDMI
output which prefers YCC 4:4:4.

Signed-off-by: Joshua Ashton 
---
 drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c 
b/drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c
index 471078fc3900..652270a0b498 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c
@@ -90,8 +90,8 @@ static const struct out_csc_color_matrix_type 
output_csc_matrix[] = {
{ 0xE00, 0xF349, 0xFEB7, 0x1000, 0x6CE, 0x16E3,
0x24F, 0x200, 0xFCCB, 0xF535, 0xE00, 0x1000} },
{ COLOR_SPACE_YCBCR2020_TYPE,
-   { 0x1000, 0xF149, 0xFEB7, 0x, 0x0868, 0x15B2,
-   0x01E6, 0x, 0xFB88, 0xF478, 0x1000, 0x} 
},
+   { 0x1000, 0xF149, 0xFEB7, 0x1004, 0x0868, 0x15B2,
+   0x01E6, 0x201, 0xFB88, 0xF478, 0x1000, 0x1004} 
},


LGTM.

I'd also add a fixes tag here to:

Fixes: 40df2f809e8f ("drm/amd/display: color space ycbcr709 support")

Thanks,

Reviewed-by: Melissa Wen 


{ COLOR_SPACE_YCBCR709_BLACK_TYPE,
{ 0x, 0x, 0x, 0x1000, 0x, 0x,
0x, 0x0200, 0x, 0x, 0x, 0x1000} 
},
--
2.39.0





Re: [PATCH] drm/amd/display: Fix COLOR_SPACE_YCBCR2020_TYPE matrix

2023-01-16 Thread Alex Deucher
Applied with the fixes tag.

Thanks,

Alex

On Mon, Jan 16, 2023 at 9:50 AM Melissa Wen  wrote:
>
> On 01/10, Joshua Ashton wrote:
> > The YCC conversion matrix for RGB -> COLOR_SPACE_YCBCR2020_TYPE is
> > missing the values for the fourth column of the matrix.
> >
> > The fourth column of the matrix is essentially just a value that is
> > added given that the color is 3 components in size.
> > These values are needed to bias the chroma from the [-1, 1] -> [0, 1]
> > range.
> >
> > This fixes color being very green when using Gamescope HDR on HDMI
> > output which prefers YCC 4:4:4.
> >
> > Signed-off-by: Joshua Ashton 
> > ---
> >  drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c 
> > b/drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c
> > index 471078fc3900..652270a0b498 100644
> > --- a/drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c
> > +++ b/drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c
> > @@ -90,8 +90,8 @@ static const struct out_csc_color_matrix_type 
> > output_csc_matrix[] = {
> >   { 0xE00, 0xF349, 0xFEB7, 0x1000, 0x6CE, 0x16E3,
> >   0x24F, 0x200, 0xFCCB, 0xF535, 0xE00, 0x1000} 
> > },
> >   { COLOR_SPACE_YCBCR2020_TYPE,
> > - { 0x1000, 0xF149, 0xFEB7, 0x, 0x0868, 0x15B2,
> > - 0x01E6, 0x, 0xFB88, 0xF478, 0x1000, 
> > 0x} },
> > + { 0x1000, 0xF149, 0xFEB7, 0x1004, 0x0868, 0x15B2,
> > + 0x01E6, 0x201, 0xFB88, 0xF478, 0x1000, 
> > 0x1004} },
>
> LGTM.
>
> I'd also add a fixes tag here to:
>
> Fixes: 40df2f809e8f ("drm/amd/display: color space ycbcr709 support")
>
> Thanks,
>
> Reviewed-by: Melissa Wen 
>
> >   { COLOR_SPACE_YCBCR709_BLACK_TYPE,
> >   { 0x, 0x, 0x, 0x1000, 0x, 0x,
> >   0x, 0x0200, 0x, 0x, 0x, 
> > 0x1000} },
> > --
> > 2.39.0
> >
>