WKTR/DRT always trigger the Discrete GPU on dual GPU systems
authordino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 25 Dec 2019 17:50:57 +0000 (17:50 +0000)
committerdino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 25 Dec 2019 17:50:57 +0000 (17:50 +0000)
https://bugs.webkit.org/show_bug.cgi?id=205546
<rdar://problem/58139610>

Reviewed by Alexey Proskuryakov.

Add an option "--prefer-integrated-gpu" to run-webkit-test
that causes the LayoutTestHelper to NOT lock the
machine to a discrete GPU on a dual-GPU system.
The default is false.

* DumpRenderTree/mac/LayoutTestHelper.m:
(main):
* Scripts/webkitpy/layout_tests/controllers/manager.py:
(Manager._set_up_run):
* Scripts/webkitpy/layout_tests/run_webkit_tests.py:
(parse_args):
* Scripts/webkitpy/port/base.py:
(Port.start_helper):
* Scripts/webkitpy/port/mac.py:
(MacPort.start_helper):
* Scripts/webkitpy/port/mock_drt.py:
(MockDRTPort.start_helper):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@253910 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/DumpRenderTree/mac/LayoutTestHelper.m
Tools/Scripts/webkitpy/layout_tests/controllers/manager.py
Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py
Tools/Scripts/webkitpy/port/base.py
Tools/Scripts/webkitpy/port/mac.py
Tools/Scripts/webkitpy/port/mock_drt.py

index fd9de92..288d4b0 100644 (file)
@@ -1,3 +1,29 @@
+2019-12-25  Dean Jackson  <dino@apple.com>
+
+        WKTR/DRT always trigger the Discrete GPU on dual GPU systems
+        https://bugs.webkit.org/show_bug.cgi?id=205546
+        <rdar://problem/58139610>
+
+        Reviewed by Alexey Proskuryakov.
+
+        Add an option "--prefer-integrated-gpu" to run-webkit-test
+        that causes the LayoutTestHelper to NOT lock the
+        machine to a discrete GPU on a dual-GPU system.
+        The default is false.
+
+        * DumpRenderTree/mac/LayoutTestHelper.m:
+        (main):
+        * Scripts/webkitpy/layout_tests/controllers/manager.py:
+        (Manager._set_up_run):
+        * Scripts/webkitpy/layout_tests/run_webkit_tests.py:
+        (parse_args):
+        * Scripts/webkitpy/port/base.py:
+        (Port.start_helper):
+        * Scripts/webkitpy/port/mac.py:
+        (MacPort.start_helper):
+        * Scripts/webkitpy/port/mock_drt.py:
+        (MockDRTPort.start_helper):
+
 2019-12-25  Wenson Hsieh  <wenson_hsieh@apple.com>
 
         REGRESSION (r253282): Tests that use applyAutocorrection assert in UIScriptContext::requestUIScriptCompletion
index 8476322..8ffd22d 100644 (file)
@@ -57,6 +57,7 @@ CFUUIDRef CGDisplayCreateUUIDFromDisplayID(uint32_t displayID);
 // running layout tests.
 
 static int installColorProfile = false;
+static int preferIntegratedGPU = false;
 static uint32_t assertionIDForDisplaySleep = 0;
 static uint32_t assertionIDForSystemSleep = 0;
 
@@ -261,6 +262,7 @@ int main(int argc, char* argv[])
 {
     struct option options[] = {
         { "install-color-profile", no_argument, &installColorProfile, true },
+        { "prefer-integrated-gpu", no_argument, &preferIntegratedGPU, true },
     };
 
     int option;
@@ -279,7 +281,8 @@ int main(int argc, char* argv[])
     signal(SIGTERM, simpleSignalHandler);
 
     addSleepAssertions();
-    lockDownDiscreteGraphics();
+    if (!preferIntegratedGPU)
+        lockDownDiscreteGraphics();
 
     // Save off the current profile, and then install the layout test profile.
     installLayoutTestColorProfile();
index 3c152a6..d8faab2 100644 (file)
@@ -160,7 +160,7 @@ class Manager(object):
         # This must be started before we check the system dependencies,
         # since the helper may do things to make the setup correct.
         self._printer.write_update("Starting helper ...")
-        if not self._port.start_helper(self._options.pixel_tests):
+        if not self._port.start_helper(pixel_tests=self._options.pixel_tests, prefer_integrated_gpu=self._options.prefer_integrated_gpu):
             return False
 
         self._update_worker_count(test_names, device_type=device_type)
index 201313a..98f8515 100755 (executable)
@@ -327,6 +327,9 @@ def parse_args(args):
         optparse.make_option(
             "--use-gpu-process", action="store_true", default=False,
             help=("Enable all GPU process related features, also set additional expectations and the result report flavor.")),
+        optparse.make_option(
+            "--prefer-integrated-gpu", action="store_true", default=False,
+            help=("Prefer using the lower-power integrated GPU on a dual-GPU system. Note that other running applications and the tests themselves can override this request.")),
     ]))
 
     option_group_definitions.append(("Web Platform Test Server Options", [
index c74fa35..de00666 100644 (file)
@@ -949,7 +949,7 @@ class Port(object):
         """Return a newly created Driver subclass for starting/stopping the test driver."""
         return driver.DriverProxy(self, worker_number, self._driver_class(), pixel_tests=self.get_option('pixel_tests'), no_timeout=no_timeout)
 
-    def start_helper(self, pixel_tests=False):
+    def start_helper(self, pixel_tests=False, prefer_integrated_gpu=False):
         """If a port needs to reconfigure graphics settings or do other
         things to ensure a known test configuration, it should override this
         method."""
index b5f62a9..35d48cd 100644 (file)
@@ -212,13 +212,15 @@ class MacPort(DarwinPort):
             supportable_instances = default_count
         return min(supportable_instances, default_count)
 
-    def start_helper(self, pixel_tests=False):
+    def start_helper(self, pixel_tests=False, prefer_integrated_gpu=False):
         helper_path = self._path_to_helper()
         if not helper_path:
             _log.error("No path to LayoutTestHelper binary")
             return False
         _log.debug("Starting layout helper %s" % helper_path)
         arguments = [helper_path, '--install-color-profile']
+        if prefer_integrated_gpu:
+            arguments.append('--prefer-integrated-gpu')
         self._helper = self._executive.popen(arguments,
             stdin=self._executive.PIPE, stdout=self._executive.PIPE, stderr=None)
         is_ready = self._helper.stdout.readline()
index c958df4..81cae48 100644 (file)
@@ -101,7 +101,7 @@ class MockDRTPort(object):
 
         return new_cmd_line
 
-    def start_helper(self, pixel_tests=False):
+    def start_helper(self, pixel_tests=False, prefer_integrated_gpu=False):
         pass
 
     def start_http_server(self, number_of_servers):