diff mbox series

drm/i915/icl: Handle YCbCr to RGB conversion for BT2020 case

Message ID 20190507130257.22837-2-shashank.sharma@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915/icl: Handle YCbCr to RGB conversion for BT2020 case | expand

Commit Message

Sharma, Shashank May 7, 2019, 1:02 p.m. UTC
From: Uma Shankar <uma.shankar@intel.com>

Currently input csc for YCbCR to RGB conversion handles only
BT601 and Bt709. Extending it to support BT2020 as well.

Signed-off-by: Uma Shankar <uma.shankar@intel.com>
Signed-off-by: Shashank Sharma <shashank.sharma@intel.com>
---
 drivers/gpu/drm/i915/intel_sprite.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

Comments

Ville Syrjälä May 7, 2019, 2:06 p.m. UTC | #1
On Tue, May 07, 2019 at 06:32:57PM +0530, Shashank Sharma wrote:
> From: Uma Shankar <uma.shankar@intel.com>
> 
> Currently input csc for YCbCR to RGB conversion handles only
> BT601 and Bt709. Extending it to support BT2020 as well.
> 
> Signed-off-by: Uma Shankar <uma.shankar@intel.com>
> Signed-off-by: Shashank Sharma <shashank.sharma@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_sprite.c | 24 ++++++++++++++++++++++++
>  1 file changed, 24 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
> index 44aaeac1b2ed..2536e757bec2 100644
> --- a/drivers/gpu/drm/i915/intel_sprite.c
> +++ b/drivers/gpu/drm/i915/intel_sprite.c
> @@ -433,6 +433,18 @@ icl_program_input_csc(struct intel_plane *plane,
>  			0x9EF8, 0x7800, 0xABF8,
>  			0x0, 0x7800,  0x7ED8,
>  		},
> +		/*
> +		 * BT.2020 full range YCbCr -> full range RGB
> +		 * The matrix required is :
> +		 * [1.000, 0.000, 1.474,
> +		 *  1.000, -0.1645, -0.5713,
> +		 *  1.000, 1.8814, 0.0000]
> +		 */
> +		[DRM_COLOR_YCBCR_BT2020] = {
> +			0x7BC8, 0x7800, 0x0,
> +			0x8928, 0x7800, 0xAA88,
> +			0x0, 0x7800, 0x7F10,
> +		},
>  	};
>  
>  	/* Matrix for Limited Range to Full Range Conversion */
> @@ -461,6 +473,18 @@ icl_program_input_csc(struct intel_plane *plane,
>  			0x8888, 0x7918, 0xADA8,
>  			0x0, 0x7918,  0x6870,
>  		},
> +		/*
> +		 * BT.2020 Limited range YCbCr -> full range RGB
> +		 * The matrix required is :
> +		 * [1.164, 0.000, 1.717,
> +		 *  1.138, -0.1873, -0.6504,
> +		 *  1.1380, 2.1417, 0.0000]

Where are those 1.138 coming from?

> +		 */
> +		[DRM_COLOR_YCBCR_BT2020] = {
> +			0x7DC0, 0x7950, 0x0,
> +			0x8A68, 0x7918, 0xAC00,
> +			0x0, 0x7918, 0x6890,
> +		},
>  	};
>  	const u16 *csc;
>  
> -- 
> 2.17.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Shankar, Uma May 7, 2019, 2:35 p.m. UTC | #2
>-----Original Message-----
>From: Intel-gfx [mailto:intel-gfx-bounces@lists.freedesktop.org] On Behalf Of Ville
>Syrjälä
>Sent: Tuesday, May 7, 2019 7:37 PM
>To: Sharma, Shashank <shashank.sharma@intel.com>
>Cc: intel-gfx@lists.freedesktop.org
>Subject: Re: [Intel-gfx] [PATCH] drm/i915/icl: Handle YCbCr to RGB conversion for
>BT2020 case
>
>On Tue, May 07, 2019 at 06:32:57PM +0530, Shashank Sharma wrote:
>> From: Uma Shankar <uma.shankar@intel.com>
>>
>> Currently input csc for YCbCR to RGB conversion handles only
>> BT601 and Bt709. Extending it to support BT2020 as well.
>>
>> Signed-off-by: Uma Shankar <uma.shankar@intel.com>
>> Signed-off-by: Shashank Sharma <shashank.sharma@intel.com>
>> ---
>>  drivers/gpu/drm/i915/intel_sprite.c | 24 ++++++++++++++++++++++++
>>  1 file changed, 24 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/i915/intel_sprite.c
>> b/drivers/gpu/drm/i915/intel_sprite.c
>> index 44aaeac1b2ed..2536e757bec2 100644
>> --- a/drivers/gpu/drm/i915/intel_sprite.c
>> +++ b/drivers/gpu/drm/i915/intel_sprite.c
>> @@ -433,6 +433,18 @@ icl_program_input_csc(struct intel_plane *plane,
>>  			0x9EF8, 0x7800, 0xABF8,
>>  			0x0, 0x7800,  0x7ED8,
>>  		},
>> +		/*
>> +		 * BT.2020 full range YCbCr -> full range RGB
>> +		 * The matrix required is :
>> +		 * [1.000, 0.000, 1.474,
>> +		 *  1.000, -0.1645, -0.5713,
>> +		 *  1.000, 1.8814, 0.0000]
>> +		 */
>> +		[DRM_COLOR_YCBCR_BT2020] = {
>> +			0x7BC8, 0x7800, 0x0,
>> +			0x8928, 0x7800, 0xAA88,
>> +			0x0, 0x7800, 0x7F10,
>> +		},
>>  	};
>>
>>  	/* Matrix for Limited Range to Full Range Conversion */ @@ -461,6
>> +473,18 @@ icl_program_input_csc(struct intel_plane *plane,
>>  			0x8888, 0x7918, 0xADA8,
>>  			0x0, 0x7918,  0x6870,
>>  		},
>> +		/*
>> +		 * BT.2020 Limited range YCbCr -> full range RGB
>> +		 * The matrix required is :
>> +		 * [1.164, 0.000, 1.717,
>> +		 *  1.138, -0.1873, -0.6504,
>> +		 *  1.1380, 2.1417, 0.0000]
>
>Where are those 1.138 coming from?

Hi Ville,
This is the original YCBCR to RGB BT2020 matrix:
{
        1.00000000000,  0.00000000000,  1.47460000000,
        1.00000000000,  -0.16455312684, -0.57135312684,
        1.00000000000,  1.88140000000,  0.00000000000
};

We have to convert Limited Range YCbCr to Full Range RGB. Hence we need to apply a scale factor:
 yscalefactor = 219.0 * normalizingfactor;
 cbcrscalefactor = 224.0 * normalizingfactor;

 /* Scale factors are inverted for LR to FR conversion */
 yscalefactor = 1.0 / yscalefactor;
 cbcrscalefactor = 1.0 / cbcrscalefactor;

This yields the above results. 

Regards,
Uma Shankar

>> +		 */
>> +		[DRM_COLOR_YCBCR_BT2020] = {
>> +			0x7DC0, 0x7950, 0x0,
>> +			0x8A68, 0x7918, 0xAC00,
>> +			0x0, 0x7918, 0x6890,
>> +		},
>>  	};
>>  	const u16 *csc;
>>
>> --
>> 2.17.1
>>
>> _______________________________________________
>> Intel-gfx mailing list
>> Intel-gfx@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
>
>--
>Ville Syrjälä
>Intel
>_______________________________________________
>Intel-gfx mailing list
>Intel-gfx@lists.freedesktop.org
>https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Ville Syrjälä May 7, 2019, 3:38 p.m. UTC | #3
On Tue, May 07, 2019 at 02:35:15PM +0000, Shankar, Uma wrote:
> 
> 
> >-----Original Message-----
> >From: Intel-gfx [mailto:intel-gfx-bounces@lists.freedesktop.org] On Behalf Of Ville
> >Syrjälä
> >Sent: Tuesday, May 7, 2019 7:37 PM
> >To: Sharma, Shashank <shashank.sharma@intel.com>
> >Cc: intel-gfx@lists.freedesktop.org
> >Subject: Re: [Intel-gfx] [PATCH] drm/i915/icl: Handle YCbCr to RGB conversion for
> >BT2020 case
> >
> >On Tue, May 07, 2019 at 06:32:57PM +0530, Shashank Sharma wrote:
> >> From: Uma Shankar <uma.shankar@intel.com>
> >>
> >> Currently input csc for YCbCR to RGB conversion handles only
> >> BT601 and Bt709. Extending it to support BT2020 as well.
> >>
> >> Signed-off-by: Uma Shankar <uma.shankar@intel.com>
> >> Signed-off-by: Shashank Sharma <shashank.sharma@intel.com>
> >> ---
> >>  drivers/gpu/drm/i915/intel_sprite.c | 24 ++++++++++++++++++++++++
> >>  1 file changed, 24 insertions(+)
> >>
> >> diff --git a/drivers/gpu/drm/i915/intel_sprite.c
> >> b/drivers/gpu/drm/i915/intel_sprite.c
> >> index 44aaeac1b2ed..2536e757bec2 100644
> >> --- a/drivers/gpu/drm/i915/intel_sprite.c
> >> +++ b/drivers/gpu/drm/i915/intel_sprite.c
> >> @@ -433,6 +433,18 @@ icl_program_input_csc(struct intel_plane *plane,
> >>  			0x9EF8, 0x7800, 0xABF8,
> >>  			0x0, 0x7800,  0x7ED8,
> >>  		},
> >> +		/*
> >> +		 * BT.2020 full range YCbCr -> full range RGB
> >> +		 * The matrix required is :
> >> +		 * [1.000, 0.000, 1.474,
> >> +		 *  1.000, -0.1645, -0.5713,
> >> +		 *  1.000, 1.8814, 0.0000]
> >> +		 */
> >> +		[DRM_COLOR_YCBCR_BT2020] = {
> >> +			0x7BC8, 0x7800, 0x0,
> >> +			0x8928, 0x7800, 0xAA88,
> >> +			0x0, 0x7800, 0x7F10,
> >> +		},
> >>  	};
> >>
> >>  	/* Matrix for Limited Range to Full Range Conversion */ @@ -461,6
> >> +473,18 @@ icl_program_input_csc(struct intel_plane *plane,
> >>  			0x8888, 0x7918, 0xADA8,
> >>  			0x0, 0x7918,  0x6870,
> >>  		},
> >> +		/*
> >> +		 * BT.2020 Limited range YCbCr -> full range RGB
> >> +		 * The matrix required is :
> >> +		 * [1.164, 0.000, 1.717,
> >> +		 *  1.138, -0.1873, -0.6504,
> >> +		 *  1.1380, 2.1417, 0.0000]
> >
> >Where are those 1.138 coming from?
> 
> Hi Ville,
> This is the original YCBCR to RGB BT2020 matrix:
> {
>         1.00000000000,  0.00000000000,  1.47460000000,
>         1.00000000000,  -0.16455312684, -0.57135312684,
>         1.00000000000,  1.88140000000,  0.00000000000
> };
> 
> We have to convert Limited Range YCbCr to Full Range RGB. Hence we need to apply a scale factor:
>  yscalefactor = 219.0 * normalizingfactor;
>  cbcrscalefactor = 224.0 * normalizingfactor;
> 
>  /* Scale factors are inverted for LR to FR conversion */
>  yscalefactor = 1.0 / yscalefactor;
>  cbcrscalefactor = 1.0 / cbcrscalefactor;
> 
> This yields the above results. 

Those are the coefficients for Y, so they should still
be the same for all three output channels.

igt_color_encoding gives me:
|1.1644, 0.0000, 1.6787,|
|1.1644,-0.1873,-0.6504,|
|1.1644, 2.1418, 0.0000,|

Looks like we're also misprogramming the Y pre-offset
for the full range YCbCr case.
Shankar, Uma May 9, 2019, 2:54 p.m. UTC | #4
>-----Original Message-----
>From: Ville Syrjälä [mailto:ville.syrjala@linux.intel.com]
>Sent: Tuesday, May 7, 2019 9:08 PM
>To: Shankar, Uma <uma.shankar@intel.com>
>Cc: Sharma, Shashank <shashank.sharma@intel.com>; intel-
>gfx@lists.freedesktop.org
>Subject: Re: [Intel-gfx] [PATCH] drm/i915/icl: Handle YCbCr to RGB conversion for
>BT2020 case
>
>On Tue, May 07, 2019 at 02:35:15PM +0000, Shankar, Uma wrote:
>>
>>
>> >-----Original Message-----
>> >From: Intel-gfx [mailto:intel-gfx-bounces@lists.freedesktop.org] On
>> >Behalf Of Ville Syrjälä
>> >Sent: Tuesday, May 7, 2019 7:37 PM
>> >To: Sharma, Shashank <shashank.sharma@intel.com>
>> >Cc: intel-gfx@lists.freedesktop.org
>> >Subject: Re: [Intel-gfx] [PATCH] drm/i915/icl: Handle YCbCr to RGB
>> >conversion for
>> >BT2020 case
>> >
>> >On Tue, May 07, 2019 at 06:32:57PM +0530, Shashank Sharma wrote:
>> >> From: Uma Shankar <uma.shankar@intel.com>
>> >>
>> >> Currently input csc for YCbCR to RGB conversion handles only
>> >> BT601 and Bt709. Extending it to support BT2020 as well.
>> >>
>> >> Signed-off-by: Uma Shankar <uma.shankar@intel.com>
>> >> Signed-off-by: Shashank Sharma <shashank.sharma@intel.com>
>> >> ---
>> >>  drivers/gpu/drm/i915/intel_sprite.c | 24 ++++++++++++++++++++++++
>> >>  1 file changed, 24 insertions(+)
>> >>
>> >> diff --git a/drivers/gpu/drm/i915/intel_sprite.c
>> >> b/drivers/gpu/drm/i915/intel_sprite.c
>> >> index 44aaeac1b2ed..2536e757bec2 100644
>> >> --- a/drivers/gpu/drm/i915/intel_sprite.c
>> >> +++ b/drivers/gpu/drm/i915/intel_sprite.c
>> >> @@ -433,6 +433,18 @@ icl_program_input_csc(struct intel_plane *plane,
>> >>  			0x9EF8, 0x7800, 0xABF8,
>> >>  			0x0, 0x7800,  0x7ED8,
>> >>  		},
>> >> +		/*
>> >> +		 * BT.2020 full range YCbCr -> full range RGB
>> >> +		 * The matrix required is :
>> >> +		 * [1.000, 0.000, 1.474,
>> >> +		 *  1.000, -0.1645, -0.5713,
>> >> +		 *  1.000, 1.8814, 0.0000]
>> >> +		 */
>> >> +		[DRM_COLOR_YCBCR_BT2020] = {
>> >> +			0x7BC8, 0x7800, 0x0,
>> >> +			0x8928, 0x7800, 0xAA88,
>> >> +			0x0, 0x7800, 0x7F10,
>> >> +		},
>> >>  	};
>> >>
>> >>  	/* Matrix for Limited Range to Full Range Conversion */ @@ -461,6
>> >> +473,18 @@ icl_program_input_csc(struct intel_plane *plane,
>> >>  			0x8888, 0x7918, 0xADA8,
>> >>  			0x0, 0x7918,  0x6870,
>> >>  		},
>> >> +		/*
>> >> +		 * BT.2020 Limited range YCbCr -> full range RGB
>> >> +		 * The matrix required is :
>> >> +		 * [1.164, 0.000, 1.717,
>> >> +		 *  1.138, -0.1873, -0.6504,
>> >> +		 *  1.1380, 2.1417, 0.0000]
>> >
>> >Where are those 1.138 coming from?
>>
>> Hi Ville,
>> This is the original YCBCR to RGB BT2020 matrix:
>> {
>>         1.00000000000,  0.00000000000,  1.47460000000,
>>         1.00000000000,  -0.16455312684, -0.57135312684,
>>         1.00000000000,  1.88140000000,  0.00000000000 };
>>
>> We have to convert Limited Range YCbCr to Full Range RGB. Hence we need to
>apply a scale factor:
>>  yscalefactor = 219.0 * normalizingfactor;  cbcrscalefactor = 224.0 *
>> normalizingfactor;
>>
>>  /* Scale factors are inverted for LR to FR conversion */
>> yscalefactor = 1.0 / yscalefactor;  cbcrscalefactor = 1.0 /
>> cbcrscalefactor;
>>
>> This yields the above results.
>
>Those are the coefficients for Y, so they should still be the same for all three output
>channels.
>
>igt_color_encoding gives me:
>|1.1644, 0.0000, 1.6787,|
>|1.1644,-0.1873,-0.6504,|
>|1.1644, 2.1418, 0.0000,|

Ok, I used the igt_color_encoding method and able to get values what you got.
Will update the matrix. Thanks Ville.

>Looks like we're also misprogramming the Y pre-offset for the full range YCbCr case.
For full range, I am getting same values as programmed above. Looks ok, can you double check.

Regards,
Uma Shankar

>--
>Ville Syrjälä
>Intel
Ville Syrjälä May 9, 2019, 2:57 p.m. UTC | #5
On Thu, May 09, 2019 at 02:54:19PM +0000, Shankar, Uma wrote:
> 
> 
> >-----Original Message-----
> >From: Ville Syrjälä [mailto:ville.syrjala@linux.intel.com]
> >Sent: Tuesday, May 7, 2019 9:08 PM
> >To: Shankar, Uma <uma.shankar@intel.com>
> >Cc: Sharma, Shashank <shashank.sharma@intel.com>; intel-
> >gfx@lists.freedesktop.org
> >Subject: Re: [Intel-gfx] [PATCH] drm/i915/icl: Handle YCbCr to RGB conversion for
> >BT2020 case
> >
> >On Tue, May 07, 2019 at 02:35:15PM +0000, Shankar, Uma wrote:
> >>
> >>
> >> >-----Original Message-----
> >> >From: Intel-gfx [mailto:intel-gfx-bounces@lists.freedesktop.org] On
> >> >Behalf Of Ville Syrjälä
> >> >Sent: Tuesday, May 7, 2019 7:37 PM
> >> >To: Sharma, Shashank <shashank.sharma@intel.com>
> >> >Cc: intel-gfx@lists.freedesktop.org
> >> >Subject: Re: [Intel-gfx] [PATCH] drm/i915/icl: Handle YCbCr to RGB
> >> >conversion for
> >> >BT2020 case
> >> >
> >> >On Tue, May 07, 2019 at 06:32:57PM +0530, Shashank Sharma wrote:
> >> >> From: Uma Shankar <uma.shankar@intel.com>
> >> >>
> >> >> Currently input csc for YCbCR to RGB conversion handles only
> >> >> BT601 and Bt709. Extending it to support BT2020 as well.
> >> >>
> >> >> Signed-off-by: Uma Shankar <uma.shankar@intel.com>
> >> >> Signed-off-by: Shashank Sharma <shashank.sharma@intel.com>
> >> >> ---
> >> >>  drivers/gpu/drm/i915/intel_sprite.c | 24 ++++++++++++++++++++++++
> >> >>  1 file changed, 24 insertions(+)
> >> >>
> >> >> diff --git a/drivers/gpu/drm/i915/intel_sprite.c
> >> >> b/drivers/gpu/drm/i915/intel_sprite.c
> >> >> index 44aaeac1b2ed..2536e757bec2 100644
> >> >> --- a/drivers/gpu/drm/i915/intel_sprite.c
> >> >> +++ b/drivers/gpu/drm/i915/intel_sprite.c
> >> >> @@ -433,6 +433,18 @@ icl_program_input_csc(struct intel_plane *plane,
> >> >>  			0x9EF8, 0x7800, 0xABF8,
> >> >>  			0x0, 0x7800,  0x7ED8,
> >> >>  		},
> >> >> +		/*
> >> >> +		 * BT.2020 full range YCbCr -> full range RGB
> >> >> +		 * The matrix required is :
> >> >> +		 * [1.000, 0.000, 1.474,
> >> >> +		 *  1.000, -0.1645, -0.5713,
> >> >> +		 *  1.000, 1.8814, 0.0000]
> >> >> +		 */
> >> >> +		[DRM_COLOR_YCBCR_BT2020] = {
> >> >> +			0x7BC8, 0x7800, 0x0,
> >> >> +			0x8928, 0x7800, 0xAA88,
> >> >> +			0x0, 0x7800, 0x7F10,
> >> >> +		},
> >> >>  	};
> >> >>
> >> >>  	/* Matrix for Limited Range to Full Range Conversion */ @@ -461,6
> >> >> +473,18 @@ icl_program_input_csc(struct intel_plane *plane,
> >> >>  			0x8888, 0x7918, 0xADA8,
> >> >>  			0x0, 0x7918,  0x6870,
> >> >>  		},
> >> >> +		/*
> >> >> +		 * BT.2020 Limited range YCbCr -> full range RGB
> >> >> +		 * The matrix required is :
> >> >> +		 * [1.164, 0.000, 1.717,
> >> >> +		 *  1.138, -0.1873, -0.6504,
> >> >> +		 *  1.1380, 2.1417, 0.0000]
> >> >
> >> >Where are those 1.138 coming from?
> >>
> >> Hi Ville,
> >> This is the original YCBCR to RGB BT2020 matrix:
> >> {
> >>         1.00000000000,  0.00000000000,  1.47460000000,
> >>         1.00000000000,  -0.16455312684, -0.57135312684,
> >>         1.00000000000,  1.88140000000,  0.00000000000 };
> >>
> >> We have to convert Limited Range YCbCr to Full Range RGB. Hence we need to
> >apply a scale factor:
> >>  yscalefactor = 219.0 * normalizingfactor;  cbcrscalefactor = 224.0 *
> >> normalizingfactor;
> >>
> >>  /* Scale factors are inverted for LR to FR conversion */
> >> yscalefactor = 1.0 / yscalefactor;  cbcrscalefactor = 1.0 /
> >> cbcrscalefactor;
> >>
> >> This yields the above results.
> >
> >Those are the coefficients for Y, so they should still be the same for all three output
> >channels.
> >
> >igt_color_encoding gives me:
> >|1.1644, 0.0000, 1.6787,|
> >|1.1644,-0.1873,-0.6504,|
> >|1.1644, 2.1418, 0.0000,|
> 
> Ok, I used the igt_color_encoding method and able to get values what you got.
> Will update the matrix. Thanks Ville.
> 
> >Looks like we're also misprogramming the Y pre-offset for the full range YCbCr case.
> For full range, I am getting same values as programmed above. Looks ok, can you double check.

The matrix itself looks OK (some minor rounding differences perhaps, but
nothing major). But the Y preoffset should be zero for full range
YCbCr.
Shankar, Uma May 9, 2019, 3:08 p.m. UTC | #6
>-----Original Message-----
>From: Ville Syrjälä [mailto:ville.syrjala@linux.intel.com]
>Sent: Thursday, May 9, 2019 8:28 PM
>To: Shankar, Uma <uma.shankar@intel.com>
>Cc: Sharma, Shashank <shashank.sharma@intel.com>; intel-
>gfx@lists.freedesktop.org
>Subject: Re: [Intel-gfx] [PATCH] drm/i915/icl: Handle YCbCr to RGB conversion for
>BT2020 case
>
>On Thu, May 09, 2019 at 02:54:19PM +0000, Shankar, Uma wrote:
>>
>>
>> >-----Original Message-----
>> >From: Ville Syrjälä [mailto:ville.syrjala@linux.intel.com]
>> >Sent: Tuesday, May 7, 2019 9:08 PM
>> >To: Shankar, Uma <uma.shankar@intel.com>
>> >Cc: Sharma, Shashank <shashank.sharma@intel.com>; intel-
>> >gfx@lists.freedesktop.org
>> >Subject: Re: [Intel-gfx] [PATCH] drm/i915/icl: Handle YCbCr to RGB
>> >conversion for
>> >BT2020 case
>> >
>> >On Tue, May 07, 2019 at 02:35:15PM +0000, Shankar, Uma wrote:
>> >>
>> >>
>> >> >-----Original Message-----
>> >> >From: Intel-gfx [mailto:intel-gfx-bounces@lists.freedesktop.org]
>> >> >On Behalf Of Ville Syrjälä
>> >> >Sent: Tuesday, May 7, 2019 7:37 PM
>> >> >To: Sharma, Shashank <shashank.sharma@intel.com>
>> >> >Cc: intel-gfx@lists.freedesktop.org
>> >> >Subject: Re: [Intel-gfx] [PATCH] drm/i915/icl: Handle YCbCr to RGB
>> >> >conversion for
>> >> >BT2020 case
>> >> >
>> >> >On Tue, May 07, 2019 at 06:32:57PM +0530, Shashank Sharma wrote:
>> >> >> From: Uma Shankar <uma.shankar@intel.com>
>> >> >>
>> >> >> Currently input csc for YCbCR to RGB conversion handles only
>> >> >> BT601 and Bt709. Extending it to support BT2020 as well.
>> >> >>
>> >> >> Signed-off-by: Uma Shankar <uma.shankar@intel.com>
>> >> >> Signed-off-by: Shashank Sharma <shashank.sharma@intel.com>
>> >> >> ---
>> >> >>  drivers/gpu/drm/i915/intel_sprite.c | 24
>> >> >> ++++++++++++++++++++++++
>> >> >>  1 file changed, 24 insertions(+)
>> >> >>
>> >> >> diff --git a/drivers/gpu/drm/i915/intel_sprite.c
>> >> >> b/drivers/gpu/drm/i915/intel_sprite.c
>> >> >> index 44aaeac1b2ed..2536e757bec2 100644
>> >> >> --- a/drivers/gpu/drm/i915/intel_sprite.c
>> >> >> +++ b/drivers/gpu/drm/i915/intel_sprite.c
>> >> >> @@ -433,6 +433,18 @@ icl_program_input_csc(struct intel_plane *plane,
>> >> >>  			0x9EF8, 0x7800, 0xABF8,
>> >> >>  			0x0, 0x7800,  0x7ED8,
>> >> >>  		},
>> >> >> +		/*
>> >> >> +		 * BT.2020 full range YCbCr -> full range RGB
>> >> >> +		 * The matrix required is :
>> >> >> +		 * [1.000, 0.000, 1.474,
>> >> >> +		 *  1.000, -0.1645, -0.5713,
>> >> >> +		 *  1.000, 1.8814, 0.0000]
>> >> >> +		 */
>> >> >> +		[DRM_COLOR_YCBCR_BT2020] = {
>> >> >> +			0x7BC8, 0x7800, 0x0,
>> >> >> +			0x8928, 0x7800, 0xAA88,
>> >> >> +			0x0, 0x7800, 0x7F10,
>> >> >> +		},
>> >> >>  	};
>> >> >>
>> >> >>  	/* Matrix for Limited Range to Full Range Conversion */ @@
>> >> >> -461,6
>> >> >> +473,18 @@ icl_program_input_csc(struct intel_plane *plane,
>> >> >>  			0x8888, 0x7918, 0xADA8,
>> >> >>  			0x0, 0x7918,  0x6870,
>> >> >>  		},
>> >> >> +		/*
>> >> >> +		 * BT.2020 Limited range YCbCr -> full range RGB
>> >> >> +		 * The matrix required is :
>> >> >> +		 * [1.164, 0.000, 1.717,
>> >> >> +		 *  1.138, -0.1873, -0.6504,
>> >> >> +		 *  1.1380, 2.1417, 0.0000]
>> >> >
>> >> >Where are those 1.138 coming from?
>> >>
>> >> Hi Ville,
>> >> This is the original YCBCR to RGB BT2020 matrix:
>> >> {
>> >>         1.00000000000,  0.00000000000,  1.47460000000,
>> >>         1.00000000000,  -0.16455312684, -0.57135312684,
>> >>         1.00000000000,  1.88140000000,  0.00000000000 };
>> >>
>> >> We have to convert Limited Range YCbCr to Full Range RGB. Hence we
>> >> need to
>> >apply a scale factor:
>> >>  yscalefactor = 219.0 * normalizingfactor;  cbcrscalefactor = 224.0
>> >> * normalizingfactor;
>> >>
>> >>  /* Scale factors are inverted for LR to FR conversion */
>> >> yscalefactor = 1.0 / yscalefactor;  cbcrscalefactor = 1.0 /
>> >> cbcrscalefactor;
>> >>
>> >> This yields the above results.
>> >
>> >Those are the coefficients for Y, so they should still be the same
>> >for all three output channels.
>> >
>> >igt_color_encoding gives me:
>> >|1.1644, 0.0000, 1.6787,|
>> >|1.1644,-0.1873,-0.6504,|
>> >|1.1644, 2.1418, 0.0000,|
>>
>> Ok, I used the igt_color_encoding method and able to get values what you got.
>> Will update the matrix. Thanks Ville.
>>
>> >Looks like we're also misprogramming the Y pre-offset for the full range YCbCr
>case.
>> For full range, I am getting same values as programmed above. Looks ok, can you
>double check.
>
>The matrix itself looks OK (some minor rounding differences perhaps, but nothing
>major). But the Y preoffset should be zero for full range YCbCr.

Hi Ville,
This is what I got for Full Range from igt_color_encoding.
m4.d[m(row=0, col=0)] = 1.000000
m4.d[m(row=1, col=0)] = 1.000000
m4.d[m(row=2, col=0)] = 1.000000
m4.d[m(row=3, col=0)] = 0.000000
m4.d[m(row=0, col=1)] = 0.000000
m4.d[m(row=1, col=1)] = -0.164553
m4.d[m(row=2, col=1)] = 1.881400
m4.d[m(row=3, col=1)] = 0.000000
m4.d[m(row=0, col=2)] = 1.474600
m4.d[m(row=1, col=2)] = -0.571353
m4.d[m(row=2, col=2)] = 0.000000
m4.d[m(row=3, col=2)] = 0.000000
m4.d[m(row=0, col=3)] = -188.748810
m4.d[m(row=1, col=3)] = 94.195992
m4.d[m(row=2, col=3)] = -240.819199
m4.d[m(row=3, col=3)] = 1.000000

which matches our table. This is the argument list for :
struct igt_mat4 m4 = igt_ycbcr_to_rgb_matrix(DRM_FORMAT_YUV420,
                                     DRM_FORMAT_XRGB8888,
                                       IGT_COLOR_YCBCR_BT2020,
                                       IGT_COLOR_YCBCR_FULL_RANGE);

Am I am missing something ?

Regards,
Uma Shankar
>Ville Syrjälä
>Intel
Ville Syrjälä May 9, 2019, 3:30 p.m. UTC | #7
On Thu, May 09, 2019 at 03:08:40PM +0000, Shankar, Uma wrote:
> 
> 
> >-----Original Message-----
> >From: Ville Syrjälä [mailto:ville.syrjala@linux.intel.com]
> >Sent: Thursday, May 9, 2019 8:28 PM
> >To: Shankar, Uma <uma.shankar@intel.com>
> >Cc: Sharma, Shashank <shashank.sharma@intel.com>; intel-
> >gfx@lists.freedesktop.org
> >Subject: Re: [Intel-gfx] [PATCH] drm/i915/icl: Handle YCbCr to RGB conversion for
> >BT2020 case
> >
> >On Thu, May 09, 2019 at 02:54:19PM +0000, Shankar, Uma wrote:
> >>
> >>
> >> >-----Original Message-----
> >> >From: Ville Syrjälä [mailto:ville.syrjala@linux.intel.com]
> >> >Sent: Tuesday, May 7, 2019 9:08 PM
> >> >To: Shankar, Uma <uma.shankar@intel.com>
> >> >Cc: Sharma, Shashank <shashank.sharma@intel.com>; intel-
> >> >gfx@lists.freedesktop.org
> >> >Subject: Re: [Intel-gfx] [PATCH] drm/i915/icl: Handle YCbCr to RGB
> >> >conversion for
> >> >BT2020 case
> >> >
> >> >On Tue, May 07, 2019 at 02:35:15PM +0000, Shankar, Uma wrote:
> >> >>
> >> >>
> >> >> >-----Original Message-----
> >> >> >From: Intel-gfx [mailto:intel-gfx-bounces@lists.freedesktop.org]
> >> >> >On Behalf Of Ville Syrjälä
> >> >> >Sent: Tuesday, May 7, 2019 7:37 PM
> >> >> >To: Sharma, Shashank <shashank.sharma@intel.com>
> >> >> >Cc: intel-gfx@lists.freedesktop.org
> >> >> >Subject: Re: [Intel-gfx] [PATCH] drm/i915/icl: Handle YCbCr to RGB
> >> >> >conversion for
> >> >> >BT2020 case
> >> >> >
> >> >> >On Tue, May 07, 2019 at 06:32:57PM +0530, Shashank Sharma wrote:
> >> >> >> From: Uma Shankar <uma.shankar@intel.com>
> >> >> >>
> >> >> >> Currently input csc for YCbCR to RGB conversion handles only
> >> >> >> BT601 and Bt709. Extending it to support BT2020 as well.
> >> >> >>
> >> >> >> Signed-off-by: Uma Shankar <uma.shankar@intel.com>
> >> >> >> Signed-off-by: Shashank Sharma <shashank.sharma@intel.com>
> >> >> >> ---
> >> >> >>  drivers/gpu/drm/i915/intel_sprite.c | 24
> >> >> >> ++++++++++++++++++++++++
> >> >> >>  1 file changed, 24 insertions(+)
> >> >> >>
> >> >> >> diff --git a/drivers/gpu/drm/i915/intel_sprite.c
> >> >> >> b/drivers/gpu/drm/i915/intel_sprite.c
> >> >> >> index 44aaeac1b2ed..2536e757bec2 100644
> >> >> >> --- a/drivers/gpu/drm/i915/intel_sprite.c
> >> >> >> +++ b/drivers/gpu/drm/i915/intel_sprite.c
> >> >> >> @@ -433,6 +433,18 @@ icl_program_input_csc(struct intel_plane *plane,
> >> >> >>  			0x9EF8, 0x7800, 0xABF8,
> >> >> >>  			0x0, 0x7800,  0x7ED8,
> >> >> >>  		},
> >> >> >> +		/*
> >> >> >> +		 * BT.2020 full range YCbCr -> full range RGB
> >> >> >> +		 * The matrix required is :
> >> >> >> +		 * [1.000, 0.000, 1.474,
> >> >> >> +		 *  1.000, -0.1645, -0.5713,
> >> >> >> +		 *  1.000, 1.8814, 0.0000]
> >> >> >> +		 */
> >> >> >> +		[DRM_COLOR_YCBCR_BT2020] = {
> >> >> >> +			0x7BC8, 0x7800, 0x0,
> >> >> >> +			0x8928, 0x7800, 0xAA88,
> >> >> >> +			0x0, 0x7800, 0x7F10,
> >> >> >> +		},
> >> >> >>  	};
> >> >> >>
> >> >> >>  	/* Matrix for Limited Range to Full Range Conversion */ @@
> >> >> >> -461,6
> >> >> >> +473,18 @@ icl_program_input_csc(struct intel_plane *plane,
> >> >> >>  			0x8888, 0x7918, 0xADA8,
> >> >> >>  			0x0, 0x7918,  0x6870,
> >> >> >>  		},
> >> >> >> +		/*
> >> >> >> +		 * BT.2020 Limited range YCbCr -> full range RGB
> >> >> >> +		 * The matrix required is :
> >> >> >> +		 * [1.164, 0.000, 1.717,
> >> >> >> +		 *  1.138, -0.1873, -0.6504,
> >> >> >> +		 *  1.1380, 2.1417, 0.0000]
> >> >> >
> >> >> >Where are those 1.138 coming from?
> >> >>
> >> >> Hi Ville,
> >> >> This is the original YCBCR to RGB BT2020 matrix:
> >> >> {
> >> >>         1.00000000000,  0.00000000000,  1.47460000000,
> >> >>         1.00000000000,  -0.16455312684, -0.57135312684,
> >> >>         1.00000000000,  1.88140000000,  0.00000000000 };
> >> >>
> >> >> We have to convert Limited Range YCbCr to Full Range RGB. Hence we
> >> >> need to
> >> >apply a scale factor:
> >> >>  yscalefactor = 219.0 * normalizingfactor;  cbcrscalefactor = 224.0
> >> >> * normalizingfactor;
> >> >>
> >> >>  /* Scale factors are inverted for LR to FR conversion */
> >> >> yscalefactor = 1.0 / yscalefactor;  cbcrscalefactor = 1.0 /
> >> >> cbcrscalefactor;
> >> >>
> >> >> This yields the above results.
> >> >
> >> >Those are the coefficients for Y, so they should still be the same
> >> >for all three output channels.
> >> >
> >> >igt_color_encoding gives me:
> >> >|1.1644, 0.0000, 1.6787,|
> >> >|1.1644,-0.1873,-0.6504,|
> >> >|1.1644, 2.1418, 0.0000,|
> >>
> >> Ok, I used the igt_color_encoding method and able to get values what you got.
> >> Will update the matrix. Thanks Ville.
> >>
> >> >Looks like we're also misprogramming the Y pre-offset for the full range YCbCr
> >case.
> >> For full range, I am getting same values as programmed above. Looks ok, can you
> >double check.
> >
> >The matrix itself looks OK (some minor rounding differences perhaps, but nothing
> >major). But the Y preoffset should be zero for full range YCbCr.
> 
> Hi Ville,
> This is what I got for Full Range from igt_color_encoding.
> m4.d[m(row=0, col=0)] = 1.000000
> m4.d[m(row=1, col=0)] = 1.000000
> m4.d[m(row=2, col=0)] = 1.000000
> m4.d[m(row=3, col=0)] = 0.000000
> m4.d[m(row=0, col=1)] = 0.000000
> m4.d[m(row=1, col=1)] = -0.164553
> m4.d[m(row=2, col=1)] = 1.881400
> m4.d[m(row=3, col=1)] = 0.000000
> m4.d[m(row=0, col=2)] = 1.474600
> m4.d[m(row=1, col=2)] = -0.571353
> m4.d[m(row=2, col=2)] = 0.000000
> m4.d[m(row=3, col=2)] = 0.000000
> m4.d[m(row=0, col=3)] = -188.748810
> m4.d[m(row=1, col=3)] = 94.195992
> m4.d[m(row=2, col=3)] = -240.819199
> m4.d[m(row=3, col=3)] = 1.000000
> 
> which matches our table. This is the argument list for :
> struct igt_mat4 m4 = igt_ycbcr_to_rgb_matrix(DRM_FORMAT_YUV420,
>                                      DRM_FORMAT_XRGB8888,
>                                        IGT_COLOR_YCBCR_BT2020,
>                                        IGT_COLOR_YCBCR_FULL_RANGE);
> 
> Am I am missing something ?

I'm talking about
	I915_WRITE_FW(PLANE_INPUT_CSC_PREOFF(pipe, plane_id, 1),
		      PREOFF_YUV_TO_RGB_ME);

not sure what you're talking about :)
Shankar, Uma May 9, 2019, 3:55 p.m. UTC | #8
>-----Original Message-----
>From: Ville Syrjälä [mailto:ville.syrjala@linux.intel.com]
>Sent: Thursday, May 9, 2019 9:00 PM
>To: Shankar, Uma <uma.shankar@intel.com>
>Cc: Sharma, Shashank <shashank.sharma@intel.com>; intel-
>gfx@lists.freedesktop.org
>Subject: Re: [Intel-gfx] [PATCH] drm/i915/icl: Handle YCbCr to RGB conversion for
>BT2020 case
>
>On Thu, May 09, 2019 at 03:08:40PM +0000, Shankar, Uma wrote:
>>
>>
>> >-----Original Message-----
>> >From: Ville Syrjälä [mailto:ville.syrjala@linux.intel.com]
>> >Sent: Thursday, May 9, 2019 8:28 PM
>> >To: Shankar, Uma <uma.shankar@intel.com>
>> >Cc: Sharma, Shashank <shashank.sharma@intel.com>; intel-
>> >gfx@lists.freedesktop.org
>> >Subject: Re: [Intel-gfx] [PATCH] drm/i915/icl: Handle YCbCr to RGB
>> >conversion for
>> >BT2020 case
>> >
>> >On Thu, May 09, 2019 at 02:54:19PM +0000, Shankar, Uma wrote:
>> >>
>> >>
>> >> >-----Original Message-----
>> >> >From: Ville Syrjälä [mailto:ville.syrjala@linux.intel.com]
>> >> >Sent: Tuesday, May 7, 2019 9:08 PM
>> >> >To: Shankar, Uma <uma.shankar@intel.com>
>> >> >Cc: Sharma, Shashank <shashank.sharma@intel.com>; intel-
>> >> >gfx@lists.freedesktop.org
>> >> >Subject: Re: [Intel-gfx] [PATCH] drm/i915/icl: Handle YCbCr to RGB
>> >> >conversion for
>> >> >BT2020 case
>> >> >
>> >> >On Tue, May 07, 2019 at 02:35:15PM +0000, Shankar, Uma wrote:
>> >> >>
>> >> >>
>> >> >> >-----Original Message-----
>> >> >> >From: Intel-gfx
>> >> >> >[mailto:intel-gfx-bounces@lists.freedesktop.org]
>> >> >> >On Behalf Of Ville Syrjälä
>> >> >> >Sent: Tuesday, May 7, 2019 7:37 PM
>> >> >> >To: Sharma, Shashank <shashank.sharma@intel.com>
>> >> >> >Cc: intel-gfx@lists.freedesktop.org
>> >> >> >Subject: Re: [Intel-gfx] [PATCH] drm/i915/icl: Handle YCbCr to
>> >> >> >RGB conversion for
>> >> >> >BT2020 case
>> >> >> >
>> >> >> >On Tue, May 07, 2019 at 06:32:57PM +0530, Shashank Sharma wrote:
>> >> >> >> From: Uma Shankar <uma.shankar@intel.com>
>> >> >> >>
>> >> >> >> Currently input csc for YCbCR to RGB conversion handles only
>> >> >> >> BT601 and Bt709. Extending it to support BT2020 as well.
>> >> >> >>
>> >> >> >> Signed-off-by: Uma Shankar <uma.shankar@intel.com>
>> >> >> >> Signed-off-by: Shashank Sharma <shashank.sharma@intel.com>
>> >> >> >> ---
>> >> >> >>  drivers/gpu/drm/i915/intel_sprite.c | 24
>> >> >> >> ++++++++++++++++++++++++
>> >> >> >>  1 file changed, 24 insertions(+)
>> >> >> >>
>> >> >> >> diff --git a/drivers/gpu/drm/i915/intel_sprite.c
>> >> >> >> b/drivers/gpu/drm/i915/intel_sprite.c
>> >> >> >> index 44aaeac1b2ed..2536e757bec2 100644
>> >> >> >> --- a/drivers/gpu/drm/i915/intel_sprite.c
>> >> >> >> +++ b/drivers/gpu/drm/i915/intel_sprite.c
>> >> >> >> @@ -433,6 +433,18 @@ icl_program_input_csc(struct intel_plane *plane,
>> >> >> >>  			0x9EF8, 0x7800, 0xABF8,
>> >> >> >>  			0x0, 0x7800,  0x7ED8,
>> >> >> >>  		},
>> >> >> >> +		/*
>> >> >> >> +		 * BT.2020 full range YCbCr -> full range RGB
>> >> >> >> +		 * The matrix required is :
>> >> >> >> +		 * [1.000, 0.000, 1.474,
>> >> >> >> +		 *  1.000, -0.1645, -0.5713,
>> >> >> >> +		 *  1.000, 1.8814, 0.0000]
>> >> >> >> +		 */
>> >> >> >> +		[DRM_COLOR_YCBCR_BT2020] = {
>> >> >> >> +			0x7BC8, 0x7800, 0x0,
>> >> >> >> +			0x8928, 0x7800, 0xAA88,
>> >> >> >> +			0x0, 0x7800, 0x7F10,
>> >> >> >> +		},
>> >> >> >>  	};
>> >> >> >>
>> >> >> >>  	/* Matrix for Limited Range to Full Range Conversion */ @@
>> >> >> >> -461,6
>> >> >> >> +473,18 @@ icl_program_input_csc(struct intel_plane *plane,
>> >> >> >>  			0x8888, 0x7918, 0xADA8,
>> >> >> >>  			0x0, 0x7918,  0x6870,
>> >> >> >>  		},
>> >> >> >> +		/*
>> >> >> >> +		 * BT.2020 Limited range YCbCr -> full range RGB
>> >> >> >> +		 * The matrix required is :
>> >> >> >> +		 * [1.164, 0.000, 1.717,
>> >> >> >> +		 *  1.138, -0.1873, -0.6504,
>> >> >> >> +		 *  1.1380, 2.1417, 0.0000]
>> >> >> >
>> >> >> >Where are those 1.138 coming from?
>> >> >>
>> >> >> Hi Ville,
>> >> >> This is the original YCBCR to RGB BT2020 matrix:
>> >> >> {
>> >> >>         1.00000000000,  0.00000000000,  1.47460000000,
>> >> >>         1.00000000000,  -0.16455312684, -0.57135312684,
>> >> >>         1.00000000000,  1.88140000000,  0.00000000000 };
>> >> >>
>> >> >> We have to convert Limited Range YCbCr to Full Range RGB. Hence
>> >> >> we need to
>> >> >apply a scale factor:
>> >> >>  yscalefactor = 219.0 * normalizingfactor;  cbcrscalefactor =
>> >> >> 224.0
>> >> >> * normalizingfactor;
>> >> >>
>> >> >>  /* Scale factors are inverted for LR to FR conversion */
>> >> >> yscalefactor = 1.0 / yscalefactor;  cbcrscalefactor = 1.0 /
>> >> >> cbcrscalefactor;
>> >> >>
>> >> >> This yields the above results.
>> >> >
>> >> >Those are the coefficients for Y, so they should still be the same
>> >> >for all three output channels.
>> >> >
>> >> >igt_color_encoding gives me:
>> >> >|1.1644, 0.0000, 1.6787,|
>> >> >|1.1644,-0.1873,-0.6504,|
>> >> >|1.1644, 2.1418, 0.0000,|
>> >>
>> >> Ok, I used the igt_color_encoding method and able to get values what you got.
>> >> Will update the matrix. Thanks Ville.
>> >>
>> >> >Looks like we're also misprogramming the Y pre-offset for the full
>> >> >range YCbCr
>> >case.
>> >> For full range, I am getting same values as programmed above. Looks
>> >> ok, can you
>> >double check.
>> >
>> >The matrix itself looks OK (some minor rounding differences perhaps,
>> >but nothing major). But the Y preoffset should be zero for full range YCbCr.
>>
>> Hi Ville,
>> This is what I got for Full Range from igt_color_encoding.
>> m4.d[m(row=0, col=0)] = 1.000000
>> m4.d[m(row=1, col=0)] = 1.000000
>> m4.d[m(row=2, col=0)] = 1.000000
>> m4.d[m(row=3, col=0)] = 0.000000
>> m4.d[m(row=0, col=1)] = 0.000000
>> m4.d[m(row=1, col=1)] = -0.164553
>> m4.d[m(row=2, col=1)] = 1.881400
>> m4.d[m(row=3, col=1)] = 0.000000
>> m4.d[m(row=0, col=2)] = 1.474600
>> m4.d[m(row=1, col=2)] = -0.571353
>> m4.d[m(row=2, col=2)] = 0.000000
>> m4.d[m(row=3, col=2)] = 0.000000
>> m4.d[m(row=0, col=3)] = -188.748810
>> m4.d[m(row=1, col=3)] = 94.195992
>> m4.d[m(row=2, col=3)] = -240.819199
>> m4.d[m(row=3, col=3)] = 1.000000
>>
>> which matches our table. This is the argument list for :
>> struct igt_mat4 m4 = igt_ycbcr_to_rgb_matrix(DRM_FORMAT_YUV420,
>>                                      DRM_FORMAT_XRGB8888,
>>                                        IGT_COLOR_YCBCR_BT2020,
>>                                        IGT_COLOR_YCBCR_FULL_RANGE);
>>
>> Am I am missing something ?
>
>I'm talking about
>	I915_WRITE_FW(PLANE_INPUT_CSC_PREOFF(pipe, plane_id, 1),
>		      PREOFF_YUV_TO_RGB_ME);
>
>not sure what you're talking about :)

Aah, I was pre-occupied with coefficient discussion itself :). Got it now, will update that and send out
the next version. 

Regards,
Uma Shankar

>--
>Ville Syrjälä
>Intel
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
index 44aaeac1b2ed..2536e757bec2 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -433,6 +433,18 @@  icl_program_input_csc(struct intel_plane *plane,
 			0x9EF8, 0x7800, 0xABF8,
 			0x0, 0x7800,  0x7ED8,
 		},
+		/*
+		 * BT.2020 full range YCbCr -> full range RGB
+		 * The matrix required is :
+		 * [1.000, 0.000, 1.474,
+		 *  1.000, -0.1645, -0.5713,
+		 *  1.000, 1.8814, 0.0000]
+		 */
+		[DRM_COLOR_YCBCR_BT2020] = {
+			0x7BC8, 0x7800, 0x0,
+			0x8928, 0x7800, 0xAA88,
+			0x0, 0x7800, 0x7F10,
+		},
 	};
 
 	/* Matrix for Limited Range to Full Range Conversion */
@@ -461,6 +473,18 @@  icl_program_input_csc(struct intel_plane *plane,
 			0x8888, 0x7918, 0xADA8,
 			0x0, 0x7918,  0x6870,
 		},
+		/*
+		 * BT.2020 Limited range YCbCr -> full range RGB
+		 * The matrix required is :
+		 * [1.164, 0.000, 1.717,
+		 *  1.138, -0.1873, -0.6504,
+		 *  1.1380, 2.1417, 0.0000]
+		 */
+		[DRM_COLOR_YCBCR_BT2020] = {
+			0x7DC0, 0x7950, 0x0,
+			0x8A68, 0x7918, 0xAC00,
+			0x0, 0x7918, 0x6890,
+		},
 	};
 	const u16 *csc;