Skip to contentSkip to conversation

drm/i915: debug print all of the DPCD we have

PATCH Applied Jani Nikula 4 participants 4 messages Oct 25, 2012 – Oct 26, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915: debug print all of the DPCD we have

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

---

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(-)
drivers/gpu/drm/i915/intel_dp.c +4 -4
index 01b67d9..52eea34 100644
@@ -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;
Signature · 1 line
1.7.9.5
Reviewed-by on v1 1/1
#1 lore raw
Quoted 27 lines · Jani Nikula

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

---

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(-)
drivers/gpu/drm/i915/intel_dp.c +0 -0
index 01b67d9..52eea34 100644

drivers/gpu/drm/i915/intel_dp.c intel_dp_detect(struct drm_connector *connector, bool force) · line 2281

Quoted 4 lines
drivers/gpu/drm/i915/intel_dp.c +1 -0
@@ -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 :)

Quoted 18 lines
drivers/gpu/drm/i915/intel_dp.c +3 -4
 	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;
Signature · 1 line
1.7.9.5
Reviewed-by on v1 1/1
#2 lore raw
In reply to Jani Nikula

Hi

2012/10/25 Jani Nikula <[email protected]>:

Quoted 4 lines

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

Quoted 51 lines

---

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(-)
drivers/gpu/drm/i915/intel_dp.c +4 -5
index 01b67d9..52eea34 100644
@@ -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
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Signature · 1 line
Paulo Zanoni
#3 lore raw
Quoted 9 lines · Paulo Zanoni

Hi

2012/10/25 Jani Nikula <[email protected]>:

Quoted 4 lines

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

Queued for -next, thanks for the patch.
-Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch