* [PATCH] drm: Pretty print out the reason for rejecting the mode
@ 2011-04-05 20:50 Chris Wilson
2011-04-05 21:06 ` Marcin Ślusarz
2011-04-05 21:39 ` Julien Cristau
0 siblings, 2 replies; 7+ messages in thread
From: Chris Wilson @ 2011-04-05 20:50 UTC (permalink / raw)
To: dri-devel
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
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] drm: Pretty print out the reason for rejecting the mode
2011-04-05 20:50 [PATCH] drm: Pretty print out the reason for rejecting the mode Chris Wilson
@ 2011-04-05 21:06 ` Marcin Ślusarz
2011-04-05 21:32 ` Chris Wilson
2011-04-06 14:10 ` Henri Verbeet
2011-04-05 21:39 ` Julien Cristau
1 sibling, 2 replies; 7+ messages in thread
From: Marcin Ślusarz @ 2011-04-05 21:06 UTC (permalink / raw)
To: Chris Wilson; +Cc: dri-devel
2011/4/5 Chris Wilson <chris@chris-wilson.co.uk>:
> 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[] = {
+ static?
> + [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",
s/maching/matching/
> + [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);
> }
> --
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] drm: Pretty print out the reason for rejecting the mode
2011-04-05 21:06 ` Marcin Ślusarz
@ 2011-04-05 21:32 ` Chris Wilson
2011-04-06 14:10 ` Henri Verbeet
1 sibling, 0 replies; 7+ messages in thread
From: Chris Wilson @ 2011-04-05 21:32 UTC (permalink / raw)
Cc: dri-devel
[-- Attachment #1: Type: text/plain, Size: 1583 bytes --]
On Tue, 5 Apr 2011 23:06:19 +0200, Marcin Ålusarz <marcin.slusarz@gmail.com> wrote:
> 2011/4/5 Chris Wilson <chris@chris-wilson.co.uk>:
> > 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[] = {
>
> + static?
Yes, it should be. I wonder if the compiler is smart enough (smarter than
me) for that to make no difference in this case...
> > + Â Â Â Â Â Â Â [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",
>
> s/maching/matching/
Cut'n'paste typo. Another patch for include/drm/drm_crtc.h required!
Thanks,
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
[-- Attachment #2: Type: text/plain, Size: 159 bytes --]
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] drm: Pretty print out the reason for rejecting the mode
2011-04-05 20:50 [PATCH] drm: Pretty print out the reason for rejecting the mode Chris Wilson
2011-04-05 21:06 ` Marcin Ślusarz
@ 2011-04-05 21:39 ` Julien Cristau
2011-04-05 21:41 ` Chris Wilson
1 sibling, 1 reply; 7+ messages in thread
From: Julien Cristau @ 2011-04-05 21:39 UTC (permalink / raw)
To: Chris Wilson; +Cc: dri-devel
On Tue, Apr 5, 2011 at 21:50:15 +0100, Chris Wilson wrote:
> + if ((unsigned)status > ARRAY_SIZE(strings))
off by one?
> + return "unknown";
> +
> + return strings[status];
> +}
> +
Cheers,
Julien
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] drm: Pretty print out the reason for rejecting the mode
2011-04-05 21:39 ` Julien Cristau
@ 2011-04-05 21:41 ` Chris Wilson
2011-04-06 14:32 ` Alex Deucher
0 siblings, 1 reply; 7+ messages in thread
From: Chris Wilson @ 2011-04-05 21:41 UTC (permalink / raw)
To: Julien Cristau; +Cc: dri-devel
On Tue, 5 Apr 2011 23:39:19 +0200, Julien Cristau <jcristau@debian.org> wrote:
> On Tue, Apr 5, 2011 at 21:50:15 +0100, Chris Wilson wrote:
>
> > + if ((unsigned)status > ARRAY_SIZE(strings))
>
> off by one?
And didn't check for holes.
/me wishes he never sent this momentarily useful bit of code. ;-)
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] drm: Pretty print out the reason for rejecting the mode
2011-04-05 21:06 ` Marcin Ślusarz
2011-04-05 21:32 ` Chris Wilson
@ 2011-04-06 14:10 ` Henri Verbeet
1 sibling, 0 replies; 7+ messages in thread
From: Henri Verbeet @ 2011-04-06 14:10 UTC (permalink / raw)
To: Marcin Ślusarz; +Cc: dri-devel
On 5 April 2011 23:06, Marcin Ślusarz <marcin.slusarz@gmail.com> wrote:
>> +static const char *mode_status_to_string(enum drm_mode_status status)
>> +{
>> + const char *strings[] = {
>
> + static?
>
You'd probably even want that to be "static const char * const strings[]".
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] drm: Pretty print out the reason for rejecting the mode
2011-04-05 21:41 ` Chris Wilson
@ 2011-04-06 14:32 ` Alex Deucher
0 siblings, 0 replies; 7+ messages in thread
From: Alex Deucher @ 2011-04-06 14:32 UTC (permalink / raw)
To: Chris Wilson; +Cc: dri-devel, Julien Cristau
On Tue, Apr 5, 2011 at 5:41 PM, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> On Tue, 5 Apr 2011 23:39:19 +0200, Julien Cristau <jcristau@debian.org> wrote:
>> On Tue, Apr 5, 2011 at 21:50:15 +0100, Chris Wilson wrote:
>>
>> > + if ((unsigned)status > ARRAY_SIZE(strings))
>>
>> off by one?
>
> And didn't check for holes.
>
> /me wishes he never sent this momentarily useful bit of code. ;-)
I think it's still useful if we can get it fixed up. I've recently
run into some cases on radeon where this would be helpful.
Alex
> -Chris
>
> --
> Chris Wilson, Intel Open Source Technology Centre
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2011-04-06 14:32 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-05 20:50 [PATCH] drm: Pretty print out the reason for rejecting the mode Chris Wilson
2011-04-05 21:06 ` 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
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.