From 20ac3140ce16af460992b83aa8aeff4afe28c2ee Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Mon, 9 Feb 2009 13:36:05 -0500 Subject: [PATCH] EDID: Hack for 1366x768 in standard timing descriptors 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 file changed, 19 insertions(+), 11 deletions(-) diff --git a/hw/xfree86/modes/xf86EdidModes.c b/hw/xfree86/modes/xf86EdidModes.c index 1413e87a5..3e62e7e52 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;