All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Gwan-gyeong Mun <gwan-gyeong.mun@intel.com>
Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	imirkin@alum.mit.edu
Subject: Re: [PATCH v7 3/7] drm: Add DisplayPort colorspace property
Date: Fri, 13 Sep 2019 22:13:36 +0300	[thread overview]
Message-ID: <20190913191336.GE1208@intel.com> (raw)
In-Reply-To: <20190912113338.30796-4-gwan-gyeong.mun@intel.com>

On Thu, Sep 12, 2019 at 02:33:34PM +0300, Gwan-gyeong Mun wrote:
> Because 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.
> v7: Fix typo [Jani Saarinen]
>     Fix white space.
> 
> Signed-off-by: Gwan-gyeong Mun <gwan-gyeong.mun@intel.com>
> Reviewed-by: Uma Shankar <uma.shankar@intel.com>
> ---
>  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..656f72c1b3d7 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" },

We already have other mechanism for the CEA vs. IT RGB.
I don't think we want to add another one. So I'd drop this.

> +	{ 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" },

I'd also drop this since we have no way to supply the profile anyway.

> +	/* 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" },

And these last two seem rather esoteric as well. I don't think any
driver supports RAW/Y stuff so I'd drop them too.

> +};
> +
>  /**
>   * 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.
>   *
> + * Because 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 drm_mode_create_colorspace_property(struct drm_connector *connector)
> +int drm_mode_create_hdmi_colorspace_property(struct drm_connector *connector)
>  {
>  	struct drm_device *dev = connector->dev;
> -	struct drm_property *prop;
>  
> -	if (connector->connector_type == DRM_MODE_CONNECTOR_HDMIA ||
> -	    connector->connector_type == DRM_MODE_CONNECTOR_HDMIB) {
> -		prop = drm_property_create_enum(dev, DRM_MODE_PROP_ENUM,
> -						"Colorspace",
> -						hdmi_colorspaces,
> -						ARRAY_SIZE(hdmi_colorspaces));
> -		if (!prop)
> -			return -ENOMEM;
> -	} else {
> -		DRM_DEBUG_KMS("Colorspace property not supported\n");
> +	if (connector->colorspace_property)
>  		return 0;
> -	}
>  
> -	connector->colorspace_property = prop;
> +	connector->colorspace_property =
> +		drm_property_create_enum(dev, DRM_MODE_PROP_ENUM, "Colorspace",
> +					 hdmi_colorspaces,
> +					 ARRAY_SIZE(hdmi_colorspaces));
> +
> +	if (!connector->colorspace_property)
> +		return -ENOMEM;
> +
> +	return 0;
> +}
> +EXPORT_SYMBOL(drm_mode_create_hdmi_colorspace_property);
> +
> +/**
> + * drm_mode_create_dp_colorspace_property - create dp 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
> + * DP connectors.
> + *
> + * Returns:
> + * Zero on success, negative errono on failure.
> + */
> +int drm_mode_create_dp_colorspace_property(struct drm_connector *connector)
> +{
> +	struct drm_device *dev = connector->dev;
> +
> +	if (connector->colorspace_property)
> +		return 0;
> +
> +	connector->colorspace_property =
> +		drm_property_create_enum(dev, DRM_MODE_PROP_ENUM, "Colorspace",
> +					 dp_colorspaces,
> +					 ARRAY_SIZE(dp_colorspaces));
> +
> +	if (!connector->colorspace_property)
> +		return -ENOMEM;
>  
>  	return 0;
>  }
> -EXPORT_SYMBOL(drm_mode_create_colorspace_property);
> +EXPORT_SYMBOL(drm_mode_create_dp_colorspace_property);
>  
>  /**
>   * drm_mode_create_content_type_property - create content type property
> diff --git a/drivers/gpu/drm/i915/display/intel_connector.c b/drivers/gpu/drm/i915/display/intel_connector.c
> index 308ec63207ee..1133c4e97bb4 100644
> --- a/drivers/gpu/drm/i915/display/intel_connector.c
> +++ b/drivers/gpu/drm/i915/display/intel_connector.c
> @@ -277,7 +277,22 @@ intel_attach_aspect_ratio_property(struct drm_connector *connector)
>  void
>  intel_attach_colorspace_property(struct drm_connector *connector)
>  {
> -	if (!drm_mode_create_colorspace_property(connector))
> -		drm_object_attach_property(&connector->base,
> -					   connector->colorspace_property, 0);
> +	switch (connector->connector_type) {
> +	case DRM_MODE_CONNECTOR_HDMIA:
> +	case DRM_MODE_CONNECTOR_HDMIB:
> +		if (drm_mode_create_hdmi_colorspace_property(connector))
> +			return;
> +		break;
> +	case DRM_MODE_CONNECTOR_DisplayPort:
> +	case DRM_MODE_CONNECTOR_eDP:
> +		if (drm_mode_create_dp_colorspace_property(connector))
> +			return;
> +		break;
> +	default:
> +		DRM_DEBUG_KMS("Colorspace property not supported\n");
> +		return;
> +	}
> +
> +	drm_object_attach_property(&connector->base,
> +				   connector->colorspace_property, 0);
>  }
> diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
> index 681cb590f952..48efe92effd7 100644
> --- a/include/drm/drm_connector.h
> +++ b/include/drm/drm_connector.h
> @@ -281,6 +281,14 @@ enum drm_panel_orientation {
>  /* Additional Colorimetry extension added as part of CTA 861.G */
>  #define DRM_MODE_COLORIMETRY_DCI_P3_RGB_D65		11
>  #define DRM_MODE_COLORIMETRY_DCI_P3_RGB_THEATER		12
> +/* Additional Colorimetry Options added for DP 1.4a VSC Colorimetry Format */
> +#define DRM_MODE_COLORIMETRY_CEA_RGB			13
> +#define DRM_MODE_COLORIMETRY_RGB_WIDE_FIXED		14
> +#define DRM_MODE_COLORIMETRY_RGB_WIDE_FLOAT		15
> +#define DRM_MODE_COLORIMETRY_RGB_CUSTOM_COLOR_PROFILE	16
> +#define DRM_MODE_COLORIMETRY_BT601_YCC			17
> +#define DRM_MODE_COLORIMETRY_Y_ONLY_DICOM_P14_GRAYSCALE	18
> +#define DRM_MODE_COLORIMETRY_RAW_CUSTOM_COLOR_PROFILE	19
>  
>  /**
>   * enum drm_bus_flags - bus_flags info for &drm_display_info
> @@ -1523,7 +1531,8 @@ int drm_connector_attach_scaling_mode_property(struct drm_connector *connector,
>  int drm_connector_attach_vrr_capable_property(
>  		struct drm_connector *connector);
>  int drm_mode_create_aspect_ratio_property(struct drm_device *dev);
> -int drm_mode_create_colorspace_property(struct drm_connector *connector);
> +int drm_mode_create_hdmi_colorspace_property(struct drm_connector *connector);
> +int drm_mode_create_dp_colorspace_property(struct drm_connector *connector);
>  int drm_mode_create_content_type_property(struct drm_device *dev);
>  void drm_hdmi_avi_infoframe_content_type(struct hdmi_avi_infoframe *frame,
>  					 const struct drm_connector_state *conn_state);
> -- 
> 2.23.0

-- 
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2019-09-13 19:13 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-12 11:33 [PATCH v7 0/7] drm/i915/dp: Support for DP HDR outputs Gwan-gyeong Mun
2019-09-12 11:33 ` [PATCH v7 1/7] drm/i915/dp: Extend program of VSC Header and DB for Colorimetry Format Gwan-gyeong Mun
2019-09-12 11:33 ` [PATCH v7 2/7] drm/i915/dp: Add support of BT.2020 Colorimetry to DP MSA Gwan-gyeong Mun
2019-09-12 11:33 ` [PATCH v7 3/7] drm: Add DisplayPort colorspace property Gwan-gyeong Mun
2019-09-13 19:13   ` Ville Syrjälä [this message]
2019-09-16  7:10     ` Mun, Gwan-gyeong
2019-09-12 11:33 ` [PATCH v7 4/7] drm/i915/dp: Attach " Gwan-gyeong Mun
2019-09-12 11:33 ` [PATCH v7 5/7] drm/i915: Add new GMP register size for GEN11 Gwan-gyeong Mun
2019-09-12 11:33 ` [PATCH v7 6/7] drm/i915/dp: Program an Infoframe SDP Header and DB for HDR Static Metadata Gwan-gyeong Mun
2019-09-12 11:33 ` [PATCH v7 7/7] drm/i915/dp: Attach HDR metadata property to DP connector Gwan-gyeong Mun
2019-09-12 15:21 ` ✓ Fi.CI.BAT: success for drm/i915/dp: Support for DP HDR outputs (rev7) Patchwork
2019-09-13  3:00 ` ✓ Fi.CI.IGT: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190913191336.GE1208@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gwan-gyeong.mun@intel.com \
    --cc=imirkin@alum.mit.edu \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.