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

Commit 60822211 authored by Abhinav Kumar's avatar Abhinav Kumar Committed by Gerrit - the friendly Code Review server
Browse files

disp: msm: add colorimetry block parsing to SDE EDID parser



Add colorimetry data block parsing to SDE EDID parser so that
we can eliminate usage of the same information parsed in upstream
EDID parser.

Change-Id: I53692bb90eeee1f8a865da54ce0e8932c381489a
Signed-off-by: default avatarAbhinav Kumar <abhinavk@codeaurora.org>
parent f1959d90
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -424,6 +424,7 @@ struct sde_connector_dyn_hdr_metadata {
 * @hdr_avg_luminance: desired avg luminance obtained from HDR block
 * @hdr_min_luminance: desired min luminance obtained from HDR block
 * @hdr_supported: does the sink support HDR content
 * @color_enc_fmt: Colorimetry encoding formats of sink
 * @allow_bl_update: Flag to indicate if BL update is allowed currently or not
 * @qsync_mode: Cached Qsync mode, 0=disabled, 1=continuous mode
 * @qsync_updated: Qsync settings were updated
@@ -484,6 +485,8 @@ struct sde_connector {
	u32 hdr_min_luminance;
	bool hdr_supported;

	u32 color_enc_fmt;

	u8 hdr_plus_app_ver;
	u32 qsync_mode;
	bool qsync_updated;
+54 −0
Original line number Diff line number Diff line
@@ -548,6 +548,58 @@ sde_edid_parse_hdr_db(struct drm_connector *connector, const u8 *db)
	SDE_EDID_DEBUG("min luminance %d\n", c_conn->hdr_min_luminance);
}


/*
 * drm_extract_clrmetry_db - Parse the HDMI colorimetry extended block
 * @connector: connector corresponding to the HDMI sink
 * @db: start of the HDMI colorimetry extended block
 *
 * Parses the HDMI colorimetry block to extract sink info for @connector.
 */
static void
sde_parse_clrmetry_db(struct drm_connector *connector, const u8 *db)
{

	struct sde_connector *c_conn;

	c_conn = to_sde_connector(connector);

	if (!db) {
		DRM_ERROR("invalid db\n");
		return;
	}

	/* Byte 3 Bit 0: xvYCC_601 */
	if (db[2] & BIT(0))
		c_conn->color_enc_fmt |= DRM_EDID_CLRMETRY_xvYCC_601;
	/* Byte 3 Bit 1: xvYCC_709 */
	if (db[2] & BIT(1))
		c_conn->color_enc_fmt |= DRM_EDID_CLRMETRY_xvYCC_709;
	/* Byte 3 Bit 2: sYCC_601 */
	if (db[2] & BIT(2))
		c_conn->color_enc_fmt |= DRM_EDID_CLRMETRY_sYCC_601;
	/* Byte 3 Bit 3: ADBYCC_601 */
	if (db[2] & BIT(3))
		c_conn->color_enc_fmt |= DRM_EDID_CLRMETRY_ADBYCC_601;
	/* Byte 3 Bit 4: ADB_RGB */
	if (db[2] & BIT(4))
		c_conn->color_enc_fmt |= DRM_EDID_CLRMETRY_ADB_RGB;
	/* Byte 3 Bit 5: BT2020_CYCC */
	if (db[2] & BIT(5))
		c_conn->color_enc_fmt |= DRM_EDID_CLRMETRY_BT2020_CYCC;
	/* Byte 3 Bit 6: BT2020_YCC */
	if (db[2] & BIT(6))
		c_conn->color_enc_fmt |= DRM_EDID_CLRMETRY_BT2020_YCC;
	/* Byte 3 Bit 7: BT2020_RGB */
	if (db[2] & BIT(7))
		c_conn->color_enc_fmt |= DRM_EDID_CLRMETRY_BT2020_RGB;
	/* Byte 4 Bit 7: DCI-P3 */
	if (db[3] & BIT(7))
		c_conn->color_enc_fmt |= DRM_EDID_CLRMETRY_DCI_P3;

	DRM_DEBUG_KMS("colorimetry fmts = 0x%x\n", c_conn->color_enc_fmt);
}

/*
 * sde_edid_parse_extended_blk_info - Parse the HDMI extended tag blocks
 * @connector: connector corresponding to external sink
@@ -581,6 +633,8 @@ sde_edid_parse_extended_blk_info(struct drm_connector *connector,
				case HDR_STATIC_METADATA_DATA_BLOCK:
					sde_edid_parse_hdr_db(connector, db);
					break;
				case COLORIMETRY_EXTENDED_DATA_BLOCK:
					sde_parse_clrmetry_db(connector, db);
				default:
					break;
				}
+1 −0
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ enum extended_data_block_types {
	VIDEO_CAPABILITY_DATA_BLOCK = 0x0,
	VENDOR_SPECIFIC_VIDEO_DATA_BLOCK = 0x01,
	HDMI_VIDEO_DATA_BLOCK = 0x04,
	COLORIMETRY_EXTENDED_DATA_BLOCK = 0x5,
	HDR_STATIC_METADATA_DATA_BLOCK = 0x06,
	Y420_VIDEO_DATA_BLOCK = 0x0E,
	VIDEO_FORMAT_PREFERENCE_DATA_BLOCK = 0x0D,