|
@@ -29,6 +29,7 @@
|
|
|
* Dave Airlie <airlied@linux.ie>
|
|
|
* Jesse Barnes <jesse.barnes@intel.com>
|
|
|
*/
|
|
|
+#include <linux/ctype.h>
|
|
|
#include <linux/list.h>
|
|
|
#include <linux/slab.h>
|
|
|
#include <linux/export.h>
|
|
@@ -252,6 +253,28 @@ char *drm_get_connector_status_name(enum drm_connector_status status)
|
|
|
}
|
|
|
EXPORT_SYMBOL(drm_get_connector_status_name);
|
|
|
|
|
|
+static char printable_char(int c)
|
|
|
+{
|
|
|
+ return isascii(c) && isprint(c) ? c : '?';
|
|
|
+}
|
|
|
+
|
|
|
+char *drm_get_format_name(uint32_t format)
|
|
|
+{
|
|
|
+ static char buf[32];
|
|
|
+
|
|
|
+ snprintf(buf, sizeof(buf),
|
|
|
+ "%c%c%c%c %s-endian (0x%08x)",
|
|
|
+ printable_char(format & 0xff),
|
|
|
+ printable_char((format >> 8) & 0xff),
|
|
|
+ printable_char((format >> 16) & 0xff),
|
|
|
+ printable_char((format >> 24) & 0x7f),
|
|
|
+ format & DRM_FORMAT_BIG_ENDIAN ? "big" : "little",
|
|
|
+ format);
|
|
|
+
|
|
|
+ return buf;
|
|
|
+}
|
|
|
+EXPORT_SYMBOL(drm_get_format_name);
|
|
|
+
|
|
|
/**
|
|
|
* drm_mode_object_get - allocate a new modeset identifier
|
|
|
* @dev: DRM device
|
|
@@ -1834,7 +1857,8 @@ int drm_mode_setplane(struct drm_device *dev, void *data,
|
|
|
if (fb->pixel_format == plane->format_types[i])
|
|
|
break;
|
|
|
if (i == plane->format_count) {
|
|
|
- DRM_DEBUG_KMS("Invalid pixel format 0x%08x\n", fb->pixel_format);
|
|
|
+ DRM_DEBUG_KMS("Invalid pixel format %s\n",
|
|
|
+ drm_get_format_name(fb->pixel_format));
|
|
|
ret = -EINVAL;
|
|
|
goto out;
|
|
|
}
|
|
@@ -2312,7 +2336,8 @@ static int framebuffer_check(const struct drm_mode_fb_cmd2 *r)
|
|
|
|
|
|
ret = format_check(r);
|
|
|
if (ret) {
|
|
|
- DRM_DEBUG_KMS("bad framebuffer format 0x%08x\n", r->pixel_format);
|
|
|
+ DRM_DEBUG_KMS("bad framebuffer format %s\n",
|
|
|
+ drm_get_format_name(r->pixel_format));
|
|
|
return ret;
|
|
|
}
|
|
|
|