summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorAbhinav Kumar <abhinavk@codeaurora.org>2017-07-20 21:40:10 -0700
committerAbhinav Kumar <abhinavk@codeaurora.org>2017-08-01 23:02:44 -0700
commitae1a4ed18e3ea00a202a499fd03ac598562abd0d (patch)
tree46a96ce63475a13749c8795857d4a98e35b731a0 /drivers
parentfc8b7422d9fb1acf9f402bb64b5d994769458237 (diff)
drm/edid: add colorimetry block parsing support
Add support for parsing the colorimetry data block of EDID to get information about the supported encoding formats of the sink. This information is needed to use the appropriate color encoding scheme before transmitting the video stream to the sink. Change-Id: I133e8f21fa4ad843219dbefed2d072ad2edab197 Signed-off-by: Abhinav Kumar <abhinavk@codeaurora.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/drm_edid.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index c3574c5042da..47c1747e7ae3 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -2716,6 +2716,7 @@ add_detailed_modes(struct drm_connector *connector, struct edid *edid,
#define VENDOR_BLOCK 0x03
#define SPEAKER_BLOCK 0x04
#define HDR_STATIC_METADATA_EXTENDED_DATA_BLOCK 0x06
+#define COLORIMETRY_EXTENDED_DATA_BLOCK 0x05
#define EXTENDED_TAG 0x07
#define VIDEO_CAPABILITY_BLOCK 0x07
#define Y420_VIDEO_DATA_BLOCK 0x0E
@@ -3595,6 +3596,50 @@ drm_extract_hdr_db(struct drm_connector *connector, const u8 *db)
}
/*
+ * drm_extract_colorimetry_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
+drm_extract_clrmetry_db(struct drm_connector *connector, const u8 *db)
+{
+
+ if (!db) {
+ DRM_ERROR("invalid db\n");
+ return;
+ }
+
+ /* Bit 0: xvYCC_601 */
+ if (db[2] & BIT(0))
+ connector->color_enc_fmt |= DRM_EDID_COLORIMETRY_xvYCC_601;
+ /* Bit 0: xvYCC_709 */
+ if (db[2] & BIT(1))
+ connector->color_enc_fmt |= DRM_EDID_COLORIMETRY_xvYCC_709;
+ /* Bit 0: sYCC_601 */
+ if (db[2] & BIT(2))
+ connector->color_enc_fmt |= DRM_EDID_COLORIMETRY_sYCC_601;
+ /* Bit 0: ADBYCC_601 */
+ if (db[2] & BIT(3))
+ connector->color_enc_fmt |= DRM_EDID_COLORIMETRY_ADBYCC_601;
+ /* Bit 0: ADB_RGB */
+ if (db[2] & BIT(4))
+ connector->color_enc_fmt |= DRM_EDID_COLORIMETRY_ADB_RGB;
+ /* Bit 0: BT2020_CYCC */
+ if (db[2] & BIT(5))
+ connector->color_enc_fmt |= DRM_EDID_COLORIMETRY_BT2020_CYCC;
+ /* Bit 0: BT2020_YCC */
+ if (db[2] & BIT(6))
+ connector->color_enc_fmt |= DRM_EDID_COLORIMETRY_BT2020_YCC;
+ /* Bit 0: BT2020_RGB */
+ if (db[2] & BIT(7))
+ connector->color_enc_fmt |= DRM_EDID_COLORIMETRY_BT2020_RGB;
+
+ DRM_DEBUG_KMS("colorimetry fmt 0x%x\n", connector->color_enc_fmt);
+}
+
+/*
* drm_hdmi_extract_extended_blk_info - Parse the HDMI extended tag blocks
* @connector: connector corresponding to the HDMI sink
* @edid: handle to the EDID structure
@@ -3626,6 +3671,9 @@ struct edid *edid)
case HDR_STATIC_METADATA_EXTENDED_DATA_BLOCK:
drm_extract_hdr_db(connector, db);
break;
+ case COLORIMETRY_EXTENDED_DATA_BLOCK:
+ drm_extract_clrmetry_db(connector, db);
+ break;
default:
break;
}