All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] drm/edid: parse multiple CEA extension block
@ 2022-02-22  6:38 Lee Shawn C
  2022-02-22  6:38 ` [PATCH 2/3] drm/edid: read HF-EEODB ext block Lee Shawn C
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Lee Shawn C @ 2022-02-22  6:38 UTC (permalink / raw)
  To: dri-devel; +Cc: Ankit Nautiyal, Lee Shawn C

Try to find and parse more CEA ext blocks if edid->extensions
is greater than one.

Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Ville Syrjala <ville.syrjala@linux.intel.com>
Cc: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Signed-off-by: Lee Shawn C <shawn.c.lee@intel.com>
---
 drivers/gpu/drm/drm_edid.c | 75 +++++++++++++++++++++++---------------
 1 file changed, 45 insertions(+), 30 deletions(-)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 12893e7be89b..3d5dbbeca7f9 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -4313,43 +4313,58 @@ add_cea_modes(struct drm_connector *connector, struct edid *edid)
 	const u8 *cea = drm_find_cea_extension(edid);
 	const u8 *db, *hdmi = NULL, *video = NULL;
 	u8 dbl, hdmi_len, video_len = 0;
-	int modes = 0;
+	int modes = 0, j;
 
-	if (cea && cea_revision(cea) >= 3) {
-		int i, start, end;
+	if (!cea)
+		return 0;
 
-		if (cea_db_offsets(cea, &start, &end))
-			return 0;
+	for (j = (cea - (u8 *)edid) / EDID_LENGTH; j <= edid->extensions;) {
+		if (cea && cea_revision(cea) >= 3) {
+			int i, start, end;
 
-		for_each_cea_db(cea, i, start, end) {
-			db = &cea[i];
-			dbl = cea_db_payload_len(db);
+			if (cea_db_offsets(cea, &start, &end))
+				continue;
 
-			if (cea_db_tag(db) == VIDEO_BLOCK) {
-				video = db + 1;
-				video_len = dbl;
-				modes += do_cea_modes(connector, video, dbl);
-			} else if (cea_db_is_hdmi_vsdb(db)) {
-				hdmi = db;
-				hdmi_len = dbl;
-			} else if (cea_db_is_y420vdb(db)) {
-				const u8 *vdb420 = &db[2];
-
-				/* Add 4:2:0(only) modes present in EDID */
-				modes += do_y420vdb_modes(connector,
-							  vdb420,
-							  dbl - 1);
+			for_each_cea_db(cea, i, start, end) {
+				db = &cea[i];
+				dbl = cea_db_payload_len(db);
+
+				if (cea_db_tag(db) == VIDEO_BLOCK) {
+					video = db + 1;
+					video_len = dbl;
+					modes += do_cea_modes(connector, video, dbl);
+				} else if (cea_db_is_hdmi_vsdb(db)) {
+					hdmi = db;
+					hdmi_len = dbl;
+				} else if (cea_db_is_y420vdb(db)) {
+					const u8 *vdb420 = &db[2];
+
+					/* Add 4:2:0(only) modes present in EDID */
+					modes += do_y420vdb_modes(connector,
+								  vdb420,
+								  dbl - 1);
+				}
 			}
 		}
-	}
 
-	/*
-	 * We parse the HDMI VSDB after having added the cea modes as we will
-	 * be patching their flags when the sink supports stereo 3D.
-	 */
-	if (hdmi)
-		modes += do_hdmi_vsdb_modes(connector, hdmi, hdmi_len, video,
-					    video_len);
+		/*
+		 * We parse the HDMI VSDB after having added the cea modes as we will
+		 * be patching their flags when the sink supports stereo 3D.
+		 */
+		if (hdmi) {
+			modes += do_hdmi_vsdb_modes(connector, hdmi, hdmi_len, video,
+						    video_len);
+			hdmi  = NULL;
+			video = NULL;
+			hdmi_len = 0;
+			video_len = 0;
+		}
+
+		/* move to next CEA extension block */
+		cea = drm_find_edid_extension(edid, CEA_EXT, &j);
+		if (!cea)
+			break;
+	}
 
 	return modes;
 }
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread
* [PATCH 0/3] enhanced edid driver compatibility
@ 2022-02-24 14:16 Lee Shawn C
  2022-02-24 14:16 ` [PATCH 1/3] drm/edid: parse multiple CEA extension block Lee Shawn C
  0 siblings, 1 reply; 13+ messages in thread
From: Lee Shawn C @ 2022-02-24 14:16 UTC (permalink / raw)
  To: dri-devel; +Cc: Lee Shawn C

Support to parse multiple CEA extension blocks and HF-EEODB to
extend drm edid driver's capability.

Lee Shawn C (3):
  drm/edid: parse multiple CEA extension block
  drm/edid: read HF-EEODB ext block
  drm/edid: parse HF-EEODB CEA extension block

 drivers/gpu/drm/drm_connector.c |   5 +-
 drivers/gpu/drm/drm_displayid.c |   5 +-
 drivers/gpu/drm/drm_edid.c      | 200 ++++++++++++++++++++++----------
 include/drm/drm_edid.h          |   4 +-
 4 files changed, 151 insertions(+), 63 deletions(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2022-02-27 14:49 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-22  6:38 [PATCH 1/3] drm/edid: parse multiple CEA extension block Lee Shawn C
2022-02-22  6:38 ` [PATCH 2/3] drm/edid: read HF-EEODB ext block Lee Shawn C
2022-02-22  6:38 ` [PATCH 3/3] drm/edid: parse HF-EEODB CEA extension block Lee Shawn C
2022-02-22  7:28 ` [PATCH 1/3] drm/edid: parse multiple " Ville Syrjälä
2022-02-22  8:49   ` Lee, Shawn C
2022-02-22  9:19   ` Jani Nikula
2022-02-22  9:43     ` Ville Syrjälä
2022-02-22 14:02 ` [v2 " Lee Shawn C
2022-02-22 14:02   ` [v2 2/3] drm/edid: read HF-EEODB ext block Lee Shawn C
2022-02-22 14:02   ` [v2 3/3] drm/edid: parse HF-EEODB CEA extension block Lee Shawn C
  -- strict thread matches above, loose matches on Subject: below --
2022-02-24 14:16 [PATCH 0/3] enhanced edid driver compatibility Lee Shawn C
2022-02-24 14:16 ` [PATCH 1/3] drm/edid: parse multiple CEA extension block Lee Shawn C
2022-02-25 17:47   ` Ville Syrjälä
2022-02-27 14:49     ` Lee, Shawn C

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.