[xrandr] Pretty print modeFlags on unattached modes

Chris Wilson chris at chris-wilson.co.uk
Thu Sep 17 02:42:06 PDT 2015


For modes attached to an output we decode the modeFlags into their human
readable strings. For unattached modes, we currently do not print the
modeFlags at all - so continue the copy'n'paste for mode printing.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92025
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 xrandr.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/xrandr.c b/xrandr.c
index bcaf247..a38417d 100644
--- a/xrandr.c
+++ b/xrandr.c
@@ -3372,9 +3372,15 @@ main (int argc, char **argv)
 
 	    if (!(mode->modeFlags & ModeShown))
 	    {
-		printf ("  %s (0x%x) %6.1fMHz\n",
+		int f;
+
+		printf ("  %s (0x%x) %6.1fMHz",
 			mode->name, (int)mode->id,
 			(double)mode->dotClock / 1000000.0);
+		for (f = 0; mode_flags[f].flag; f++)
+		    if (mode->modeFlags & mode_flags[f].flag)
+			printf (" %s", mode_flags[f].string);
+		printf("\n");
 		printf ("        h: width  %4d start %4d end %4d total %4d skew %4d clock %6.1fKHz\n",
 			mode->width, mode->hSyncStart, mode->hSyncEnd,
 			mode->hTotal, mode->hSkew, mode_hsync (mode) / 1000);
-- 
2.5.1



More information about the xorg-devel mailing list