Skip to contentSkip to conversation

drm/edid: rename macro for CEA extended-tag

PATCH Superseded Shashank Sharma 3 participants 3 messages Jul 3, 2017

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 drm/edid: rename macro for CEA extended-tag

CEA-861-F introduces extended tag codes for EDID extension blocks, which indicates the actual type of the data block. The code for using exteded tag is 0x7, whereas in the existing code, the corresponding macro is named as "VIDEO_CAPABILITY_BLOCK"

This patch renames the macro and usages from "VIDEO_CAPABILITY_BLOCK" to "CEA_EXTENDED_TAG"

V2: Add extended tag code check for video capabilitiy block (ville)

---
 drivers/gpu/drm/drm_edid.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_edid.c +11 -2
index 2e55599..5bf9ffe 100644
@@ -2566,7 +2566,8 @@ add_detailed_modes(struct drm_connector *connector, struct edid *edid,
 #define VIDEO_BLOCK     0x02
 #define VENDOR_BLOCK    0x03
 #define SPEAKER_BLOCK	0x04
-#define VIDEO_CAPABILITY_BLOCK	0x07
+#define CEA_EXTENDED_TAG	0x07
+#define VIDEO_CAPBLK_EXT_TAG	0x0
 #define EDID_BASIC_AUDIO	(1 << 6)
 #define EDID_CEA_YCRCB444	(1 << 5)
 #define EDID_CEA_YCRCB422	(1 << 4)
@@ -3218,6 +3219,12 @@ cea_db_payload_len(const u8 *db)
 }
 
 static int
+cea_db_extended_tag(const u8 *db)
+{
+	return db[1];
+}
+
+static int
 cea_db_tag(const u8 *db)
 {
 	return db[0] >> 5;
@@ -3793,7 +3800,9 @@ bool drm_rgb_quant_range_selectable(struct edid *edid)
 		return false;
 
 	for_each_cea_db(edid_ext, i, start, end) {
-		if (cea_db_tag(&edid_ext[i]) == VIDEO_CAPABILITY_BLOCK &&
+		if (cea_db_tag(&edid_ext[i]) == CEA_EXTENDED_TAG &&
+		    cea_db_extended_tag(&edid_ext[i]) ==
+			VIDEO_CAPBLK_EXT_TAG &&
 		    cea_db_payload_len(&edid_ext[i]) == 2) {
 			DRM_DEBUG_KMS("CEA VCDB 0x%02x\n", edid_ext[i + 2]);
 			return edid_ext[i + 2] & EDID_CEA_VCDB_QS;
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw
Quoted 21 lines · Shashank Sharma

CEA-861-F introduces extended tag codes for EDID extension blocks, which indicates the actual type of the data block. The code for using exteded tag is 0x7, whereas in the existing code, the corresponding macro is named as "VIDEO_CAPABILITY_BLOCK"

This patch renames the macro and usages from "VIDEO_CAPABILITY_BLOCK" to "CEA_EXTENDED_TAG"

V2: Add extended tag code check for video capabilitiy block (ville)

---
 drivers/gpu/drm/drm_edid.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_edid.c +0 -0
index 2e55599..5bf9ffe 100644

drivers/gpu/drm/drm_edid.c add_detailed_modes(struct drm_connector *connector, struct edid *edid, · line 2570

Quoted 6 lines
drivers/gpu/drm/drm_edid.c +2 -1
@@ -2566,7 +2566,8 @@ add_detailed_modes(struct drm_connector *connector, struct edid *edid,
 #define VIDEO_BLOCK     0x02
 #define VENDOR_BLOCK    0x03
 #define SPEAKER_BLOCK	0x04
-#define VIDEO_CAPABILITY_BLOCK	0x07
+#define CEA_EXTENDED_TAG	0x07
+#define VIDEO_CAPBLK_EXT_TAG	0x0

We don't have the _TAG suffix in the other defines either. So maybe something like this?

...
#define SPEAKER_BLOCK 0x04
#define USE_EXTENDED_TAG 0x07
#define EXT_VIDEO_CAPABILITY_BLOCK 0x00

Quoted 17 lines
drivers/gpu/drm/drm_edid.c +6 -0
 #define EDID_BASIC_AUDIO	(1 << 6)
 #define EDID_CEA_YCRCB444	(1 << 5)
 #define EDID_CEA_YCRCB422	(1 << 4)
@@ -3218,6 +3219,12 @@ cea_db_payload_len(const u8 *db)
 }
 
 static int
+cea_db_extended_tag(const u8 *db)
+{
+	return db[1];
+}
+
+static int
 cea_db_tag(const u8 *db)
 {
 	return db[0] >> 5;

drivers/gpu/drm/drm_edid.c bool drm_rgb_quant_range_selectable(struct edid *edid) · line 3806

Quoted 8 lines
drivers/gpu/drm/drm_edid.c +3 -1
@@ -3793,7 +3800,9 @@ bool drm_rgb_quant_range_selectable(struct edid *edid)
 		return false;
 
 	for_each_cea_db(edid_ext, i, start, end) {
-		if (cea_db_tag(&edid_ext[i]) == VIDEO_CAPABILITY_BLOCK &&
+		if (cea_db_tag(&edid_ext[i]) == CEA_EXTENDED_TAG &&
+		    cea_db_extended_tag(&edid_ext[i]) ==
+			VIDEO_CAPBLK_EXT_TAG &&
 		    cea_db_payload_len(&edid_ext[i]) == 2) {

And I suggest doing the length check before the ext tag check, otherwise we're potentially accessing data outside the block. Well, as long as there's *something* there the current order will work, but IMO it's better to be a little paranoid when parsing stuff.

Quoted 4 lines
drivers/gpu/drm/drm_edid.c +0 -0
 			DRM_DEBUG_KMS("CEA VCDB 0x%02x\n", edid_ext[i + 2]);
 			return edid_ext[i + 2] & EDID_CEA_VCDB_QS;
Signature · 1 line
2.7.4
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw

✓ Fi.CI.BAT: success for drm/edid: rename macro for CEA extended-tag (rev2)

In reply to Shashank Sharma
== Series Details ==

== Series Details ==

Series: drm/edid: rename macro for CEA extended-tag (rev2)
URL : https://patchwork.freedesktop.org/series/26744/
State : success

== Summary ==

Series 26744v2 drm/edid: rename macro for CEA extended-tag
https://patchwork.freedesktop.org/api/1.0/series/26744/revisions/2/mbox/

fi-bdw-5557u     total:279  pass:264  dwarn:0   dfail:0   fail:3   skip:11  time:443s
fi-bdw-gvtdvm    total:279  pass:257  dwarn:8   dfail:0   fail:0   skip:14  time:436s
fi-blb-e6850     total:279  pass:224  dwarn:1   dfail:0   fail:0   skip:54  time:357s
fi-bsw-n3050     total:279  pass:239  dwarn:0   dfail:0   fail:3   skip:36  time:513s
fi-bxt-j4205     total:279  pass:256  dwarn:0   dfail:0   fail:3   skip:19  time:499s
fi-byt-j1900     total:279  pass:250  dwarn:1   dfail:0   fail:3   skip:24  time:478s
fi-byt-n2820     total:279  pass:246  dwarn:1   dfail:0   fail:3   skip:28  time:481s
fi-glk-2a        total:279  pass:256  dwarn:0   dfail:0   fail:3   skip:19  time:586s
fi-hsw-4770      total:279  pass:259  dwarn:0   dfail:0   fail:3   skip:16  time:427s
fi-hsw-4770r     total:279  pass:259  dwarn:0   dfail:0   fail:3   skip:16  time:410s
fi-ilk-650       total:279  pass:225  dwarn:0   dfail:0   fail:3   skip:50  time:416s
fi-ivb-3520m     total:279  pass:257  dwarn:0   dfail:0   fail:3   skip:18  time:493s
fi-ivb-3770      total:279  pass:257  dwarn:0   dfail:0   fail:3   skip:18  time:465s
fi-kbl-7500u     total:279  pass:257  dwarn:0   dfail:0   fail:3   skip:18  time:457s
fi-kbl-7560u     total:279  pass:264  dwarn:1   dfail:0   fail:3   skip:10  time:557s
fi-kbl-r         total:279  pass:256  dwarn:1   dfail:0   fail:3   skip:18  time:564s
fi-skl-6260u     total:279  pass:265  dwarn:0   dfail:0   fail:3   skip:10  time:452s
fi-skl-6700hq    total:279  pass:219  dwarn:1   dfail:0   fail:33  skip:24  time:308s
fi-skl-6700k     total:279  pass:257  dwarn:0   dfail:0   fail:3   skip:18  time:462s
fi-skl-6770hq    total:279  pass:265  dwarn:0   dfail:0   fail:3   skip:10  time:470s
fi-skl-gvtdvm    total:279  pass:266  dwarn:0   dfail:0   fail:0   skip:13  time:440s
fi-snb-2520m     total:279  pass:247  dwarn:0   dfail:0   fail:3   skip:28  time:540s
fi-snb-2600      total:279  pass:246  dwarn:0   dfail:0   fail:3   skip:29  time:399s

fi-pnv-d510 failed to collect. IGT log at Patchwork_5096/fi-pnv-d510/igt.log

df0182c2c95385492772c6e4ace76b463298b8ca drm-tip: 2017y-07m-03d-13h-20m-24s UTC integration manifest 5505a61 drm/edid: rename macro for CEA extended-tag

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_5096/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx