public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915: debug print all of the DPCD we have
@ 2012-10-25  7:58 Jani Nikula
  2012-10-25 12:40 ` Mika Kuoppala
  2012-10-25 13:00 ` Paulo Zanoni
  0 siblings, 2 replies; 4+ messages in thread
From: Jani Nikula @ 2012-10-25  7:58 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula

At some point the DPCD size was increased, but the debug print not. While
at it, switch to using hex dump.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>

---

The obvious downside here is that the hex dumping to buffer is done
regardless of drm.debug value. I thought it was still better than the
alternatives:

1) DRM_DEBUG_KMS with loads of %02x as it were

2) if (drm_debug & DRM_UT_KMS)

3) print_hex_dump(KERN_DEBUG, ... )

4) adding a new drm_print_hex_dump or similar that does 2) internally
---
 drivers/gpu/drm/i915/intel_dp.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 01b67d9..52eea34 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -2278,6 +2278,7 @@ intel_dp_detect(struct drm_connector *connector, bool force)
 	struct drm_device *dev = intel_dp->base.base.dev;
 	enum drm_connector_status status;
 	struct edid *edid = NULL;
+	char dpcd_hex_dump[sizeof(intel_dp->dpcd) * 3];
 
 	intel_dp->has_audio = false;
 
@@ -2286,10 +2287,9 @@ intel_dp_detect(struct drm_connector *connector, bool force)
 	else
 		status = g4x_dp_detect(intel_dp);
 
-	DRM_DEBUG_KMS("DPCD: %02hx%02hx%02hx%02hx%02hx%02hx%02hx%02hx\n",
-		      intel_dp->dpcd[0], intel_dp->dpcd[1], intel_dp->dpcd[2],
-		      intel_dp->dpcd[3], intel_dp->dpcd[4], intel_dp->dpcd[5],
-		      intel_dp->dpcd[6], intel_dp->dpcd[7]);
+	hex_dump_to_buffer(intel_dp->dpcd, sizeof(intel_dp->dpcd),
+			   32, 1, dpcd_hex_dump, sizeof(dpcd_hex_dump), false);
+	DRM_DEBUG_KMS("DPCD: %s\n", dpcd_hex_dump);
 
 	if (status != connector_status_connected)
 		return status;
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/i915: debug print all of the DPCD we have
  2012-10-25  7:58 [PATCH] drm/i915: debug print all of the DPCD we have Jani Nikula
@ 2012-10-25 12:40 ` Mika Kuoppala
  2012-10-25 13:00 ` Paulo Zanoni
  1 sibling, 0 replies; 4+ messages in thread
From: Mika Kuoppala @ 2012-10-25 12:40 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula

On Thu, 25 Oct 2012 10:58:10 +0300, Jani Nikula <jani.nikula@intel.com> wrote:
> At some point the DPCD size was increased, but the debug print not. While
> at it, switch to using hex dump.
> 
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> 
> ---
> 
> The obvious downside here is that the hex dumping to buffer is done
> regardless of drm.debug value. I thought it was still better than the
> alternatives:
> 
> 1) DRM_DEBUG_KMS with loads of %02x as it were
> 
> 2) if (drm_debug & DRM_UT_KMS)
> 
> 3) print_hex_dump(KERN_DEBUG, ... )
> 
> 4) adding a new drm_print_hex_dump or similar that does 2) internally
> ---
>  drivers/gpu/drm/i915/intel_dp.c |    8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 01b67d9..52eea34 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -2278,6 +2278,7 @@ intel_dp_detect(struct drm_connector *connector, bool force)
>  	struct drm_device *dev = intel_dp->base.base.dev;
>  	enum drm_connector_status status;
>  	struct edid *edid = NULL;
> +	char dpcd_hex_dump[sizeof(intel_dp->dpcd) * 3];

It seems hex_dump_to_buffer nukes trailing ' ' before inserting null.
Would make reader less nervous by adding + 1 thought, for courtesy :)

>  	intel_dp->has_audio = false;
>  
> @@ -2286,10 +2287,9 @@ intel_dp_detect(struct drm_connector *connector, bool force)
>  	else
>  		status = g4x_dp_detect(intel_dp);
>  
> -	DRM_DEBUG_KMS("DPCD: %02hx%02hx%02hx%02hx%02hx%02hx%02hx%02hx\n",
> -		      intel_dp->dpcd[0], intel_dp->dpcd[1], intel_dp->dpcd[2],
> -		      intel_dp->dpcd[3], intel_dp->dpcd[4], intel_dp->dpcd[5],
> -		      intel_dp->dpcd[6], intel_dp->dpcd[7]);
> +	hex_dump_to_buffer(intel_dp->dpcd, sizeof(intel_dp->dpcd),
> +			   32, 1, dpcd_hex_dump, sizeof(dpcd_hex_dump), false);
> +	DRM_DEBUG_KMS("DPCD: %s\n", dpcd_hex_dump);
>  
>  	if (status != connector_status_connected)
>  		return status;
> -- 
> 1.7.9.5

Reviewed-by: Mika Kuoppala <mika.kuoppala@intel.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/i915: debug print all of the DPCD we have
  2012-10-25  7:58 [PATCH] drm/i915: debug print all of the DPCD we have Jani Nikula
  2012-10-25 12:40 ` Mika Kuoppala
@ 2012-10-25 13:00 ` Paulo Zanoni
  2012-10-26 18:50   ` Daniel Vetter
  1 sibling, 1 reply; 4+ messages in thread
From: Paulo Zanoni @ 2012-10-25 13:00 UTC (permalink / raw)
  To: Jani Nikula; +Cc: intel-gfx

Hi

2012/10/25 Jani Nikula <jani.nikula@intel.com>:
> At some point the DPCD size was increased, but the debug print not. While
> at it, switch to using hex dump.
>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>

Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>

>
> ---
>
> The obvious downside here is that the hex dumping to buffer is done
> regardless of drm.debug value. I thought it was still better than the
> alternatives:
>
> 1) DRM_DEBUG_KMS with loads of %02x as it were
>
> 2) if (drm_debug & DRM_UT_KMS)
>
> 3) print_hex_dump(KERN_DEBUG, ... )
>
> 4) adding a new drm_print_hex_dump or similar that does 2) internally
> ---
>  drivers/gpu/drm/i915/intel_dp.c |    8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 01b67d9..52eea34 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -2278,6 +2278,7 @@ intel_dp_detect(struct drm_connector *connector, bool force)
>         struct drm_device *dev = intel_dp->base.base.dev;
>         enum drm_connector_status status;
>         struct edid *edid = NULL;
> +       char dpcd_hex_dump[sizeof(intel_dp->dpcd) * 3];
>
>         intel_dp->has_audio = false;
>
> @@ -2286,10 +2287,9 @@ intel_dp_detect(struct drm_connector *connector, bool force)
>         else
>                 status = g4x_dp_detect(intel_dp);
>
> -       DRM_DEBUG_KMS("DPCD: %02hx%02hx%02hx%02hx%02hx%02hx%02hx%02hx\n",
> -                     intel_dp->dpcd[0], intel_dp->dpcd[1], intel_dp->dpcd[2],
> -                     intel_dp->dpcd[3], intel_dp->dpcd[4], intel_dp->dpcd[5],
> -                     intel_dp->dpcd[6], intel_dp->dpcd[7]);
> +       hex_dump_to_buffer(intel_dp->dpcd, sizeof(intel_dp->dpcd),
> +                          32, 1, dpcd_hex_dump, sizeof(dpcd_hex_dump), false);
> +       DRM_DEBUG_KMS("DPCD: %s\n", dpcd_hex_dump);
>
>         if (status != connector_status_connected)
>                 return status;
> --
> 1.7.9.5
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx



-- 
Paulo Zanoni

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/i915: debug print all of the DPCD we have
  2012-10-25 13:00 ` Paulo Zanoni
@ 2012-10-26 18:50   ` Daniel Vetter
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel Vetter @ 2012-10-26 18:50 UTC (permalink / raw)
  To: Paulo Zanoni; +Cc: Jani Nikula, intel-gfx

On Thu, Oct 25, 2012 at 11:00:32AM -0200, Paulo Zanoni wrote:
> Hi
> 
> 2012/10/25 Jani Nikula <jani.nikula@intel.com>:
> > At some point the DPCD size was increased, but the debug print not. While
> > at it, switch to using hex dump.
> >
> > Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> 
> Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Queued for -next, thanks for the patch.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-10-26 18:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-25  7:58 [PATCH] drm/i915: debug print all of the DPCD we have Jani Nikula
2012-10-25 12:40 ` Mika Kuoppala
2012-10-25 13:00 ` Paulo Zanoni
2012-10-26 18:50   ` Daniel Vetter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox