[Intel-gfx] [RFC][PATCH 06/11] drm/edid: Don't call drm_add_display_info() with an invalid EDID

Ville Syrjala ville.syrjala at linux.intel.com
Tue Feb 27 12:56:55 UTC 2018


From: Ville Syrjälä <ville.syrjala at linux.intel.com>

drm_mode_connector_update_edid_property() will call
drm_add_display_info() if an invalid edid is passed in.
This differs from the behaviour of drm_add_edid_modes() which
doesn't try to populate the display info from an invalid edid.
Adjust drm_mode_connector_update_edid_property() to match that
behaviour.

Unfortunately we have to pass the edid as non-const to
drm_mode_connector_update_edid_property() because drm_edid_is_valid()
may need to modify it :( Would be nice to one day fix up the EDID code
to not do crazy things like that.

Cc: Keith Packard <keithp at keithp.com>
Cc: Daniel Vetter <daniel.vetter at ffwll.ch>
Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
 drivers/gpu/drm/drm_connector.c | 4 ++--
 include/drm/drm_connector.h     | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
index ddd7d978f462..d8c3ef4f17da 100644
--- a/drivers/gpu/drm/drm_connector.c
+++ b/drivers/gpu/drm/drm_connector.c
@@ -1368,7 +1368,7 @@ EXPORT_SYMBOL(drm_mode_connector_set_tile_property);
  * Zero on success, negative errno on failure.
  */
 int drm_mode_connector_update_edid_property(struct drm_connector *connector,
-					    const struct edid *edid)
+					    struct edid *edid)
 {
 	struct drm_device *dev = connector->dev;
 	size_t size = 0;
@@ -1390,7 +1390,7 @@ int drm_mode_connector_update_edid_property(struct drm_connector *connector,
 	 * ordering of calls.
 	 */
 	drm_reset_display_info(connector);
-	if (edid)
+	if (edid && drm_edid_is_valid(edid))
 		drm_add_display_info(connector, edid);
 
 	drm_object_property_set_value(&connector->base,
diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
index aad3258facf2..8815ef1ce429 100644
--- a/include/drm/drm_connector.h
+++ b/include/drm/drm_connector.h
@@ -1119,7 +1119,7 @@ int drm_mode_connector_set_path_property(struct drm_connector *connector,
 					 const char *path);
 int drm_mode_connector_set_tile_property(struct drm_connector *connector);
 int drm_mode_connector_update_edid_property(struct drm_connector *connector,
-					    const struct edid *edid);
+					    struct edid *edid);
 void drm_mode_connector_set_link_status_property(struct drm_connector *connector,
 						 uint64_t link_status);
 int drm_connector_init_panel_orientation_property(
-- 
2.13.6



More information about the Intel-gfx mailing list