Chameleon: Correct the names of EDIDs and explicitly filter unsupported resolutions

The EDIDs of display_Resolution are manually created. They are not
obtained from some real monitor. Their names having "HDMI"/"DP" are
not correct. So change their names to the version of EDID.

Also modify the filtering rule of EDID to only look at the resolution
due to the corresponding pixel clocks are not supported.

BUG=None
TEST=Ran the affected tests on peach and veyron devices.

Change-Id: Id802f5c0e971873d0895ed9c7ee64c1ee630d1b1
Reviewed-on: https://chromium-review.googlesource.com/352574
Commit-Ready: Wai-Hong Tam <waihong@google.com>
Tested-by: Wai-Hong Tam <waihong@google.com>
Reviewed-by: Hsu Wei-Cheng <mojahsu@chromium.org>
diff --git a/client/cros/chameleon/edid.py b/client/cros/chameleon/edid.py
index 8e0644f..95e3ff6 100644
--- a/client/cros/chameleon/edid.py
+++ b/client/cros/chameleon/edid.py
@@ -11,11 +11,10 @@
 # support the HDMI EDIDs and the DP one at 1680x1050. A more proper
 # solution is to build a database of supported resolutions and pixel
 # clocks for each model and check if the EDID is in the supported list.
-def is_edid_supported(host, interface, width, height):
+def is_edid_supported(host, width, height):
     """Check whether the EDID is supported by DUT
 
     @param host: A CrosHost object.
-    @param interface: The display interface, like 'HDMI'.
     @param width: The screen width
     @param height: The screen height
 
@@ -25,8 +24,9 @@
     platform = host.get_platform()
     prefix = platform.lower().split('_')[0]
     if prefix in ('snow', 'spring', 'skate', 'peach', 'veyron'):
-        if interface == 'DP':
-            return width == 1680 and height == 1050
+        if (width, height) in [(1280, 800), (1440, 900), (1600, 900),
+                               (3840, 2160)]:
+            return False
     return True
 
 
diff --git a/server/site_tests/display_Resolution/control.4K.extended b/server/site_tests/display_Resolution/control.4K.extended
index 88de3a4..ff9d0fd 100644
--- a/server/site_tests/display_Resolution/control.4K.extended
+++ b/server/site_tests/display_Resolution/control.4K.extended
@@ -23,8 +23,7 @@
 chameleon_args = hosts.CrosHost.get_chameleon_arguments(args_dict)
 
 def run(machine):
-    resolution_list=[('DP', 3840, 2160),
-                     ('HDMI', 3840, 2160),]
+    resolution_list=[('EDIDv2', 3840, 2160)]
     host = hosts.create_host(machine, chameleon_args=chameleon_args)
     job.run_test("display_Resolution", host=host,
                  resolution_list=resolution_list, tag="4K.extended")
diff --git a/server/site_tests/display_Resolution/control.4K.mirrored b/server/site_tests/display_Resolution/control.4K.mirrored
index 2708d69..073fed8 100644
--- a/server/site_tests/display_Resolution/control.4K.mirrored
+++ b/server/site_tests/display_Resolution/control.4K.mirrored
@@ -23,8 +23,7 @@
 chameleon_args = hosts.CrosHost.get_chameleon_arguments(args_dict)
 
 def run(machine):
-    resolution_list=[('DP', 3840, 2160),
-                     ('HDMI', 3840, 2160),]
+    resolution_list=[('EDIDv2', 3840, 2160)]
     host = hosts.create_host(machine, chameleon_args=chameleon_args)
     job.run_test("display_Resolution", host=host, test_mirrored=True,
                  resolution_list=resolution_list, tag="4K.mirrored")
diff --git a/server/site_tests/display_Resolution/display_Resolution.py b/server/site_tests/display_Resolution/display_Resolution.py
index 949b43b..af0a986 100644
--- a/server/site_tests/display_Resolution/display_Resolution.py
+++ b/server/site_tests/display_Resolution/display_Resolution.py
@@ -31,14 +31,12 @@
     WAIT_TIME_LID_TRANSITION = 5
 
     DEFAULT_RESOLUTION_LIST = [
-            # Mix DP and HDMI together to test the converter cases.
-            ('DP', 1280, 800),
-            ('DP', 1440, 900),
-            ('DP', 1600, 900),
-            ('DP', 1680, 1050),
-            ('DP', 1920, 1080),
-            ('HDMI', 1280, 720),
-            ('HDMI', 1920, 1080),
+            ('EDIDv1', 1280, 800),
+            ('EDIDv1', 1440, 900),
+            ('EDIDv1', 1600, 900),
+            ('EDIDv1', 1680, 1050),
+            ('EDIDv2', 1280, 720),
+            ('EDIDv2', 1920, 1080),
     ]
 
     def run_once(self, host, test_mirrored=False, test_suspend_resume=False,
@@ -68,13 +66,11 @@
                     chameleon_port, display_facade, self.outputdir)
             chameleon_port_name = chameleon_port.get_connector_type()
             logging.info('Detected %s chameleon port.', chameleon_port_name)
-            for interface, width, height in resolution_list:
-                if not chameleon_port_name.startswith(interface):
-                    continue
+            for label, width, height in resolution_list:
                 test_resolution = (width, height)
-                test_name = "%s_%dx%d" % ((interface,) + test_resolution)
+                test_name = "%s_%dx%d" % ((label,) + test_resolution)
 
-                if not edid.is_edid_supported(host, interface, width, height):
+                if not edid.is_edid_supported(host, width, height):
                     logging.info('Skip unsupported EDID: %s', test_name)
                     continue
 
diff --git a/server/site_tests/display_Resolution/test_data/edids/DP_1920x1080 b/server/site_tests/display_Resolution/test_data/edids/DP_1920x1080
deleted file mode 100644
index a906a16..0000000
--- a/server/site_tests/display_Resolution/test_data/edids/DP_1920x1080
+++ /dev/null
Binary files differ
diff --git a/server/site_tests/display_Resolution/test_data/edids/DP_3840x2160 b/server/site_tests/display_Resolution/test_data/edids/DP_3840x2160
deleted file mode 100644
index 79c9013..0000000
--- a/server/site_tests/display_Resolution/test_data/edids/DP_3840x2160
+++ /dev/null
Binary files differ
diff --git a/server/site_tests/display_Resolution/test_data/edids/DP_1280x800 b/server/site_tests/display_Resolution/test_data/edids/EDIDv1_1280x800
similarity index 100%
rename from server/site_tests/display_Resolution/test_data/edids/DP_1280x800
rename to server/site_tests/display_Resolution/test_data/edids/EDIDv1_1280x800
Binary files differ
diff --git a/server/site_tests/display_Resolution/test_data/edids/DP_1440x900 b/server/site_tests/display_Resolution/test_data/edids/EDIDv1_1440x900
similarity index 100%
rename from server/site_tests/display_Resolution/test_data/edids/DP_1440x900
rename to server/site_tests/display_Resolution/test_data/edids/EDIDv1_1440x900
Binary files differ
diff --git a/server/site_tests/display_Resolution/test_data/edids/DP_1600x900 b/server/site_tests/display_Resolution/test_data/edids/EDIDv1_1600x900
similarity index 100%
rename from server/site_tests/display_Resolution/test_data/edids/DP_1600x900
rename to server/site_tests/display_Resolution/test_data/edids/EDIDv1_1600x900
Binary files differ
diff --git a/server/site_tests/display_Resolution/test_data/edids/DP_1680x1050 b/server/site_tests/display_Resolution/test_data/edids/EDIDv1_1680x1050
similarity index 100%
rename from server/site_tests/display_Resolution/test_data/edids/DP_1680x1050
rename to server/site_tests/display_Resolution/test_data/edids/EDIDv1_1680x1050
Binary files differ
diff --git a/server/site_tests/display_Resolution/test_data/edids/HDMI_1280x720 b/server/site_tests/display_Resolution/test_data/edids/EDIDv2_1280x720
similarity index 100%
rename from server/site_tests/display_Resolution/test_data/edids/HDMI_1280x720
rename to server/site_tests/display_Resolution/test_data/edids/EDIDv2_1280x720
Binary files differ
diff --git a/server/site_tests/display_Resolution/test_data/edids/HDMI_1920x1080 b/server/site_tests/display_Resolution/test_data/edids/EDIDv2_1920x1080
similarity index 100%
rename from server/site_tests/display_Resolution/test_data/edids/HDMI_1920x1080
rename to server/site_tests/display_Resolution/test_data/edids/EDIDv2_1920x1080
Binary files differ
diff --git a/server/site_tests/display_Resolution/test_data/edids/HDMI_3840x2160 b/server/site_tests/display_Resolution/test_data/edids/EDIDv2_3840x2160
similarity index 100%
rename from server/site_tests/display_Resolution/test_data/edids/HDMI_3840x2160
rename to server/site_tests/display_Resolution/test_data/edids/EDIDv2_3840x2160
Binary files differ
diff --git a/server/site_tests/display_SuspendStress/display_SuspendStress.py b/server/site_tests/display_SuspendStress/display_SuspendStress.py
index aa80e96..a6751ee 100644
--- a/server/site_tests/display_SuspendStress/display_SuspendStress.py
+++ b/server/site_tests/display_SuspendStress/display_SuspendStress.py
@@ -41,7 +41,7 @@
         _, width, height = testcase_spec
         test_resolution = (width, height)
 
-        if not edid.is_edid_supported(host, *testcase_spec):
+        if not edid.is_edid_supported(host, testcase_spec[1], testcase_spec[2]):
             raise error.TestFail('Error: EDID is not supported by the platform'
                     ': %s', test_name)