Add 1920x1200 known mode and edid to test it

The known_modes timings did not include 1920x1200. Mostly this does
not matter because the monitor provides its own DTD with detailed
timing. But in the case where this is a fallback because we can't
do the higer res monitor timing it may be listed in the standard
modes section of the EDID. Add the CVT modeline for 1920x1200 to
the known_modes so this entry can be used. Add EDID with this
property to test EDIDs.

BUG=chromium-os:31265
TEST=Try on Dell U3011 and faked using -v -E6 -T1 flags

Change-Id: I9ad36f8c93b766e39b3178b346e4f5d84459d3f1
Reviewed-on: https://gerrit.chromium.org/gerrit/23655
Tested-by: Mark Hayter <mdhayter@chromium.org>
Reviewed-by: Todd Broch <tbroch@chromium.org>
Commit-Ready: Mark Hayter <mdhayter@chromium.org>
diff --git a/ch7036_monitor.c b/ch7036_monitor.c
index 75fda52..547b6d9 100644
--- a/ch7036_monitor.c
+++ b/ch7036_monitor.c
@@ -220,7 +220,16 @@
     1,  1,  1,
     2160,  1600,112, 168,   1245,1200,  3,    4  ,
     MK_SCALE(0, 0),
- },
+  },
+  // CVT 1920x1200 reduced blanking modeline (not from chrontel)
+  // (As well as CVT this matches Dell monitor DTD)
+  {
+    154000,
+    MK_PIXEL_HDMI(1, 0, 0),
+    1,  0,  1,
+    2080,  1920, 48, 32,   1235,1200,  3,    6 ,
+    MK_SCALE(0, 0),
+  },
 
 
 };
@@ -467,6 +476,8 @@
     native_aspect = force_aspect;
   else
     native_aspect = find_aspect_fromisize(data);
+  if (verbose) printf("Check standard modes (monitor native aspect %s)\n",
+                      aspect_to_str[native_aspect]);
 
   for(i=0; i < (EDID_N_STDTIME + KNOWN_EST_TIMES); i++) {
     int hinfo = 0x01;
@@ -502,10 +513,14 @@
     hres = (hinfo * STDTIME_HMULT) + STDTIME_HBASE;
     if (verbose) printf("Found %d wide %s\n", hres,
                         aspect_to_str[vinfo>>STDTIME_VASPECT_SHIFT]);
-    if ((force_maxw > 0) && (hres > force_maxw)) continue;
-
-    if (verbose) printf("Try %d wide %s\n", hres,
-                        aspect_to_str[vinfo>>STDTIME_VASPECT_SHIFT]);
+    if ((force_maxw > 0) && (hres > force_maxw)) {
+      if (verbose) printf("-- ignore because greater than forced max width\n");
+      continue;
+    }
+    if (hres > CH_MAX_HRES) {
+      if (verbose) printf("-- too wide for scaler\n");
+      continue;
+    }
 
     switch (vinfo >> STDTIME_VASPECT_SHIFT) {
     case ASPECT_16_10:
@@ -561,7 +576,8 @@
           curbest_aspect = (vinfo >> STDTIME_VASPECT_SHIFT);
         }
       }
-    }
+    } else if (verbose) printf("-- no match in known_modes table\n");
+
   }
   if (curbest != NULL) {
     *mon = curbest;
diff --git a/edid_utils.c b/edid_utils.c
index 05afa5f..47a6380 100644
--- a/edid_utils.c
+++ b/edid_utils.c
@@ -169,8 +169,29 @@
   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xdd
 };
 
+/* Has DTD that is too wide */
+unsigned char test_edid6[256] = {
+  0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00,
+  0x10, 0xac, 0x63, 0x40, 0x4c, 0x35, 0x31, 0x33,
+  0x0c, 0x15, 0x01, 0x03, 0x80, 0x40, 0x28, 0x78,
+  0xea, 0x8d, 0x85, 0xad, 0x4f, 0x35, 0xb1, 0x25,
+  0x0e, 0x50, 0x54, 0xa5, 0x4b, 0x00, 0x71, 0x4f,
+  0x81, 0x00, 0x81, 0x80, 0xa9, 0x40, 0xd1, 0x00,
+  0xd1, 0x40, 0x01, 0x01, 0x01, 0x01, 0xe2, 0x68,
+  0x00, 0xa0, 0xa0, 0x40, 0x2e, 0x60, 0x30, 0x20,
+  0x36, 0x00, 0x81, 0x91, 0x21, 0x00, 0x00, 0x1a,
+  0x00, 0x00, 0x00, 0xff, 0x00, 0x50, 0x48, 0x35,
+  0x4e, 0x59, 0x31, 0x33, 0x4d, 0x33, 0x31, 0x35,
+  0x4c, 0x0a, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x44,
+  0x45, 0x4c, 0x4c, 0x20, 0x55, 0x33, 0x30, 0x31,
+  0x31, 0x0a, 0x20, 0x20, 0x00, 0x00, 0x00, 0xfd,
+  0x00, 0x31, 0x56, 0x1d, 0x71, 0x1c, 0x00, 0x0a,
+  0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0xb0
+};
+
 static unsigned char *test_edids[N_TEST_EDIDS] = {
-  test_edid1, test_edid2, test_edid3, test_edid4, test_edid5
+  test_edid1, test_edid2, test_edid3, test_edid4, test_edid5,
+  test_edid6
 };
 
 int get_test_edid(int n, unsigned char *dst)
diff --git a/edid_utils.h b/edid_utils.h
index 89356af..1098eb2 100644
--- a/edid_utils.h
+++ b/edid_utils.h
@@ -167,7 +167,7 @@
 #define COL_META 3
 
 /* Number of test EDID arrays available to get/show_test_edid */
-#define N_TEST_EDIDS 5
+#define N_TEST_EDIDS 6
 
 int edid_valid(unsigned char *edid_data);
 int edid_has_hdmi_info(unsigned char *edid_data, int ext);