[PATCH] xserver xf86PrintModeline(): print DisplayMode type bits.

vdb at picaros.org vdb at picaros.org
Sun Nov 21 13:45:11 PST 2010


The patch below should apply to xserver from git.

Signed-off-by: Servaas Vandenberghe

diff --git a/hw/xfree86/modes/xf86Modes.c b/hw/xfree86/modes/xf86Modes.c
index 51eb4c9..eff13f1 100644
--- a/hw/xfree86/modes/xf86Modes.c
+++ b/hw/xfree86/modes/xf86Modes.c
@@ -283,10 +283,29 @@ add(char **p, char *new)
  * Print out a modeline.
  */
 void
-xf86PrintModeline(int scrnIndex,DisplayModePtr mode)
+xf86PrintModeline(int scrnIndex, DisplayModePtr mode)
 {
     char tmp[256];
     char *flags = xnfcalloc(1, 1);
+#define TBITS 6
+    const char tchar[TBITS+1] = "UezdPb";
+    int tbit[TBITS] = {
+	M_T_USERPREF, M_T_DRIVER, M_T_USERDEF,
+	M_T_DEFAULT, M_T_PREFERRED, M_T_BUILTIN
+    };
+    char type[TBITS+2];   /* +1 for leading space */
+#undef TBITS
+    int tlen = 0;
+
+    if (mode->type) {
+	int i;
+
+	type[tlen++] = ' ';
+	for (i = 0; tchar[i]; i++)
+	    if (mode->type & tbit[i])
+		type[tlen++] = tchar[i];
+    }
+    type[tlen] = '\0';
 
     if (mode->HSkew) { 
 	snprintf(tmp, 256, "hskew %i", mode->HSkew); 
@@ -310,12 +329,12 @@ #if 0
     if (mode->Flags & V_CLKDIV2) add(&flags, "vclk/2");
 #endif
     xf86DrvMsg(scrnIndex, X_INFO,
-		   "Modeline \"%s\"x%.01f  %6.2f  %i %i %i %i  %i %i %i %i%s "
-		   "(%.01f kHz)\n",
-		   mode->name, mode->VRefresh, mode->Clock/1000., mode->HDisplay,
-		   mode->HSyncStart, mode->HSyncEnd, mode->HTotal,
-		   mode->VDisplay, mode->VSyncStart, mode->VSyncEnd,
-		   mode->VTotal, flags, xf86ModeHSync(mode));
+	       "Modeline \"%s\"x%.01f  %6.2f  %i %i %i %i  %i %i %i %i%s"
+	       " (%.01f kHz%s)\n",
+	       mode->name, mode->VRefresh, mode->Clock/1000.,
+	       mode->HDisplay, mode->HSyncStart, mode->HSyncEnd, mode->HTotal,
+	       mode->VDisplay, mode->VSyncStart, mode->VSyncEnd, mode->VTotal,
+	       flags, xf86ModeHSync(mode), type);
     free(flags);
 }
 


More information about the xorg-devel mailing list