Bug 1355726 - Add a talos test for WebGL video texture upload; r?jgilbert, jmaher draft
authorDaosheng Mu <daoshengmu@gmail.com>
Wed, 12 Apr 2017 15:24:17 +0800
changeset 561749 3ca0577fab3da7c98d2945f545d8ea073d285708
parent 560035 b5b5dbed1c409d96aa6b97f2036cd66312fc45ad
child 624075 cac8b2344575aada699ce76a914aa36fa4b2c16e
push id53844
push userbmo:dmu@mozilla.com
push dateThu, 13 Apr 2017 05:48:51 +0000
reviewersjgilbert, jmaher
bugs1355726
milestone55.0a1
Bug 1355726 - Add a talos test for WebGL video texture upload; r?jgilbert, jmaher MozReview-Commit-ID: Fjtl08avXTV
testing/talos/talos.json
testing/talos/talos/test.py
testing/talos/talos/tests/webgl/benchmarks/video/video_upload.html
testing/talos/talos/tests/webgl/glvideo.manifest
--- a/testing/talos/talos.json
+++ b/testing/talos/talos.json
@@ -63,21 +63,21 @@
         "g3": {
             "tests": ["dromaeo_dom"],
             "talos_options": ["--disable-e10s"]
         },
         "g3-e10s": {
             "tests": ["dromaeo_dom"]
         },
         "g4": {
-            "tests": ["basic_compositor_video"],
+            "tests": ["basic_compositor_video", "glvideo"],
             "talos_options": ["--disable-e10s"]
         },
         "g4-e10s": {
-            "tests": ["basic_compositor_video"]
+            "tests": ["basic_compositor_video", "glvideo"]
         },
         "svgr": {
             "tests": ["tsvgx", "tsvgr_opacity", "tart", "tscrollx", "cart", "tsvg_static"],
             "talos_options": ["--disable-e10s"]
         },
         "svgr-e10s": {
             "tests": ["tsvgx", "tsvgr_opacity", "tart", "tscrollx", "cart", "tsvg_static"]
         },
--- a/testing/talos/talos/test.py
+++ b/testing/talos/talos/test.py
@@ -407,16 +407,35 @@ class glterrain(PageloaderTest):
     preferences = {'layout.frame_rate': 0,
                    'docshell.event_starvation_delay_hint': 1,
                    'dom.send_after_paint_to_content': False}
     filters = filter.ignore_first.prepare(1) + filter.median.prepare()
     unit = 'frame interval'
 
 
 @register_test()
+class glvideo(PageloaderTest):
+    """
+    WebGL video texture update with 1080p video.
+    Measures mean tick time across 100 ticks.
+    (each tick is texImage2D(<video>)+setTimeout(0))
+    """
+    tpmanifest = '${talos}/tests/webgl/glvideo.manifest'
+    tpcycles = 1
+    tppagecycles = 5
+    tploadnocache = True
+    tpmozafterpaint = False
+    gecko_profile_interval = 2
+    gecko_profile_entries = 2000000
+    win_counters = w7_counters = linux_counters = mac_counters = None
+    filters = filter.ignore_first.prepare(1) + filter.median.prepare()
+    unit = 'ms'
+
+
+@register_test()
 class tp5n(PageloaderTest):
     """
     Tests the time it takes Firefox to load the tp5 web page test set.
 
     The tp5 is an updated web page test set to 100 pages from April 8th, 2011.
     Effort was made for the pages to no longer be splash screens/login
     pages/home pages but to be pages that better reflect the actual content
     of the site in question.
new file mode 100644
--- /dev/null
+++ b/testing/talos/talos/tests/webgl/benchmarks/video/video_upload.html
@@ -0,0 +1,67 @@
+<!-- This Source Code Form is subject to the terms of the Mozilla Public
+   - License, v. 2.0. If a copy of the MPL was not distributed with this file,
+   - You can obtain one at http://mozilla.org/MPL/2.0/.  -->
+<html>
+<head>
+<script src="chrome://talos-powers-content/content/TalosPowersContent.js"></script>
+<script language="javascript" type="text/javascript">
+const kTotalTicks = 100;
+var start;
+var gl = document.createElement('canvas').getContext('webgl');
+gl.bindTexture(gl.TEXTURE_2D, gl.createTexture());
+var video;
+video = document.createElement('video');
+video.src = "../../../video/clips/testsrc.1080p.60fps.mp4";
+video.addEventListener('playing', playingListener, true); // loadstart?
+video.loop = true;
+
+function init() {
+  TalosPowersContent.focus(content_focused);
+}
+
+function content_focused() {
+  video.play();
+}
+
+function playingListener()
+{
+  video.removeEventListener('playing', playingListener, true);
+  start = performance.now();
+  tick();
+}
+
+var tickCount = 0;
+function tick() {
+  if (tickCount >= kTotalTicks) {
+    var elapsed = performance.now() - start;
+    reportResult(elapsed, kTotalTicks);
+    return;
+  }
+
+  gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, video);
+  ++tickCount;
+
+  window.setTimeout(tick, 0);
+}
+
+function reportResult(totalTime, totalTicks) {
+  var meanTickTime = totalTime / totalTicks;
+  var desc = 'Mean tick time across ' + totalTicks + ' ticks: ';
+  var text = desc + meanTickTime + ' ms\n';
+
+  dump('[talos glvideo result] ' + text);
+
+  if (window.tpRecordTime) {
+    // Within talos - report the results
+    return tpRecordTime(meanTickTime, 0, desc);
+  } else {
+    // Local run in a plain browser, display the formatted report
+    alert('[talos glvideo result] ' + text);
+  }
+}
+</script>
+
+</head>
+<body id="body" onload="init();">
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/testing/talos/talos/tests/webgl/glvideo.manifest
@@ -0,0 +1,1 @@
+% http://localhost/tests/webgl/benchmarks/video/video_upload.html
\ No newline at end of file