diff mbox series

[v7,14/22] drm/edid: merge ELD handling to update_display_info()

Message ID 1f2e7424b998fbcdd9cea488e7d6d7cbb26c460f.1672826282.git.jani.nikula@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/edid: info & modes parsing and drm_edid refactors | expand

Commit Message

Jani Nikula Jan. 4, 2023, 10:05 a.m. UTC
Simplify display info update by merging ELD handling as well as clearing
of the data in update_display_info().

The connector->eld really should be moved under display_info altogether,
but that's for another time.

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/drm_edid.c | 28 +++++++++++++---------------
 1 file changed, 13 insertions(+), 15 deletions(-)

Comments

Ville Syrjälä Jan. 18, 2023, 4:14 p.m. UTC | #1
On Wed, Jan 04, 2023 at 12:05:29PM +0200, Jani Nikula wrote:
> Simplify display info update by merging ELD handling as well as clearing
> of the data in update_display_info().
> 
> The connector->eld really should be moved under display_info altogether,
> but that's for another time.
> 
> 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>

> ---
>  drivers/gpu/drm/drm_edid.c | 28 +++++++++++++---------------
>  1 file changed, 13 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index 6bc0432046c8..810a5fca398a 100644
> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -5489,8 +5489,6 @@ static void drm_edid_to_eld(struct drm_connector *connector,
>  	int total_sad_count = 0;
>  	int mnl;
>  
> -	clear_eld(connector);
> -
>  	if (!drm_edid)
>  		return;
>  
> @@ -6465,9 +6463,15 @@ static void update_display_info(struct drm_connector *connector,
>  				const struct drm_edid *drm_edid)
>  {
>  	struct drm_display_info *info = &connector->display_info;
> -	const struct edid *edid = drm_edid->edid;
> +	const struct edid *edid;
>  
>  	drm_reset_display_info(connector);
> +	clear_eld(connector);
> +
> +	if (!drm_edid)
> +		return;
> +
> +	edid = drm_edid->edid;
>  
>  	info->quirks = edid_get_quirks(drm_edid);
>  
> @@ -6550,6 +6554,9 @@ static void update_display_info(struct drm_connector *connector,
>  
>  	if (info->quirks & EDID_QUIRK_CAP_DSC_15BPP)
>  		info->max_dsc_bpp = 15;
> +
> +	/* Depends on info->cea_rev set by drm_parse_cea_ext() above */
> +	drm_edid_to_eld(connector, drm_edid);
>  }
>  
>  static struct drm_display_mode *drm_mode_displayid_detailed(struct drm_device *dev,
> @@ -6650,12 +6657,6 @@ static int _drm_edid_connector_update(struct drm_connector *connector,
>  	struct drm_display_info *info = &connector->display_info;
>  	int num_modes = 0;
>  
> -	if (!drm_edid) {
> -		drm_reset_display_info(connector);
> -		clear_eld(connector);
> -		return 0;
> -	}
> -
>  	/*
>  	 * CEA-861-F adds ycbcr capability map block, for HDMI 2.0 sinks.
>  	 * To avoid multiple parsing of same block, lets parse that map
> @@ -6663,8 +6664,8 @@ static int _drm_edid_connector_update(struct drm_connector *connector,
>  	 */
>  	update_display_info(connector, drm_edid);
>  
> -	/* Depends on info->cea_rev set by update_display_info() above */
> -	drm_edid_to_eld(connector, drm_edid);
> +	if (!drm_edid)
> +		return 0;
>  
>  	/*
>  	 * EDID spec says modes should be preferred in this order:
> @@ -6801,10 +6802,7 @@ static int _drm_connector_update_edid_property(struct drm_connector *connector,
>  	 * that it seems better to duplicate it rather than attempt to ensure
>  	 * some arbitrary ordering of calls.
>  	 */
> -	if (drm_edid)
> -		update_display_info(connector, drm_edid);
> -	else
> -		drm_reset_display_info(connector);
> +	update_display_info(connector, drm_edid);
>  
>  	_drm_update_tile_info(connector, drm_edid);
>  
> -- 
> 2.34.1
diff mbox series

Patch

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 6bc0432046c8..810a5fca398a 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -5489,8 +5489,6 @@  static void drm_edid_to_eld(struct drm_connector *connector,
 	int total_sad_count = 0;
 	int mnl;
 
-	clear_eld(connector);
-
 	if (!drm_edid)
 		return;
 
@@ -6465,9 +6463,15 @@  static void update_display_info(struct drm_connector *connector,
 				const struct drm_edid *drm_edid)
 {
 	struct drm_display_info *info = &connector->display_info;
-	const struct edid *edid = drm_edid->edid;
+	const struct edid *edid;
 
 	drm_reset_display_info(connector);
+	clear_eld(connector);
+
+	if (!drm_edid)
+		return;
+
+	edid = drm_edid->edid;
 
 	info->quirks = edid_get_quirks(drm_edid);
 
@@ -6550,6 +6554,9 @@  static void update_display_info(struct drm_connector *connector,
 
 	if (info->quirks & EDID_QUIRK_CAP_DSC_15BPP)
 		info->max_dsc_bpp = 15;
+
+	/* Depends on info->cea_rev set by drm_parse_cea_ext() above */
+	drm_edid_to_eld(connector, drm_edid);
 }
 
 static struct drm_display_mode *drm_mode_displayid_detailed(struct drm_device *dev,
@@ -6650,12 +6657,6 @@  static int _drm_edid_connector_update(struct drm_connector *connector,
 	struct drm_display_info *info = &connector->display_info;
 	int num_modes = 0;
 
-	if (!drm_edid) {
-		drm_reset_display_info(connector);
-		clear_eld(connector);
-		return 0;
-	}
-
 	/*
 	 * CEA-861-F adds ycbcr capability map block, for HDMI 2.0 sinks.
 	 * To avoid multiple parsing of same block, lets parse that map
@@ -6663,8 +6664,8 @@  static int _drm_edid_connector_update(struct drm_connector *connector,
 	 */
 	update_display_info(connector, drm_edid);
 
-	/* Depends on info->cea_rev set by update_display_info() above */
-	drm_edid_to_eld(connector, drm_edid);
+	if (!drm_edid)
+		return 0;
 
 	/*
 	 * EDID spec says modes should be preferred in this order:
@@ -6801,10 +6802,7 @@  static int _drm_connector_update_edid_property(struct drm_connector *connector,
 	 * that it seems better to duplicate it rather than attempt to ensure
 	 * some arbitrary ordering of calls.
 	 */
-	if (drm_edid)
-		update_display_info(connector, drm_edid);
-	else
-		drm_reset_display_info(connector);
+	update_display_info(connector, drm_edid);
 
 	_drm_update_tile_info(connector, drm_edid);