Re: [Intel-gfx] [PATCH v6 3/7] drm: Add DisplayPort colorspace property

2019-09-12 Thread Saarinen, Jani
Hi,

> -Original Message-
> From: Intel-gfx [mailto:intel-gfx-boun...@lists.freedesktop.org] On Behalf Of
> Gwan-gyeong Mun
> Sent: torstai 12. syyskuuta 2019 6.25
> To: intel-gfx@lists.freedesktop.org
> Cc: imir...@alum.mit.edu; dri-de...@lists.freedesktop.org
> Subject: [Intel-gfx] [PATCH v6 3/7] drm: Add DisplayPort colorspace property
> 
> Becasue between HDMI and DP have different colorspaces, it renames
Typo ^^

> drm_mode_create_colorspace_property() function to
> drm_mode_create_hdmi_colorspace_property() function for HDMI connector.
> And it adds drm_mode_create_dp_colorspace_property() function for creating of 
> DP
> colorspace property.
> In order to apply changed and added drm api, i915 driver has channged.
> 
> v3: Addressed review comments from Ville
> - Add new colorimetry options for DP 1.4a spec.
> - Separate set of colorimetry enum values for DP.
> v4: Add additional comments to struct drm_prop_enum_list.
> Polishing an enum string of struct drm_prop_enum_list
> v5: Change definitions of DRM_MODE_COLORIMETRYs to follow HDMI prefix and
> DP abbreviations.
> Add missed variables on dp_colorspaces.
> Fix typo. [Uma]
> v6: Addressed review comments from Ilia and Ville
>- Split drm_mode_create_colorspace_property() to DP and HDMI connector.
> 
> Signed-off-by: Gwan-gyeong Mun 
> Reviewed-by: Uma Shankar 
> ---
>  drivers/gpu/drm/drm_connector.c   | 110 +++---
>  .../gpu/drm/i915/display/intel_connector.c|  21 +++-
>  include/drm/drm_connector.h   |  11 +-
>  3 files changed, 121 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
> index 4c766624b20d..48f4058c6d96 100644
> --- a/drivers/gpu/drm/drm_connector.c
> +++ b/drivers/gpu/drm/drm_connector.c
> @@ -882,6 +882,47 @@ static const struct drm_prop_enum_list
> hdmi_colorspaces[] = {
>   { DRM_MODE_COLORIMETRY_DCI_P3_RGB_THEATER, "DCI-
> P3_RGB_Theater" },  };
> 
> +/*
> + * As per DP 1.4a spec, 2.2.5.7.5 VSC SDP Payload for Pixel
> +Encoding/Colorimetry
> + * Format Table 2-120
> + */
> +static const struct drm_prop_enum_list dp_colorspaces[] = {
> + /* For Default case, driver will set the colorspace */
> + { DRM_MODE_COLORIMETRY_DEFAULT, "Default" },
> + /* Colorimetry based on sRGB (IEC 61966-2-1) */
> + { DRM_MODE_COLORIMETRY_CEA_RGB, "CEA_RGB" },
> + { DRM_MODE_COLORIMETRY_RGB_WIDE_FIXED,
> "RGB_Wide_Gamut_Fixed_Point" },
> + /* Colorimetry based on scRGB (IEC 61966-2-2) */
> + { DRM_MODE_COLORIMETRY_RGB_WIDE_FLOAT,
> "RGB_Wide_Gamut_Floating_Point" },
> + /* Colorimetry based on IEC 61966-2-5 */
> + { DRM_MODE_COLORIMETRY_OPRGB, "opRGB" },
> + /* Colorimetry based on SMPTE RP 431-2 */
> + { DRM_MODE_COLORIMETRY_DCI_P3_RGB_D65, "DCI-P3_RGB_D65" },
> + { DRM_MODE_COLORIMETRY_RGB_CUSTOM_COLOR_PROFILE,
> "RGB_Custom_Color_Profile" },
> + /* Colorimetry based on ITU-R BT.2020 */
> + { DRM_MODE_COLORIMETRY_BT2020_RGB, "BT2020_RGB" },
> + { DRM_MODE_COLORIMETRY_BT601_YCC, "BT601_YCC" },
> + { DRM_MODE_COLORIMETRY_BT709_YCC, "BT709_YCC" },
> + /* Standard Definition Colorimetry based on IEC 61966-2-4 */
> + { DRM_MODE_COLORIMETRY_XVYCC_601, "XVYCC_601" },
> + /* High Definition Colorimetry based on IEC 61966-2-4 */
> + { DRM_MODE_COLORIMETRY_XVYCC_709, "XVYCC_709" },
> + /* Colorimetry based on IEC 61966-2-1/Amendment 1 */
> + { DRM_MODE_COLORIMETRY_SYCC_601, "SYCC_601" },
> + /* Colorimetry based on IEC 61966-2-5 [33] */
> + { DRM_MODE_COLORIMETRY_OPYCC_601, "opYCC_601" },
> + /* Colorimetry based on ITU-R BT.2020 */
> + { DRM_MODE_COLORIMETRY_BT2020_CYCC, "BT2020_CYCC" },
> + /* Colorimetry based on ITU-R BT.2020 */
> + { DRM_MODE_COLORIMETRY_BT2020_YCC, "BT2020_YCC" },
> + /*
> +  * Colorimetry based on Digital Imaging and Communications in Medicine
> +  * (DICOM) Part 14: Grayscale Standard Display Function
> +  */
> + { DRM_MODE_COLORIMETRY_Y_ONLY_DICOM_P14_GRAYSCALE,
> "Y_ONLY_DICOM_Part_14_Grayscale" },
> + { DRM_MODE_COLORIMETRY_RAW_CUSTOM_COLOR_PROFILE,
> +"Raw_Custom_Color_Profile" }, };
> +
>  /**
>   * DOC: standard connector properties
>   *
> @@ -1674,7 +1715,6 @@
> EXPORT_SYMBOL(drm_mode_create_aspect_ratio_property);
>   * DOC: standard connector properties
>   *
>   * Colorspace:
> - * drm_mode_create_colorspace_property - create colorspace pro

[Intel-gfx] [PATCH v6 3/7] drm: Add DisplayPort colorspace property

2019-09-11 Thread Gwan-gyeong Mun
Becasue between HDMI and DP have different colorspaces, it renames
drm_mode_create_colorspace_property() function to
drm_mode_create_hdmi_colorspace_property() function for HDMI connector.
And it adds drm_mode_create_dp_colorspace_property() function for creating
of DP colorspace property.
In order to apply changed and added drm api, i915 driver has channged.

v3: Addressed review comments from Ville
- Add new colorimetry options for DP 1.4a spec.
- Separate set of colorimetry enum values for DP.
v4: Add additional comments to struct drm_prop_enum_list.
Polishing an enum string of struct drm_prop_enum_list
v5: Change definitions of DRM_MODE_COLORIMETRYs to follow HDMI prefix and
DP abbreviations.
Add missed variables on dp_colorspaces.
Fix typo. [Uma]
v6: Addressed review comments from Ilia and Ville
   - Split drm_mode_create_colorspace_property() to DP and HDMI connector.

Signed-off-by: Gwan-gyeong Mun 
Reviewed-by: Uma Shankar 
---
 drivers/gpu/drm/drm_connector.c   | 110 +++---
 .../gpu/drm/i915/display/intel_connector.c|  21 +++-
 include/drm/drm_connector.h   |  11 +-
 3 files changed, 121 insertions(+), 21 deletions(-)

diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
index 4c766624b20d..48f4058c6d96 100644
--- a/drivers/gpu/drm/drm_connector.c
+++ b/drivers/gpu/drm/drm_connector.c
@@ -882,6 +882,47 @@ static const struct drm_prop_enum_list hdmi_colorspaces[] 
= {
{ DRM_MODE_COLORIMETRY_DCI_P3_RGB_THEATER, "DCI-P3_RGB_Theater" },
 };
 
+/*
+ * As per DP 1.4a spec, 2.2.5.7.5 VSC SDP Payload for Pixel 
Encoding/Colorimetry
+ * Format Table 2-120
+ */
+static const struct drm_prop_enum_list dp_colorspaces[] = {
+   /* For Default case, driver will set the colorspace */
+   { DRM_MODE_COLORIMETRY_DEFAULT, "Default" },
+   /* Colorimetry based on sRGB (IEC 61966-2-1) */
+   { DRM_MODE_COLORIMETRY_CEA_RGB, "CEA_RGB" },
+   { DRM_MODE_COLORIMETRY_RGB_WIDE_FIXED, "RGB_Wide_Gamut_Fixed_Point" },
+   /* Colorimetry based on scRGB (IEC 61966-2-2) */
+   { DRM_MODE_COLORIMETRY_RGB_WIDE_FLOAT, "RGB_Wide_Gamut_Floating_Point" 
},
+   /* Colorimetry based on IEC 61966-2-5 */
+   { DRM_MODE_COLORIMETRY_OPRGB, "opRGB" },
+   /* Colorimetry based on SMPTE RP 431-2 */
+   { DRM_MODE_COLORIMETRY_DCI_P3_RGB_D65, "DCI-P3_RGB_D65" },
+   { DRM_MODE_COLORIMETRY_RGB_CUSTOM_COLOR_PROFILE, 
"RGB_Custom_Color_Profile" },
+   /* Colorimetry based on ITU-R BT.2020 */
+   { DRM_MODE_COLORIMETRY_BT2020_RGB, "BT2020_RGB" },
+   { DRM_MODE_COLORIMETRY_BT601_YCC, "BT601_YCC" },
+   { DRM_MODE_COLORIMETRY_BT709_YCC, "BT709_YCC" },
+   /* Standard Definition Colorimetry based on IEC 61966-2-4 */
+   { DRM_MODE_COLORIMETRY_XVYCC_601, "XVYCC_601" },
+   /* High Definition Colorimetry based on IEC 61966-2-4 */
+   { DRM_MODE_COLORIMETRY_XVYCC_709, "XVYCC_709" },
+   /* Colorimetry based on IEC 61966-2-1/Amendment 1 */
+   { DRM_MODE_COLORIMETRY_SYCC_601, "SYCC_601" },
+   /* Colorimetry based on IEC 61966-2-5 [33] */
+   { DRM_MODE_COLORIMETRY_OPYCC_601, "opYCC_601" },
+   /* Colorimetry based on ITU-R BT.2020 */
+   { DRM_MODE_COLORIMETRY_BT2020_CYCC, "BT2020_CYCC" },
+   /* Colorimetry based on ITU-R BT.2020 */
+   { DRM_MODE_COLORIMETRY_BT2020_YCC, "BT2020_YCC" },
+   /*
+* Colorimetry based on Digital Imaging and Communications in Medicine
+* (DICOM) Part 14: Grayscale Standard Display Function
+*/
+   { DRM_MODE_COLORIMETRY_Y_ONLY_DICOM_P14_GRAYSCALE, 
"Y_ONLY_DICOM_Part_14_Grayscale" },
+   { DRM_MODE_COLORIMETRY_RAW_CUSTOM_COLOR_PROFILE, 
"Raw_Custom_Color_Profile" },
+};
+
 /**
  * DOC: standard connector properties
  *
@@ -1674,7 +1715,6 @@ EXPORT_SYMBOL(drm_mode_create_aspect_ratio_property);
  * DOC: standard connector properties
  *
  * Colorspace:
- * drm_mode_create_colorspace_property - create colorspace property
  * This property helps select a suitable colorspace based on the sink
  * capability. Modern sink devices support wider gamut like BT2020.
  * This helps switch to BT2020 mode if the BT2020 encoded video stream
@@ -1694,32 +1734,68 @@ EXPORT_SYMBOL(drm_mode_create_aspect_ratio_property);
  *  - This property is just to inform sink what colorspace
  *source is trying to drive.
  *
+ * Becasue between HDMI and DP have different colorspaces,
+ * drm_mode_create_hdmi_colorspace_property() is used for HDMI connector and
+ * drm_mode_create_dp_colorspace_property() is used for DP connector.
+ */
+
+/**
+ * drm_mode_create_hdmi_colorspace_property - create hdmi colorspace property
+ * @connector: connector to create the Colorspace property on.
+ *
  * Called by a driver the first time it's needed, must be attached to desired
- * connectors.
+ * HDMI connectors.
+ *
+ * Returns:
+ * Zero on success, negative errono on failure.
  */
-int