diff options
author | Ville Syrjälä <ville.syrjala@linux.intel.com> | 2013-04-24 11:52:36 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2013-04-30 16:20:00 -0400 |
commit | e7272df342ba337e87e210470bb93d97d192f2e0 (patch) | |
tree | 19fd9d002d434a0517ef84c8f778ccbb4a5b3872 | |
parent | 4954c4282f6b945f1dd5716f92b594a07fa4ffe3 (diff) |
drm: Add drm_rect_debug_print()
Add a debug function to print the rectangle in a human readable format.
v2: Renamed drm_region to drm_rect, the function from drm_region_debug
to drm_rect_debug_print(), and use %+d instead of +%d in the format.
v3: Use %d format for width/height in the non fixed point case as well
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Dave Airlie <airlied@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r-- | drivers/gpu/drm/drm_rect.c | 22 | ||||
-rw-r--r-- | include/drm/drm_rect.h | 1 |
2 files changed, 23 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_rect.c b/drivers/gpu/drm/drm_rect.c index dc11a2867f20..7047ca025787 100644 --- a/drivers/gpu/drm/drm_rect.c +++ b/drivers/gpu/drm/drm_rect.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/errno.h> | 24 | #include <linux/errno.h> |
25 | #include <linux/export.h> | 25 | #include <linux/export.h> |
26 | #include <linux/kernel.h> | 26 | #include <linux/kernel.h> |
27 | #include <drm/drmP.h> | ||
27 | #include <drm/drm_rect.h> | 28 | #include <drm/drm_rect.h> |
28 | 29 | ||
29 | /** | 30 | /** |
@@ -271,3 +272,24 @@ int drm_rect_calc_vscale_relaxed(struct drm_rect *src, | |||
271 | return vscale; | 272 | return vscale; |
272 | } | 273 | } |
273 | EXPORT_SYMBOL(drm_rect_calc_vscale_relaxed); | 274 | EXPORT_SYMBOL(drm_rect_calc_vscale_relaxed); |
275 | |||
276 | /** | ||
277 | * drm_rect_debug_print - print the rectangle information | ||
278 | * @r: rectangle to print | ||
279 | * @fixed_point: rectangle is in 16.16 fixed point format | ||
280 | */ | ||
281 | void drm_rect_debug_print(const struct drm_rect *r, bool fixed_point) | ||
282 | { | ||
283 | int w = drm_rect_width(r); | ||
284 | int h = drm_rect_height(r); | ||
285 | |||
286 | if (fixed_point) | ||
287 | DRM_DEBUG_KMS("%d.%06ux%d.%06u%+d.%06u%+d.%06u\n", | ||
288 | w >> 16, ((w & 0xffff) * 15625) >> 10, | ||
289 | h >> 16, ((h & 0xffff) * 15625) >> 10, | ||
290 | r->x1 >> 16, ((r->x1 & 0xffff) * 15625) >> 10, | ||
291 | r->y1 >> 16, ((r->y1 & 0xffff) * 15625) >> 10); | ||
292 | else | ||
293 | DRM_DEBUG_KMS("%dx%d%+d%+d\n", w, h, r->x1, r->y1); | ||
294 | } | ||
295 | EXPORT_SYMBOL(drm_rect_debug_print); | ||
diff --git a/include/drm/drm_rect.h b/include/drm/drm_rect.h index de24f16a3c4f..fe767b757c8c 100644 --- a/include/drm/drm_rect.h +++ b/include/drm/drm_rect.h | |||
@@ -140,5 +140,6 @@ int drm_rect_calc_hscale_relaxed(struct drm_rect *src, | |||
140 | int drm_rect_calc_vscale_relaxed(struct drm_rect *src, | 140 | int drm_rect_calc_vscale_relaxed(struct drm_rect *src, |
141 | struct drm_rect *dst, | 141 | struct drm_rect *dst, |
142 | int min_vscale, int max_vscale); | 142 | int min_vscale, int max_vscale); |
143 | void drm_rect_debug_print(const struct drm_rect *r, bool fixed_point); | ||
143 | 144 | ||
144 | #endif | 145 | #endif |