diff mbox series

[v4,2/3] drm: Add DP colorspace property

Message ID 1543336843-22193-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 Nov. 27, 2018, 4:40 p.m. UTC
This patch adds a DP colorspace property, enabling
userspace to switch to various supported colorspaces.
This will help enable BT2020 along with other colorspaces.

v2: Addressed Maarten and Ville's review comments. Enhanced
    the colorspace enum to incorporate both HDMI and DP supported
    colorspaces. Also, added a default option for colorspace.

v3: Split the changes to have separate colorspace property for
DP and HDMI.

v4: Addressed Chris and Ville's review comments, and created a
common colorspace property for DP and HDMI, filtered the list
based on the colorspaces supported by the respective protocol
standard.

Signed-off-by: Uma Shankar <uma.shankar@intel.com>
---
 drivers/gpu/drm/drm_connector.c | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

Comments

Brian Starkey Nov. 28, 2018, 11:41 a.m. UTC | #1
Hi Uma,

On Tue, Nov 27, 2018 at 10:10:42PM +0530, Uma Shankar wrote:
> This patch adds a DP colorspace property, enabling
> userspace to switch to various supported colorspaces.
> This will help enable BT2020 along with other colorspaces.
> 
> v2: Addressed Maarten and Ville's review comments. Enhanced
>     the colorspace enum to incorporate both HDMI and DP supported
>     colorspaces. Also, added a default option for colorspace.
> 
> v3: Split the changes to have separate colorspace property for
> DP and HDMI.
> 
> v4: Addressed Chris and Ville's review comments, and created a
> common colorspace property for DP and HDMI, filtered the list
> based on the colorspaces supported by the respective protocol
> standard.
> 
> Signed-off-by: Uma Shankar <uma.shankar@intel.com>
> ---
>  drivers/gpu/drm/drm_connector.c | 31 +++++++++++++++++++++++++++++++
>  1 file changed, 31 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
> index 57d36e4..30e2e6f 100644
> --- a/drivers/gpu/drm/drm_connector.c
> +++ b/drivers/gpu/drm/drm_connector.c
> @@ -850,6 +850,29 @@ int drm_display_info_set_bus_formats(struct drm_display_info *info,
>  	{ COLORIMETRY_BT2020_CYCC, "BT2020_CYCC" },
>  };
>  
> +static const struct drm_prop_enum_list dp_colorspace[] = {
> +	/* For Default case, driver will set the colorspace */
> +	{ COLORIMETRY_DEFAULT, "Default" },
> +	/* Standard Definition Colorimetry based on CEA 861 */
> +	{ COLORIMETRY_ITU_601, "ITU_601" },
> +	{ COLORIMETRY_ITU_709, "ITU_709" },
> +	/* Standard Definition Colorimetry based on IEC 61966-2-4 */
> +	{ COLORIMETRY_XV_YCC_601, "XV_YCC_601" },
> +	/* High Definition Colorimetry based on IEC 61966-2-4 */
> +	{ COLORIMETRY_XV_YCC_709, "XV_YCC_709" },
> +	/* Colorimetry based on IEC 61966-2-5 */
> +	{ COLORIMETRY_OPRGB, "opRGB" },

A macro for the common ones might be good to ensure they always stay
in-sync between HDMI and DP

Thanks,
-Brian

> +	/* DP MSA Colorimetry */
> +	{ DP_COLORIMETRY_Y_CBCR_ITU_601, "YCBCR_ITU_601" },
> +	{ DP_COLORIMETRY_Y_CBCR_ITU_709, "YCBCR_ITU_709" },
> +	{ DP_COLORIMETRY_SRGB, "sRGB" },
> +	{ DP_COLORIMETRY_RGB_WIDE_GAMUT, "RGB Wide Gamut" },
> +	{ DP_COLORIMETRY_SCRGB, "scRGB" },
> +	{ DP_COLORIMETRY_DCI_P3, "DCI-P3" },
> +	{ DP_COLORIMETRY_CUSTOM_COLOR_PROFILE, "Custom Profile" },
> +};
> +
> +
>  /**
>   * DOC: standard connector properties
>   *
> @@ -1454,6 +1477,14 @@ int drm_mode_create_colorspace_property(struct drm_connector *connector)
>  						ARRAY_SIZE(hdmi_colorspace));
>  		if (!prop)
>  			return -ENOMEM;
> +	} else if (connector->connector_type == DRM_MODE_CONNECTOR_eDP ||
> +		connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort) {
> +
> +		prop = drm_property_create_enum(dev, DRM_MODE_PROP_ENUM,
> +						"Colorspace", dp_colorspace,
> +						ARRAY_SIZE(dp_colorspace));
> +		if (!prop)
> +			return -ENOMEM;
>  	}
>  
>  	connector->colorspace_property = prop;
> -- 
> 1.9.1
>
Shankar, Uma Nov. 28, 2018, 1:59 p.m. UTC | #2
>-----Original Message-----
>From: Brian Starkey [mailto:Brian.Starkey@arm.com]
>Sent: Wednesday, November 28, 2018 5:12 PM
>To: Shankar, Uma <uma.shankar@intel.com>
>Cc: intel-gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org; Lankhorst,
>Maarten <maarten.lankhorst@intel.com>; Syrjala, Ville <ville.syrjala@intel.com>;
>Sharma, Shashank <shashank.sharma@intel.com>; jonas@kwiboo.se;
>hansverk@cisco.com; nd <nd@arm.com>
>Subject: Re: [v4 2/3] drm: Add DP colorspace property
>
>Hi Uma,
>
>On Tue, Nov 27, 2018 at 10:10:42PM +0530, Uma Shankar wrote:
>> This patch adds a DP colorspace property, enabling userspace to switch
>> to various supported colorspaces.
>> This will help enable BT2020 along with other colorspaces.
>>
>> v2: Addressed Maarten and Ville's review comments. Enhanced
>>     the colorspace enum to incorporate both HDMI and DP supported
>>     colorspaces. Also, added a default option for colorspace.
>>
>> v3: Split the changes to have separate colorspace property for DP and
>> HDMI.
>>
>> v4: Addressed Chris and Ville's review comments, and created a common
>> colorspace property for DP and HDMI, filtered the list based on the
>> colorspaces supported by the respective protocol standard.
>>
>> Signed-off-by: Uma Shankar <uma.shankar@intel.com>
>> ---
>>  drivers/gpu/drm/drm_connector.c | 31 +++++++++++++++++++++++++++++++
>>  1 file changed, 31 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/drm_connector.c
>> b/drivers/gpu/drm/drm_connector.c index 57d36e4..30e2e6f 100644
>> --- a/drivers/gpu/drm/drm_connector.c
>> +++ b/drivers/gpu/drm/drm_connector.c
>> @@ -850,6 +850,29 @@ int drm_display_info_set_bus_formats(struct
>drm_display_info *info,
>>  	{ COLORIMETRY_BT2020_CYCC, "BT2020_CYCC" },  };
>>
>> +static const struct drm_prop_enum_list dp_colorspace[] = {
>> +	/* For Default case, driver will set the colorspace */
>> +	{ COLORIMETRY_DEFAULT, "Default" },
>> +	/* Standard Definition Colorimetry based on CEA 861 */
>> +	{ COLORIMETRY_ITU_601, "ITU_601" },
>> +	{ COLORIMETRY_ITU_709, "ITU_709" },
>> +	/* Standard Definition Colorimetry based on IEC 61966-2-4 */
>> +	{ COLORIMETRY_XV_YCC_601, "XV_YCC_601" },
>> +	/* High Definition Colorimetry based on IEC 61966-2-4 */
>> +	{ COLORIMETRY_XV_YCC_709, "XV_YCC_709" },
>> +	/* Colorimetry based on IEC 61966-2-5 */
>> +	{ COLORIMETRY_OPRGB, "opRGB" },
>
>A macro for the common ones might be good to ensure they always stay in-sync
>between HDMI and DP

Yes, I can make that. Will update it.

Thanks & Regards,
Uma Shankar

>Thanks,
>-Brian
>
>> +	/* DP MSA Colorimetry */
>> +	{ DP_COLORIMETRY_Y_CBCR_ITU_601, "YCBCR_ITU_601" },
>> +	{ DP_COLORIMETRY_Y_CBCR_ITU_709, "YCBCR_ITU_709" },
>> +	{ DP_COLORIMETRY_SRGB, "sRGB" },
>> +	{ DP_COLORIMETRY_RGB_WIDE_GAMUT, "RGB Wide Gamut" },
>> +	{ DP_COLORIMETRY_SCRGB, "scRGB" },
>> +	{ DP_COLORIMETRY_DCI_P3, "DCI-P3" },
>> +	{ DP_COLORIMETRY_CUSTOM_COLOR_PROFILE, "Custom Profile" }, };
>> +
>> +
>>  /**
>>   * DOC: standard connector properties
>>   *
>> @@ -1454,6 +1477,14 @@ int drm_mode_create_colorspace_property(struct
>drm_connector *connector)
>>  						ARRAY_SIZE(hdmi_colorspace));
>>  		if (!prop)
>>  			return -ENOMEM;
>> +	} else if (connector->connector_type == DRM_MODE_CONNECTOR_eDP
>||
>> +		connector->connector_type ==
>DRM_MODE_CONNECTOR_DisplayPort) {
>> +
>> +		prop = drm_property_create_enum(dev,
>DRM_MODE_PROP_ENUM,
>> +						"Colorspace", dp_colorspace,
>> +						ARRAY_SIZE(dp_colorspace));
>> +		if (!prop)
>> +			return -ENOMEM;
>>  	}
>>
>>  	connector->colorspace_property = prop;
>> --
>> 1.9.1
>>
Sharma, Shashank Nov. 28, 2018, 4:13 p.m. UTC | #3
Regards

Shashank


On 11/27/2018 10:10 PM, Uma Shankar wrote:
> This patch adds a DP colorspace property, enabling
> userspace to switch to various supported colorspaces.
> This will help enable BT2020 along with other colorspaces.
>
> v2: Addressed Maarten and Ville's review comments. Enhanced
>      the colorspace enum to incorporate both HDMI and DP supported
>      colorspaces. Also, added a default option for colorspace.
>
> v3: Split the changes to have separate colorspace property for
> DP and HDMI.
>
> v4: Addressed Chris and Ville's review comments, and created a
> common colorspace property for DP and HDMI, filtered the list
> based on the colorspaces supported by the respective protocol
> standard.
>
> Signed-off-by: Uma Shankar <uma.shankar@intel.com>
> ---
>   drivers/gpu/drm/drm_connector.c | 31 +++++++++++++++++++++++++++++++
>   1 file changed, 31 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
> index 57d36e4..30e2e6f 100644
> --- a/drivers/gpu/drm/drm_connector.c
> +++ b/drivers/gpu/drm/drm_connector.c
> @@ -850,6 +850,29 @@ int drm_display_info_set_bus_formats(struct drm_display_info *info,
>   	{ COLORIMETRY_BT2020_CYCC, "BT2020_CYCC" },
>   };
>   
> +static const struct drm_prop_enum_list dp_colorspace[] = {
> +	/* For Default case, driver will set the colorspace */
> +	{ COLORIMETRY_DEFAULT, "Default" },
> +	/* Standard Definition Colorimetry based on CEA 861 */
> +	{ COLORIMETRY_ITU_601, "ITU_601" },
> +	{ COLORIMETRY_ITU_709, "ITU_709" },
> +	/* Standard Definition Colorimetry based on IEC 61966-2-4 */
> +	{ COLORIMETRY_XV_YCC_601, "XV_YCC_601" },
> +	/* High Definition Colorimetry based on IEC 61966-2-4 */
> +	{ COLORIMETRY_XV_YCC_709, "XV_YCC_709" },
> +	/* Colorimetry based on IEC 61966-2-5 */
> +	{ COLORIMETRY_OPRGB, "opRGB" },
> +	/* DP MSA Colorimetry */
> +	{ DP_COLORIMETRY_Y_CBCR_ITU_601, "YCBCR_ITU_601" },
> +	{ DP_COLORIMETRY_Y_CBCR_ITU_709, "YCBCR_ITU_709" },
> +	{ DP_COLORIMETRY_SRGB, "sRGB" },
> +	{ DP_COLORIMETRY_RGB_WIDE_GAMUT, "RGB Wide Gamut" },
> +	{ DP_COLORIMETRY_SCRGB, "scRGB" },
> +	{ DP_COLORIMETRY_DCI_P3, "DCI-P3" },
> +	{ DP_COLORIMETRY_CUSTOM_COLOR_PROFILE, "Custom Profile" },
> +};
> +
> +
The same comments as previous patch, possibility of the platform specfic 
enum values being passed from the core driver. and DRM layer blindly 
registers it.
- Shashank
>   /**
>    * DOC: standard connector properties
>    *
> @@ -1454,6 +1477,14 @@ int drm_mode_create_colorspace_property(struct drm_connector *connector)
>   						ARRAY_SIZE(hdmi_colorspace));
>   		if (!prop)
>   			return -ENOMEM;
> +	} else if (connector->connector_type == DRM_MODE_CONNECTOR_eDP ||
> +		connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort) {
> +
> +		prop = drm_property_create_enum(dev, DRM_MODE_PROP_ENUM,
> +						"Colorspace", dp_colorspace,
> +						ARRAY_SIZE(dp_colorspace));
> +		if (!prop)
> +			return -ENOMEM;
>   	}
>   
>   	connector->colorspace_property = prop;
diff mbox series

Patch

diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
index 57d36e4..30e2e6f 100644
--- a/drivers/gpu/drm/drm_connector.c
+++ b/drivers/gpu/drm/drm_connector.c
@@ -850,6 +850,29 @@  int drm_display_info_set_bus_formats(struct drm_display_info *info,
 	{ COLORIMETRY_BT2020_CYCC, "BT2020_CYCC" },
 };
 
+static const struct drm_prop_enum_list dp_colorspace[] = {
+	/* For Default case, driver will set the colorspace */
+	{ COLORIMETRY_DEFAULT, "Default" },
+	/* Standard Definition Colorimetry based on CEA 861 */
+	{ COLORIMETRY_ITU_601, "ITU_601" },
+	{ COLORIMETRY_ITU_709, "ITU_709" },
+	/* Standard Definition Colorimetry based on IEC 61966-2-4 */
+	{ COLORIMETRY_XV_YCC_601, "XV_YCC_601" },
+	/* High Definition Colorimetry based on IEC 61966-2-4 */
+	{ COLORIMETRY_XV_YCC_709, "XV_YCC_709" },
+	/* Colorimetry based on IEC 61966-2-5 */
+	{ COLORIMETRY_OPRGB, "opRGB" },
+	/* DP MSA Colorimetry */
+	{ DP_COLORIMETRY_Y_CBCR_ITU_601, "YCBCR_ITU_601" },
+	{ DP_COLORIMETRY_Y_CBCR_ITU_709, "YCBCR_ITU_709" },
+	{ DP_COLORIMETRY_SRGB, "sRGB" },
+	{ DP_COLORIMETRY_RGB_WIDE_GAMUT, "RGB Wide Gamut" },
+	{ DP_COLORIMETRY_SCRGB, "scRGB" },
+	{ DP_COLORIMETRY_DCI_P3, "DCI-P3" },
+	{ DP_COLORIMETRY_CUSTOM_COLOR_PROFILE, "Custom Profile" },
+};
+
+
 /**
  * DOC: standard connector properties
  *
@@ -1454,6 +1477,14 @@  int drm_mode_create_colorspace_property(struct drm_connector *connector)
 						ARRAY_SIZE(hdmi_colorspace));
 		if (!prop)
 			return -ENOMEM;
+	} else if (connector->connector_type == DRM_MODE_CONNECTOR_eDP ||
+		connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort) {
+
+		prop = drm_property_create_enum(dev, DRM_MODE_PROP_ENUM,
+						"Colorspace", dp_colorspace,
+						ARRAY_SIZE(dp_colorspace));
+		if (!prop)
+			return -ENOMEM;
 	}
 
 	connector->colorspace_property = prop;