Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Ville Syrjälä and committed by
Daniel Vetter
e7272df3 4954c428

+23
+22
drivers/gpu/drm/drm_rect.c
··· 24 24 #include <linux/errno.h> 25 25 #include <linux/export.h> 26 26 #include <linux/kernel.h> 27 + #include <drm/drmP.h> 27 28 #include <drm/drm_rect.h> 28 29 29 30 /** ··· 272 271 return vscale; 273 272 } 274 273 EXPORT_SYMBOL(drm_rect_calc_vscale_relaxed); 274 + 275 + /** 276 + * drm_rect_debug_print - print the rectangle information 277 + * @r: rectangle to print 278 + * @fixed_point: rectangle is in 16.16 fixed point format 279 + */ 280 + void drm_rect_debug_print(const struct drm_rect *r, bool fixed_point) 281 + { 282 + int w = drm_rect_width(r); 283 + int h = drm_rect_height(r); 284 + 285 + if (fixed_point) 286 + DRM_DEBUG_KMS("%d.%06ux%d.%06u%+d.%06u%+d.%06u\n", 287 + w >> 16, ((w & 0xffff) * 15625) >> 10, 288 + h >> 16, ((h & 0xffff) * 15625) >> 10, 289 + r->x1 >> 16, ((r->x1 & 0xffff) * 15625) >> 10, 290 + r->y1 >> 16, ((r->y1 & 0xffff) * 15625) >> 10); 291 + else 292 + DRM_DEBUG_KMS("%dx%d%+d%+d\n", w, h, r->x1, r->y1); 293 + } 294 + EXPORT_SYMBOL(drm_rect_debug_print);
+1
include/drm/drm_rect.h
··· 140 140 int drm_rect_calc_vscale_relaxed(struct drm_rect *src, 141 141 struct drm_rect *dst, 142 142 int min_vscale, int max_vscale); 143 + void drm_rect_debug_print(const struct drm_rect *r, bool fixed_point); 143 144 144 145 #endif