All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: dri-devel@lists.freedesktop.org
Subject: [PATCH] drm: Pretty print out the reason for rejecting the mode
Date: Tue,  5 Apr 2011 21:50:15 +0100	[thread overview]
Message-ID: <1302036615-14998-1-git-send-email-chris@chris-wilson.co.uk> (raw)

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/drm_modes.c |   52 +++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 50 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
index 25bf873..b3e07ac 100644
--- a/drivers/gpu/drm/drm_modes.c
+++ b/drivers/gpu/drm/drm_modes.c
@@ -853,6 +853,52 @@ void drm_mode_validate_clocks(struct drm_device *dev,
 }
 EXPORT_SYMBOL(drm_mode_validate_clocks);
 
+static const char *mode_status_to_string(enum drm_mode_status status)
+{
+	const char *strings[] = {
+		[MODE_OK] = "OK",
+		[MODE_HSYNC] = "hsync out of range",
+		[MODE_VSYNC] = "vsync out of range",
+		[MODE_H_ILLEGAL] = "illegal horizontal timings",
+		[MODE_V_ILLEGAL] = "illegal vertical timings",
+		[MODE_BAD_WIDTH] = "requires an unsupported linepitch",
+		[MODE_NOMODE] = "no mode with a maching name",
+		[MODE_NO_INTERLACE] = "interlaced mode not supported",
+		[MODE_NO_DBLESCAN] = "doublescan mode not supported",
+		[MODE_NO_VSCAN] = "multiscan mode not supported",
+		[MODE_MEM] = "insufficient video memory",
+		[MODE_VIRTUAL_X] = "mode width too large for specified virtual size",
+		[MODE_VIRTUAL_Y] = "mode height too large for specified virtual size",
+		[MODE_MEM_VIRT] = "insufficient video memory given virtual size",
+		[MODE_NOCLOCK] = "no fixed clock available",
+		[MODE_CLOCK_HIGH] = "clock required is too high",
+		[MODE_CLOCK_LOW] = "clock required is too low",
+		[MODE_CLOCK_RANGE] = "clock/mode isn't in a ClockRange",
+		[MODE_BAD_HVALUE] = "horizontal timing was out of range",
+		[MODE_BAD_VVALUE] = "vertical timing was out of range",
+		[MODE_BAD_VSCAN] = "VScan value out of range",
+		[MODE_HSYNC_NARROW] = "horizontal sync too narrow",
+		[MODE_HSYNC_WIDE] = "horizontal sync too wide",
+		[MODE_HBLANK_NARROW] = "horizontal blanking too narrow",
+		[MODE_HBLANK_WIDE] = "horizontal blanking too wide",
+		[MODE_VSYNC_NARROW] = "vertical sync too narrow",
+		[MODE_VSYNC_WIDE] = "vertical sync too wide",
+		[MODE_VBLANK_NARROW] = "vertical blanking too narrow",
+		[MODE_VBLANK_WIDE] = "vertical blanking too wide",
+		[MODE_PANEL] = "exceeds panel dimensions",
+		[MODE_INTERLACE_WIDTH] = "width too large for interlaced mode",
+		[MODE_ONE_WIDTH] = "only one width is supported",
+		[MODE_ONE_HEIGHT] = "only one height is supported",
+		[MODE_ONE_SIZE] = "only one resolution is supported",
+		[MODE_NO_REDUCED] = "monitor doesn't accept reduced blanking",
+	};
+
+	if ((unsigned)status > ARRAY_SIZE(strings))
+		return "unknown";
+
+	return strings[status];
+}
+
 /**
  * drm_mode_prune_invalid - remove invalid modes from mode list
  * @dev: DRM device
@@ -876,8 +922,10 @@ void drm_mode_prune_invalid(struct drm_device *dev,
 			list_del(&mode->head);
 			if (verbose) {
 				drm_mode_debug_printmodeline(mode);
-				DRM_DEBUG_KMS("Not using %s mode %d\n",
-					mode->name, mode->status);
+				DRM_DEBUG_KMS("Not using %s mode: %s [%d]\n",
+					      mode->name,
+					      mode_status_to_string(mode->status),
+					      mode->status);
 			}
 			drm_mode_destroy(dev, mode);
 		}
-- 
1.7.4.1

             reply	other threads:[~2011-04-05 20:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-05 20:50 Chris Wilson [this message]
2011-04-05 21:06 ` [PATCH] drm: Pretty print out the reason for rejecting the mode Marcin Ślusarz
2011-04-05 21:32   ` Chris Wilson
2011-04-06 14:10   ` Henri Verbeet
2011-04-05 21:39 ` Julien Cristau
2011-04-05 21:41   ` Chris Wilson
2011-04-06 14:32     ` Alex Deucher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1302036615-14998-1-git-send-email-chris@chris-wilson.co.uk \
    --to=chris@chris-wilson.co.uk \
    --cc=dri-devel@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.