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

vdb at picaros.org vdb at picaros.org
Mon Nov 15 08:13:08 PST 2010


The patch below adds printing of the DisplayMode type bits.  It helps 
to trace the modeline origin and to understand the initial configured 
modeline.

type_bit       flag   origin
M_T_USERPREF   U      set by the Option "PreferredMode"
M_T_DRIVER     e      driver: EDID, flat panel native
M_T_USERDEF    u      configured zoom mode Ctrl+Alt+Keypad-{Plus,Minus}
M_T_DEFAULT    d      VESA default
M_T_PREFERRED  P      driver preferred timing, also set by PreferredMode
M_T_BUILTIN    b      hardware fixed CRTC mode

This patch is the first of a set implementing a zoom mode list 
configuration per monitor and thus per output.  The further patches 
do not apply any longer and require cleanup.  Is there any interest 
in reenabling the Ctrl+Alt+Keypad-{Plus,Minus} mode switch ?

Example xf86PrintModeline() output:

Modeline "1600x1200 at 60"x60.0  144.00  1600 1632 1792 1920  1200 1201 1204 1250
 (75.0 kHz UP)
Modeline "1600x1200"x60.0  162.00  1600 1664 1856 2160  1200 1201 1204 1250
 +hsync +vsync (75.0 kHz eP)
Modeline "1600x1200 at 50"x50.0  120.00  1600 1628 1788 1920  1200 1201 1204 1250
 (62.5 kHz)

http://bugs.freedesktop.org/show_bug.cgi?id=17953

Signed-off-by: Servaas Vandenberghe
diff --git a/hw/xfree86/modes/xf86Modes.c b/hw/xfree86/modes/xf86Modes.c
index 05f4319..9d03c64 100644
--- a/hw/xfree86/modes/xf86Modes.c
+++ b/hw/xfree86/modes/xf86Modes.c
@@ -291,11 +291,26 @@ add(char **p, char *new)
  * Print out a modeline.
  */
 void
-xf86PrintModeline(int scrnIndex,DisplayModePtr mode)
+xf86PrintModeline(int scrnIndex, DisplayModePtr mode)
 {
     char tmp[256];
+    char tchar[] = "UeudPb";
+    int tbit[] = { M_T_USERPREF, M_T_DRIVER, M_T_USERDEF,
+		   M_T_DEFAULT, M_T_PREFERRED, M_T_BUILTIN };
+    char type[sizeof(tchar)+2];
+    int tlen = 0;
     char *flags = xnfcalloc(1, 1);
 
+    if (mode->type) {
+      int i;
+
+      type[tlen++] = ' ';
+      for (i = 0; i < sizeof(tchar); i++)
+	if (mode->type & tbit[i])
+	  type[tlen++] = tchar[i];
+    }
+    type[tlen++] = '\0';
+
     if (mode->HSkew) { 
 	snprintf(tmp, 256, "hskew %i", mode->HSkew); 
 	add(&flags, tmp);
@@ -318,12 +333,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);
 }
 #endif /* XORG_VERSION_CURRENT <= 7.2.99.2 */


More information about the xorg-devel mailing list