From patchwork Tue Apr 5 20:50:15 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 688721 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p35KoUMC014165 for ; Tue, 5 Apr 2011 20:50:50 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 566AA9EC76 for ; Tue, 5 Apr 2011 13:50:29 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from fireflyinternet.com (server109-228-6-236.live-servers.net [109.228.6.236]) by gabe.freedesktop.org (Postfix) with ESMTP id D9AAA9E734 for ; Tue, 5 Apr 2011 13:50:20 -0700 (PDT) X-Default-Received-SPF: pass (skip=forwardok (res=PASS)) x-ip-name=78.156.66.37; Received: from arrandale.alporthouse.com (unverified [78.156.66.37]) by fireflyinternet.com (Firefly Internet SMTP) with ESMTP id 31211795-1500050 for multiple; Tue, 05 Apr 2011 21:50:15 +0100 From: Chris Wilson 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 Message-Id: <1302036615-14998-1-git-send-email-chris@chris-wilson.co.uk> X-Mailer: git-send-email 1.7.4.1 X-Originating-IP: 78.156.66.37 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Tue, 05 Apr 2011 20:50:50 +0000 (UTC) Signed-off-by: Chris Wilson --- 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); }