Browse Source

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: Abhinav Kumar <[email protected]>
Abhinav Kumar 5 năm trước cách đây
mục cha
commit
6082221107

+ 3 - 0
msm/sde/sde_connector.h

@@ -424,6 +424,7 @@ struct sde_connector_dyn_hdr_metadata {
  * @hdr_avg_luminance: desired avg luminance obtained from HDR block
  * @hdr_avg_luminance: desired avg luminance obtained from HDR block
  * @hdr_min_luminance: desired min luminance obtained from HDR block
  * @hdr_min_luminance: desired min luminance obtained from HDR block
  * @hdr_supported: does the sink support HDR content
  * @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
  * @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_mode: Cached Qsync mode, 0=disabled, 1=continuous mode
  * @qsync_updated: Qsync settings were updated
  * @qsync_updated: Qsync settings were updated
@@ -484,6 +485,8 @@ struct sde_connector {
 	u32 hdr_min_luminance;
 	u32 hdr_min_luminance;
 	bool hdr_supported;
 	bool hdr_supported;
 
 
+	u32 color_enc_fmt;
+
 	u8 hdr_plus_app_ver;
 	u8 hdr_plus_app_ver;
 	u32 qsync_mode;
 	u32 qsync_mode;
 	bool qsync_updated;
 	bool qsync_updated;

+ 54 - 0
msm/sde_edid_parser.c

@@ -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);
 	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
  * sde_edid_parse_extended_blk_info - Parse the HDMI extended tag blocks
  * @connector: connector corresponding to external sink
  * @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:
 				case HDR_STATIC_METADATA_DATA_BLOCK:
 					sde_edid_parse_hdr_db(connector, db);
 					sde_edid_parse_hdr_db(connector, db);
 					break;
 					break;
+				case COLORIMETRY_EXTENDED_DATA_BLOCK:
+					sde_parse_clrmetry_db(connector, db);
 				default:
 				default:
 					break;
 					break;
 				}
 				}

+ 1 - 0
msm/sde_edid_parser.h

@@ -41,6 +41,7 @@ enum extended_data_block_types {
 	VIDEO_CAPABILITY_DATA_BLOCK = 0x0,
 	VIDEO_CAPABILITY_DATA_BLOCK = 0x0,
 	VENDOR_SPECIFIC_VIDEO_DATA_BLOCK = 0x01,
 	VENDOR_SPECIFIC_VIDEO_DATA_BLOCK = 0x01,
 	HDMI_VIDEO_DATA_BLOCK = 0x04,
 	HDMI_VIDEO_DATA_BLOCK = 0x04,
+	COLORIMETRY_EXTENDED_DATA_BLOCK = 0x5,
 	HDR_STATIC_METADATA_DATA_BLOCK = 0x06,
 	HDR_STATIC_METADATA_DATA_BLOCK = 0x06,
 	Y420_VIDEO_DATA_BLOCK = 0x0E,
 	Y420_VIDEO_DATA_BLOCK = 0x0E,
 	VIDEO_FORMAT_PREFERENCE_DATA_BLOCK = 0x0D,
 	VIDEO_FORMAT_PREFERENCE_DATA_BLOCK = 0x0D,