From fb4177046de19730a784c3c16e4b73aab0ec6e41 Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Sat, 12 Oct 2013 12:16:44 -0400 Subject: update signed/object prop types Signed-off-by: Rob Clark --- tests/proptest/proptest.c | 44 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 35 insertions(+), 9 deletions(-) (limited to 'tests/proptest/proptest.c') diff --git a/tests/proptest/proptest.c b/tests/proptest/proptest.c index 4a569211..7618f63d 100644 --- a/tests/proptest/proptest.c +++ b/tests/proptest/proptest.c @@ -36,6 +36,10 @@ #include "xf86drmMode.h" #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) +static inline int64_t U642I64(uint64_t val) +{ + return (int64_t)*((int64_t *)&val); +} int fd; drmModeResPtr res = NULL; @@ -87,8 +91,10 @@ dump_blob(uint32_t blob_id) drmModePropertyBlobPtr blob; blob = drmModeGetPropertyBlob(fd, blob_id); - if (!blob) + if (!blob) { + printf("\n"); return; + } blob_data = blob->data; @@ -121,34 +127,54 @@ dump_prop(uint32_t prop_id, uint64_t value) printf("\t\tflags:"); if (prop->flags & DRM_MODE_PROP_PENDING) printf(" pending"); - if (prop->flags & DRM_MODE_PROP_RANGE) - printf(" range"); if (prop->flags & DRM_MODE_PROP_IMMUTABLE) printf(" immutable"); - if (prop->flags & DRM_MODE_PROP_ENUM) + if (drm_property_type_is(prop, DRM_MODE_PROP_SIGNED_RANGE)) + printf(" signed range"); + if (drm_property_type_is(prop, DRM_MODE_PROP_RANGE)) + printf(" range"); + if (drm_property_type_is(prop, DRM_MODE_PROP_ENUM)) printf(" enum"); - if (prop->flags & DRM_MODE_PROP_BLOB) + if (drm_property_type_is(prop, DRM_MODE_PROP_BITMASK)) + printf(" bitmask"); + if (drm_property_type_is(prop, DRM_MODE_PROP_BLOB)) printf(" blob"); + if (drm_property_type_is(prop, DRM_MODE_PROP_OBJECT)) + printf(" object"); printf("\n"); - if (prop->flags & DRM_MODE_PROP_RANGE) { + + if (drm_property_type_is(prop, DRM_MODE_PROP_SIGNED_RANGE)) { + printf("\t\tvalues:"); + for (i = 0; i < prop->count_values; i++) + printf(" %"PRId64, U642I64(prop->values[i])); + printf("\n"); + } + + if (drm_property_type_is(prop, DRM_MODE_PROP_RANGE)) { printf("\t\tvalues:"); for (i = 0; i < prop->count_values; i++) printf(" %"PRIu64, prop->values[i]); printf("\n"); } - if (prop->flags & DRM_MODE_PROP_ENUM) { + if (drm_property_type_is(prop, DRM_MODE_PROP_ENUM)) { printf("\t\tenums:"); for (i = 0; i < prop->count_enums; i++) printf(" %s=%llu", prop->enums[i].name, prop->enums[i].value); printf("\n"); + } else if (drm_property_type_is(prop, DRM_MODE_PROP_BITMASK)) { + printf("\t\tvalues:"); + for (i = 0; i < prop->count_enums; i++) + printf(" %s=0x%llx", prop->enums[i].name, + (1LL << prop->enums[i].value)); + printf("\n"); } else { assert(prop->count_enums == 0); } - if (prop->flags & DRM_MODE_PROP_BLOB) { + if (drm_property_type_is(prop, DRM_MODE_PROP_BLOB)) { printf("\t\tblobs:\n"); for (i = 0; i < prop->count_blobs; i++) dump_blob(prop->blob_ids[i]); @@ -158,7 +184,7 @@ dump_prop(uint32_t prop_id, uint64_t value) } printf("\t\tvalue:"); - if (prop->flags & DRM_MODE_PROP_BLOB) + if (drm_property_type_is(prop, DRM_MODE_PROP_BLOB)) dump_blob(value); else printf(" %"PRIu64"\n", value); -- cgit v1.2.3