Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e62dae58 authored by Uma Shankar's avatar Uma Shankar Committed by Alistair Delva
Browse files

ANDROID: drm: Add DP colorspace property



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.

v5: Merged the DP handling along with platform colorspace
handling as per Shashank's comments.

v6: Reverted to old design of exposing all colorspaces to
userspace as per Ville's review comment

v7: Fixed sparse warnings, updated the RB from Maarten and Jani's ack.

v8: Addressed Ville's review comments and updated the colorspace
macro definitions.

Signed-off-by: default avatarUma Shankar <uma.shankar@intel.com>
Acked-by: default avatarJani Nikula <jani.nikula@intel.com>
Reviewed-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: https://patchwork.kernel.org/patch/10797701/


[adelva: Renamed some enums and added BT.2020 formats]
Bug: 152417756
Signed-off-by: default avatarAlistair Delva <adelva@google.com>
Change-Id: I90f3132104d1fe5cbc48b78fbcf80d73add49e1f
parent 9ef33e95
Loading
Loading
Loading
Loading
+30 −0
Original line number Diff line number Diff line
@@ -849,6 +849,28 @@ static const struct drm_prop_enum_list hdmi_colorspaces[] = {
	{ DRM_MODE_COLORIMETRY_DCI_P3_RGB_THEATER, "DCI-P3_RGB_Theater" },
};

static const struct drm_prop_enum_list dp_colorspaces[] = {
	/* For Default case, driver will set the colorspace */
	{ DRM_MODE_COLORIMETRY_DEFAULT, "Default" },
	/* 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-5 */
	{ DRM_MODE_COLORIMETRY_OPRGB, "opRGB" },
	{ DRM_MODE_COLORIMETRY_DCI_P3_RGB_D65, "DCI-P3_RGB_D65" },
	/* DP MSA Colorimetry */
	{ DRM_MODE_DP_COLORIMETRY_BT601_YCC, "YCBCR_ITU_601" },
	{ DRM_MODE_DP_COLORIMETRY_BT709_YCC, "YCBCR_ITU_709" },
	{ DRM_MODE_DP_COLORIMETRY_SRGB, "sRGB" },
	{ DRM_MODE_DP_COLORIMETRY_RGB_WIDE_GAMUT, "RGB Wide Gamut" },
	{ DRM_MODE_DP_COLORIMETRY_SCRGB, "scRGB" },
	/* Colorimetry based on ITU-R BT.2020 */
	{ DRM_MODE_COLORIMETRY_BT2020_RGB, "BT2020_RGB" },
	/* Colorimetry based on ITU-R BT.2020 */
	{ DRM_MODE_COLORIMETRY_BT2020_YCC, "BT2020_YCC" },
};

/**
 * DOC: standard connector properties
 *
@@ -1463,6 +1485,14 @@ int drm_mode_create_colorspace_property(struct drm_connector *connector)
						ARRAY_SIZE(hdmi_colorspaces));
		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_colorspaces,
						ARRAY_SIZE(dp_colorspaces));

		if (!prop)
			return -ENOMEM;
	} else {
		DRM_DEBUG_KMS("Colorspace property not supported\n");
		return 0;
+6 −0
Original line number Diff line number Diff line
@@ -233,6 +233,12 @@ 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
/* DP MSA Colorimetry Options */
#define DRM_MODE_DP_COLORIMETRY_BT601_YCC		13
#define DRM_MODE_DP_COLORIMETRY_BT709_YCC		14
#define DRM_MODE_DP_COLORIMETRY_SRGB			15
#define DRM_MODE_DP_COLORIMETRY_RGB_WIDE_GAMUT		16
#define DRM_MODE_DP_COLORIMETRY_SCRGB			17

/**
 * struct drm_display_info - runtime data about the connected sink