diff options
author | Rob Clark <robdclark@gmail.com> | 2016-11-05 11:08:06 -0400 |
---|---|---|
committer | Sean Paul <seanpaul@chromium.org> | 2016-11-08 16:38:03 -0500 |
commit | 65c7dc18b2b6628156c5ed2bc5ef66bca17267fb (patch) | |
tree | 89453b7faecf0d22fbaf50f897749f26574d347b /include/drm/drmP.h | |
parent | 06a66b5c77ede71f0601f4710284ca1076e673fa (diff) | |
download | blackbird-op-linux-65c7dc18b2b6628156c5ed2bc5ef66bca17267fb.tar.gz blackbird-op-linux-65c7dc18b2b6628156c5ed2bc5ef66bca17267fb.zip |
drm: helper macros to print composite types
I'll want to print things in a similar way in a later patch. This will
make it easier.
Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1478358492-30738-2-git-send-email-robdclark@gmail.com
Diffstat (limited to 'include/drm/drmP.h')
-rw-r--r-- | include/drm/drmP.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/include/drm/drmP.h b/include/drm/drmP.h index a3effab98407..e92c904fe8cb 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h @@ -306,6 +306,27 @@ void drm_printk(const char *level, unsigned int category, #define DRM_DEBUG_PRIME_RATELIMITED(fmt, args...) \ DRM_DEV_DEBUG_PRIME_RATELIMITED(NULL, fmt, ##args) +/* Format strings and argument splitters to simplify printing + * various "complex" objects + */ +#define DRM_MODE_FMT "%d:\"%s\" %d %d %d %d %d %d %d %d %d %d 0x%x 0x%x" +#define DRM_MODE_ARG(m) \ + (m)->base.id, (m)->name, (m)->vrefresh, (m)->clock, \ + (m)->hdisplay, (m)->hsync_start, (m)->hsync_end, (m)->htotal, \ + (m)->vdisplay, (m)->vsync_start, (m)->vsync_end, (m)->vtotal, \ + (m)->type, (m)->flags + +#define DRM_RECT_FMT "%dx%d%+d%+d" +#define DRM_RECT_ARG(r) drm_rect_width(r), drm_rect_height(r), (r)->x1, (r)->y1 + +/* for rect's in fixed-point format: */ +#define DRM_RECT_FP_FMT "%d.%06ux%d.%06u%+d.%06u%+d.%06u" +#define DRM_RECT_FP_ARG(r) \ + drm_rect_width(r) >> 16, ((drm_rect_width(r) & 0xffff) * 15625) >> 10, \ + drm_rect_height(r) >> 16, ((drm_rect_height(r) & 0xffff) * 15625) >> 10, \ + (r)->x1 >> 16, (((r)->x1 & 0xffff) * 15625) >> 10, \ + (r)->y1 >> 16, (((r)->y1 & 0xffff) * 15625) >> 10 + /*@}*/ /***********************************************************************/ |