[libdrm,7/8] proptest: support bitmask properties

Message ID 1338919594-25392-8-git-send-email-rob.clark@linaro.org
State New
Headers show

Commit Message

Rob Clark June 5, 2012, 6:06 p.m.
From: Rob Clark <rob@ti.com>

Add support to display bitmask properties.

Signed-off-by: Rob Clark <rob@ti.com>
---
 tests/proptest/proptest.c |    8 ++++++++
 1 file changed, 8 insertions(+)

Patch

diff --git a/tests/proptest/proptest.c b/tests/proptest/proptest.c
index 52896fe..fa34a48 100644
--- a/tests/proptest/proptest.c
+++ b/tests/proptest/proptest.c
@@ -127,6 +127,8 @@  dump_prop(uint32_t prop_id, uint64_t value)
 		printf(" immutable");
 	if (prop->flags & DRM_MODE_PROP_ENUM)
 		printf(" enum");
+	if (prop->flags & DRM_MODE_PROP_BITMASK)
+		printf(" bitmask");
 	if (prop->flags & DRM_MODE_PROP_BLOB)
 		printf(" blob");
 	printf("\n");
@@ -144,6 +146,12 @@  dump_prop(uint32_t prop_id, uint64_t value)
 			printf(" %s=%llu", prop->enums[i].name,
 			       prop->enums[i].value);
 		printf("\n");
+	} else if (prop->flags & 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);
 	}