diff mbox

drm: Pretty print pixel format in drm_fb_get_bpp_depth() and format_check()

Message ID 1381860411-21661-1-git-send-email-ville.syrjala@linux.intel.com (mailing list archive)
State Accepted
Headers show

Commit Message

Ville Syrjälä Oct. 15, 2013, 6:06 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

drm_fb_get_bpp_depth() likes to complain about unsupported pixel formats
but doesn't bother telling us what the format was. Also format_check()
just returns an error when it encouters an invalid format, leaving the
user scratching his head trying to figure out why addfb failed. Make
life a bit easier by using drm_get_format_name() in both places.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/drm_crtc.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Alex Deucher Oct. 15, 2013, 9:56 p.m. UTC | #1
On Tue, Oct 15, 2013 at 2:06 PM,  <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> drm_fb_get_bpp_depth() likes to complain about unsupported pixel formats
> but doesn't bother telling us what the format was. Also format_check()
> just returns an error when it encouters an invalid format, leaving the
> user scratching his head trying to figure out why addfb failed. Make
> life a bit easier by using drm_get_format_name() in both places.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

> ---
>  drivers/gpu/drm/drm_crtc.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index d7a8370..8b428e5 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -2489,6 +2489,8 @@ static int format_check(const struct drm_mode_fb_cmd2 *r)
>         case DRM_FORMAT_YVU444:
>                 return 0;
>         default:
> +               DRM_DEBUG_KMS("invalid pixel format %s\n",
> +                             drm_get_format_name(r->pixel_format));
>                 return -EINVAL;
>         }
>  }
> @@ -3822,7 +3824,8 @@ void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth,
>                 *bpp = 32;
>                 break;
>         default:
> -               DRM_DEBUG_KMS("unsupported pixel format\n");
> +               DRM_DEBUG_KMS("unsupported pixel format %s\n",
> +                             drm_get_format_name(format));
>                 *depth = 0;
>                 *bpp = 0;
>                 break;
> --
> 1.8.1.5
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
Lespiau, Damien Oct. 15, 2013, 11:35 p.m. UTC | #2
On Tue, Oct 15, 2013 at 09:06:51PM +0300, ville.syrjala@linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> drm_fb_get_bpp_depth() likes to complain about unsupported pixel formats
> but doesn't bother telling us what the format was. Also format_check()
> just returns an error when it encouters an invalid format, leaving the
> user scratching his head trying to figure out why addfb failed. Make
> life a bit easier by using drm_get_format_name() in both places.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Reviewed-by: Damien Lespiau <damien.lespiau@intel.com>
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index d7a8370..8b428e5 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -2489,6 +2489,8 @@  static int format_check(const struct drm_mode_fb_cmd2 *r)
 	case DRM_FORMAT_YVU444:
 		return 0;
 	default:
+		DRM_DEBUG_KMS("invalid pixel format %s\n",
+			      drm_get_format_name(r->pixel_format));
 		return -EINVAL;
 	}
 }
@@ -3822,7 +3824,8 @@  void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth,
 		*bpp = 32;
 		break;
 	default:
-		DRM_DEBUG_KMS("unsupported pixel format\n");
+		DRM_DEBUG_KMS("unsupported pixel format %s\n",
+			      drm_get_format_name(format));
 		*depth = 0;
 		*bpp = 0;
 		break;