summaryrefslogtreecommitdiff
path: root/tests/modetest
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@bitplanet.net>2012-06-28 10:48:31 -0400
committerKristian Høgsberg <krh@bitplanet.net>2012-06-28 13:24:36 -0400
commitc0ed9b23ecb48b8301f66d2270e638249709e94e (patch)
tree4d2164d76600cdb2833c6368878b8349bfdd55cf /tests/modetest
parenta7805194b7b91de01b671beeb724584dca69ad68 (diff)
modetest: Dump bit field names
Diffstat (limited to 'tests/modetest')
-rw-r--r--tests/modetest/modetest.c51
1 files changed, 50 insertions, 1 deletions
diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c
index dc84cf32..ec3121e1 100644
--- a/tests/modetest/modetest.c
+++ b/tests/modetest/modetest.c
@@ -118,6 +118,49 @@ struct type_name connector_type_names[] = {
type_name_fn(connector_type)
+#define bit_name_fn(res) \
+char * res##_str(int type) { \
+ int i; \
+ const char *sep = ""; \
+ for (i = 0; i < ARRAY_SIZE(res##_names); i++) { \
+ if (type & (1 << i)) { \
+ printf("%s%s", sep, res##_names[i]); \
+ sep = ", "; \
+ } \
+ } \
+}
+
+static const char *mode_type_names[] = {
+ "builtin",
+ "clock_c",
+ "crtc_c",
+ "preferred",
+ "default",
+ "userdef",
+ "driver",
+};
+
+bit_name_fn(mode_type)
+
+static const char *mode_flag_names[] = {
+ "phsync",
+ "nhsync",
+ "pvsync",
+ "nvsync",
+ "interlace",
+ "dblscan",
+ "csync",
+ "pcsync",
+ "ncsync",
+ "hskew",
+ "bcast",
+ "pixmux",
+ "dblclk",
+ "clkdiv2"
+};
+
+bit_name_fn(mode_flag)
+
void dump_encoders(void)
{
drmModeEncoder *encoder;
@@ -146,7 +189,7 @@ void dump_encoders(void)
void dump_mode(drmModeModeInfo *mode)
{
- printf("\t%s %d %d %d %d %d %d %d %d %d\n",
+ printf(" %s %d %d %d %d %d %d %d %d %d",
mode->name,
mode->vrefresh,
mode->hdisplay,
@@ -157,6 +200,12 @@ void dump_mode(drmModeModeInfo *mode)
mode->vsync_start,
mode->vsync_end,
mode->vtotal);
+
+ printf(" flags: ");
+ mode_flag_str(mode->flags);
+ printf("; type: ");
+ mode_type_str(mode->type);
+ printf("\n");
}
static void