[v2,5/9] drm/i915: Dump the mode for the crtc just the once
diff mbox series

Message ID 20191129185434.25549-6-ville.syrjala@linux.intel.com
State New
Headers show
Series
  • drm/i915: i915_display_info cleanup
Related show

Commit Message

Ville Syrjälä Nov. 29, 2019, 6:54 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

No point in repeating the crtc mode for each cloned encoder.
Just print it once, and avoid using multiple lines for it.
And while at let's polish the fixed mode print to fit on
one line as well.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/i915_debugfs.c | 27 +++++++++------------------
 1 file changed, 9 insertions(+), 18 deletions(-)

Comments

Ramalingam C Dec. 2, 2019, 2:56 p.m. UTC | #1
On 2019-11-29 at 20:54:30 +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> No point in repeating the crtc mode for each cloned encoder.
> Just print it once, and avoid using multiple lines for it.
> And while at let's polish the fixed mode print to fit on
> one line as well.

Looks good to me.

Reviewed-by: Ramalingam C <ramalingam.c@intel.com>

> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/i915_debugfs.c | 27 +++++++++------------------
>  1 file changed, 9 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> index 28f45f25cfc0..11f3f91befb9 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -2388,29 +2388,16 @@ static void intel_encoder_info(struct seq_file *m,
>  	seq_printf(m, "\tencoder %d: type: %s, connectors:\n",
>  		   encoder->base.base.id, encoder->base.name);
>  
> -	for_each_connector_on_encoder(dev, &encoder->base, connector) {
> -		seq_printf(m, "\t\tconnector %d: type: %s, status: %s",
> -			   connector->base.base.id, connector->base.name,
> -			   drm_get_connector_status_name(connector->base.status));
> -
> -		if (connector->base.status == connector_status_connected) {
> -			const struct intel_crtc_state *crtc_state =
> -				to_intel_crtc_state(crtc->base.state);
> -
> -			seq_printf(m, ", mode:\n");
> -			intel_seq_print_mode(m, 2, &crtc_state->hw.mode);
> -		} else {
> -			seq_putc(m, '\n');
> -		}
> -	}
> +	for_each_connector_on_encoder(dev, &encoder->base, connector)
> +		seq_printf(m, "\t\tconnector %d: type: %s\n",
> +			   connector->base.base.id, connector->base.name);
>  }
>  
>  static void intel_panel_info(struct seq_file *m, struct intel_panel *panel)
>  {
> -	struct drm_display_mode *mode = panel->fixed_mode;
> +	const struct drm_display_mode *mode = panel->fixed_mode;
>  
> -	seq_printf(m, "\tfixed mode:\n");
> -	intel_seq_print_mode(m, 2, mode);
> +	seq_printf(m, "\tfixed mode: " DRM_MODE_FMT "\n", DRM_MODE_ARG(mode));
>  }
>  
>  static void intel_hdcp_info(struct seq_file *m,
> @@ -2651,8 +2638,12 @@ static void intel_crtc_info(struct seq_file *m, struct intel_crtc *crtc)
>  		   yesno(crtc_state->dither), crtc_state->pipe_bpp);
>  
>  	if (crtc_state->hw.active) {
> +		const struct drm_display_mode *mode =
> +			&crtc_state->hw.mode;
>  		struct intel_encoder *encoder;
>  
> +		seq_printf(m, "\tmode: " DRM_MODE_FMT "\n", DRM_MODE_ARG(mode));
> +
>  		for_each_encoder_on_crtc(&dev_priv->drm, &crtc->base, encoder)
>  			intel_encoder_info(m, crtc, encoder);
>  
> -- 
> 2.23.0
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Patch
diff mbox series

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 28f45f25cfc0..11f3f91befb9 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -2388,29 +2388,16 @@  static void intel_encoder_info(struct seq_file *m,
 	seq_printf(m, "\tencoder %d: type: %s, connectors:\n",
 		   encoder->base.base.id, encoder->base.name);
 
-	for_each_connector_on_encoder(dev, &encoder->base, connector) {
-		seq_printf(m, "\t\tconnector %d: type: %s, status: %s",
-			   connector->base.base.id, connector->base.name,
-			   drm_get_connector_status_name(connector->base.status));
-
-		if (connector->base.status == connector_status_connected) {
-			const struct intel_crtc_state *crtc_state =
-				to_intel_crtc_state(crtc->base.state);
-
-			seq_printf(m, ", mode:\n");
-			intel_seq_print_mode(m, 2, &crtc_state->hw.mode);
-		} else {
-			seq_putc(m, '\n');
-		}
-	}
+	for_each_connector_on_encoder(dev, &encoder->base, connector)
+		seq_printf(m, "\t\tconnector %d: type: %s\n",
+			   connector->base.base.id, connector->base.name);
 }
 
 static void intel_panel_info(struct seq_file *m, struct intel_panel *panel)
 {
-	struct drm_display_mode *mode = panel->fixed_mode;
+	const struct drm_display_mode *mode = panel->fixed_mode;
 
-	seq_printf(m, "\tfixed mode:\n");
-	intel_seq_print_mode(m, 2, mode);
+	seq_printf(m, "\tfixed mode: " DRM_MODE_FMT "\n", DRM_MODE_ARG(mode));
 }
 
 static void intel_hdcp_info(struct seq_file *m,
@@ -2651,8 +2638,12 @@  static void intel_crtc_info(struct seq_file *m, struct intel_crtc *crtc)
 		   yesno(crtc_state->dither), crtc_state->pipe_bpp);
 
 	if (crtc_state->hw.active) {
+		const struct drm_display_mode *mode =
+			&crtc_state->hw.mode;
 		struct intel_encoder *encoder;
 
+		seq_printf(m, "\tmode: " DRM_MODE_FMT "\n", DRM_MODE_ARG(mode));
+
 		for_each_encoder_on_crtc(&dev_priv->drm, &crtc->base, encoder)
 			intel_encoder_info(m, crtc, encoder);