diff mbox series

[v2,2/2] drm/i915: Attach colorspace property and enable modeset

Message ID 1540987546-3142-3-git-send-email-uma.shankar@intel.com (mailing list archive)
State New, archived
Headers show
Series Add Colorspace connector property interface | expand

Commit Message

Shankar, Uma Oct. 31, 2018, 12:05 p.m. UTC
This patch attaches the colorspace connector property to the
hdmi connector. Based on colorspace change, modeset will be
triggered to switch to new colorspace.

Based on colorspace property value create an infoframe
with appropriate colorspace. This can be used to send an
infoframe packet with proper colorspace value set which
will help to enable wider color gamut like BT2020 on sink.

v2: Merged the changes of creating infoframe as well to this
patch as per Maarten's suggestion.

Signed-off-by: Uma Shankar <uma.shankar@intel.com>
---
 drivers/gpu/drm/i915/intel_atomic.c | 1 +
 drivers/gpu/drm/i915/intel_hdmi.c   | 5 +++++
 2 files changed, 6 insertions(+)

Comments

Maarten Lankhorst Nov. 2, 2018, 9:23 a.m. UTC | #1
Op 31-10-18 om 13:05 schreef Uma Shankar:
> This patch attaches the colorspace connector property to the
> hdmi connector. Based on colorspace change, modeset will be
> triggered to switch to new colorspace.
>
> Based on colorspace property value create an infoframe
> with appropriate colorspace. This can be used to send an
> infoframe packet with proper colorspace value set which
> will help to enable wider color gamut like BT2020 on sink.
>
> v2: Merged the changes of creating infoframe as well to this
> patch as per Maarten's suggestion.
>
> Signed-off-by: Uma Shankar <uma.shankar@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_atomic.c | 1 +
>  drivers/gpu/drm/i915/intel_hdmi.c   | 5 +++++
>  2 files changed, 6 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/intel_atomic.c b/drivers/gpu/drm/i915/intel_atomic.c
> index a5a2c8f..35ef70a 100644
> --- a/drivers/gpu/drm/i915/intel_atomic.c
> +++ b/drivers/gpu/drm/i915/intel_atomic.c
> @@ -125,6 +125,7 @@ int intel_digital_connector_atomic_check(struct drm_connector *conn,
>  	 */
>  	if (new_conn_state->force_audio != old_conn_state->force_audio ||
>  	    new_conn_state->broadcast_rgb != old_conn_state->broadcast_rgb ||
> +	    new_state->colorspace != old_state->colorspace ||
>  	    new_conn_state->base.picture_aspect_ratio != old_conn_state->base.picture_aspect_ratio ||
>  	    new_conn_state->base.content_type != old_conn_state->base.content_type ||
>  	    new_conn_state->base.scaling_mode != old_conn_state->base.scaling_mode)
> diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
> index 129b880..8a41fb3 100644
> --- a/drivers/gpu/drm/i915/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/intel_hdmi.c
> @@ -486,6 +486,8 @@ static void intel_hdmi_set_avi_infoframe(struct intel_encoder *encoder,
>  	else
>  		frame.avi.colorspace = HDMI_COLORSPACE_RGB;
>  
> +	frame.avi.extended_colorimetry = conn_state->colorspace;
> +
>  	drm_hdmi_avi_infoframe_quant_range(&frame.avi, adjusted_mode,
>  					   crtc_state->limited_color_range ?
>  					   HDMI_QUANTIZATION_RANGE_LIMITED :
> @@ -2125,6 +2127,9 @@ static void intel_hdmi_destroy(struct drm_connector *connector)
>  	intel_attach_broadcast_rgb_property(connector);
>  	intel_attach_aspect_ratio_property(connector);
>  	drm_connector_attach_content_type_property(connector);
> +	drm_object_attach_property(&connector->base,
> +			connector->dev->mode_config.colorspace_property,
> +			COLORIMETRY_ITU_709);
Just put 0 here..
If you want to init the default colorspace, put it in the first patch.

We should perhaps hide color spaces that are not supported on HDMI?
>  	connector->state->picture_aspect_ratio = HDMI_PICTURE_ASPECT_NONE;
>  }
>
Shankar, Uma Nov. 2, 2018, 2:18 p.m. UTC | #2
>-----Original Message-----
>From: Maarten Lankhorst [mailto:maarten.lankhorst@linux.intel.com]
>Sent: Friday, November 2, 2018 2:53 PM
>To: Shankar, Uma <uma.shankar@intel.com>; dri-devel@lists.freedesktop.org;
>intel-gfx@lists.freedesktop.org
>Cc: Syrjala, Ville <ville.syrjala@intel.com>; ajax@redhat.com; Lankhorst, Maarten
><maarten.lankhorst@intel.com>
>Subject: Re: [Intel-gfx] [v2 2/2] drm/i915: Attach colorspace property and enable
>modeset
>
>Op 31-10-18 om 13:05 schreef Uma Shankar:
>> This patch attaches the colorspace connector property to the hdmi
>> connector. Based on colorspace change, modeset will be triggered to
>> switch to new colorspace.
>>
>> Based on colorspace property value create an infoframe with
>> appropriate colorspace. This can be used to send an infoframe packet
>> with proper colorspace value set which will help to enable wider color
>> gamut like BT2020 on sink.
>>
>> v2: Merged the changes of creating infoframe as well to this patch as
>> per Maarten's suggestion.
>>
>> Signed-off-by: Uma Shankar <uma.shankar@intel.com>
>> ---
>>  drivers/gpu/drm/i915/intel_atomic.c | 1 +
>>  drivers/gpu/drm/i915/intel_hdmi.c   | 5 +++++
>>  2 files changed, 6 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/i915/intel_atomic.c
>> b/drivers/gpu/drm/i915/intel_atomic.c
>> index a5a2c8f..35ef70a 100644
>> --- a/drivers/gpu/drm/i915/intel_atomic.c
>> +++ b/drivers/gpu/drm/i915/intel_atomic.c
>> @@ -125,6 +125,7 @@ int intel_digital_connector_atomic_check(struct
>drm_connector *conn,
>>  	 */
>>  	if (new_conn_state->force_audio != old_conn_state->force_audio ||
>>  	    new_conn_state->broadcast_rgb != old_conn_state->broadcast_rgb
>> ||
>> +	    new_state->colorspace != old_state->colorspace ||
>>  	    new_conn_state->base.picture_aspect_ratio != old_conn_state-
>>base.picture_aspect_ratio ||
>>  	    new_conn_state->base.content_type != old_conn_state-
>>base.content_type ||
>>  	    new_conn_state->base.scaling_mode !=
>> old_conn_state->base.scaling_mode)
>> diff --git a/drivers/gpu/drm/i915/intel_hdmi.c
>> b/drivers/gpu/drm/i915/intel_hdmi.c
>> index 129b880..8a41fb3 100644
>> --- a/drivers/gpu/drm/i915/intel_hdmi.c
>> +++ b/drivers/gpu/drm/i915/intel_hdmi.c
>> @@ -486,6 +486,8 @@ static void intel_hdmi_set_avi_infoframe(struct
>intel_encoder *encoder,
>>  	else
>>  		frame.avi.colorspace = HDMI_COLORSPACE_RGB;
>>
>> +	frame.avi.extended_colorimetry = conn_state->colorspace;
>> +
>>  	drm_hdmi_avi_infoframe_quant_range(&frame.avi, adjusted_mode,
>>  					   crtc_state->limited_color_range ?
>>
>HDMI_QUANTIZATION_RANGE_LIMITED :
>> @@ -2125,6 +2127,9 @@ static void intel_hdmi_destroy(struct drm_connector
>*connector)
>>  	intel_attach_broadcast_rgb_property(connector);
>>  	intel_attach_aspect_ratio_property(connector);
>>  	drm_connector_attach_content_type_property(connector);
>> +	drm_object_attach_property(&connector->base,
>> +			connector->dev->mode_config.colorspace_property,
>> +			COLORIMETRY_ITU_709);
>Just put 0 here..
>If you want to init the default colorspace, put it in the first patch.

Ok, will update this.

>We should perhaps hide color spaces that are not supported on HDMI?

Currently the supported colorspaces will be picked from edid by userspace and
they should use the current property interface to set the one which is supported.
Even on HDMI, some connectors may not support certain colorspace, so keeping
it on userspace to set the one which is supported by the particular connector. Hope
this approach is fine ?

Regards,
Uma Shankar

>>  	connector->state->picture_aspect_ratio =
>HDMI_PICTURE_ASPECT_NONE;
>> }
>>
>
Ville Syrjälä Nov. 2, 2018, 3:41 p.m. UTC | #3
On Fri, Nov 02, 2018 at 02:18:42PM +0000, Shankar, Uma wrote:
> 
> 
> >-----Original Message-----
> >From: Maarten Lankhorst [mailto:maarten.lankhorst@linux.intel.com]
> >Sent: Friday, November 2, 2018 2:53 PM
> >To: Shankar, Uma <uma.shankar@intel.com>; dri-devel@lists.freedesktop.org;
> >intel-gfx@lists.freedesktop.org
> >Cc: Syrjala, Ville <ville.syrjala@intel.com>; ajax@redhat.com; Lankhorst, Maarten
> ><maarten.lankhorst@intel.com>
> >Subject: Re: [Intel-gfx] [v2 2/2] drm/i915: Attach colorspace property and enable
> >modeset
> >
> >Op 31-10-18 om 13:05 schreef Uma Shankar:
> >> This patch attaches the colorspace connector property to the hdmi
> >> connector. Based on colorspace change, modeset will be triggered to
> >> switch to new colorspace.
> >>
> >> Based on colorspace property value create an infoframe with
> >> appropriate colorspace. This can be used to send an infoframe packet
> >> with proper colorspace value set which will help to enable wider color
> >> gamut like BT2020 on sink.
> >>
> >> v2: Merged the changes of creating infoframe as well to this patch as
> >> per Maarten's suggestion.
> >>
> >> Signed-off-by: Uma Shankar <uma.shankar@intel.com>
> >> ---
> >>  drivers/gpu/drm/i915/intel_atomic.c | 1 +
> >>  drivers/gpu/drm/i915/intel_hdmi.c   | 5 +++++
> >>  2 files changed, 6 insertions(+)
> >>
> >> diff --git a/drivers/gpu/drm/i915/intel_atomic.c
> >> b/drivers/gpu/drm/i915/intel_atomic.c
> >> index a5a2c8f..35ef70a 100644
> >> --- a/drivers/gpu/drm/i915/intel_atomic.c
> >> +++ b/drivers/gpu/drm/i915/intel_atomic.c
> >> @@ -125,6 +125,7 @@ int intel_digital_connector_atomic_check(struct
> >drm_connector *conn,
> >>  	 */
> >>  	if (new_conn_state->force_audio != old_conn_state->force_audio ||
> >>  	    new_conn_state->broadcast_rgb != old_conn_state->broadcast_rgb
> >> ||
> >> +	    new_state->colorspace != old_state->colorspace ||
> >>  	    new_conn_state->base.picture_aspect_ratio != old_conn_state-
> >>base.picture_aspect_ratio ||
> >>  	    new_conn_state->base.content_type != old_conn_state-
> >>base.content_type ||
> >>  	    new_conn_state->base.scaling_mode !=
> >> old_conn_state->base.scaling_mode)
> >> diff --git a/drivers/gpu/drm/i915/intel_hdmi.c
> >> b/drivers/gpu/drm/i915/intel_hdmi.c
> >> index 129b880..8a41fb3 100644
> >> --- a/drivers/gpu/drm/i915/intel_hdmi.c
> >> +++ b/drivers/gpu/drm/i915/intel_hdmi.c
> >> @@ -486,6 +486,8 @@ static void intel_hdmi_set_avi_infoframe(struct
> >intel_encoder *encoder,
> >>  	else
> >>  		frame.avi.colorspace = HDMI_COLORSPACE_RGB;
> >>
> >> +	frame.avi.extended_colorimetry = conn_state->colorspace;
> >> +
> >>  	drm_hdmi_avi_infoframe_quant_range(&frame.avi, adjusted_mode,
> >>  					   crtc_state->limited_color_range ?
> >>
> >HDMI_QUANTIZATION_RANGE_LIMITED :
> >> @@ -2125,6 +2127,9 @@ static void intel_hdmi_destroy(struct drm_connector
> >*connector)
> >>  	intel_attach_broadcast_rgb_property(connector);
> >>  	intel_attach_aspect_ratio_property(connector);
> >>  	drm_connector_attach_content_type_property(connector);
> >> +	drm_object_attach_property(&connector->base,
> >> +			connector->dev->mode_config.colorspace_property,
> >> +			COLORIMETRY_ITU_709);
> >Just put 0 here..
> >If you want to init the default colorspace, put it in the first patch.
> 
> Ok, will update this.
> 
> >We should perhaps hide color spaces that are not supported on HDMI?
> 
> Currently the supported colorspaces will be picked from edid by userspace and
> they should use the current property interface to set the one which is supported.
> Even on HDMI, some connectors may not support certain colorspace, so keeping
> it on userspace to set the one which is supported by the particular connector. Hope
> this approach is fine ?

I think we want to trim the list to whatever the infoframe vs. MSA/VSC
SDP can carry. So HDMI will have one list, DP another. And I guess for
lspcon we want to go with the HDMI definition since we populate the
infoframe by hand.
Maarten Lankhorst Nov. 2, 2018, 3:44 p.m. UTC | #4
Op 02-11-18 om 16:41 schreef Ville Syrjälä:
> On Fri, Nov 02, 2018 at 02:18:42PM +0000, Shankar, Uma wrote:
>>
>>> -----Original Message-----
>>> From: Maarten Lankhorst [mailto:maarten.lankhorst@linux.intel.com]
>>> Sent: Friday, November 2, 2018 2:53 PM
>>> To: Shankar, Uma <uma.shankar@intel.com>; dri-devel@lists.freedesktop.org;
>>> intel-gfx@lists.freedesktop.org
>>> Cc: Syrjala, Ville <ville.syrjala@intel.com>; ajax@redhat.com; Lankhorst, Maarten
>>> <maarten.lankhorst@intel.com>
>>> Subject: Re: [Intel-gfx] [v2 2/2] drm/i915: Attach colorspace property and enable
>>> modeset
>>>
>>> Op 31-10-18 om 13:05 schreef Uma Shankar:
>>>> This patch attaches the colorspace connector property to the hdmi
>>>> connector. Based on colorspace change, modeset will be triggered to
>>>> switch to new colorspace.
>>>>
>>>> Based on colorspace property value create an infoframe with
>>>> appropriate colorspace. This can be used to send an infoframe packet
>>>> with proper colorspace value set which will help to enable wider color
>>>> gamut like BT2020 on sink.
>>>>
>>>> v2: Merged the changes of creating infoframe as well to this patch as
>>>> per Maarten's suggestion.
>>>>
>>>> Signed-off-by: Uma Shankar <uma.shankar@intel.com>
>>>> ---
>>>>  drivers/gpu/drm/i915/intel_atomic.c | 1 +
>>>>  drivers/gpu/drm/i915/intel_hdmi.c   | 5 +++++
>>>>  2 files changed, 6 insertions(+)
>>>>
>>>> diff --git a/drivers/gpu/drm/i915/intel_atomic.c
>>>> b/drivers/gpu/drm/i915/intel_atomic.c
>>>> index a5a2c8f..35ef70a 100644
>>>> --- a/drivers/gpu/drm/i915/intel_atomic.c
>>>> +++ b/drivers/gpu/drm/i915/intel_atomic.c
>>>> @@ -125,6 +125,7 @@ int intel_digital_connector_atomic_check(struct
>>> drm_connector *conn,
>>>>  	 */
>>>>  	if (new_conn_state->force_audio != old_conn_state->force_audio ||
>>>>  	    new_conn_state->broadcast_rgb != old_conn_state->broadcast_rgb
>>>> ||
>>>> +	    new_state->colorspace != old_state->colorspace ||
>>>>  	    new_conn_state->base.picture_aspect_ratio != old_conn_state-
>>>> base.picture_aspect_ratio ||
>>>>  	    new_conn_state->base.content_type != old_conn_state-
>>>> base.content_type ||
>>>>  	    new_conn_state->base.scaling_mode !=
>>>> old_conn_state->base.scaling_mode)
>>>> diff --git a/drivers/gpu/drm/i915/intel_hdmi.c
>>>> b/drivers/gpu/drm/i915/intel_hdmi.c
>>>> index 129b880..8a41fb3 100644
>>>> --- a/drivers/gpu/drm/i915/intel_hdmi.c
>>>> +++ b/drivers/gpu/drm/i915/intel_hdmi.c
>>>> @@ -486,6 +486,8 @@ static void intel_hdmi_set_avi_infoframe(struct
>>> intel_encoder *encoder,
>>>>  	else
>>>>  		frame.avi.colorspace = HDMI_COLORSPACE_RGB;
>>>>
>>>> +	frame.avi.extended_colorimetry = conn_state->colorspace;
>>>> +
>>>>  	drm_hdmi_avi_infoframe_quant_range(&frame.avi, adjusted_mode,
>>>>  					   crtc_state->limited_color_range ?
>>>>
>>> HDMI_QUANTIZATION_RANGE_LIMITED :
>>>> @@ -2125,6 +2127,9 @@ static void intel_hdmi_destroy(struct drm_connector
>>> *connector)
>>>>  	intel_attach_broadcast_rgb_property(connector);
>>>>  	intel_attach_aspect_ratio_property(connector);
>>>>  	drm_connector_attach_content_type_property(connector);
>>>> +	drm_object_attach_property(&connector->base,
>>>> +			connector->dev->mode_config.colorspace_property,
>>>> +			COLORIMETRY_ITU_709);
>>> Just put 0 here..
>>> If you want to init the default colorspace, put it in the first patch.
>> Ok, will update this.
>>
>>> We should perhaps hide color spaces that are not supported on HDMI?
>> Currently the supported colorspaces will be picked from edid by userspace and
>> they should use the current property interface to set the one which is supported.
>> Even on HDMI, some connectors may not support certain colorspace, so keeping
>> it on userspace to set the one which is supported by the particular connector. Hope
>> this approach is fine ?
> I think we want to trim the list to whatever the infoframe vs. MSA/VSC
> SDP can carry. So HDMI will have one list, DP another. And I guess for
> lspcon we want to go with the HDMI definition since we populate the
> infoframe by hand.
>
What about passive DP to HDMI convertors?
Ville Syrjälä Nov. 2, 2018, 3:49 p.m. UTC | #5
On Fri, Nov 02, 2018 at 04:44:10PM +0100, Maarten Lankhorst wrote:
> Op 02-11-18 om 16:41 schreef Ville Syrjälä:
> > On Fri, Nov 02, 2018 at 02:18:42PM +0000, Shankar, Uma wrote:
> >>
> >>> -----Original Message-----
> >>> From: Maarten Lankhorst [mailto:maarten.lankhorst@linux.intel.com]
> >>> Sent: Friday, November 2, 2018 2:53 PM
> >>> To: Shankar, Uma <uma.shankar@intel.com>; dri-devel@lists.freedesktop.org;
> >>> intel-gfx@lists.freedesktop.org
> >>> Cc: Syrjala, Ville <ville.syrjala@intel.com>; ajax@redhat.com; Lankhorst, Maarten
> >>> <maarten.lankhorst@intel.com>
> >>> Subject: Re: [Intel-gfx] [v2 2/2] drm/i915: Attach colorspace property and enable
> >>> modeset
> >>>
> >>> Op 31-10-18 om 13:05 schreef Uma Shankar:
> >>>> This patch attaches the colorspace connector property to the hdmi
> >>>> connector. Based on colorspace change, modeset will be triggered to
> >>>> switch to new colorspace.
> >>>>
> >>>> Based on colorspace property value create an infoframe with
> >>>> appropriate colorspace. This can be used to send an infoframe packet
> >>>> with proper colorspace value set which will help to enable wider color
> >>>> gamut like BT2020 on sink.
> >>>>
> >>>> v2: Merged the changes of creating infoframe as well to this patch as
> >>>> per Maarten's suggestion.
> >>>>
> >>>> Signed-off-by: Uma Shankar <uma.shankar@intel.com>
> >>>> ---
> >>>>  drivers/gpu/drm/i915/intel_atomic.c | 1 +
> >>>>  drivers/gpu/drm/i915/intel_hdmi.c   | 5 +++++
> >>>>  2 files changed, 6 insertions(+)
> >>>>
> >>>> diff --git a/drivers/gpu/drm/i915/intel_atomic.c
> >>>> b/drivers/gpu/drm/i915/intel_atomic.c
> >>>> index a5a2c8f..35ef70a 100644
> >>>> --- a/drivers/gpu/drm/i915/intel_atomic.c
> >>>> +++ b/drivers/gpu/drm/i915/intel_atomic.c
> >>>> @@ -125,6 +125,7 @@ int intel_digital_connector_atomic_check(struct
> >>> drm_connector *conn,
> >>>>  	 */
> >>>>  	if (new_conn_state->force_audio != old_conn_state->force_audio ||
> >>>>  	    new_conn_state->broadcast_rgb != old_conn_state->broadcast_rgb
> >>>> ||
> >>>> +	    new_state->colorspace != old_state->colorspace ||
> >>>>  	    new_conn_state->base.picture_aspect_ratio != old_conn_state-
> >>>> base.picture_aspect_ratio ||
> >>>>  	    new_conn_state->base.content_type != old_conn_state-
> >>>> base.content_type ||
> >>>>  	    new_conn_state->base.scaling_mode !=
> >>>> old_conn_state->base.scaling_mode)
> >>>> diff --git a/drivers/gpu/drm/i915/intel_hdmi.c
> >>>> b/drivers/gpu/drm/i915/intel_hdmi.c
> >>>> index 129b880..8a41fb3 100644
> >>>> --- a/drivers/gpu/drm/i915/intel_hdmi.c
> >>>> +++ b/drivers/gpu/drm/i915/intel_hdmi.c
> >>>> @@ -486,6 +486,8 @@ static void intel_hdmi_set_avi_infoframe(struct
> >>> intel_encoder *encoder,
> >>>>  	else
> >>>>  		frame.avi.colorspace = HDMI_COLORSPACE_RGB;
> >>>>
> >>>> +	frame.avi.extended_colorimetry = conn_state->colorspace;
> >>>> +
> >>>>  	drm_hdmi_avi_infoframe_quant_range(&frame.avi, adjusted_mode,
> >>>>  					   crtc_state->limited_color_range ?
> >>>>
> >>> HDMI_QUANTIZATION_RANGE_LIMITED :
> >>>> @@ -2125,6 +2127,9 @@ static void intel_hdmi_destroy(struct drm_connector
> >>> *connector)
> >>>>  	intel_attach_broadcast_rgb_property(connector);
> >>>>  	intel_attach_aspect_ratio_property(connector);
> >>>>  	drm_connector_attach_content_type_property(connector);
> >>>> +	drm_object_attach_property(&connector->base,
> >>>> +			connector->dev->mode_config.colorspace_property,
> >>>> +			COLORIMETRY_ITU_709);
> >>> Just put 0 here..
> >>> If you want to init the default colorspace, put it in the first patch.
> >> Ok, will update this.
> >>
> >>> We should perhaps hide color spaces that are not supported on HDMI?
> >> Currently the supported colorspaces will be picked from edid by userspace and
> >> they should use the current property interface to set the one which is supported.
> >> Even on HDMI, some connectors may not support certain colorspace, so keeping
> >> it on userspace to set the one which is supported by the particular connector. Hope
> >> this approach is fine ?
> > I think we want to trim the list to whatever the infoframe vs. MSA/VSC
> > SDP can carry. So HDMI will have one list, DP another. And I guess for
> > lspcon we want to go with the HDMI definition since we populate the
> > infoframe by hand.
> >
> What about passive DP to HDMI convertors?

By passive you mean DP++? Those are HDMI for us.

External DP->HDMI protocol converters are perhaps more tricky, but
since we treat those as pure DP now and don't send any infoframes I
think we should do the same when it comes to the exposed valeus for
the property.
Sharma, Shashank Nov. 3, 2018, 6:21 a.m. UTC | #6
Regards

Shashank


On 10/31/2018 5:35 PM, Uma Shankar wrote:
> This patch attaches the colorspace connector property to the
> hdmi connector. Based on colorspace change, modeset will be
> triggered to switch to new colorspace.
>
> Based on colorspace property value create an infoframe
> with appropriate colorspace. This can be used to send an
> infoframe packet with proper colorspace value set which
> will help to enable wider color gamut like BT2020 on sink.
>
> v2: Merged the changes of creating infoframe as well to this
> patch as per Maarten's suggestion.
>
> Signed-off-by: Uma Shankar <uma.shankar@intel.com>
> ---
>   drivers/gpu/drm/i915/intel_atomic.c | 1 +
>   drivers/gpu/drm/i915/intel_hdmi.c   | 5 +++++
>   2 files changed, 6 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/intel_atomic.c b/drivers/gpu/drm/i915/intel_atomic.c
> index a5a2c8f..35ef70a 100644
> --- a/drivers/gpu/drm/i915/intel_atomic.c
> +++ b/drivers/gpu/drm/i915/intel_atomic.c
> @@ -125,6 +125,7 @@ int intel_digital_connector_atomic_check(struct drm_connector *conn,
>   	 */
>   	if (new_conn_state->force_audio != old_conn_state->force_audio ||
>   	    new_conn_state->broadcast_rgb != old_conn_state->broadcast_rgb ||
> +	    new_state->colorspace != old_state->colorspace ||
>   	    new_conn_state->base.picture_aspect_ratio != old_conn_state->base.picture_aspect_ratio ||
>   	    new_conn_state->base.content_type != old_conn_state->base.content_type ||
>   	    new_conn_state->base.scaling_mode != old_conn_state->base.scaling_mode)
> diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
> index 129b880..8a41fb3 100644
> --- a/drivers/gpu/drm/i915/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/intel_hdmi.c
> @@ -486,6 +486,8 @@ static void intel_hdmi_set_avi_infoframe(struct intel_encoder *encoder,
>   	else
>   		frame.avi.colorspace = HDMI_COLORSPACE_RGB;
>   
> +	frame.avi.extended_colorimetry = conn_state->colorspace;
> +
We must also set the date byte 2 bits C1-C0 (colorimetry part) to 
indicate the use of extended colorimetry bits, so that monitor will 
refer to extended colorimetry data, else it wont even bother looking at it:

Extended Colorimetry Information Valid (colorimetry indicated in bits 
EC0, EC1, and EC2)


Its right now set to dafault 0-0 I guess, indicating No data We should 
also set it to a default value now, when we have started bothering about 
gamut.

Regards
Shashank
>   	drm_hdmi_avi_infoframe_quant_range(&frame.avi, adjusted_mode,
>   					   crtc_state->limited_color_range ?
>   					   HDMI_QUANTIZATION_RANGE_LIMITED :
> @@ -2125,6 +2127,9 @@ static void intel_hdmi_destroy(struct drm_connector *connector)
>   	intel_attach_broadcast_rgb_property(connector);
>   	intel_attach_aspect_ratio_property(connector);
>   	drm_connector_attach_content_type_property(connector);
> +	drm_object_attach_property(&connector->base,
> +			connector->dev->mode_config.colorspace_property,
> +			COLORIMETRY_ITU_709);
>   	connector->state->picture_aspect_ratio = HDMI_PICTURE_ASPECT_NONE;
>   }
>
<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>Regards</p>
    <p>Shashank<br>
    </p>
    <br>
    <div class="moz-cite-prefix">On 10/31/2018 5:35 PM, Uma Shankar
      wrote:<br>
    </div>
    <blockquote
      cite="mid:1540987546-3142-3-git-send-email-uma.shankar@intel.com"
      type="cite">
      <pre wrap="">This patch attaches the colorspace connector property to the
hdmi connector. Based on colorspace change, modeset will be
triggered to switch to new colorspace.

Based on colorspace property value create an infoframe
with appropriate colorspace. This can be used to send an
infoframe packet with proper colorspace value set which
will help to enable wider color gamut like BT2020 on sink.

v2: Merged the changes of creating infoframe as well to this
patch as per Maarten's suggestion.

Signed-off-by: Uma Shankar <a class="moz-txt-link-rfc2396E" href="mailto:uma.shankar@intel.com">&lt;uma.shankar@intel.com&gt;</a>
---
 drivers/gpu/drm/i915/intel_atomic.c | 1 +
 drivers/gpu/drm/i915/intel_hdmi.c   | 5 +++++
 2 files changed, 6 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_atomic.c b/drivers/gpu/drm/i915/intel_atomic.c
index a5a2c8f..35ef70a 100644
--- a/drivers/gpu/drm/i915/intel_atomic.c
+++ b/drivers/gpu/drm/i915/intel_atomic.c
@@ -125,6 +125,7 @@ int intel_digital_connector_atomic_check(struct drm_connector *conn,
 	 */
 	if (new_conn_state-&gt;force_audio != old_conn_state-&gt;force_audio ||
 	    new_conn_state-&gt;broadcast_rgb != old_conn_state-&gt;broadcast_rgb ||
+	    new_state-&gt;colorspace != old_state-&gt;colorspace ||
 	    new_conn_state-&gt;base.picture_aspect_ratio != old_conn_state-&gt;base.picture_aspect_ratio ||
 	    new_conn_state-&gt;base.content_type != old_conn_state-&gt;base.content_type ||
 	    new_conn_state-&gt;base.scaling_mode != old_conn_state-&gt;base.scaling_mode)
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index 129b880..8a41fb3 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -486,6 +486,8 @@ static void intel_hdmi_set_avi_infoframe(struct intel_encoder *encoder,
 	else
 		frame.avi.colorspace = HDMI_COLORSPACE_RGB;
 
+	frame.avi.extended_colorimetry = conn_state-&gt;colorspace;
+</pre>
    </blockquote>
    We must also set the date byte 2 bits C1-C0 (colorimetry part) to
    indicate the use of extended colorimetry bits, so that monitor will
    refer to extended colorimetry data, else it wont even bother looking
    at it:<br>
    <br>
    <meta http-equiv="Content-Type" content="text/html;
      charset=windows-1252">
    <table class="NormalTable" height="57" width="804">
      <tbody>
        <tr>
          <td width="200"><span class="fontstyle0">Extended Colorimetry
              Information Valid (colorimetry indicated in bits EC0, EC1,
              and EC2)</span></td>
        </tr>
      </tbody>
    </table>
    <br style=" font-style: normal; font-variant: normal; font-weight:
      normal; letter-spacing: normal; line-height: normal; orphans: 2;
      text-align: -webkit-auto; text-indent: 0px; text-transform: none;
      white-space: normal; widows: 2; word-spacing: 0px;
      -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">
    <style>
<!--
br
{
mso-data-placement:same-cell;
}
table
{
mso-displayed-decimal-separator:"\.";
mso-displayed-thousand-separator:"\, ";
}
tr
{
mso-height-source:auto;
mso-ruby-visibility:none;
}
td
{
border:.5pt solid windowtext;
}
.NormalTable{cellspacing:0;cellpadding:10;border-collapse:collapse;mso-table-layout-alt:fixed;border:none; mso-border-alt:solid windowtext .75pt;mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-border-insideh:.75pt solid windowtext;mso-border-insidev:.75pt solid windowtext}
.fontstyle0
{
	font-family:ArialMT;
	font-size:9pt;
	font-style:normal;
	font-weight:normal;
	color:rgb(0,0,0);
}
.fontstyle1
{
	font-size:12pt;
	font-style:normal;
	font-weight:normal;
	color:rgb(0,0,0);
}
--></style>Its right now set to dafault 0-0 I guess, indicating No data
    We should also set it to a default value now, when we have started
    bothering about gamut. <br>
    <br>
    Regards<br>
    Shashank<br style=" font-style: normal; font-variant: normal;
      font-weight: normal; letter-spacing: normal; line-height: normal;
      orphans: 2; text-align: -webkit-auto; text-indent: 0px;
      text-transform: none; white-space: normal; widows: 2;
      word-spacing: 0px; -webkit-text-size-adjust: auto;
      -webkit-text-stroke-width: 0px; ">
    <style>
<!--
br
{
mso-data-placement:same-cell;
}
table
{
mso-displayed-decimal-separator:"\.";
mso-displayed-thousand-separator:"\, ";
}
tr
{
mso-height-source:auto;
mso-ruby-visibility:none;
}
td
{
border:.5pt solid windowtext;
}
.NormalTable{cellspacing:0;cellpadding:10;border-collapse:collapse;mso-table-layout-alt:fixed;border:none; mso-border-alt:solid windowtext .75pt;mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-border-insideh:.75pt solid windowtext;mso-border-insidev:.75pt solid windowtext}
.fontstyle0
{
	font-family:ArialMT;
	font-size:9pt;
	font-style:normal;
	font-weight:normal;
	color:rgb(0,0,0);
}
.fontstyle1
{
	font-size:12pt;
	font-style:normal;
	font-weight:normal;
	color:rgb(0,0,0);
}
--> </style>
    <blockquote
      cite="mid:1540987546-3142-3-git-send-email-uma.shankar@intel.com"
      type="cite">
      <pre wrap="">
 	drm_hdmi_avi_infoframe_quant_range(&amp;frame.avi, adjusted_mode,
 					   crtc_state-&gt;limited_color_range ?
 					   HDMI_QUANTIZATION_RANGE_LIMITED :
@@ -2125,6 +2127,9 @@ static void intel_hdmi_destroy(struct drm_connector *connector)
 	intel_attach_broadcast_rgb_property(connector);
 	intel_attach_aspect_ratio_property(connector);
 	drm_connector_attach_content_type_property(connector);
+	drm_object_attach_property(&amp;connector-&gt;base,
+			connector-&gt;dev-&gt;mode_config.colorspace_property,
+			COLORIMETRY_ITU_709);
 	connector-&gt;state-&gt;picture_aspect_ratio = HDMI_PICTURE_ASPECT_NONE;
 }
 
</pre>
    </blockquote>
    <br>
  </body>
</html>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/intel_atomic.c b/drivers/gpu/drm/i915/intel_atomic.c
index a5a2c8f..35ef70a 100644
--- a/drivers/gpu/drm/i915/intel_atomic.c
+++ b/drivers/gpu/drm/i915/intel_atomic.c
@@ -125,6 +125,7 @@  int intel_digital_connector_atomic_check(struct drm_connector *conn,
 	 */
 	if (new_conn_state->force_audio != old_conn_state->force_audio ||
 	    new_conn_state->broadcast_rgb != old_conn_state->broadcast_rgb ||
+	    new_state->colorspace != old_state->colorspace ||
 	    new_conn_state->base.picture_aspect_ratio != old_conn_state->base.picture_aspect_ratio ||
 	    new_conn_state->base.content_type != old_conn_state->base.content_type ||
 	    new_conn_state->base.scaling_mode != old_conn_state->base.scaling_mode)
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index 129b880..8a41fb3 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -486,6 +486,8 @@  static void intel_hdmi_set_avi_infoframe(struct intel_encoder *encoder,
 	else
 		frame.avi.colorspace = HDMI_COLORSPACE_RGB;
 
+	frame.avi.extended_colorimetry = conn_state->colorspace;
+
 	drm_hdmi_avi_infoframe_quant_range(&frame.avi, adjusted_mode,
 					   crtc_state->limited_color_range ?
 					   HDMI_QUANTIZATION_RANGE_LIMITED :
@@ -2125,6 +2127,9 @@  static void intel_hdmi_destroy(struct drm_connector *connector)
 	intel_attach_broadcast_rgb_property(connector);
 	intel_attach_aspect_ratio_property(connector);
 	drm_connector_attach_content_type_property(connector);
+	drm_object_attach_property(&connector->base,
+			connector->dev->mode_config.colorspace_property,
+			COLORIMETRY_ITU_709);
 	connector->state->picture_aspect_ratio = HDMI_PICTURE_ASPECT_NONE;
 }