diff mbox

[2/5] drm: Make the HPD status updates debug logs more readable

Message ID 1368029014-30181-3-git-send-email-damien.lespiau@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Lespiau, Damien May 8, 2013, 4:03 p.m. UTC
Instead of just printing "status updated from 1 to 2", make those enum
numbers immediately readable.

v2: Also patch output_poll_execute() (Daniel Vetter)

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
---
 drivers/gpu/drm/drm_crtc_helper.c | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

Comments

Chris Wilson May 8, 2013, 4:43 p.m. UTC | #1
On Wed, May 08, 2013 at 05:03:31PM +0100, Damien Lespiau wrote:
> 
> Instead of just printing "status updated from 1 to 2", make those enum
> numbers immediately readable.
> 
> v2: Also patch output_poll_execute() (Daniel Vetter)

For bonus points, only emit the message when it is updated.
-Chris
Ville Syrjala May 8, 2013, 4:43 p.m. UTC | #2
On Wed, May 08, 2013 at 05:03:31PM +0100, Damien Lespiau wrote:
> Instead of just printing "status updated from 1 to 2", make those enum
> numbers immediately readable.
> 
> v2: Also patch output_poll_execute() (Daniel Vetter)
> 
> Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
> Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
> ---
>  drivers/gpu/drm/drm_crtc_helper.c | 22 ++++++++++++++++++----
>  1 file changed, 18 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
> index 7b2d378..8976eb6 100644
> --- a/drivers/gpu/drm/drm_crtc_helper.c
> +++ b/drivers/gpu/drm/drm_crtc_helper.c
> @@ -968,6 +968,18 @@ void drm_kms_helper_hotplug_event(struct drm_device *dev)
>  }
>  EXPORT_SYMBOL(drm_kms_helper_hotplug_event);
>  
> +static const char *connector_status_str(enum drm_connector_status status)
> +{
> +	switch (status) {
> +	case connector_status_connected:
> +		return "connected";
> +	case connector_status_disconnected:
> +		return "disconnected";
> +	default:
> +		return "unknown";
> +	}
> +}

drm_get_connector_status_name()

> +
>  #define DRM_OUTPUT_POLL_PERIOD (10*HZ)
>  static void output_poll_execute(struct work_struct *work)
>  {
> @@ -1002,10 +1014,11 @@ static void output_poll_execute(struct work_struct *work)
>  			continue;
>  
>  		connector->status = connector->funcs->detect(connector, false);
> -		DRM_DEBUG_KMS("[CONNECTOR:%d:%s] status updated from %d to %d\n",
> +		DRM_DEBUG_KMS("[CONNECTOR:%d:%s] status updated from %s to %s\n",
>  			      connector->base.id,
>  			      drm_get_connector_name(connector),
> -			      old_status, connector->status);
> +			      connector_status_str(old_status),
> +			      connector_status_str(connector->status));
>  		if (old_status != connector->status)
>  			changed = true;
>  	}
> @@ -1080,10 +1093,11 @@ void drm_helper_hpd_irq_event(struct drm_device *dev)
>  		old_status = connector->status;
>  
>  		connector->status = connector->funcs->detect(connector, false);
> -		DRM_DEBUG_KMS("[CONNECTOR:%d:%s] status updated from %d to %d\n",
> +		DRM_DEBUG_KMS("[CONNECTOR:%d:%s] status updated from %s to %s\n",
>  			      connector->base.id,
>  			      drm_get_connector_name(connector),
> -			      old_status, connector->status);
> +			      connector_status_str(old_status),
> +			      connector_status_str(connector->status));
>  		if (old_status != connector->status)
>  			changed = true;
>  	}
> -- 
> 1.8.1.4
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
Jani Nikula May 10, 2013, 6:27 a.m. UTC | #3
On Wed, 08 May 2013, Ville Syrjälä <ville.syrjala@linux.intel.com> wrote:
> On Wed, May 08, 2013 at 05:03:31PM +0100, Damien Lespiau wrote:
>> +static const char *connector_status_str(enum drm_connector_status status)
>> +{
>> +	switch (status) {
>> +	case connector_status_connected:
>> +		return "connected";
>> +	case connector_status_disconnected:
>> +		return "disconnected";
>> +	default:
>> +		return "unknown";
>> +	}
>> +}
>
> drm_get_connector_status_name()

...and export it and use in intel_hpd_irq_event() in i915/i915_irq.c too
please.

Jani.
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
index 7b2d378..8976eb6 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -968,6 +968,18 @@  void drm_kms_helper_hotplug_event(struct drm_device *dev)
 }
 EXPORT_SYMBOL(drm_kms_helper_hotplug_event);
 
+static const char *connector_status_str(enum drm_connector_status status)
+{
+	switch (status) {
+	case connector_status_connected:
+		return "connected";
+	case connector_status_disconnected:
+		return "disconnected";
+	default:
+		return "unknown";
+	}
+}
+
 #define DRM_OUTPUT_POLL_PERIOD (10*HZ)
 static void output_poll_execute(struct work_struct *work)
 {
@@ -1002,10 +1014,11 @@  static void output_poll_execute(struct work_struct *work)
 			continue;
 
 		connector->status = connector->funcs->detect(connector, false);
-		DRM_DEBUG_KMS("[CONNECTOR:%d:%s] status updated from %d to %d\n",
+		DRM_DEBUG_KMS("[CONNECTOR:%d:%s] status updated from %s to %s\n",
 			      connector->base.id,
 			      drm_get_connector_name(connector),
-			      old_status, connector->status);
+			      connector_status_str(old_status),
+			      connector_status_str(connector->status));
 		if (old_status != connector->status)
 			changed = true;
 	}
@@ -1080,10 +1093,11 @@  void drm_helper_hpd_irq_event(struct drm_device *dev)
 		old_status = connector->status;
 
 		connector->status = connector->funcs->detect(connector, false);
-		DRM_DEBUG_KMS("[CONNECTOR:%d:%s] status updated from %d to %d\n",
+		DRM_DEBUG_KMS("[CONNECTOR:%d:%s] status updated from %s to %s\n",
 			      connector->base.id,
 			      drm_get_connector_name(connector),
-			      old_status, connector->status);
+			      connector_status_str(old_status),
+			      connector_status_str(connector->status));
 		if (old_status != connector->status)
 			changed = true;
 	}