[Intel-gfx] [PATCH 3/4] drm: Add drm_region_debug()
ville.syrjala at linux.intel.com
ville.syrjala at linux.intel.com
Thu Feb 21 22:35:02 CET 2013
From: Ville Syrjälä <ville.syrjala at linux.intel.com>
Add a debug function to print the region in a human readable format.
Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
drivers/gpu/drm/drm_region.c | 22 ++++++++++++++++++++++
include/drm/drm_region.h | 1 +
2 files changed, 23 insertions(+)
diff --git a/drivers/gpu/drm/drm_region.c b/drivers/gpu/drm/drm_region.c
index c694424..82e1043 100644
--- a/drivers/gpu/drm/drm_region.c
+++ b/drivers/gpu/drm/drm_region.c
@@ -24,6 +24,7 @@
#include <linux/errno.h>
#include <linux/export.h>
#include <linux/kernel.h>
+#include <drm/drmP.h>
#include <drm/drm_region.h>
/**
@@ -266,3 +267,24 @@ int drm_calc_vscale_relaxed(struct drm_region *src, struct drm_region *dst,
return vscale;
}
EXPORT_SYMBOL(drm_calc_vscale_relaxed);
+
+/**
+ * drm_region_debug - print the region information
+ * @r: region to print
+ * @fixed_point: is the region in 16.16 fixed point format
+ */
+void drm_region_debug(const struct drm_region *r, bool fixed_point)
+{
+ int w = drm_region_width(r);
+ int h = drm_region_height(r);
+
+ if (fixed_point)
+ DRM_DEBUG_KMS("%d.%06ux%d.%06u+%d.%06u+%d.%06u\n",
+ w >> 16, ((w & 0xffff) * 15625) >> 10,
+ h >> 16, ((h & 0xffff) * 15625) >> 10,
+ r->x1 >> 16, ((r->x1 & 0xffff) * 15625) >> 10,
+ r->y1 >> 16, ((r->y1 & 0xffff) * 15625) >> 10);
+ else
+ DRM_DEBUG_KMS("%ux%u+%d+%d\n", w, h, r->x1, r->y1);
+}
+EXPORT_SYMBOL(drm_region_debug);
diff --git a/include/drm/drm_region.h b/include/drm/drm_region.h
index c12d953..10591f5 100644
--- a/include/drm/drm_region.h
+++ b/include/drm/drm_region.h
@@ -136,5 +136,6 @@ int drm_calc_hscale_relaxed(struct drm_region *src, struct drm_region *dst,
int min_hscale, int max_hscale);
int drm_calc_vscale_relaxed(struct drm_region *src, struct drm_region *dst,
int min_vscale, int max_vscale);
+void drm_region_debug(const struct drm_region *r, bool fixed_point);
#endif
--
1.7.12.4
More information about the Intel-gfx
mailing list