[Intel-gfx] [PATCH 2/9] drm: Recognize invalid (all-zero) modes in drm_mode_debug_printmodeline(_raw)

Tvrtko Ursulin tvrtko.ursulin at linux.intel.com
Wed Apr 27 10:06:55 UTC 2016


From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>

Instead of a long string full of zeros in various forms
print out "---" for more tidy appearace in the logs.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
Cc: Daniel Vetter <daniel.vetter at ffwll.ch>
Cc: dri-devel at lists.freedesktop.org
---
 drivers/gpu/drm/drm_modes.c | 25 +++++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
index fd4795e2c8db..da9012dc4bba 100644
--- a/drivers/gpu/drm/drm_modes.c
+++ b/drivers/gpu/drm/drm_modes.c
@@ -49,13 +49,26 @@
  */
 void drm_mode_debug_printmodeline_raw(const struct drm_display_mode *mode)
 {
-	if (drm_debug & DRM_UT_KMS)
+	if (!(drm_debug & DRM_UT_KMS))
+		return;
+
+	if (mode->base.id == 0 &&
+	    (mode->name == NULL || mode->name[0] == 0) &&
+	    mode->vrefresh == 0 && mode->clock == 0 &&
+	    mode->hdisplay == 0 && mode->hsync_start == 0 &&
+	    mode->hsync_end == 0 && mode->htotal == 0 &&
+	    mode->vdisplay == 0 && mode->vsync_start == 0 &&
+	    mode->vsync_end == 0 && mode->vtotal == 0 &&
+	    mode->type == 0 && mode->flags == 0) {
+		printk("---");
+	} else {
 		printk("%d:\"%s\" %d %d %d %d %d %d %d %d %d %d 0x%x 0x%x",
-		       mode->base.id, mode->name, mode->vrefresh, mode->clock,
-		       mode->hdisplay, mode->hsync_start,
-		       mode->hsync_end, mode->htotal,
-		       mode->vdisplay, mode->vsync_start,
-		       mode->vsync_end, mode->vtotal, mode->type, mode->flags);
+			mode->base.id, mode->name, mode->vrefresh, mode->clock,
+			mode->hdisplay, mode->hsync_start,
+			mode->hsync_end, mode->htotal,
+			mode->vdisplay, mode->vsync_start,
+			mode->vsync_end, mode->vtotal, mode->type, mode->flags);
+	}
 }
 EXPORT_SYMBOL(drm_mode_debug_printmodeline_raw);
 
-- 
1.9.1



More information about the Intel-gfx mailing list