drm/edid: convert drm_parse_cea_ext() to use cea db iter
authorJani Nikula <jani.nikula@intel.com>
Tue, 3 May 2022 09:23:58 +0000 (12:23 +0300)
committerJani Nikula <jani.nikula@intel.com>
Thu, 5 May 2022 17:28:24 +0000 (20:28 +0300)
Iterate through all CTA data blocks across all CTA Extensions and
DisplayID data blocks.

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/7400792525c13f58652f288b891d6057637ed4c8.1651569697.git.jani.nikula@intel.com
drivers/gpu/drm/drm_edid.c

index 3433d9f..98b2e61 100644 (file)
@@ -5497,8 +5497,9 @@ static void drm_parse_cea_ext(struct drm_connector *connector,
                              const struct edid *edid)
 {
        struct drm_display_info *info = &connector->display_info;
+       const struct cea_db *db;
+       struct cea_db_iter iter;
        const u8 *edid_ext;
-       int i, start, end;
 
        edid_ext = drm_find_cea_extension(edid);
        if (!edid_ext)
@@ -5517,26 +5518,26 @@ static void drm_parse_cea_ext(struct drm_connector *connector,
                        info->color_formats |= DRM_COLOR_FORMAT_YCBCR422;
        }
 
-       if (cea_db_offsets(edid_ext, &start, &end))
-               return;
-
-       for_each_cea_db(edid_ext, i, start, end) {
-               const u8 *db = &edid_ext[i];
+       cea_db_iter_edid_begin(edid, &iter);
+       cea_db_iter_for_each(db, &iter) {
+               /* FIXME: convert parsers to use struct cea_db */
+               const u8 *data = (const u8 *)db;
 
                if (cea_db_is_hdmi_vsdb(db))
-                       drm_parse_hdmi_vsdb_video(connector, db);
+                       drm_parse_hdmi_vsdb_video(connector, data);
                if (cea_db_is_hdmi_forum_vsdb(db) ||
                    cea_db_is_hdmi_forum_scdb(db))
-                       drm_parse_hdmi_forum_scds(connector, db);
+                       drm_parse_hdmi_forum_scds(connector, data);
                if (cea_db_is_microsoft_vsdb(db))
-                       drm_parse_microsoft_vsdb(connector, db);
+                       drm_parse_microsoft_vsdb(connector, data);
                if (cea_db_is_y420cmdb(db))
-                       drm_parse_y420cmdb_bitmap(connector, db);
+                       drm_parse_y420cmdb_bitmap(connector, data);
                if (cea_db_is_vcdb(db))
-                       drm_parse_vcdb(connector, db);
+                       drm_parse_vcdb(connector, data);
                if (cea_db_is_hdmi_hdr_metadata_block(db))
-                       drm_parse_hdr_metadata_block(connector, db);
+                       drm_parse_hdr_metadata_block(connector, data);
        }
+       cea_db_iter_end(&iter);
 }
 
 static