[PATCH] EDID: Hack for 1366x768 in standard timing descriptors

Adam Jackson ajax at nwnk.net
Mon Feb 9 10:36:05 PST 2009


From: Adam Jackson <ajax at redhat.com>

Sending this one on to the list.  I'm really not sure what the right
thing to do here is, but I'm reasonably confident this is better than
what we've got.  At any rate, it made the crappy TV in my hotel work
while I was on vacation.

I despise TVs, I really do.

---

All you get for standard timing descriptors is horizontal size in
multiples of 8 pixels (which means you can't say 1366) and height in
terms of aspect ratio (which means you can't say 768).  You'd like to
just fuzzy-match this by walking the DMT list for sufficiently close
modes, but you can't because DMT is useless and only defines a 1360x768
mode, because it's _also_ specified in terms of character cells despite
providing pixel exact timings.  Neither can you use CVT or GTF to
generate the timings, because they _also_ believe that modes have to be
a multiple of 8 pixels.

You'd also hope you could find a timing definition for this in CEA, but
you can't because CEA only defines transmission formats that actually
exist.  So there's 480p, 720p, and 1080p, but no 768p.  And why would
there be, after all, the encoded signal is never 768p so obviously no
one would ever make a display in that format.

So instead, make a CVT mode since that's likely to be handled well by
just about everything, smash the horizontal active down by 2, and shift
the sync pulse by 1.  Underscanning the hard way.

Pass the suicide.
---
 hw/xfree86/modes/xf86EdidModes.c |   30 +++++++++++++++++++-----------
 1 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/hw/xfree86/modes/xf86EdidModes.c b/hw/xfree86/modes/xf86EdidModes.c
index bea2f7e..7bffa98 100644
--- a/hw/xfree86/modes/xf86EdidModes.c
+++ b/hw/xfree86/modes/xf86EdidModes.c
@@ -474,26 +474,34 @@ DDCModesFromStandardTiming(struct std_timings *timing, ddc_quirk_t quirks,
     int i;
 
     for (i = 0; i < STD_TIMINGS; i++) {
-        if (timing[i].hsize && timing[i].vsize && timing[i].refresh) {
-	    Mode = FindDMTMode(timing[i].hsize, timing[i].vsize,
-			       timing[i].refresh, rb);
+	hsize = timing[i].hsize;
+	vsize = timing[i].vsize;
+	refresh = timing[i].refresh;
+
+	/* HDTV hack.  Hooray. */
+	if (hsize == 1360 && vsize == 765 && refresh == 60) {
+	    Mode = xf86CVTMode(1366, 768, 60, FALSE, FALSE);
+	    Mode->HDisplay = 1366;
+	    Mode->VSyncStart--;
+	    Mode->VSyncEnd--;
+	} else if (hsize && vsize && refresh) {
+	    Mode = FindDMTMode(hsize, vsize, refresh, rb);
 
 	    if (!Mode) {
 		if (timing_level == LEVEL_CVT)
 		    /* pass rb here too? */
-		    Mode = xf86CVTMode(timing[i].hsize, timing[i].vsize,
-				       timing[i].refresh, FALSE, FALSE);
+		    Mode = xf86CVTMode(hsize, vsize, refresh, FALSE, FALSE);
 		else if (timing_level == LEVEL_GTF)
-		    Mode = xf86GTFMode(timing[i].hsize, timing[i].vsize,
-				       timing[i].refresh, FALSE, FALSE);
+		    Mode = xf86GTFMode(hsize, vsize, refresh, FALSE, FALSE);
 	    }
 
-	    if (!Mode)
-		continue;
+	}
 
+	if (Mode) {
 	    Mode->type = M_T_DRIVER;
-            Modes = xf86ModesAdd(Modes, Mode);
-        }
+	    Modes = xf86ModesAdd(Modes, Mode);
+	}
+	Mode = NULL;
     }
 
     return Modes;
-- 
1.6.1.2



More information about the xorg-devel mailing list