Blame qtwebengine-opensource-src-5.9.0-no-sse2.patch

Kevin Kofler 1d5bdd
diff -Nur qtwebengine-opensource-src-5.9.0/examples/webengine/customdialogs/customdialogs.pro qtwebengine-opensource-src-5.9.0-no-sse2/examples/webengine/customdialogs/customdialogs.pro
Kevin Kofler 1d5bdd
--- qtwebengine-opensource-src-5.9.0/examples/webengine/customdialogs/customdialogs.pro	2017-05-19 06:22:04.000000000 +0200
Kevin Kofler 1d5bdd
+++ qtwebengine-opensource-src-5.9.0-no-sse2/examples/webengine/customdialogs/customdialogs.pro	2017-06-12 20:48:36.743167401 +0200
Kevin Kofler 1d5bdd
@@ -1,5 +1,7 @@
Kevin Kofler 1d5bdd
 QT += webengine
Kevin Kofler 1d5bdd
 
Kevin Kofler 1d5bdd
+QMAKE_LFLAGS += -Wl,-rpath-link,$$OUT_PWD/../../../src/core/Release
Kevin Kofler 1d5bdd
+
Kevin Kofler 1d5bdd
 HEADERS += \
Kevin Kofler 1d5bdd
     server.h
Kevin Kofler 1d5bdd
 
Kevin Kofler 1d5bdd
diff -Nur qtwebengine-opensource-src-5.9.0/examples/webengine/minimal/minimal.pro qtwebengine-opensource-src-5.9.0-no-sse2/examples/webengine/minimal/minimal.pro
Kevin Kofler 1d5bdd
--- qtwebengine-opensource-src-5.9.0/examples/webengine/minimal/minimal.pro	2017-05-19 06:22:04.000000000 +0200
Kevin Kofler 1d5bdd
+++ qtwebengine-opensource-src-5.9.0-no-sse2/examples/webengine/minimal/minimal.pro	2017-06-12 20:48:02.646665156 +0200
Kevin Kofler 1d5bdd
@@ -2,6 +2,8 @@
Kevin Kofler 1d5bdd
 
Kevin Kofler 1d5bdd
 QT += webengine
Kevin Kofler 1d5bdd
 
Kevin Kofler 1d5bdd
+QMAKE_LFLAGS += -Wl,-rpath-link,$$OUT_PWD/../../../src/core/Release
Kevin Kofler 1d5bdd
+
Kevin Kofler 1d5bdd
 SOURCES += main.cpp
Kevin Kofler 1d5bdd
 
Kevin Kofler 1d5bdd
 RESOURCES += qml.qrc
Kevin Kofler 1d5bdd
diff -Nur qtwebengine-opensource-src-5.9.0/examples/webengine/quicknanobrowser/quicknanobrowser.pro qtwebengine-opensource-src-5.9.0-no-sse2/examples/webengine/quicknanobrowser/quicknanobrowser.pro
Kevin Kofler 1d5bdd
--- qtwebengine-opensource-src-5.9.0/examples/webengine/quicknanobrowser/quicknanobrowser.pro	2017-05-19 06:22:04.000000000 +0200
Kevin Kofler 1d5bdd
+++ qtwebengine-opensource-src-5.9.0-no-sse2/examples/webengine/quicknanobrowser/quicknanobrowser.pro	2017-06-12 20:48:24.553340621 +0200
Kevin Kofler 1d5bdd
@@ -20,5 +20,7 @@
Kevin Kofler 1d5bdd
     QT += widgets # QApplication is required to get native styling with QtQuickControls
Kevin Kofler 1d5bdd
 }
Kevin Kofler 1d5bdd
 
Kevin Kofler 1d5bdd
+QMAKE_LFLAGS += -Wl,-rpath-link,$$OUT_PWD/../../../src/core/Release
Kevin Kofler 1d5bdd
+
Kevin Kofler 1d5bdd
 target.path = $$[QT_INSTALL_EXAMPLES]/webengine/quicknanobrowser
Kevin Kofler 1d5bdd
 INSTALLS += target
Kevin Kofler 1d5bdd
diff -Nur qtwebengine-opensource-src-5.9.0/examples/webengine/recipebrowser/recipebrowser.pro qtwebengine-opensource-src-5.9.0-no-sse2/examples/webengine/recipebrowser/recipebrowser.pro
Kevin Kofler 1d5bdd
--- qtwebengine-opensource-src-5.9.0/examples/webengine/recipebrowser/recipebrowser.pro	2017-05-19 06:22:04.000000000 +0200
Kevin Kofler 1d5bdd
+++ qtwebengine-opensource-src-5.9.0-no-sse2/examples/webengine/recipebrowser/recipebrowser.pro	2017-06-12 20:48:31.672239461 +0200
Kevin Kofler 1d5bdd
@@ -2,6 +2,8 @@
Kevin Kofler 1d5bdd
 
Kevin Kofler 1d5bdd
 QT += quick qml quickcontrols2 webengine
Kevin Kofler 1d5bdd
 
Kevin Kofler 1d5bdd
+QMAKE_LFLAGS += -Wl,-rpath-link,$$OUT_PWD/../../../src/core/Release
Kevin Kofler 1d5bdd
+
Kevin Kofler 1d5bdd
 cross_compile {
Kevin Kofler 1d5bdd
   posix|qnx|linux: DEFINES += QTWEBENGINE_RECIPE_BROWSER_EMBEDDED
Kevin Kofler 1d5bdd
 }
Kevin Kofler 1d5bdd
diff -Nur qtwebengine-opensource-src-5.9.0/examples/webenginewidgets/contentmanipulation/contentmanipulation.pro qtwebengine-opensource-src-5.9.0-no-sse2/examples/webenginewidgets/contentmanipulation/contentmanipulation.pro
Kevin Kofler 1d5bdd
--- qtwebengine-opensource-src-5.9.0/examples/webenginewidgets/contentmanipulation/contentmanipulation.pro	2017-05-19 06:22:04.000000000 +0200
Kevin Kofler 1d5bdd
+++ qtwebengine-opensource-src-5.9.0-no-sse2/examples/webenginewidgets/contentmanipulation/contentmanipulation.pro	2017-06-12 20:47:51.870824827 +0200
Kevin Kofler 1d5bdd
@@ -1,5 +1,7 @@
Kevin Kofler 1d5bdd
 QT      +=  webenginewidgets
Kevin Kofler 1d5bdd
 
Kevin Kofler 1d5bdd
+QMAKE_LFLAGS += -Wl,-rpath-link,$$OUT_PWD/../../../src/core/Release
Kevin Kofler 1d5bdd
+
Kevin Kofler 1d5bdd
 HEADERS =   mainwindow.h
Kevin Kofler 1d5bdd
 SOURCES =   main.cpp \
Kevin Kofler 1d5bdd
             mainwindow.cpp
Kevin Kofler 1d5bdd
diff -Nur qtwebengine-opensource-src-5.9.0/examples/webenginewidgets/cookiebrowser/cookiebrowser.pro qtwebengine-opensource-src-5.9.0-no-sse2/examples/webenginewidgets/cookiebrowser/cookiebrowser.pro
Kevin Kofler 1d5bdd
--- qtwebengine-opensource-src-5.9.0/examples/webenginewidgets/cookiebrowser/cookiebrowser.pro	2017-05-19 06:22:04.000000000 +0200
Kevin Kofler 1d5bdd
+++ qtwebengine-opensource-src-5.9.0-no-sse2/examples/webenginewidgets/cookiebrowser/cookiebrowser.pro	2017-06-12 20:47:00.603584486 +0200
Kevin Kofler 1d5bdd
@@ -3,6 +3,8 @@
Kevin Kofler 1d5bdd
 TEMPLATE = app
Kevin Kofler 1d5bdd
 CONFIG += c++11
Kevin Kofler 1d5bdd
 
Kevin Kofler 1d5bdd
+QMAKE_LFLAGS += -Wl,-rpath-link,$$OUT_PWD/../../../src/core/Release
Kevin Kofler 1d5bdd
+
Kevin Kofler 1d5bdd
 SOURCES += \
Kevin Kofler 1d5bdd
     main.cpp\
Kevin Kofler 1d5bdd
     mainwindow.cpp
Kevin Kofler 1d5bdd
diff -Nur qtwebengine-opensource-src-5.9.0/examples/webenginewidgets/demobrowser/demobrowser.pro qtwebengine-opensource-src-5.9.0-no-sse2/examples/webenginewidgets/demobrowser/demobrowser.pro
Kevin Kofler 1d5bdd
--- qtwebengine-opensource-src-5.9.0/examples/webenginewidgets/demobrowser/demobrowser.pro	2017-05-19 06:22:04.000000000 +0200
Kevin Kofler 1d5bdd
+++ qtwebengine-opensource-src-5.9.0-no-sse2/examples/webenginewidgets/demobrowser/demobrowser.pro	2017-06-12 20:47:26.036207636 +0200
Kevin Kofler 1d5bdd
@@ -3,6 +3,8 @@
Kevin Kofler 1d5bdd
 QT += webenginewidgets network widgets printsupport
Kevin Kofler 1d5bdd
 CONFIG += c++11
Kevin Kofler 1d5bdd
 
Kevin Kofler 1d5bdd
+QMAKE_LFLAGS += -Wl,-rpath-link,$$OUT_PWD/../../../src/core/Release
Kevin Kofler 1d5bdd
+
Kevin Kofler 1d5bdd
 qtHaveModule(uitools):!embedded: QT += uitools
Kevin Kofler 1d5bdd
 else: DEFINES += QT_NO_UITOOLS
Kevin Kofler 1d5bdd
 
Kevin Kofler 1d5bdd
diff -Nur qtwebengine-opensource-src-5.9.0/examples/webenginewidgets/markdowneditor/markdowneditor.pro qtwebengine-opensource-src-5.9.0-no-sse2/examples/webenginewidgets/markdowneditor/markdowneditor.pro
Kevin Kofler 1d5bdd
--- qtwebengine-opensource-src-5.9.0/examples/webenginewidgets/markdowneditor/markdowneditor.pro	2017-05-19 06:22:04.000000000 +0200
Kevin Kofler 1d5bdd
+++ qtwebengine-opensource-src-5.9.0-no-sse2/examples/webenginewidgets/markdowneditor/markdowneditor.pro	2017-06-12 20:47:36.026059609 +0200
Kevin Kofler 1d5bdd
@@ -3,6 +3,8 @@
Kevin Kofler 1d5bdd
 QT += webenginewidgets webchannel
Kevin Kofler 1d5bdd
 CONFIG += c++11
Kevin Kofler 1d5bdd
 
Kevin Kofler 1d5bdd
+QMAKE_LFLAGS += -Wl,-rpath-link,$$OUT_PWD/../../../src/core/Release
Kevin Kofler 1d5bdd
+
Kevin Kofler 1d5bdd
 HEADERS += \
Kevin Kofler 1d5bdd
     mainwindow.h \
Kevin Kofler 1d5bdd
     previewpage.h \
Kevin Kofler 1d5bdd
diff -Nur qtwebengine-opensource-src-5.9.0/examples/webenginewidgets/minimal/minimal.pro qtwebengine-opensource-src-5.9.0-no-sse2/examples/webenginewidgets/minimal/minimal.pro
Kevin Kofler 1d5bdd
--- qtwebengine-opensource-src-5.9.0/examples/webenginewidgets/minimal/minimal.pro	2017-05-19 06:22:04.000000000 +0200
Kevin Kofler 1d5bdd
+++ qtwebengine-opensource-src-5.9.0-no-sse2/examples/webenginewidgets/minimal/minimal.pro	2017-06-12 20:46:13.714279273 +0200
Kevin Kofler 1d5bdd
@@ -2,6 +2,8 @@
Kevin Kofler 1d5bdd
 
Kevin Kofler 1d5bdd
 QT += webenginewidgets
Kevin Kofler 1d5bdd
 
Kevin Kofler 1d5bdd
+QMAKE_LFLAGS += -Wl,-rpath-link,$$OUT_PWD/../../../src/core/Release
Kevin Kofler 1d5bdd
+
Kevin Kofler 1d5bdd
 SOURCES += main.cpp
Kevin Kofler 1d5bdd
 
Kevin Kofler 1d5bdd
 target.path = $$[QT_INSTALL_EXAMPLES]/webenginewidgets/minimal
Kevin Kofler 1d5bdd
diff -Nur qtwebengine-opensource-src-5.9.0/examples/webenginewidgets/simplebrowser/simplebrowser.pro qtwebengine-opensource-src-5.9.0-no-sse2/examples/webenginewidgets/simplebrowser/simplebrowser.pro
Kevin Kofler 1d5bdd
--- qtwebengine-opensource-src-5.9.0/examples/webenginewidgets/simplebrowser/simplebrowser.pro	2017-05-19 06:22:04.000000000 +0200
Kevin Kofler 1d5bdd
+++ qtwebengine-opensource-src-5.9.0-no-sse2/examples/webenginewidgets/simplebrowser/simplebrowser.pro	2017-06-12 20:47:31.059133208 +0200
Kevin Kofler 1d5bdd
@@ -3,6 +3,8 @@
Kevin Kofler 1d5bdd
 QT += webenginewidgets
Kevin Kofler 1d5bdd
 CONFIG += c++11
Kevin Kofler 1d5bdd
 
Kevin Kofler 1d5bdd
+QMAKE_LFLAGS += -Wl,-rpath-link,$$OUT_PWD/../../../src/core/Release
Kevin Kofler 1d5bdd
+
Kevin Kofler 1d5bdd
 HEADERS += \
Kevin Kofler 1d5bdd
     browser.h \
Kevin Kofler 1d5bdd
     browserwindow.h \
Kevin Kofler 1d5bdd
diff -Nur qtwebengine-opensource-src-5.9.0/examples/webenginewidgets/spellchecker/spellchecker.pro qtwebengine-opensource-src-5.9.0-no-sse2/examples/webenginewidgets/spellchecker/spellchecker.pro
Kevin Kofler 1d5bdd
--- qtwebengine-opensource-src-5.9.0/examples/webenginewidgets/spellchecker/spellchecker.pro	2017-05-19 06:22:04.000000000 +0200
Kevin Kofler 1d5bdd
+++ qtwebengine-opensource-src-5.9.0-no-sse2/examples/webenginewidgets/spellchecker/spellchecker.pro	2017-06-12 20:47:46.165909361 +0200
Kevin Kofler 1d5bdd
@@ -7,6 +7,8 @@
Kevin Kofler 1d5bdd
     error("Spellcheck example can not be built when using native OS dictionaries.")
Kevin Kofler 1d5bdd
 }
Kevin Kofler 1d5bdd
 
Kevin Kofler 1d5bdd
+QMAKE_LFLAGS += -Wl,-rpath-link,$$OUT_PWD/../../../src/core/Release
Kevin Kofler 1d5bdd
+
Kevin Kofler 1d5bdd
 HEADERS += \
Kevin Kofler 1d5bdd
     webview.h
Kevin Kofler 1d5bdd
 
Kevin Kofler 1d5bdd
diff -Nur qtwebengine-opensource-src-5.9.0/examples/webenginewidgets/videoplayer/videoplayer.pro qtwebengine-opensource-src-5.9.0-no-sse2/examples/webenginewidgets/videoplayer/videoplayer.pro
Kevin Kofler 1d5bdd
--- qtwebengine-opensource-src-5.9.0/examples/webenginewidgets/videoplayer/videoplayer.pro	2017-05-19 06:22:04.000000000 +0200
Kevin Kofler 1d5bdd
+++ qtwebengine-opensource-src-5.9.0-no-sse2/examples/webenginewidgets/videoplayer/videoplayer.pro	2017-06-12 20:47:20.160294702 +0200
Kevin Kofler 1d5bdd
@@ -2,6 +2,8 @@
Kevin Kofler 1d5bdd
 
Kevin Kofler 1d5bdd
 QT += webenginewidgets
Kevin Kofler 1d5bdd
 
Kevin Kofler 1d5bdd
+QMAKE_LFLAGS += -Wl,-rpath-link,$$OUT_PWD/../../../src/core/Release
Kevin Kofler 1d5bdd
+
Kevin Kofler 1d5bdd
 HEADERS += \
Kevin Kofler 1d5bdd
     mainwindow.h \
Kevin Kofler 1d5bdd
     fullscreenwindow.h \
Kevin Kofler c87d48
diff -Nur qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/build/config/compiler/BUILD.gn qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/build/config/compiler/BUILD.gn
Kevin Kofler c87d48
--- qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/build/config/compiler/BUILD.gn	2017-05-18 16:51:44.000000000 +0200
Kevin Kofler c87d48
+++ qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/build/config/compiler/BUILD.gn	2017-06-08 23:09:28.104582812 +0200
Kevin Kofler c87d48
@@ -533,13 +533,6 @@
Kevin Kofler c87d48
     } else if (current_cpu == "x86") {
Kevin Kofler c87d48
       cflags += [ "-m32" ]
Kevin Kofler c87d48
       ldflags += [ "-m32" ]
Kevin Kofler c87d48
-      if (!is_nacl) {
Kevin Kofler c87d48
-        cflags += [
Kevin Kofler c87d48
-          "-msse2",
Kevin Kofler c87d48
-          "-mfpmath=sse",
Kevin Kofler c87d48
-          "-mmmx",
Kevin Kofler c87d48
-        ]
Kevin Kofler c87d48
-      }
Kevin Kofler c87d48
     } else if (current_cpu == "arm") {
Kevin Kofler c87d48
       if (is_clang && !is_android && !is_nacl) {
Kevin Kofler c87d48
         cflags += [ "--target=arm-linux-gnueabihf" ]
Kevin Kofler c87d48
diff -Nur qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/build/config/v8_target_cpu.gni qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/build/config/v8_target_cpu.gni
Kevin Kofler c87d48
--- qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/build/config/v8_target_cpu.gni	2017-05-18 16:51:44.000000000 +0200
Kevin Kofler c87d48
+++ qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/build/config/v8_target_cpu.gni	2017-06-10 01:42:15.216049690 +0200
Kevin Kofler c87d48
@@ -59,3 +59,11 @@
Kevin Kofler c87d48
   # It should never be explicitly set by the user.
Kevin Kofler c87d48
   v8_current_cpu = v8_target_cpu
Kevin Kofler c87d48
 }
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+if (v8_current_cpu == "x86") {
Kevin Kofler c87d48
+  # If we are not building for the x86_sse2 toolchain, we actually want to build
Kevin Kofler c87d48
+  # the "x87" backend instead.
Kevin Kofler c87d48
+  if (current_toolchain != "//build/toolchain/linux:x86_sse2") {
Kevin Kofler c87d48
+    v8_current_cpu = "x87"
Kevin Kofler c87d48
+  }
Kevin Kofler c87d48
+}
Kevin Kofler 4fe1e7
diff -Nur qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/build/toolchain/gcc_toolchain.gni qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/build/toolchain/gcc_toolchain.gni
Kevin Kofler 4fe1e7
--- qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/build/toolchain/gcc_toolchain.gni	2017-05-18 16:51:44.000000000 +0200
Kevin Kofler 4fe1e7
+++ qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/build/toolchain/gcc_toolchain.gni	2017-06-10 16:24:14.175128763 +0200
Kevin Kofler 4fe1e7
@@ -213,6 +213,10 @@
Kevin Kofler 4fe1e7
       extra_ldflags = ""
Kevin Kofler 4fe1e7
     }
Kevin Kofler 4fe1e7
 
Kevin Kofler 4fe1e7
+    if (defined(invoker.shlib_subdir)) {
Kevin Kofler 4fe1e7
+      shlib_subdir = invoker.shlib_subdir
Kevin Kofler 4fe1e7
+    }
Kevin Kofler 4fe1e7
+
Kevin Kofler 4fe1e7
     # These library switches can apply to all tools below.
Kevin Kofler 4fe1e7
     lib_switch = "-l"
Kevin Kofler 4fe1e7
     lib_dir_switch = "-L"
Kevin Kofler c87d48
diff -Nur qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/build/toolchain/linux/BUILD.gn qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/build/toolchain/linux/BUILD.gn
Kevin Kofler c87d48
--- qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/build/toolchain/linux/BUILD.gn	2017-05-18 16:51:44.000000000 +0200
Kevin Kofler c87d48
+++ qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/build/toolchain/linux/BUILD.gn	2017-06-10 02:09:47.874494730 +0200
Kevin Kofler c87d48
@@ -78,6 +78,26 @@
Kevin Kofler c87d48
   }
Kevin Kofler c87d48
 }
Kevin Kofler c87d48
 
Kevin Kofler c87d48
+gcc_toolchain("x86_sse2") {
Kevin Kofler c87d48
+  cc = "gcc"
Kevin Kofler c87d48
+  cxx = "g++"
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+  readelf = "readelf"
Kevin Kofler c87d48
+  nm = "nm"
Kevin Kofler c87d48
+  ar = "ar"
Kevin Kofler c87d48
+  ld = cxx
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+  extra_cflags = "-msse2 -mfpmath=sse"
Kevin Kofler c87d48
+  extra_cxxflags = "-msse2 -mfpmath=sse"
Kevin Kofler c87d48
+  shlib_subdir = "lib/sse2"
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+  toolchain_args = {
Kevin Kofler c87d48
+    current_cpu = "x86"
Kevin Kofler c87d48
+    current_os = "linux"
Kevin Kofler c87d48
+    is_clang = false
Kevin Kofler c87d48
+  }
Kevin Kofler c87d48
+}
Kevin Kofler c87d48
+
Kevin Kofler c87d48
 clang_toolchain("clang_x64") {
Kevin Kofler c87d48
   toolchain_args = {
Kevin Kofler c87d48
     current_cpu = "x64"
Kevin Kofler c87d48
diff -Nur qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/cc/BUILD.gn qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/cc/BUILD.gn
Kevin Kofler c87d48
--- qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/cc/BUILD.gn	2017-05-18 16:51:44.000000000 +0200
Kevin Kofler c87d48
+++ qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/cc/BUILD.gn	2017-06-08 23:12:50.719511297 +0200
Kevin Kofler c87d48
@@ -567,13 +567,6 @@
Kevin Kofler c87d48
     "trees/tree_synchronizer.h",
Kevin Kofler c87d48
   ]
Kevin Kofler c87d48
 
Kevin Kofler c87d48
-  if (current_cpu == "x86" || current_cpu == "x64") {
Kevin Kofler c87d48
-    sources += [
Kevin Kofler c87d48
-      "raster/texture_compressor_etc1_sse.cc",
Kevin Kofler c87d48
-      "raster/texture_compressor_etc1_sse.h",
Kevin Kofler c87d48
-    ]
Kevin Kofler c87d48
-  }
Kevin Kofler c87d48
-
Kevin Kofler c87d48
   configs += [ "//build/config:precompiled_headers" ]
Kevin Kofler c87d48
 
Kevin Kofler c87d48
   public_deps = [
Kevin Kofler c87d48
@@ -583,6 +576,7 @@
Kevin Kofler c87d48
   deps = [
Kevin Kofler c87d48
     "//base",
Kevin Kofler c87d48
     "//base/third_party/dynamic_annotations",
Kevin Kofler c87d48
+    "//cc:cc_opts",
Kevin Kofler c87d48
     "//cc/proto",
Kevin Kofler c87d48
     "//cc/surfaces:surface_id",
Kevin Kofler c87d48
     "//gpu",
Kevin Kofler c87d48
@@ -612,6 +606,36 @@
Kevin Kofler c87d48
   }
Kevin Kofler c87d48
 }
Kevin Kofler c87d48
 
Kevin Kofler c87d48
+source_set("cc_opts") {
Kevin Kofler c87d48
+  public_deps = [
Kevin Kofler c87d48
+    "//cc:cc_opts_sse",
Kevin Kofler c87d48
+  ]
Kevin Kofler c87d48
+}
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+source_set("cc_opts_sse") {
Kevin Kofler c87d48
+  if (current_cpu == "x86" || current_cpu == "x64") {
Kevin Kofler c87d48
+    deps = [
Kevin Kofler c87d48
+      "//base",
Kevin Kofler c87d48
+    ]
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+    defines = [ "CC_IMPLEMENTATION=1" ]
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+    if (!is_debug && (is_win || is_android)) {
Kevin Kofler c87d48
+      configs -= [ "//build/config/compiler:optimize" ]
Kevin Kofler c87d48
+      configs += [ "//build/config/compiler:optimize_max" ]
Kevin Kofler c87d48
+    }
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+    sources = [
Kevin Kofler c87d48
+      "raster/texture_compressor.h",
Kevin Kofler c87d48
+      "raster/texture_compressor_etc1.h",
Kevin Kofler c87d48
+      "raster/texture_compressor_etc1_sse.cc",
Kevin Kofler c87d48
+      "raster/texture_compressor_etc1_sse.h",
Kevin Kofler c87d48
+    ]
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+    cflags = [ "-msse2" ]
Kevin Kofler c87d48
+  }
Kevin Kofler c87d48
+}
Kevin Kofler c87d48
+
Kevin Kofler c87d48
 static_library("test_support") {
Kevin Kofler c87d48
   testonly = true
Kevin Kofler c87d48
   sources = [
Kevin Kofler 0df1d8
diff -Nur qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/content/renderer/BUILD.gn qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/content/renderer/BUILD.gn
Kevin Kofler 0df1d8
--- qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/content/renderer/BUILD.gn	2017-05-18 16:51:44.000000000 +0200
Kevin Kofler 0df1d8
+++ qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/content/renderer/BUILD.gn	2017-06-12 14:19:26.095936011 +0200
Kevin Kofler 0df1d8
@@ -468,6 +468,13 @@
Kevin Kofler 0df1d8
     "//ui/surface",
Kevin Kofler 0df1d8
     "//v8",
Kevin Kofler c87d48
   ]
Kevin Kofler 0df1d8
+
Kevin Kofler c87d48
+  if (current_cpu == "x86") {
Kevin Kofler c87d48
+    deps += [
Kevin Kofler 0df1d8
+      "//v8(//build/toolchain/linux:x86_sse2)",
Kevin Kofler c87d48
+    ]
Kevin Kofler c87d48
+  }
Kevin Kofler c87d48
+
Kevin Kofler 0df1d8
   allow_circular_includes_from = []
Kevin Kofler c87d48
 
Kevin Kofler 0df1d8
   if (use_aura && !use_qt) {
Kevin Kofler c87d48
diff -Nur qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/media/base/BUILD.gn qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/media/base/BUILD.gn
Kevin Kofler c87d48
--- qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/media/base/BUILD.gn	2017-05-18 16:51:44.000000000 +0200
Kevin Kofler c87d48
+++ qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/media/base/BUILD.gn	2017-06-08 22:49:57.484256877 +0200
Kevin Kofler c87d48
@@ -336,13 +336,13 @@
Kevin Kofler c87d48
   }
Kevin Kofler c87d48
 
Kevin Kofler c87d48
   if (current_cpu == "x86" || current_cpu == "x64") {
Kevin Kofler c87d48
-    sources += [
Kevin Kofler c87d48
-      "simd/convert_rgb_to_yuv_sse2.cc",
Kevin Kofler c87d48
-      "simd/convert_rgb_to_yuv_ssse3.cc",
Kevin Kofler c87d48
-      "simd/convert_yuv_to_rgb_x86.cc",
Kevin Kofler c87d48
-      "simd/filter_yuv_sse2.cc",
Kevin Kofler c87d48
+    sources += [ "simd/convert_yuv_to_rgb_x86.cc" ]
Kevin Kofler c87d48
+    deps += [
Kevin Kofler c87d48
+      ":media_yasm",
Kevin Kofler c87d48
+      ":media_mmx",
Kevin Kofler c87d48
+      ":media_sse",
Kevin Kofler c87d48
+      ":media_sse2",
Kevin Kofler c87d48
     ]
Kevin Kofler c87d48
-    deps += [ ":media_yasm" ]
Kevin Kofler c87d48
   }
Kevin Kofler c87d48
 
Kevin Kofler c87d48
   if (is_linux || is_win) {
Kevin Kofler c87d48
@@ -539,10 +539,47 @@
Kevin Kofler c87d48
 }
Kevin Kofler c87d48
 
Kevin Kofler c87d48
 if (current_cpu == "x86" || current_cpu == "x64") {
Kevin Kofler c87d48
+  source_set("media_mmx") {
Kevin Kofler c87d48
+    sources = [ "simd/filter_yuv_mmx.cc" ]
Kevin Kofler c87d48
+    configs += [ "//media:media_config" ]
Kevin Kofler c87d48
+    if (!is_win) {
Kevin Kofler c87d48
+      cflags = [ "-mmmx" ]
Kevin Kofler c87d48
+    }
Kevin Kofler c87d48
+  }
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+  source_set("media_sse") {
Kevin Kofler c87d48
+    sources = [
Kevin Kofler c87d48
+      "simd/sinc_resampler_sse.cc",
Kevin Kofler c87d48
+    ]
Kevin Kofler c87d48
+    configs += [
Kevin Kofler c87d48
+      "//media:media_config",
Kevin Kofler c87d48
+      "//media:media_implementation",
Kevin Kofler c87d48
+    ]
Kevin Kofler c87d48
+    if (!is_win) {
Kevin Kofler c87d48
+      cflags = [ "-msse" ]
Kevin Kofler c87d48
+    }
Kevin Kofler c87d48
+  }
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+  source_set("media_sse2") {
Kevin Kofler c87d48
+    sources = [
Kevin Kofler c87d48
+      "simd/convert_rgb_to_yuv_sse2.cc",
Kevin Kofler c87d48
+      "simd/convert_rgb_to_yuv_ssse3.cc",
Kevin Kofler c87d48
+      "simd/filter_yuv_sse2.cc",
Kevin Kofler c87d48
+    ]
Kevin Kofler c87d48
+    configs += [
Kevin Kofler c87d48
+      "//media:media_config",
Kevin Kofler c87d48
+      "//media:media_implementation",
Kevin Kofler c87d48
+    ]
Kevin Kofler c87d48
+    if (!is_win) {
Kevin Kofler c87d48
+      cflags = [ "-msse2" ]
Kevin Kofler c87d48
+    }
Kevin Kofler c87d48
+  }
Kevin Kofler c87d48
+
Kevin Kofler c87d48
   import("//third_party/yasm/yasm_assemble.gni")
Kevin Kofler c87d48
   yasm_assemble("media_yasm") {
Kevin Kofler c87d48
     sources = [
Kevin Kofler c87d48
       "simd/convert_rgb_to_yuv_ssse3.asm",
Kevin Kofler c87d48
+      "simd/convert_yuv_to_rgb_mmx.asm",
Kevin Kofler c87d48
       "simd/convert_yuv_to_rgb_sse.asm",
Kevin Kofler c87d48
       "simd/convert_yuva_to_argb_mmx.asm",
Kevin Kofler c87d48
       "simd/empty_register_state_mmx.asm",
Kevin Kofler c87d48
diff -Nur qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/media/base/media.cc qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/media/base/media.cc
Kevin Kofler c87d48
--- qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/media/base/media.cc	2017-05-18 16:51:44.000000000 +0200
Kevin Kofler c87d48
+++ qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/media/base/media.cc	2017-06-08 22:49:57.484256877 +0200
Kevin Kofler c87d48
@@ -10,6 +10,8 @@
Kevin Kofler c87d48
 #include "base/metrics/field_trial.h"
Kevin Kofler c87d48
 #include "base/trace_event/trace_event.h"
Kevin Kofler c87d48
 #include "media/base/media_switches.h"
Kevin Kofler c87d48
+#include "media/base/sinc_resampler.h"
Kevin Kofler c87d48
+#include "media/base/vector_math.h"
Kevin Kofler c87d48
 #include "media/base/yuv_convert.h"
Kevin Kofler c87d48
 
Kevin Kofler c87d48
 #if defined(OS_ANDROID)
Kevin Kofler c87d48
@@ -40,6 +42,8 @@
Kevin Kofler c87d48
     TRACE_EVENT_WARMUP_CATEGORY("media");
Kevin Kofler c87d48
 
Kevin Kofler c87d48
     // Perform initialization of libraries which require runtime CPU detection.
Kevin Kofler c87d48
+    vector_math::Initialize();
Kevin Kofler c87d48
+    SincResampler::InitializeCPUSpecificFeatures();
Kevin Kofler c87d48
     InitializeCPUSpecificYUVConversions();
Kevin Kofler c87d48
 
Kevin Kofler c87d48
 #if !defined(MEDIA_DISABLE_FFMPEG)
Kevin Kofler c87d48
diff -Nur qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/media/base/simd/convert_yuv_to_rgb.h qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/media/base/simd/convert_yuv_to_rgb.h
Kevin Kofler c87d48
--- qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/media/base/simd/convert_yuv_to_rgb.h	2017-05-18 16:51:44.000000000 +0200
Kevin Kofler c87d48
+++ qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/media/base/simd/convert_yuv_to_rgb.h	2017-06-08 22:49:57.643254478 +0200
Kevin Kofler c87d48
@@ -65,6 +65,17 @@
Kevin Kofler c87d48
                                         int rgbstride,
Kevin Kofler c87d48
                                         YUVType yuv_type);
Kevin Kofler c87d48
 
Kevin Kofler c87d48
+MEDIA_EXPORT void ConvertYUVToRGB32_MMX(const uint8_t* yplane,
Kevin Kofler c87d48
+                                        const uint8_t* uplane,
Kevin Kofler c87d48
+                                        const uint8_t* vplane,
Kevin Kofler c87d48
+                                        uint8_t* rgbframe,
Kevin Kofler c87d48
+                                        int width,
Kevin Kofler c87d48
+                                        int height,
Kevin Kofler c87d48
+                                        int ystride,
Kevin Kofler c87d48
+                                        int uvstride,
Kevin Kofler c87d48
+                                        int rgbstride,
Kevin Kofler c87d48
+                                        YUVType yuv_type);
Kevin Kofler c87d48
+
Kevin Kofler c87d48
 MEDIA_EXPORT void ConvertYUVAToARGB_MMX(const uint8_t* yplane,
Kevin Kofler c87d48
                                         const uint8_t* uplane,
Kevin Kofler c87d48
                                         const uint8_t* vplane,
Kevin Kofler c87d48
@@ -124,6 +135,13 @@
Kevin Kofler c87d48
                                            ptrdiff_t width,
Kevin Kofler c87d48
                                            const int16_t* convert_table);
Kevin Kofler c87d48
 
Kevin Kofler c87d48
+MEDIA_EXPORT void ConvertYUVToRGB32Row_MMX(const uint8_t* yplane,
Kevin Kofler c87d48
+                                           const uint8_t* uplane,
Kevin Kofler c87d48
+                                           const uint8_t* vplane,
Kevin Kofler c87d48
+                                           uint8_t* rgbframe,
Kevin Kofler c87d48
+                                           ptrdiff_t width,
Kevin Kofler c87d48
+                                           const int16_t* convert_table);
Kevin Kofler c87d48
+
Kevin Kofler c87d48
 MEDIA_EXPORT void ConvertYUVToRGB32Row_SSE(const uint8_t* yplane,
Kevin Kofler c87d48
                                            const uint8_t* uplane,
Kevin Kofler c87d48
                                            const uint8_t* vplane,
Kevin Kofler c87d48
@@ -131,6 +149,14 @@
Kevin Kofler c87d48
                                            ptrdiff_t width,
Kevin Kofler c87d48
                                            const int16_t* convert_table);
Kevin Kofler c87d48
 
Kevin Kofler c87d48
+MEDIA_EXPORT void ScaleYUVToRGB32Row_MMX(const uint8_t* y_buf,
Kevin Kofler c87d48
+                                         const uint8_t* u_buf,
Kevin Kofler c87d48
+                                         const uint8_t* v_buf,
Kevin Kofler c87d48
+                                         uint8_t* rgb_buf,
Kevin Kofler c87d48
+                                         ptrdiff_t width,
Kevin Kofler c87d48
+                                         ptrdiff_t source_dx,
Kevin Kofler c87d48
+                                         const int16_t* convert_table);
Kevin Kofler c87d48
+
Kevin Kofler c87d48
 MEDIA_EXPORT void ScaleYUVToRGB32Row_SSE(const uint8_t* y_buf,
Kevin Kofler c87d48
                                          const uint8_t* u_buf,
Kevin Kofler c87d48
                                          const uint8_t* v_buf,
Kevin Kofler c87d48
@@ -147,6 +173,14 @@
Kevin Kofler c87d48
                                               ptrdiff_t source_dx,
Kevin Kofler c87d48
                                               const int16_t* convert_table);
Kevin Kofler c87d48
 
Kevin Kofler c87d48
+MEDIA_EXPORT void LinearScaleYUVToRGB32Row_MMX(const uint8_t* y_buf,
Kevin Kofler c87d48
+                                               const uint8_t* u_buf,
Kevin Kofler c87d48
+                                               const uint8_t* v_buf,
Kevin Kofler c87d48
+                                               uint8_t* rgb_buf,
Kevin Kofler c87d48
+                                               ptrdiff_t width,
Kevin Kofler c87d48
+                                               ptrdiff_t source_dx,
Kevin Kofler c87d48
+                                               const int16_t* convert_table);
Kevin Kofler c87d48
+
Kevin Kofler c87d48
 MEDIA_EXPORT void LinearScaleYUVToRGB32Row_SSE(const uint8_t* y_buf,
Kevin Kofler c87d48
                                                const uint8_t* u_buf,
Kevin Kofler c87d48
                                                const uint8_t* v_buf,
Kevin Kofler c87d48
diff -Nur qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/media/base/simd/convert_yuv_to_rgb_mmx.asm qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/media/base/simd/convert_yuv_to_rgb_mmx.asm
Kevin Kofler c87d48
--- qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/media/base/simd/convert_yuv_to_rgb_mmx.asm	1970-01-01 01:00:00.000000000 +0100
Kevin Kofler c87d48
+++ qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/media/base/simd/convert_yuv_to_rgb_mmx.asm	2017-06-08 22:49:57.698253649 +0200
Kevin Kofler c87d48
@@ -0,0 +1,23 @@
Kevin Kofler c87d48
+; Copyright (c) 2011 The Chromium Authors. All rights reserved.
Kevin Kofler c87d48
+; Use of this source code is governed by a BSD-style license that can be
Kevin Kofler c87d48
+; found in the LICENSE file.
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+%include "third_party/x86inc/x86inc.asm"
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+;
Kevin Kofler c87d48
+; This file uses MMX instructions.
Kevin Kofler c87d48
+;
Kevin Kofler c87d48
+  SECTION_TEXT
Kevin Kofler c87d48
+  CPU       MMX
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+; Use movq to save the output.
Kevin Kofler c87d48
+%define MOVQ movq
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+; extern "C" void ConvertYUVToRGB32Row_MMX(const uint8* y_buf,
Kevin Kofler c87d48
+;                                          const uint8* u_buf,
Kevin Kofler c87d48
+;                                          const uint8* v_buf,
Kevin Kofler c87d48
+;                                          uint8* rgb_buf,
Kevin Kofler c87d48
+;                                          ptrdiff_t width,
Kevin Kofler c87d48
+;                                          const int16* convert_table);
Kevin Kofler c87d48
+%define SYMBOL ConvertYUVToRGB32Row_MMX
Kevin Kofler c87d48
+%include "convert_yuv_to_rgb_mmx.inc"
Kevin Kofler c87d48
diff -Nur qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/media/base/simd/convert_yuv_to_rgb_x86.cc qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/media/base/simd/convert_yuv_to_rgb_x86.cc
Kevin Kofler c87d48
--- qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/media/base/simd/convert_yuv_to_rgb_x86.cc	2017-05-18 16:51:44.000000000 +0200
Kevin Kofler c87d48
+++ qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/media/base/simd/convert_yuv_to_rgb_x86.cc	2017-06-08 22:49:57.699253634 +0200
Kevin Kofler c87d48
@@ -47,6 +47,34 @@
Kevin Kofler c87d48
   EmptyRegisterState();
Kevin Kofler c87d48
 }
Kevin Kofler c87d48
 
Kevin Kofler c87d48
+void ConvertYUVToRGB32_MMX(const uint8_t* yplane,
Kevin Kofler c87d48
+                           const uint8_t* uplane,
Kevin Kofler c87d48
+                           const uint8_t* vplane,
Kevin Kofler c87d48
+                           uint8_t* rgbframe,
Kevin Kofler c87d48
+                           int width,
Kevin Kofler c87d48
+                           int height,
Kevin Kofler c87d48
+                           int ystride,
Kevin Kofler c87d48
+                           int uvstride,
Kevin Kofler c87d48
+                           int rgbstride,
Kevin Kofler c87d48
+                           YUVType yuv_type) {
Kevin Kofler c87d48
+  unsigned int y_shift = GetVerticalShift(yuv_type);
Kevin Kofler c87d48
+  for (int y = 0; y < height; ++y) {
Kevin Kofler c87d48
+    uint8_t* rgb_row = rgbframe + y * rgbstride;
Kevin Kofler c87d48
+    const uint8_t* y_ptr = yplane + y * ystride;
Kevin Kofler c87d48
+    const uint8_t* u_ptr = uplane + (y >> y_shift) * uvstride;
Kevin Kofler c87d48
+    const uint8_t* v_ptr = vplane + (y >> y_shift) * uvstride;
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+    ConvertYUVToRGB32Row_MMX(y_ptr,
Kevin Kofler c87d48
+                             u_ptr,
Kevin Kofler c87d48
+                             v_ptr,
Kevin Kofler c87d48
+                             rgb_row,
Kevin Kofler c87d48
+                             width,
Kevin Kofler c87d48
+                             GetLookupTable(yuv_type));
Kevin Kofler c87d48
+  }
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+  EmptyRegisterState();
Kevin Kofler c87d48
+}
Kevin Kofler c87d48
+
Kevin Kofler c87d48
 void ConvertYUVToRGB32_SSE(const uint8_t* yplane,
Kevin Kofler c87d48
                            const uint8_t* uplane,
Kevin Kofler c87d48
                            const uint8_t* vplane,
Kevin Kofler c87d48
diff -Nur qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/media/base/simd/filter_yuv.h qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/media/base/simd/filter_yuv.h
Kevin Kofler c87d48
--- qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/media/base/simd/filter_yuv.h	2017-05-18 16:51:44.000000000 +0200
Kevin Kofler c87d48
+++ qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/media/base/simd/filter_yuv.h	2017-06-08 22:49:57.699253634 +0200
Kevin Kofler c87d48
@@ -20,6 +20,12 @@
Kevin Kofler c87d48
                                   int source_width,
Kevin Kofler c87d48
                                   uint8_t source_y_fraction);
Kevin Kofler c87d48
 
Kevin Kofler c87d48
+MEDIA_EXPORT void FilterYUVRows_MMX(uint8_t* ybuf,
Kevin Kofler c87d48
+                                    const uint8_t* y0_ptr,
Kevin Kofler c87d48
+                                    const uint8_t* y1_ptr,
Kevin Kofler c87d48
+                                    int source_width,
Kevin Kofler c87d48
+                                    uint8_t source_y_fraction);
Kevin Kofler c87d48
+
Kevin Kofler c87d48
 MEDIA_EXPORT void FilterYUVRows_SSE2(uint8_t* ybuf,
Kevin Kofler c87d48
                                      const uint8_t* y0_ptr,
Kevin Kofler c87d48
                                      const uint8_t* y1_ptr,
Kevin Kofler c87d48
diff -Nur qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/media/base/simd/filter_yuv_mmx.cc qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/media/base/simd/filter_yuv_mmx.cc
Kevin Kofler c87d48
--- qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/media/base/simd/filter_yuv_mmx.cc	1970-01-01 01:00:00.000000000 +0100
Kevin Kofler c87d48
+++ qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/media/base/simd/filter_yuv_mmx.cc	2017-06-08 22:49:57.699253634 +0200
Kevin Kofler c87d48
@@ -0,0 +1,79 @@
Kevin Kofler c87d48
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
Kevin Kofler c87d48
+// Use of this source code is governed by a BSD-style license that can be
Kevin Kofler c87d48
+// found in the LICENSE file.
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+#if defined(_MSC_VER)
Kevin Kofler c87d48
+#include <intrin.h>
Kevin Kofler c87d48
+#else
Kevin Kofler c87d48
+#include <mmintrin.h>
Kevin Kofler c87d48
+#endif
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+#include "build/build_config.h"
Kevin Kofler c87d48
+#include "media/base/simd/filter_yuv.h"
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+namespace media {
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+#if defined(COMPILER_MSVC)
Kevin Kofler c87d48
+// Warning 4799 is about calling emms before the function exits.
Kevin Kofler c87d48
+// We calls emms in a frame level so suppress this warning.
Kevin Kofler c87d48
+#pragma warning(push)
Kevin Kofler c87d48
+#pragma warning(disable: 4799)
Kevin Kofler c87d48
+#endif
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+void FilterYUVRows_MMX(uint8_t* dest,
Kevin Kofler c87d48
+                       const uint8_t* src0,
Kevin Kofler c87d48
+                       const uint8_t* src1,
Kevin Kofler c87d48
+                       int width,
Kevin Kofler c87d48
+                       uint8_t fraction) {
Kevin Kofler c87d48
+  int pixel = 0;
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+  // Process the unaligned bytes first.
Kevin Kofler c87d48
+  int unaligned_width =
Kevin Kofler c87d48
+      (8 - (reinterpret_cast<uintptr_t>(dest) & 7)) & 7;
Kevin Kofler c87d48
+  while (pixel < width && pixel < unaligned_width) {
Kevin Kofler c87d48
+    dest[pixel] = (src0[pixel] * (256 - fraction) +
Kevin Kofler c87d48
+                   src1[pixel] * fraction) >> 8;
Kevin Kofler c87d48
+    ++pixel;
Kevin Kofler c87d48
+  }
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+  __m64 zero = _mm_setzero_si64();
Kevin Kofler c87d48
+  __m64 src1_fraction = _mm_set1_pi16(fraction);
Kevin Kofler c87d48
+  __m64 src0_fraction = _mm_set1_pi16(256 - fraction);
Kevin Kofler c87d48
+  const __m64* src0_64 = reinterpret_cast<const __m64*>(src0 + pixel);
Kevin Kofler c87d48
+  const __m64* src1_64 = reinterpret_cast<const __m64*>(src1 + pixel);
Kevin Kofler c87d48
+  __m64* dest64 = reinterpret_cast<__m64*>(dest + pixel);
Kevin Kofler c87d48
+  __m64* end64 = reinterpret_cast<__m64*>(
Kevin Kofler c87d48
+      reinterpret_cast<uintptr_t>(dest + width) & ~7);
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+  while (dest64 < end64) {
Kevin Kofler c87d48
+    __m64 src0 = *src0_64++;
Kevin Kofler c87d48
+    __m64 src1 = *src1_64++;
Kevin Kofler c87d48
+    __m64 src2 = _mm_unpackhi_pi8(src0, zero);
Kevin Kofler c87d48
+    __m64 src3 = _mm_unpackhi_pi8(src1, zero);
Kevin Kofler c87d48
+    src0 = _mm_unpacklo_pi8(src0, zero);
Kevin Kofler c87d48
+    src1 = _mm_unpacklo_pi8(src1, zero);
Kevin Kofler c87d48
+    src0 = _mm_mullo_pi16(src0, src0_fraction);
Kevin Kofler c87d48
+    src1 = _mm_mullo_pi16(src1, src1_fraction);
Kevin Kofler c87d48
+    src2 = _mm_mullo_pi16(src2, src0_fraction);
Kevin Kofler c87d48
+    src3 = _mm_mullo_pi16(src3, src1_fraction);
Kevin Kofler c87d48
+    src0 = _mm_add_pi16(src0, src1);
Kevin Kofler c87d48
+    src2 = _mm_add_pi16(src2, src3);
Kevin Kofler c87d48
+    src0 = _mm_srli_pi16(src0, 8);
Kevin Kofler c87d48
+    src2 = _mm_srli_pi16(src2, 8);
Kevin Kofler c87d48
+    src0 = _mm_packs_pu16(src0, src2);
Kevin Kofler c87d48
+    *dest64++ = src0;
Kevin Kofler c87d48
+    pixel += 8;
Kevin Kofler c87d48
+  }
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+  while (pixel < width) {
Kevin Kofler c87d48
+    dest[pixel] = (src0[pixel] * (256 - fraction) +
Kevin Kofler c87d48
+                   src1[pixel] * fraction) >> 8;
Kevin Kofler c87d48
+    ++pixel;
Kevin Kofler c87d48
+  }
Kevin Kofler c87d48
+}
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+#if defined(COMPILER_MSVC)
Kevin Kofler c87d48
+#pragma warning(pop)
Kevin Kofler c87d48
+#endif
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+}  // namespace media
Kevin Kofler c87d48
diff -Nur qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/media/base/simd/sinc_resampler_sse.cc qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/media/base/simd/sinc_resampler_sse.cc
Kevin Kofler c87d48
--- qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/media/base/simd/sinc_resampler_sse.cc	1970-01-01 01:00:00.000000000 +0100
Kevin Kofler c87d48
+++ qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/media/base/simd/sinc_resampler_sse.cc	2017-06-08 22:49:57.699253634 +0200
Kevin Kofler c87d48
@@ -0,0 +1,50 @@
Kevin Kofler c87d48
+// Copyright 2013 The Chromium Authors. All rights reserved.
Kevin Kofler c87d48
+// Use of this source code is governed by a BSD-style license that can be
Kevin Kofler c87d48
+// found in the LICENSE file.
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+#include "media/base/sinc_resampler.h"
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+#include <xmmintrin.h>
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+namespace media {
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+float SincResampler::Convolve_SSE(const float* input_ptr, const float* k1,
Kevin Kofler c87d48
+                                  const float* k2,
Kevin Kofler c87d48
+                                  double kernel_interpolation_factor) {
Kevin Kofler c87d48
+  __m128 m_input;
Kevin Kofler c87d48
+  __m128 m_sums1 = _mm_setzero_ps();
Kevin Kofler c87d48
+  __m128 m_sums2 = _mm_setzero_ps();
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+  // Based on |input_ptr| alignment, we need to use loadu or load.  Unrolling
Kevin Kofler c87d48
+  // these loops hurt performance in local testing.
Kevin Kofler c87d48
+  if (reinterpret_cast<uintptr_t>(input_ptr) & 0x0F) {
Kevin Kofler c87d48
+    for (int i = 0; i < kKernelSize; i += 4) {
Kevin Kofler c87d48
+      m_input = _mm_loadu_ps(input_ptr + i);
Kevin Kofler c87d48
+      m_sums1 = _mm_add_ps(m_sums1, _mm_mul_ps(m_input, _mm_load_ps(k1 + i)));
Kevin Kofler c87d48
+      m_sums2 = _mm_add_ps(m_sums2, _mm_mul_ps(m_input, _mm_load_ps(k2 + i)));
Kevin Kofler c87d48
+    }
Kevin Kofler c87d48
+  } else {
Kevin Kofler c87d48
+    for (int i = 0; i < kKernelSize; i += 4) {
Kevin Kofler c87d48
+      m_input = _mm_load_ps(input_ptr + i);
Kevin Kofler c87d48
+      m_sums1 = _mm_add_ps(m_sums1, _mm_mul_ps(m_input, _mm_load_ps(k1 + i)));
Kevin Kofler c87d48
+      m_sums2 = _mm_add_ps(m_sums2, _mm_mul_ps(m_input, _mm_load_ps(k2 + i)));
Kevin Kofler c87d48
+    }
Kevin Kofler c87d48
+  }
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+  // Linearly interpolate the two "convolutions".
Kevin Kofler c87d48
+  m_sums1 = _mm_mul_ps(m_sums1, _mm_set_ps1(
Kevin Kofler c87d48
+      static_cast<float>(1.0 - kernel_interpolation_factor)));
Kevin Kofler c87d48
+  m_sums2 = _mm_mul_ps(m_sums2, _mm_set_ps1(
Kevin Kofler c87d48
+      static_cast<float>(kernel_interpolation_factor)));
Kevin Kofler c87d48
+  m_sums1 = _mm_add_ps(m_sums1, m_sums2);
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+  // Sum components together.
Kevin Kofler c87d48
+  float result;
Kevin Kofler c87d48
+  m_sums2 = _mm_add_ps(_mm_movehl_ps(m_sums1, m_sums1), m_sums1);
Kevin Kofler c87d48
+  _mm_store_ss(&result, _mm_add_ss(m_sums2, _mm_shuffle_ps(
Kevin Kofler c87d48
+      m_sums2, m_sums2, 1)));
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+  return result;
Kevin Kofler c87d48
+}
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+}  // namespace media
Kevin Kofler c87d48
diff -Nur qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/media/base/simd/vector_math_sse.cc qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/media/base/simd/vector_math_sse.cc
Kevin Kofler c87d48
--- qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/media/base/simd/vector_math_sse.cc	1970-01-01 01:00:00.000000000 +0100
Kevin Kofler c87d48
+++ qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/media/base/simd/vector_math_sse.cc	2017-06-08 22:49:57.700253619 +0200
Kevin Kofler c87d48
@@ -0,0 +1,118 @@
Kevin Kofler c87d48
+// Copyright 2013 The Chromium Authors. All rights reserved.
Kevin Kofler c87d48
+// Use of this source code is governed by a BSD-style license that can be
Kevin Kofler c87d48
+// found in the LICENSE file.
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+#include "media/base/vector_math_testing.h"
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+#include <algorithm>
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+#include <xmmintrin.h>  // NOLINT
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+namespace media {
Kevin Kofler c87d48
+namespace vector_math {
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+void FMUL_SSE(const float src[], float scale, int len, float dest[]) {
Kevin Kofler c87d48
+  const int rem = len % 4;
Kevin Kofler c87d48
+  const int last_index = len - rem;
Kevin Kofler c87d48
+  __m128 m_scale = _mm_set_ps1(scale);
Kevin Kofler c87d48
+  for (int i = 0; i < last_index; i += 4)
Kevin Kofler c87d48
+    _mm_store_ps(dest + i, _mm_mul_ps(_mm_load_ps(src + i), m_scale));
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+  // Handle any remaining values that wouldn't fit in an SSE pass.
Kevin Kofler c87d48
+  for (int i = last_index; i < len; ++i)
Kevin Kofler c87d48
+    dest[i] = src[i] * scale;
Kevin Kofler c87d48
+}
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+void FMAC_SSE(const float src[], float scale, int len, float dest[]) {
Kevin Kofler c87d48
+  const int rem = len % 4;
Kevin Kofler c87d48
+  const int last_index = len - rem;
Kevin Kofler c87d48
+  __m128 m_scale = _mm_set_ps1(scale);
Kevin Kofler c87d48
+  for (int i = 0; i < last_index; i += 4) {
Kevin Kofler c87d48
+    _mm_store_ps(dest + i, _mm_add_ps(_mm_load_ps(dest + i),
Kevin Kofler c87d48
+                 _mm_mul_ps(_mm_load_ps(src + i), m_scale)));
Kevin Kofler c87d48
+  }
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+  // Handle any remaining values that wouldn't fit in an SSE pass.
Kevin Kofler c87d48
+  for (int i = last_index; i < len; ++i)
Kevin Kofler c87d48
+    dest[i] += src[i] * scale;
Kevin Kofler c87d48
+}
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+// Convenience macro to extract float 0 through 3 from the vector |a|.  This is
Kevin Kofler c87d48
+// needed because compilers other than clang don't support access via
Kevin Kofler c87d48
+// operator[]().
Kevin Kofler c87d48
+#define EXTRACT_FLOAT(a, i) \
Kevin Kofler c87d48
+    (i == 0 ? \
Kevin Kofler c87d48
+         _mm_cvtss_f32(a) : \
Kevin Kofler c87d48
+         _mm_cvtss_f32(_mm_shuffle_ps(a, a, i)))
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+std::pair<float, float> EWMAAndMaxPower_SSE(
Kevin Kofler c87d48
+    float initial_value, const float src[], int len, float smoothing_factor) {
Kevin Kofler c87d48
+  // When the recurrence is unrolled, we see that we can split it into 4
Kevin Kofler c87d48
+  // separate lanes of evaluation:
Kevin Kofler c87d48
+  //
Kevin Kofler c87d48
+  // y[n] = a(S[n]^2) + (1-a)(y[n-1])
Kevin Kofler c87d48
+  //      = a(S[n]^2) + (1-a)^1(aS[n-1]^2) + (1-a)^2(aS[n-2]^2) + ...
Kevin Kofler c87d48
+  //      = z[n] + (1-a)^1(z[n-1]) + (1-a)^2(z[n-2]) + (1-a)^3(z[n-3])
Kevin Kofler c87d48
+  //
Kevin Kofler c87d48
+  // where z[n] = a(S[n]^2) + (1-a)^4(z[n-4]) + (1-a)^8(z[n-8]) + ...
Kevin Kofler c87d48
+  //
Kevin Kofler c87d48
+  // Thus, the strategy here is to compute z[n], z[n-1], z[n-2], and z[n-3] in
Kevin Kofler c87d48
+  // each of the 4 lanes, and then combine them to give y[n].
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+  const int rem = len % 4;
Kevin Kofler c87d48
+  const int last_index = len - rem;
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+  const __m128 smoothing_factor_x4 = _mm_set_ps1(smoothing_factor);
Kevin Kofler c87d48
+  const float weight_prev = 1.0f - smoothing_factor;
Kevin Kofler c87d48
+  const __m128 weight_prev_x4 = _mm_set_ps1(weight_prev);
Kevin Kofler c87d48
+  const __m128 weight_prev_squared_x4 =
Kevin Kofler c87d48
+      _mm_mul_ps(weight_prev_x4, weight_prev_x4);
Kevin Kofler c87d48
+  const __m128 weight_prev_4th_x4 =
Kevin Kofler c87d48
+      _mm_mul_ps(weight_prev_squared_x4, weight_prev_squared_x4);
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+  // Compute z[n], z[n-1], z[n-2], and z[n-3] in parallel in lanes 3, 2, 1 and
Kevin Kofler c87d48
+  // 0, respectively.
Kevin Kofler c87d48
+  __m128 max_x4 = _mm_setzero_ps();
Kevin Kofler c87d48
+  __m128 ewma_x4 = _mm_setr_ps(0.0f, 0.0f, 0.0f, initial_value);
Kevin Kofler c87d48
+  int i;
Kevin Kofler c87d48
+  for (i = 0; i < last_index; i += 4) {
Kevin Kofler c87d48
+    ewma_x4 = _mm_mul_ps(ewma_x4, weight_prev_4th_x4);
Kevin Kofler c87d48
+    const __m128 sample_x4 = _mm_load_ps(src + i);
Kevin Kofler c87d48
+    const __m128 sample_squared_x4 = _mm_mul_ps(sample_x4, sample_x4);
Kevin Kofler c87d48
+    max_x4 = _mm_max_ps(max_x4, sample_squared_x4);
Kevin Kofler c87d48
+    // Note: The compiler optimizes this to a single multiply-and-accumulate
Kevin Kofler c87d48
+    // instruction:
Kevin Kofler c87d48
+    ewma_x4 = _mm_add_ps(ewma_x4,
Kevin Kofler c87d48
+                         _mm_mul_ps(sample_squared_x4, smoothing_factor_x4));
Kevin Kofler c87d48
+  }
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+  // y[n] = z[n] + (1-a)^1(z[n-1]) + (1-a)^2(z[n-2]) + (1-a)^3(z[n-3])
Kevin Kofler c87d48
+  float ewma = EXTRACT_FLOAT(ewma_x4, 3);
Kevin Kofler c87d48
+  ewma_x4 = _mm_mul_ps(ewma_x4, weight_prev_x4);
Kevin Kofler c87d48
+  ewma += EXTRACT_FLOAT(ewma_x4, 2);
Kevin Kofler c87d48
+  ewma_x4 = _mm_mul_ps(ewma_x4, weight_prev_x4);
Kevin Kofler c87d48
+  ewma += EXTRACT_FLOAT(ewma_x4, 1);
Kevin Kofler c87d48
+  ewma_x4 = _mm_mul_ss(ewma_x4, weight_prev_x4);
Kevin Kofler c87d48
+  ewma += EXTRACT_FLOAT(ewma_x4, 0);
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+  // Fold the maximums together to get the overall maximum.
Kevin Kofler c87d48
+  max_x4 = _mm_max_ps(max_x4,
Kevin Kofler c87d48
+                      _mm_shuffle_ps(max_x4, max_x4, _MM_SHUFFLE(3, 3, 1, 1)));
Kevin Kofler c87d48
+  max_x4 = _mm_max_ss(max_x4, _mm_shuffle_ps(max_x4, max_x4, 2));
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+  std::pair<float, float> result(ewma, EXTRACT_FLOAT(max_x4, 0));
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+  // Handle remaining values at the end of |src|.
Kevin Kofler c87d48
+  for (; i < len; ++i) {
Kevin Kofler c87d48
+    result.first *= weight_prev;
Kevin Kofler c87d48
+    const float sample = src[i];
Kevin Kofler c87d48
+    const float sample_squared = sample * sample;
Kevin Kofler c87d48
+    result.first += sample_squared * smoothing_factor;
Kevin Kofler c87d48
+    result.second = std::max(result.second, sample_squared);
Kevin Kofler c87d48
+  }
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+  return result;
Kevin Kofler c87d48
+}
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+}  // namespace vector_math
Kevin Kofler c87d48
+}  // namespace media
Kevin Kofler c87d48
diff -Nur qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/media/base/sinc_resampler.cc qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/media/base/sinc_resampler.cc
Kevin Kofler c87d48
--- qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/media/base/sinc_resampler.cc	2017-05-18 16:51:44.000000000 +0200
Kevin Kofler c87d48
+++ qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/media/base/sinc_resampler.cc	2017-06-08 22:49:57.700253619 +0200
Kevin Kofler c87d48
@@ -81,17 +81,12 @@
Kevin Kofler c87d48
 #include <cmath>
Kevin Kofler c87d48
 #include <limits>
Kevin Kofler c87d48
 
Kevin Kofler c87d48
+#include "base/cpu.h"
Kevin Kofler c87d48
 #include "base/logging.h"
Kevin Kofler c87d48
 #include "build/build_config.h"
Kevin Kofler c87d48
 
Kevin Kofler c87d48
-#if defined(ARCH_CPU_X86_FAMILY)
Kevin Kofler c87d48
-#include <xmmintrin.h>
Kevin Kofler c87d48
-#define CONVOLVE_FUNC Convolve_SSE
Kevin Kofler c87d48
-#elif defined(ARCH_CPU_ARM_FAMILY) && defined(USE_NEON)
Kevin Kofler c87d48
+#if defined(ARCH_CPU_ARM_FAMILY) && defined(USE_NEON)
Kevin Kofler c87d48
 #include <arm_neon.h>
Kevin Kofler c87d48
-#define CONVOLVE_FUNC Convolve_NEON
Kevin Kofler c87d48
-#else
Kevin Kofler c87d48
-#define CONVOLVE_FUNC Convolve_C
Kevin Kofler c87d48
 #endif
Kevin Kofler c87d48
 
Kevin Kofler c87d48
 namespace media {
Kevin Kofler c87d48
@@ -112,10 +107,41 @@
Kevin Kofler c87d48
   return sinc_scale_factor;
Kevin Kofler c87d48
 }
Kevin Kofler c87d48
 
Kevin Kofler c87d48
+#undef CONVOLVE_FUNC
Kevin Kofler c87d48
+
Kevin Kofler c87d48
 static int CalculateChunkSize(int block_size_, double io_ratio) {
Kevin Kofler c87d48
   return block_size_ / io_ratio;
Kevin Kofler c87d48
 }
Kevin Kofler c87d48
 
Kevin Kofler c87d48
+// If we know the minimum architecture at compile time, avoid CPU detection.
Kevin Kofler c87d48
+// Force NaCl code to use C routines since (at present) nothing there uses these
Kevin Kofler c87d48
+// methods and plumbing the -msse built library is non-trivial.
Kevin Kofler c87d48
+#if defined(ARCH_CPU_X86_FAMILY) && !defined(OS_NACL)
Kevin Kofler c87d48
+#if defined(__SSE__)
Kevin Kofler c87d48
+#define CONVOLVE_FUNC Convolve_SSE
Kevin Kofler c87d48
+void SincResampler::InitializeCPUSpecificFeatures() {}
Kevin Kofler c87d48
+#else
Kevin Kofler c87d48
+// X86 CPU detection required.  Functions will be set by
Kevin Kofler c87d48
+// InitializeCPUSpecificFeatures().
Kevin Kofler c87d48
+#define CONVOLVE_FUNC g_convolve_proc_
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+typedef float (*ConvolveProc)(const float*, const float*, const float*, double);
Kevin Kofler c87d48
+static ConvolveProc g_convolve_proc_ = NULL;
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+void SincResampler::InitializeCPUSpecificFeatures() {
Kevin Kofler c87d48
+  CHECK(!g_convolve_proc_);
Kevin Kofler c87d48
+  g_convolve_proc_ = base::CPU().has_sse() ? Convolve_SSE : Convolve_C;
Kevin Kofler c87d48
+}
Kevin Kofler c87d48
+#endif
Kevin Kofler c87d48
+#elif defined(ARCH_CPU_ARM_FAMILY) && defined(USE_NEON)
Kevin Kofler c87d48
+#define CONVOLVE_FUNC Convolve_NEON
Kevin Kofler c87d48
+void SincResampler::InitializeCPUSpecificFeatures() {}
Kevin Kofler c87d48
+#else
Kevin Kofler c87d48
+// Unknown architecture.
Kevin Kofler c87d48
+#define CONVOLVE_FUNC Convolve_C
Kevin Kofler c87d48
+void SincResampler::InitializeCPUSpecificFeatures() {}
Kevin Kofler c87d48
+#endif
Kevin Kofler c87d48
+
Kevin Kofler c87d48
 SincResampler::SincResampler(double io_sample_rate_ratio,
Kevin Kofler c87d48
                              int request_frames,
Kevin Kofler c87d48
                              const ReadCB& read_cb)
Kevin Kofler c87d48
@@ -328,46 +354,7 @@
Kevin Kofler c87d48
       kernel_interpolation_factor * sum2);
Kevin Kofler c87d48
 }
Kevin Kofler c87d48
 
Kevin Kofler c87d48
-#if defined(ARCH_CPU_X86_FAMILY)
Kevin Kofler c87d48
-float SincResampler::Convolve_SSE(const float* input_ptr, const float* k1,
Kevin Kofler c87d48
-                                  const float* k2,
Kevin Kofler c87d48
-                                  double kernel_interpolation_factor) {
Kevin Kofler c87d48
-  __m128 m_input;
Kevin Kofler c87d48
-  __m128 m_sums1 = _mm_setzero_ps();
Kevin Kofler c87d48
-  __m128 m_sums2 = _mm_setzero_ps();
Kevin Kofler c87d48
-
Kevin Kofler c87d48
-  // Based on |input_ptr| alignment, we need to use loadu or load.  Unrolling
Kevin Kofler c87d48
-  // these loops hurt performance in local testing.
Kevin Kofler c87d48
-  if (reinterpret_cast<uintptr_t>(input_ptr) & 0x0F) {
Kevin Kofler c87d48
-    for (int i = 0; i < kKernelSize; i += 4) {
Kevin Kofler c87d48
-      m_input = _mm_loadu_ps(input_ptr + i);
Kevin Kofler c87d48
-      m_sums1 = _mm_add_ps(m_sums1, _mm_mul_ps(m_input, _mm_load_ps(k1 + i)));
Kevin Kofler c87d48
-      m_sums2 = _mm_add_ps(m_sums2, _mm_mul_ps(m_input, _mm_load_ps(k2 + i)));
Kevin Kofler c87d48
-    }
Kevin Kofler c87d48
-  } else {
Kevin Kofler c87d48
-    for (int i = 0; i < kKernelSize; i += 4) {
Kevin Kofler c87d48
-      m_input = _mm_load_ps(input_ptr + i);
Kevin Kofler c87d48
-      m_sums1 = _mm_add_ps(m_sums1, _mm_mul_ps(m_input, _mm_load_ps(k1 + i)));
Kevin Kofler c87d48
-      m_sums2 = _mm_add_ps(m_sums2, _mm_mul_ps(m_input, _mm_load_ps(k2 + i)));
Kevin Kofler c87d48
-    }
Kevin Kofler c87d48
-  }
Kevin Kofler c87d48
-
Kevin Kofler c87d48
-  // Linearly interpolate the two "convolutions".
Kevin Kofler c87d48
-  m_sums1 = _mm_mul_ps(m_sums1, _mm_set_ps1(
Kevin Kofler c87d48
-      static_cast<float>(1.0 - kernel_interpolation_factor)));
Kevin Kofler c87d48
-  m_sums2 = _mm_mul_ps(m_sums2, _mm_set_ps1(
Kevin Kofler c87d48
-      static_cast<float>(kernel_interpolation_factor)));
Kevin Kofler c87d48
-  m_sums1 = _mm_add_ps(m_sums1, m_sums2);
Kevin Kofler c87d48
-
Kevin Kofler c87d48
-  // Sum components together.
Kevin Kofler c87d48
-  float result;
Kevin Kofler c87d48
-  m_sums2 = _mm_add_ps(_mm_movehl_ps(m_sums1, m_sums1), m_sums1);
Kevin Kofler c87d48
-  _mm_store_ss(&result, _mm_add_ss(m_sums2, _mm_shuffle_ps(
Kevin Kofler c87d48
-      m_sums2, m_sums2, 1)));
Kevin Kofler c87d48
-
Kevin Kofler c87d48
-  return result;
Kevin Kofler c87d48
-}
Kevin Kofler c87d48
-#elif defined(ARCH_CPU_ARM_FAMILY) && defined(USE_NEON)
Kevin Kofler c87d48
+#if defined(ARCH_CPU_ARM_FAMILY) && defined(USE_NEON)
Kevin Kofler c87d48
 float SincResampler::Convolve_NEON(const float* input_ptr, const float* k1,
Kevin Kofler c87d48
                                    const float* k2,
Kevin Kofler c87d48
                                    double kernel_interpolation_factor) {
Kevin Kofler c87d48
diff -Nur qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/media/base/sinc_resampler.h qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/media/base/sinc_resampler.h
Kevin Kofler c87d48
--- qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/media/base/sinc_resampler.h	2017-05-18 16:51:44.000000000 +0200
Kevin Kofler c87d48
+++ qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/media/base/sinc_resampler.h	2017-06-08 22:49:57.700253619 +0200
Kevin Kofler c87d48
@@ -36,6 +36,10 @@
Kevin Kofler c87d48
     kKernelStorageSize = kKernelSize * (kKernelOffsetCount + 1),
Kevin Kofler c87d48
   };
Kevin Kofler c87d48
 
Kevin Kofler c87d48
+  // Selects runtime specific CPU features like SSE.  Must be called before
Kevin Kofler c87d48
+  // using SincResampler.
Kevin Kofler c87d48
+  static void InitializeCPUSpecificFeatures();
Kevin Kofler c87d48
+
Kevin Kofler c87d48
   // Callback type for providing more data into the resampler.  Expects |frames|
Kevin Kofler c87d48
   // of data to be rendered into |destination|; zero padded if not enough frames
Kevin Kofler c87d48
   // are available to satisfy the request.
Kevin Kofler c87d48
diff -Nur qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/media/base/sinc_resampler_perftest.cc qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/media/base/sinc_resampler_perftest.cc
Kevin Kofler c87d48
--- qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/media/base/sinc_resampler_perftest.cc	2017-05-18 16:51:44.000000000 +0200
Kevin Kofler c87d48
+++ qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/media/base/sinc_resampler_perftest.cc	2017-06-08 22:49:57.701253604 +0200
Kevin Kofler c87d48
@@ -4,6 +4,7 @@
Kevin Kofler c87d48
 
Kevin Kofler c87d48
 #include "base/bind.h"
Kevin Kofler c87d48
 #include "base/bind_helpers.h"
Kevin Kofler c87d48
+#include "base/cpu.h"
Kevin Kofler c87d48
 #include "base/time/time.h"
Kevin Kofler c87d48
 #include "build/build_config.h"
Kevin Kofler c87d48
 #include "media/base/sinc_resampler.h"
Kevin Kofler c87d48
@@ -61,6 +62,9 @@
Kevin Kofler c87d48
       &resampler, SincResampler::Convolve_C, true, "unoptimized_aligned");
Kevin Kofler c87d48
 
Kevin Kofler c87d48
 #if defined(CONVOLVE_FUNC)
Kevin Kofler c87d48
+#if defined(ARCH_CPU_X86_FAMILY)
Kevin Kofler c87d48
+  ASSERT_TRUE(base::CPU().has_sse());
Kevin Kofler c87d48
+#endif
Kevin Kofler c87d48
   RunConvolveBenchmark(
Kevin Kofler c87d48
       &resampler, SincResampler::CONVOLVE_FUNC, true, "optimized_aligned");
Kevin Kofler c87d48
   RunConvolveBenchmark(
Kevin Kofler c87d48
diff -Nur qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/media/base/sinc_resampler_unittest.cc qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/media/base/sinc_resampler_unittest.cc
Kevin Kofler c87d48
--- qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/media/base/sinc_resampler_unittest.cc	2017-05-18 16:51:44.000000000 +0200
Kevin Kofler c87d48
+++ qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/media/base/sinc_resampler_unittest.cc	2017-06-08 22:49:57.701253604 +0200
Kevin Kofler c87d48
@@ -10,6 +10,7 @@
Kevin Kofler c87d48
 
Kevin Kofler c87d48
 #include "base/bind.h"
Kevin Kofler c87d48
 #include "base/bind_helpers.h"
Kevin Kofler c87d48
+#include "base/cpu.h"
Kevin Kofler c87d48
 #include "base/macros.h"
Kevin Kofler c87d48
 #include "base/strings/string_number_conversions.h"
Kevin Kofler c87d48
 #include "base/time/time.h"
Kevin Kofler c87d48
@@ -166,6 +167,10 @@
Kevin Kofler c87d48
 static const double kKernelInterpolationFactor = 0.5;
Kevin Kofler c87d48
 
Kevin Kofler c87d48
 TEST(SincResamplerTest, Convolve) {
Kevin Kofler c87d48
+#if defined(ARCH_CPU_X86_FAMILY)
Kevin Kofler c87d48
+  ASSERT_TRUE(base::CPU().has_sse());
Kevin Kofler c87d48
+#endif
Kevin Kofler c87d48
+
Kevin Kofler c87d48
   // Initialize a dummy resampler.
Kevin Kofler c87d48
   MockSource mock_source;
Kevin Kofler c87d48
   SincResampler resampler(
Kevin Kofler c87d48
diff -Nur qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/media/base/vector_math.cc qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/media/base/vector_math.cc
Kevin Kofler c87d48
--- qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/media/base/vector_math.cc	2017-05-18 16:51:44.000000000 +0200
Kevin Kofler c87d48
+++ qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/media/base/vector_math.cc	2017-06-08 22:49:57.701253604 +0200
Kevin Kofler c87d48
@@ -7,12 +7,17 @@
Kevin Kofler c87d48
 
Kevin Kofler c87d48
 #include <algorithm>
Kevin Kofler c87d48
 
Kevin Kofler c87d48
+#include "base/cpu.h"
Kevin Kofler c87d48
 #include "base/logging.h"
Kevin Kofler c87d48
 #include "build/build_config.h"
Kevin Kofler c87d48
 
Kevin Kofler c87d48
+namespace media {
Kevin Kofler c87d48
+namespace vector_math {
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+// If we know the minimum architecture at compile time, avoid CPU detection.
Kevin Kofler c87d48
 // NaCl does not allow intrinsics.
Kevin Kofler c87d48
 #if defined(ARCH_CPU_X86_FAMILY) && !defined(OS_NACL)
Kevin Kofler c87d48
-#include <xmmintrin.h>
Kevin Kofler c87d48
+#if defined(__SSE__)
Kevin Kofler c87d48
 // Don't use custom SSE versions where the auto-vectorized C version performs
Kevin Kofler c87d48
 // better, which is anywhere clang is used.
Kevin Kofler c87d48
 #if !defined(__clang__)
Kevin Kofler c87d48
@@ -23,20 +28,52 @@
Kevin Kofler c87d48
 #define FMUL_FUNC FMUL_C
Kevin Kofler c87d48
 #endif
Kevin Kofler c87d48
 #define EWMAAndMaxPower_FUNC EWMAAndMaxPower_SSE
Kevin Kofler c87d48
+void Initialize() {}
Kevin Kofler c87d48
+#else
Kevin Kofler c87d48
+// X86 CPU detection required.  Functions will be set by Initialize().
Kevin Kofler c87d48
+#if !defined(__clang__)
Kevin Kofler c87d48
+#define FMAC_FUNC g_fmac_proc_
Kevin Kofler c87d48
+#define FMUL_FUNC g_fmul_proc_
Kevin Kofler c87d48
+#else
Kevin Kofler c87d48
+#define FMAC_FUNC FMAC_C
Kevin Kofler c87d48
+#define FMUL_FUNC FMUL_C
Kevin Kofler c87d48
+#endif
Kevin Kofler c87d48
+#define EWMAAndMaxPower_FUNC g_ewma_power_proc_
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+#if !defined(__clang__)
Kevin Kofler c87d48
+typedef void (*MathProc)(const float src[], float scale, int len, float dest[]);
Kevin Kofler c87d48
+static MathProc g_fmac_proc_ = NULL;
Kevin Kofler c87d48
+static MathProc g_fmul_proc_ = NULL;
Kevin Kofler c87d48
+#endif
Kevin Kofler c87d48
+typedef std::pair<float, float> (*EWMAAndMaxPowerProc)(
Kevin Kofler c87d48
+    float initial_value, const float src[], int len, float smoothing_factor);
Kevin Kofler c87d48
+static EWMAAndMaxPowerProc g_ewma_power_proc_ = NULL;
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+void Initialize() {
Kevin Kofler c87d48
+  CHECK(!g_fmac_proc_);
Kevin Kofler c87d48
+  CHECK(!g_fmul_proc_);
Kevin Kofler c87d48
+  CHECK(!g_ewma_power_proc_);
Kevin Kofler c87d48
+  const bool kUseSSE = base::CPU().has_sse();
Kevin Kofler c87d48
+#if !defined(__clang__)
Kevin Kofler c87d48
+  g_fmac_proc_ = kUseSSE ? FMAC_SSE : FMAC_C;
Kevin Kofler c87d48
+  g_fmul_proc_ = kUseSSE ? FMUL_SSE : FMUL_C;
Kevin Kofler c87d48
+#endif
Kevin Kofler c87d48
+  g_ewma_power_proc_ = kUseSSE ? EWMAAndMaxPower_SSE : EWMAAndMaxPower_C;
Kevin Kofler c87d48
+}
Kevin Kofler c87d48
+#endif
Kevin Kofler c87d48
 #elif defined(ARCH_CPU_ARM_FAMILY) && defined(USE_NEON)
Kevin Kofler c87d48
 #include <arm_neon.h>
Kevin Kofler c87d48
 #define FMAC_FUNC FMAC_NEON
Kevin Kofler c87d48
 #define FMUL_FUNC FMUL_NEON
Kevin Kofler c87d48
 #define EWMAAndMaxPower_FUNC EWMAAndMaxPower_NEON
Kevin Kofler c87d48
+void Initialize() {}
Kevin Kofler c87d48
 #else
Kevin Kofler c87d48
 #define FMAC_FUNC FMAC_C
Kevin Kofler c87d48
 #define FMUL_FUNC FMUL_C
Kevin Kofler c87d48
 #define EWMAAndMaxPower_FUNC EWMAAndMaxPower_C
Kevin Kofler c87d48
+void Initialize() {}
Kevin Kofler c87d48
 #endif
Kevin Kofler c87d48
 
Kevin Kofler c87d48
-namespace media {
Kevin Kofler c87d48
-namespace vector_math {
Kevin Kofler c87d48
-
Kevin Kofler c87d48
 void FMAC(const float src[], float scale, int len, float dest[]) {
Kevin Kofler c87d48
   // Ensure |src| and |dest| are 16-byte aligned.
Kevin Kofler c87d48
   DCHECK_EQ(0u, reinterpret_cast<uintptr_t>(src) & (kRequiredAlignment - 1));
Kevin Kofler c87d48
@@ -89,111 +126,6 @@
Kevin Kofler c87d48
   return result;
Kevin Kofler c87d48
 }
Kevin Kofler c87d48
 
Kevin Kofler c87d48
-#if defined(ARCH_CPU_X86_FAMILY) && !defined(OS_NACL)
Kevin Kofler c87d48
-void FMUL_SSE(const float src[], float scale, int len, float dest[]) {
Kevin Kofler c87d48
-  const int rem = len % 4;
Kevin Kofler c87d48
-  const int last_index = len - rem;
Kevin Kofler c87d48
-  __m128 m_scale = _mm_set_ps1(scale);
Kevin Kofler c87d48
-  for (int i = 0; i < last_index; i += 4)
Kevin Kofler c87d48
-    _mm_store_ps(dest + i, _mm_mul_ps(_mm_load_ps(src + i), m_scale));
Kevin Kofler c87d48
-
Kevin Kofler c87d48
-  // Handle any remaining values that wouldn't fit in an SSE pass.
Kevin Kofler c87d48
-  for (int i = last_index; i < len; ++i)
Kevin Kofler c87d48
-    dest[i] = src[i] * scale;
Kevin Kofler c87d48
-}
Kevin Kofler c87d48
-
Kevin Kofler c87d48
-void FMAC_SSE(const float src[], float scale, int len, float dest[]) {
Kevin Kofler c87d48
-  const int rem = len % 4;
Kevin Kofler c87d48
-  const int last_index = len - rem;
Kevin Kofler c87d48
-  __m128 m_scale = _mm_set_ps1(scale);
Kevin Kofler c87d48
-  for (int i = 0; i < last_index; i += 4) {
Kevin Kofler c87d48
-    _mm_store_ps(dest + i, _mm_add_ps(_mm_load_ps(dest + i),
Kevin Kofler c87d48
-                 _mm_mul_ps(_mm_load_ps(src + i), m_scale)));
Kevin Kofler c87d48
-  }
Kevin Kofler c87d48
-
Kevin Kofler c87d48
-  // Handle any remaining values that wouldn't fit in an SSE pass.
Kevin Kofler c87d48
-  for (int i = last_index; i < len; ++i)
Kevin Kofler c87d48
-    dest[i] += src[i] * scale;
Kevin Kofler c87d48
-}
Kevin Kofler c87d48
-
Kevin Kofler c87d48
-// Convenience macro to extract float 0 through 3 from the vector |a|.  This is
Kevin Kofler c87d48
-// needed because compilers other than clang don't support access via
Kevin Kofler c87d48
-// operator[]().
Kevin Kofler c87d48
-#define EXTRACT_FLOAT(a, i) \
Kevin Kofler c87d48
-    (i == 0 ? \
Kevin Kofler c87d48
-         _mm_cvtss_f32(a) : \
Kevin Kofler c87d48
-         _mm_cvtss_f32(_mm_shuffle_ps(a, a, i)))
Kevin Kofler c87d48
-
Kevin Kofler c87d48
-std::pair<float, float> EWMAAndMaxPower_SSE(
Kevin Kofler c87d48
-    float initial_value, const float src[], int len, float smoothing_factor) {
Kevin Kofler c87d48
-  // When the recurrence is unrolled, we see that we can split it into 4
Kevin Kofler c87d48
-  // separate lanes of evaluation:
Kevin Kofler c87d48
-  //
Kevin Kofler c87d48
-  // y[n] = a(S[n]^2) + (1-a)(y[n-1])
Kevin Kofler c87d48
-  //      = a(S[n]^2) + (1-a)^1(aS[n-1]^2) + (1-a)^2(aS[n-2]^2) + ...
Kevin Kofler c87d48
-  //      = z[n] + (1-a)^1(z[n-1]) + (1-a)^2(z[n-2]) + (1-a)^3(z[n-3])
Kevin Kofler c87d48
-  //
Kevin Kofler c87d48
-  // where z[n] = a(S[n]^2) + (1-a)^4(z[n-4]) + (1-a)^8(z[n-8]) + ...
Kevin Kofler c87d48
-  //
Kevin Kofler c87d48
-  // Thus, the strategy here is to compute z[n], z[n-1], z[n-2], and z[n-3] in
Kevin Kofler c87d48
-  // each of the 4 lanes, and then combine them to give y[n].
Kevin Kofler c87d48
-
Kevin Kofler c87d48
-  const int rem = len % 4;
Kevin Kofler c87d48
-  const int last_index = len - rem;
Kevin Kofler c87d48
-
Kevin Kofler c87d48
-  const __m128 smoothing_factor_x4 = _mm_set_ps1(smoothing_factor);
Kevin Kofler c87d48
-  const float weight_prev = 1.0f - smoothing_factor;
Kevin Kofler c87d48
-  const __m128 weight_prev_x4 = _mm_set_ps1(weight_prev);
Kevin Kofler c87d48
-  const __m128 weight_prev_squared_x4 =
Kevin Kofler c87d48
-      _mm_mul_ps(weight_prev_x4, weight_prev_x4);
Kevin Kofler c87d48
-  const __m128 weight_prev_4th_x4 =
Kevin Kofler c87d48
-      _mm_mul_ps(weight_prev_squared_x4, weight_prev_squared_x4);
Kevin Kofler c87d48
-
Kevin Kofler c87d48
-  // Compute z[n], z[n-1], z[n-2], and z[n-3] in parallel in lanes 3, 2, 1 and
Kevin Kofler c87d48
-  // 0, respectively.
Kevin Kofler c87d48
-  __m128 max_x4 = _mm_setzero_ps();
Kevin Kofler c87d48
-  __m128 ewma_x4 = _mm_setr_ps(0.0f, 0.0f, 0.0f, initial_value);
Kevin Kofler c87d48
-  int i;
Kevin Kofler c87d48
-  for (i = 0; i < last_index; i += 4) {
Kevin Kofler c87d48
-    ewma_x4 = _mm_mul_ps(ewma_x4, weight_prev_4th_x4);
Kevin Kofler c87d48
-    const __m128 sample_x4 = _mm_load_ps(src + i);
Kevin Kofler c87d48
-    const __m128 sample_squared_x4 = _mm_mul_ps(sample_x4, sample_x4);
Kevin Kofler c87d48
-    max_x4 = _mm_max_ps(max_x4, sample_squared_x4);
Kevin Kofler c87d48
-    // Note: The compiler optimizes this to a single multiply-and-accumulate
Kevin Kofler c87d48
-    // instruction:
Kevin Kofler c87d48
-    ewma_x4 = _mm_add_ps(ewma_x4,
Kevin Kofler c87d48
-                         _mm_mul_ps(sample_squared_x4, smoothing_factor_x4));
Kevin Kofler c87d48
-  }
Kevin Kofler c87d48
-
Kevin Kofler c87d48
-  // y[n] = z[n] + (1-a)^1(z[n-1]) + (1-a)^2(z[n-2]) + (1-a)^3(z[n-3])
Kevin Kofler c87d48
-  float ewma = EXTRACT_FLOAT(ewma_x4, 3);
Kevin Kofler c87d48
-  ewma_x4 = _mm_mul_ps(ewma_x4, weight_prev_x4);
Kevin Kofler c87d48
-  ewma += EXTRACT_FLOAT(ewma_x4, 2);
Kevin Kofler c87d48
-  ewma_x4 = _mm_mul_ps(ewma_x4, weight_prev_x4);
Kevin Kofler c87d48
-  ewma += EXTRACT_FLOAT(ewma_x4, 1);
Kevin Kofler c87d48
-  ewma_x4 = _mm_mul_ss(ewma_x4, weight_prev_x4);
Kevin Kofler c87d48
-  ewma += EXTRACT_FLOAT(ewma_x4, 0);
Kevin Kofler c87d48
-
Kevin Kofler c87d48
-  // Fold the maximums together to get the overall maximum.
Kevin Kofler c87d48
-  max_x4 = _mm_max_ps(max_x4,
Kevin Kofler c87d48
-                      _mm_shuffle_ps(max_x4, max_x4, _MM_SHUFFLE(3, 3, 1, 1)));
Kevin Kofler c87d48
-  max_x4 = _mm_max_ss(max_x4, _mm_shuffle_ps(max_x4, max_x4, 2));
Kevin Kofler c87d48
-
Kevin Kofler c87d48
-  std::pair<float, float> result(ewma, EXTRACT_FLOAT(max_x4, 0));
Kevin Kofler c87d48
-
Kevin Kofler c87d48
-  // Handle remaining values at the end of |src|.
Kevin Kofler c87d48
-  for (; i < len; ++i) {
Kevin Kofler c87d48
-    result.first *= weight_prev;
Kevin Kofler c87d48
-    const float sample = src[i];
Kevin Kofler c87d48
-    const float sample_squared = sample * sample;
Kevin Kofler c87d48
-    result.first += sample_squared * smoothing_factor;
Kevin Kofler c87d48
-    result.second = std::max(result.second, sample_squared);
Kevin Kofler c87d48
-  }
Kevin Kofler c87d48
-
Kevin Kofler c87d48
-  return result;
Kevin Kofler c87d48
-}
Kevin Kofler c87d48
-#endif
Kevin Kofler c87d48
-
Kevin Kofler c87d48
 #if defined(ARCH_CPU_ARM_FAMILY) && defined(USE_NEON)
Kevin Kofler c87d48
 void FMAC_NEON(const float src[], float scale, int len, float dest[]) {
Kevin Kofler c87d48
   const int rem = len % 4;
Kevin Kofler c87d48
diff -Nur qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/media/base/vector_math.h qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/media/base/vector_math.h
Kevin Kofler c87d48
--- qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/media/base/vector_math.h	2017-05-18 16:51:44.000000000 +0200
Kevin Kofler c87d48
+++ qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/media/base/vector_math.h	2017-06-08 22:49:57.701253604 +0200
Kevin Kofler c87d48
@@ -15,6 +15,11 @@
Kevin Kofler c87d48
 // Required alignment for inputs and outputs to all vector math functions
Kevin Kofler c87d48
 enum { kRequiredAlignment = 16 };
Kevin Kofler c87d48
 
Kevin Kofler c87d48
+// Selects runtime specific optimizations such as SSE.  Must be called prior to
Kevin Kofler c87d48
+// calling FMAC() or FMUL().  Called during media library initialization; most
Kevin Kofler c87d48
+// users should never have to call this.
Kevin Kofler c87d48
+MEDIA_EXPORT void Initialize();
Kevin Kofler c87d48
+
Kevin Kofler c87d48
 // Multiply each element of |src| (up to |len|) by |scale| and add to |dest|.
Kevin Kofler c87d48
 // |src| and |dest| must be aligned by kRequiredAlignment.
Kevin Kofler c87d48
 MEDIA_EXPORT void FMAC(const float src[], float scale, int len, float dest[]);
Kevin Kofler c87d48
diff -Nur qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/media/base/vector_math_perftest.cc qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/media/base/vector_math_perftest.cc
Kevin Kofler c87d48
--- qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/media/base/vector_math_perftest.cc	2017-05-18 16:51:44.000000000 +0200
Kevin Kofler c87d48
+++ qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/media/base/vector_math_perftest.cc	2017-06-08 22:49:57.702253589 +0200
Kevin Kofler c87d48
@@ -5,6 +5,7 @@
Kevin Kofler c87d48
 #include <memory>
Kevin Kofler c87d48
 
Kevin Kofler c87d48
 #include "base/macros.h"
Kevin Kofler c87d48
+#include "base/cpu.h"
Kevin Kofler c87d48
 #include "base/memory/aligned_memory.h"
Kevin Kofler c87d48
 #include "base/time/time.h"
Kevin Kofler c87d48
 #include "build/build_config.h"
Kevin Kofler c87d48
@@ -82,15 +83,11 @@
Kevin Kofler c87d48
   DISALLOW_COPY_AND_ASSIGN(VectorMathPerfTest);
Kevin Kofler c87d48
 };
Kevin Kofler c87d48
 
Kevin Kofler c87d48
-// Define platform dependent function names for SIMD optimized methods.
Kevin Kofler c87d48
+// Define platform independent function name for FMAC* perf tests.
Kevin Kofler c87d48
 #if defined(ARCH_CPU_X86_FAMILY)
Kevin Kofler c87d48
 #define FMAC_FUNC FMAC_SSE
Kevin Kofler c87d48
-#define FMUL_FUNC FMUL_SSE
Kevin Kofler c87d48
-#define EWMAAndMaxPower_FUNC EWMAAndMaxPower_SSE
Kevin Kofler c87d48
 #elif defined(ARCH_CPU_ARM_FAMILY) && defined(USE_NEON)
Kevin Kofler c87d48
 #define FMAC_FUNC FMAC_NEON
Kevin Kofler c87d48
-#define FMUL_FUNC FMUL_NEON
Kevin Kofler c87d48
-#define EWMAAndMaxPower_FUNC EWMAAndMaxPower_NEON
Kevin Kofler c87d48
 #endif
Kevin Kofler c87d48
 
Kevin Kofler c87d48
 // Benchmark for each optimized vector_math::FMAC() method.
Kevin Kofler c87d48
@@ -99,6 +96,9 @@
Kevin Kofler c87d48
   RunBenchmark(
Kevin Kofler c87d48
       vector_math::FMAC_C, true, "vector_math_fmac", "unoptimized");
Kevin Kofler c87d48
 #if defined(FMAC_FUNC)
Kevin Kofler c87d48
+#if defined(ARCH_CPU_X86_FAMILY)
Kevin Kofler c87d48
+  ASSERT_TRUE(base::CPU().has_sse());
Kevin Kofler c87d48
+#endif
Kevin Kofler c87d48
   // Benchmark FMAC_FUNC() with unaligned size.
Kevin Kofler c87d48
   ASSERT_NE((kVectorSize - 1) % (vector_math::kRequiredAlignment /
Kevin Kofler c87d48
                                  sizeof(float)), 0U);
Kevin Kofler c87d48
@@ -112,12 +112,24 @@
Kevin Kofler c87d48
 #endif
Kevin Kofler c87d48
 }
Kevin Kofler c87d48
 
Kevin Kofler c87d48
+#undef FMAC_FUNC
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+// Define platform independent function name for FMULBenchmark* tests.
Kevin Kofler c87d48
+#if defined(ARCH_CPU_X86_FAMILY)
Kevin Kofler c87d48
+#define FMUL_FUNC FMUL_SSE
Kevin Kofler c87d48
+#elif defined(ARCH_CPU_ARM_FAMILY) && defined(USE_NEON)
Kevin Kofler c87d48
+#define FMUL_FUNC FMUL_NEON
Kevin Kofler c87d48
+#endif
Kevin Kofler c87d48
+
Kevin Kofler c87d48
 // Benchmark for each optimized vector_math::FMUL() method.
Kevin Kofler c87d48
 TEST_F(VectorMathPerfTest, FMUL) {
Kevin Kofler c87d48
   // Benchmark FMUL_C().
Kevin Kofler c87d48
   RunBenchmark(
Kevin Kofler c87d48
       vector_math::FMUL_C, true, "vector_math_fmul", "unoptimized");
Kevin Kofler c87d48
 #if defined(FMUL_FUNC)
Kevin Kofler c87d48
+#if defined(ARCH_CPU_X86_FAMILY)
Kevin Kofler c87d48
+  ASSERT_TRUE(base::CPU().has_sse());
Kevin Kofler c87d48
+#endif
Kevin Kofler c87d48
   // Benchmark FMUL_FUNC() with unaligned size.
Kevin Kofler c87d48
   ASSERT_NE((kVectorSize - 1) % (vector_math::kRequiredAlignment /
Kevin Kofler c87d48
                                  sizeof(float)), 0U);
Kevin Kofler c87d48
@@ -131,6 +143,14 @@
Kevin Kofler c87d48
 #endif
Kevin Kofler c87d48
 }
Kevin Kofler c87d48
 
Kevin Kofler c87d48
+#undef FMUL_FUNC
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+#if defined(ARCH_CPU_X86_FAMILY)
Kevin Kofler c87d48
+#define EWMAAndMaxPower_FUNC EWMAAndMaxPower_SSE
Kevin Kofler c87d48
+#elif defined(ARCH_CPU_ARM_FAMILY) && defined(USE_NEON)
Kevin Kofler c87d48
+#define EWMAAndMaxPower_FUNC EWMAAndMaxPower_NEON
Kevin Kofler c87d48
+#endif
Kevin Kofler c87d48
+
Kevin Kofler c87d48
 // Benchmark for each optimized vector_math::EWMAAndMaxPower() method.
Kevin Kofler c87d48
 TEST_F(VectorMathPerfTest, EWMAAndMaxPower) {
Kevin Kofler c87d48
   // Benchmark EWMAAndMaxPower_C().
Kevin Kofler c87d48
@@ -139,6 +159,9 @@
Kevin Kofler c87d48
                "vector_math_ewma_and_max_power",
Kevin Kofler c87d48
                "unoptimized");
Kevin Kofler c87d48
 #if defined(EWMAAndMaxPower_FUNC)
Kevin Kofler c87d48
+#if defined(ARCH_CPU_X86_FAMILY)
Kevin Kofler c87d48
+  ASSERT_TRUE(base::CPU().has_sse());
Kevin Kofler c87d48
+#endif
Kevin Kofler c87d48
   // Benchmark EWMAAndMaxPower_FUNC() with unaligned size.
Kevin Kofler c87d48
   ASSERT_NE((kVectorSize - 1) % (vector_math::kRequiredAlignment /
Kevin Kofler c87d48
                                  sizeof(float)), 0U);
Kevin Kofler c87d48
@@ -156,4 +179,6 @@
Kevin Kofler c87d48
 #endif
Kevin Kofler c87d48
 }
Kevin Kofler c87d48
 
Kevin Kofler c87d48
+#undef EWMAAndMaxPower_FUNC
Kevin Kofler c87d48
+
Kevin Kofler c87d48
 } // namespace media
Kevin Kofler c87d48
diff -Nur qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/media/base/vector_math_testing.h qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/media/base/vector_math_testing.h
Kevin Kofler c87d48
--- qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/media/base/vector_math_testing.h	2017-05-18 16:51:44.000000000 +0200
Kevin Kofler c87d48
+++ qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/media/base/vector_math_testing.h	2017-06-08 22:49:57.702253589 +0200
Kevin Kofler c87d48
@@ -19,7 +19,7 @@
Kevin Kofler c87d48
 MEDIA_EXPORT std::pair<float, float> EWMAAndMaxPower_C(
Kevin Kofler c87d48
     float initial_value, const float src[], int len, float smoothing_factor);
Kevin Kofler c87d48
 
Kevin Kofler c87d48
-#if defined(ARCH_CPU_X86_FAMILY) && !defined(OS_NACL)
Kevin Kofler c87d48
+#if defined(ARCH_CPU_X86_FAMILY)
Kevin Kofler c87d48
 MEDIA_EXPORT void FMAC_SSE(const float src[], float scale, int len,
Kevin Kofler c87d48
                            float dest[]);
Kevin Kofler c87d48
 MEDIA_EXPORT void FMUL_SSE(const float src[], float scale, int len,
Kevin Kofler c87d48
diff -Nur qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/media/base/vector_math_unittest.cc qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/media/base/vector_math_unittest.cc
Kevin Kofler c87d48
--- qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/media/base/vector_math_unittest.cc	2017-05-18 16:51:44.000000000 +0200
Kevin Kofler c87d48
+++ qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/media/base/vector_math_unittest.cc	2017-06-08 22:49:57.702253589 +0200
Kevin Kofler c87d48
@@ -9,6 +9,7 @@
Kevin Kofler c87d48
 #include <memory>
Kevin Kofler c87d48
 
Kevin Kofler c87d48
 #include "base/macros.h"
Kevin Kofler c87d48
+#include "base/cpu.h"
Kevin Kofler c87d48
 #include "base/memory/aligned_memory.h"
Kevin Kofler c87d48
 #include "base/strings/string_number_conversions.h"
Kevin Kofler c87d48
 #include "base/strings/stringize_macros.h"
Kevin Kofler c87d48
@@ -78,6 +79,7 @@
Kevin Kofler c87d48
 
Kevin Kofler c87d48
 #if defined(ARCH_CPU_X86_FAMILY)
Kevin Kofler c87d48
   {
Kevin Kofler c87d48
+    ASSERT_TRUE(base::CPU().has_sse());
Kevin Kofler c87d48
     SCOPED_TRACE("FMAC_SSE");
Kevin Kofler c87d48
     FillTestVectors(kInputFillValue, kOutputFillValue);
Kevin Kofler c87d48
     vector_math::FMAC_SSE(
Kevin Kofler c87d48
@@ -119,6 +121,7 @@
Kevin Kofler c87d48
 
Kevin Kofler c87d48
 #if defined(ARCH_CPU_X86_FAMILY)
Kevin Kofler c87d48
   {
Kevin Kofler c87d48
+    ASSERT_TRUE(base::CPU().has_sse());
Kevin Kofler c87d48
     SCOPED_TRACE("FMUL_SSE");
Kevin Kofler c87d48
     FillTestVectors(kInputFillValue, kOutputFillValue);
Kevin Kofler c87d48
     vector_math::FMUL_SSE(
Kevin Kofler c87d48
@@ -227,6 +230,7 @@
Kevin Kofler c87d48
 
Kevin Kofler c87d48
 #if defined(ARCH_CPU_X86_FAMILY)
Kevin Kofler c87d48
     {
Kevin Kofler c87d48
+      ASSERT_TRUE(base::CPU().has_sse());
Kevin Kofler c87d48
       SCOPED_TRACE("EWMAAndMaxPower_SSE");
Kevin Kofler c87d48
       const std::pair<float, float>& result = vector_math::EWMAAndMaxPower_SSE(
Kevin Kofler c87d48
           initial_value_, data_.get(), data_len_, smoothing_factor_);
Kevin Kofler c87d48
diff -Nur qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/media/base/yuv_convert.cc qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/media/base/yuv_convert.cc
Kevin Kofler c87d48
--- qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/media/base/yuv_convert.cc	2017-05-18 16:51:44.000000000 +0200
Kevin Kofler c87d48
+++ qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/media/base/yuv_convert.cc	2017-06-08 22:49:57.703253573 +0200
Kevin Kofler c87d48
@@ -32,7 +32,7 @@
Kevin Kofler c87d48
 #include "media/base/simd/convert_yuv_to_rgb.h"
Kevin Kofler c87d48
 #include "media/base/simd/filter_yuv.h"
Kevin Kofler c87d48
 
Kevin Kofler c87d48
-#if defined(ARCH_CPU_X86_FAMILY)
Kevin Kofler c87d48
+#if defined(ARCH_CPU_X86_FAMILY) && defined(__MMX__)
Kevin Kofler c87d48
 #if defined(COMPILER_MSVC)
Kevin Kofler c87d48
 #include <intrin.h>
Kevin Kofler c87d48
 #else
Kevin Kofler c87d48
@@ -133,7 +133,7 @@
Kevin Kofler c87d48
 
Kevin Kofler c87d48
 // Empty SIMD registers state after using them.
Kevin Kofler c87d48
 void EmptyRegisterStateStub() {}
Kevin Kofler c87d48
-#if defined(MEDIA_MMX_INTRINSICS_AVAILABLE)
Kevin Kofler c87d48
+#if defined(MEDIA_MMX_INTRINSICS_AVAILABLE) && defined(__MMX__)
Kevin Kofler c87d48
 void EmptyRegisterStateIntrinsic() { _mm_empty(); }
Kevin Kofler c87d48
 #endif
Kevin Kofler c87d48
 typedef void (*EmptyRegisterStateProc)();
Kevin Kofler c87d48
@@ -247,34 +247,46 @@
Kevin Kofler c87d48
   // Assembly code confuses MemorySanitizer. Also not available in iOS builds.
Kevin Kofler c87d48
 #if defined(ARCH_CPU_X86_FAMILY) && !defined(MEMORY_SANITIZER) && \
Kevin Kofler c87d48
     !defined(OS_IOS)
Kevin Kofler c87d48
-  g_convert_yuva_to_argb_proc_ = ConvertYUVAToARGB_MMX;
Kevin Kofler c87d48
+  base::CPU cpu;
Kevin Kofler c87d48
+  if (cpu.has_mmx()) {
Kevin Kofler c87d48
+    g_convert_yuv_to_rgb32_row_proc_ = ConvertYUVToRGB32Row_MMX;
Kevin Kofler c87d48
+    g_scale_yuv_to_rgb32_row_proc_ = ScaleYUVToRGB32Row_MMX;
Kevin Kofler c87d48
+    g_convert_yuv_to_rgb32_proc_ = ConvertYUVToRGB32_MMX;
Kevin Kofler c87d48
+    g_convert_yuva_to_argb_proc_ = ConvertYUVAToARGB_MMX;
Kevin Kofler c87d48
+    g_linear_scale_yuv_to_rgb32_row_proc_ = LinearScaleYUVToRGB32Row_MMX;
Kevin Kofler c87d48
 
Kevin Kofler c87d48
 #if defined(MEDIA_MMX_INTRINSICS_AVAILABLE)
Kevin Kofler c87d48
-  g_empty_register_state_proc_ = EmptyRegisterStateIntrinsic;
Kevin Kofler c87d48
+    g_filter_yuv_rows_proc_ = FilterYUVRows_MMX;
Kevin Kofler c87d48
+#endif
Kevin Kofler c87d48
+#if defined(MEDIA_MMX_INTRINSICS_AVAILABLE) && defined(__MMX__)
Kevin Kofler c87d48
+    g_empty_register_state_proc_ = EmptyRegisterStateIntrinsic;
Kevin Kofler c87d48
 #else
Kevin Kofler c87d48
-  g_empty_register_state_proc_ = EmptyRegisterState_MMX;
Kevin Kofler c87d48
+    g_empty_register_state_proc_ = EmptyRegisterState_MMX;
Kevin Kofler c87d48
 #endif
Kevin Kofler c87d48
+  }
Kevin Kofler c87d48
 
Kevin Kofler c87d48
-  g_convert_yuv_to_rgb32_row_proc_ = ConvertYUVToRGB32Row_SSE;
Kevin Kofler c87d48
-  g_convert_yuv_to_rgb32_proc_ = ConvertYUVToRGB32_SSE;
Kevin Kofler c87d48
+  if (cpu.has_sse()) {
Kevin Kofler c87d48
+    g_convert_yuv_to_rgb32_row_proc_ = ConvertYUVToRGB32Row_SSE;
Kevin Kofler c87d48
+    g_scale_yuv_to_rgb32_row_proc_ = ScaleYUVToRGB32Row_SSE;
Kevin Kofler c87d48
+    g_linear_scale_yuv_to_rgb32_row_proc_ = LinearScaleYUVToRGB32Row_SSE;
Kevin Kofler c87d48
+    g_convert_yuv_to_rgb32_proc_ = ConvertYUVToRGB32_SSE;
Kevin Kofler c87d48
+  }
Kevin Kofler c87d48
 
Kevin Kofler c87d48
-  g_filter_yuv_rows_proc_ = FilterYUVRows_SSE2;
Kevin Kofler c87d48
-  g_convert_rgb32_to_yuv_proc_ = ConvertRGB32ToYUV_SSE2;
Kevin Kofler c87d48
+  if (cpu.has_sse2()) {
Kevin Kofler c87d48
+    g_filter_yuv_rows_proc_ = FilterYUVRows_SSE2;
Kevin Kofler c87d48
+    g_convert_rgb32_to_yuv_proc_ = ConvertRGB32ToYUV_SSE2;
Kevin Kofler c87d48
 
Kevin Kofler c87d48
 #if defined(ARCH_CPU_X86_64)
Kevin Kofler c87d48
-  g_scale_yuv_to_rgb32_row_proc_ = ScaleYUVToRGB32Row_SSE2_X64;
Kevin Kofler c87d48
+    g_scale_yuv_to_rgb32_row_proc_ = ScaleYUVToRGB32Row_SSE2_X64;
Kevin Kofler c87d48
 
Kevin Kofler c87d48
-  // Technically this should be in the MMX section, but MSVC will optimize out
Kevin Kofler c87d48
-  // the export of LinearScaleYUVToRGB32Row_MMX, which is required by the unit
Kevin Kofler c87d48
-  // tests, if that decision can be made at compile time.  Since all X64 CPUs
Kevin Kofler c87d48
-  // have SSE2, we can hack around this by making the selection here.
Kevin Kofler c87d48
-  g_linear_scale_yuv_to_rgb32_row_proc_ = LinearScaleYUVToRGB32Row_MMX_X64;
Kevin Kofler c87d48
-#else
Kevin Kofler c87d48
-  g_scale_yuv_to_rgb32_row_proc_ = ScaleYUVToRGB32Row_SSE;
Kevin Kofler c87d48
-  g_linear_scale_yuv_to_rgb32_row_proc_ = LinearScaleYUVToRGB32Row_SSE;
Kevin Kofler c87d48
+    // Technically this should be in the MMX section, but MSVC will optimize out
Kevin Kofler c87d48
+    // the export of LinearScaleYUVToRGB32Row_MMX, which is required by the unit
Kevin Kofler c87d48
+    // tests, if that decision can be made at compile time.  Since all X64 CPUs
Kevin Kofler c87d48
+    // have SSE2, we can hack around this by making the selection here.
Kevin Kofler c87d48
+    g_linear_scale_yuv_to_rgb32_row_proc_ = LinearScaleYUVToRGB32Row_MMX_X64;
Kevin Kofler c87d48
 #endif
Kevin Kofler c87d48
+  }
Kevin Kofler c87d48
 
Kevin Kofler c87d48
-  base::CPU cpu;
Kevin Kofler c87d48
   if (cpu.has_ssse3()) {
Kevin Kofler c87d48
     g_convert_rgb24_to_yuv_proc_ = &ConvertRGB24ToYUV_SSSE3;
Kevin Kofler c87d48
 
Kevin Kofler c87d48
diff -Nur qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/media/base/yuv_convert_perftest.cc qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/media/base/yuv_convert_perftest.cc
Kevin Kofler c87d48
--- qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/media/base/yuv_convert_perftest.cc	2017-05-18 16:51:44.000000000 +0200
Kevin Kofler c87d48
+++ qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/media/base/yuv_convert_perftest.cc	2017-06-08 22:49:57.703253573 +0200
Kevin Kofler c87d48
@@ -71,6 +71,29 @@
Kevin Kofler c87d48
   DISALLOW_COPY_AND_ASSIGN(YUVConvertPerfTest);
Kevin Kofler c87d48
 };
Kevin Kofler c87d48
 
Kevin Kofler c87d48
+TEST_F(YUVConvertPerfTest, ConvertYUVToRGB32Row_MMX) {
Kevin Kofler c87d48
+  ASSERT_TRUE(base::CPU().has_mmx());
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+  base::TimeTicks start = base::TimeTicks::Now();
Kevin Kofler c87d48
+  for (int i = 0; i < kPerfTestIterations; ++i) {
Kevin Kofler c87d48
+    for (int row = 0; row < kSourceHeight; ++row) {
Kevin Kofler c87d48
+      int chroma_row = row / 2;
Kevin Kofler c87d48
+      ConvertYUVToRGB32Row_MMX(
Kevin Kofler c87d48
+          yuv_bytes_.get() + row * kSourceWidth,
Kevin Kofler c87d48
+          yuv_bytes_.get() + kSourceUOffset + (chroma_row * kSourceWidth / 2),
Kevin Kofler c87d48
+          yuv_bytes_.get() + kSourceVOffset + (chroma_row * kSourceWidth / 2),
Kevin Kofler c87d48
+          rgb_bytes_converted_.get(),
Kevin Kofler c87d48
+          kWidth,
Kevin Kofler c87d48
+          GetLookupTable(YV12));
Kevin Kofler c87d48
+    }
Kevin Kofler c87d48
+  }
Kevin Kofler c87d48
+  media::EmptyRegisterState();
Kevin Kofler c87d48
+  double total_time_seconds = (base::TimeTicks::Now() - start).InSecondsF();
Kevin Kofler c87d48
+  perf_test::PrintResult(
Kevin Kofler c87d48
+      "yuv_convert_perftest", "", "ConvertYUVToRGB32Row_MMX",
Kevin Kofler c87d48
+      kPerfTestIterations / total_time_seconds, "runs/s", true);
Kevin Kofler c87d48
+}
Kevin Kofler c87d48
+
Kevin Kofler c87d48
 TEST_F(YUVConvertPerfTest, ConvertYUVToRGB32Row_SSE) {
Kevin Kofler c87d48
   ASSERT_TRUE(base::CPU().has_sse());
Kevin Kofler c87d48
 
Kevin Kofler c87d48
@@ -161,9 +184,32 @@
Kevin Kofler c87d48
 }
Kevin Kofler c87d48
 #endif
Kevin Kofler c87d48
 
Kevin Kofler c87d48
-// 64-bit release + component builds on Windows are too smart and optimizes
Kevin Kofler c87d48
-// away the function being tested.
Kevin Kofler c87d48
-#if defined(OS_WIN) && (defined(ARCH_CPU_X86) || !defined(COMPONENT_BUILD))
Kevin Kofler c87d48
+TEST_F(YUVConvertPerfTest, ScaleYUVToRGB32Row_MMX) {
Kevin Kofler c87d48
+  ASSERT_TRUE(base::CPU().has_mmx());
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+  const int kSourceDx = 80000;  // This value means a scale down.
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+  base::TimeTicks start = base::TimeTicks::Now();
Kevin Kofler c87d48
+  for (int i = 0; i < kPerfTestIterations; ++i) {
Kevin Kofler c87d48
+    for (int row = 0; row < kSourceHeight; ++row) {
Kevin Kofler c87d48
+      int chroma_row = row / 2;
Kevin Kofler c87d48
+      ScaleYUVToRGB32Row_MMX(
Kevin Kofler c87d48
+          yuv_bytes_.get() + row * kSourceWidth,
Kevin Kofler c87d48
+          yuv_bytes_.get() + kSourceUOffset + (chroma_row * kSourceWidth / 2),
Kevin Kofler c87d48
+          yuv_bytes_.get() + kSourceVOffset + (chroma_row * kSourceWidth / 2),
Kevin Kofler c87d48
+          rgb_bytes_converted_.get(),
Kevin Kofler c87d48
+          kWidth,
Kevin Kofler c87d48
+          kSourceDx,
Kevin Kofler c87d48
+          GetLookupTable(YV12));
Kevin Kofler c87d48
+    }
Kevin Kofler c87d48
+  }
Kevin Kofler c87d48
+  media::EmptyRegisterState();
Kevin Kofler c87d48
+  double total_time_seconds = (base::TimeTicks::Now() - start).InSecondsF();
Kevin Kofler c87d48
+  perf_test::PrintResult(
Kevin Kofler c87d48
+      "yuv_convert_perftest", "", "ScaleYUVToRGB32Row_MMX",
Kevin Kofler c87d48
+      kPerfTestIterations / total_time_seconds, "runs/s", true);
Kevin Kofler c87d48
+}
Kevin Kofler c87d48
+
Kevin Kofler c87d48
 TEST_F(YUVConvertPerfTest, ScaleYUVToRGB32Row_SSE) {
Kevin Kofler c87d48
   ASSERT_TRUE(base::CPU().has_sse());
Kevin Kofler c87d48
 
Kevin Kofler c87d48
@@ -190,6 +236,32 @@
Kevin Kofler c87d48
       kPerfTestIterations / total_time_seconds, "runs/s", true);
Kevin Kofler c87d48
 }
Kevin Kofler c87d48
 
Kevin Kofler c87d48
+TEST_F(YUVConvertPerfTest, LinearScaleYUVToRGB32Row_MMX) {
Kevin Kofler c87d48
+  ASSERT_TRUE(base::CPU().has_mmx());
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+  const int kSourceDx = 80000;  // This value means a scale down.
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+  base::TimeTicks start = base::TimeTicks::Now();
Kevin Kofler c87d48
+  for (int i = 0; i < kPerfTestIterations; ++i) {
Kevin Kofler c87d48
+    for (int row = 0; row < kSourceHeight; ++row) {
Kevin Kofler c87d48
+      int chroma_row = row / 2;
Kevin Kofler c87d48
+      LinearScaleYUVToRGB32Row_MMX(
Kevin Kofler c87d48
+          yuv_bytes_.get() + row * kSourceWidth,
Kevin Kofler c87d48
+          yuv_bytes_.get() + kSourceUOffset + (chroma_row * kSourceWidth / 2),
Kevin Kofler c87d48
+          yuv_bytes_.get() + kSourceVOffset + (chroma_row * kSourceWidth / 2),
Kevin Kofler c87d48
+          rgb_bytes_converted_.get(),
Kevin Kofler c87d48
+          kWidth,
Kevin Kofler c87d48
+          kSourceDx,
Kevin Kofler c87d48
+          GetLookupTable(YV12));
Kevin Kofler c87d48
+    }
Kevin Kofler c87d48
+  }
Kevin Kofler c87d48
+  media::EmptyRegisterState();
Kevin Kofler c87d48
+  double total_time_seconds = (base::TimeTicks::Now() - start).InSecondsF();
Kevin Kofler c87d48
+  perf_test::PrintResult(
Kevin Kofler c87d48
+      "yuv_convert_perftest", "", "LinearScaleYUVToRGB32Row_MMX",
Kevin Kofler c87d48
+      kPerfTestIterations / total_time_seconds, "runs/s", true);
Kevin Kofler c87d48
+}
Kevin Kofler c87d48
+
Kevin Kofler c87d48
 TEST_F(YUVConvertPerfTest, LinearScaleYUVToRGB32Row_SSE) {
Kevin Kofler c87d48
   ASSERT_TRUE(base::CPU().has_sse());
Kevin Kofler c87d48
 
Kevin Kofler c87d48
@@ -215,7 +287,6 @@
Kevin Kofler c87d48
       "yuv_convert_perftest", "", "LinearScaleYUVToRGB32Row_SSE",
Kevin Kofler c87d48
       kPerfTestIterations / total_time_seconds, "runs/s", true);
Kevin Kofler c87d48
 }
Kevin Kofler c87d48
-#endif  // defined(OS_WIN) && (ARCH_CPU_X86 || COMPONENT_BUILD)
Kevin Kofler c87d48
 
Kevin Kofler c87d48
 #endif  // !defined(ARCH_CPU_ARM_FAMILY) && !defined(ARCH_CPU_MIPS_FAMILY)
Kevin Kofler c87d48
 
Kevin Kofler c87d48
diff -Nur qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/media/base/yuv_convert_unittest.cc qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/media/base/yuv_convert_unittest.cc
Kevin Kofler c87d48
--- qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/media/base/yuv_convert_unittest.cc	2017-05-18 16:51:44.000000000 +0200
Kevin Kofler c87d48
+++ qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/media/base/yuv_convert_unittest.cc	2017-06-08 22:49:57.703253573 +0200
Kevin Kofler c87d48
@@ -643,6 +643,37 @@
Kevin Kofler c87d48
   EXPECT_EQ(0, error);
Kevin Kofler c87d48
 }
Kevin Kofler c87d48
 
Kevin Kofler c87d48
+TEST(YUVConvertTest, ConvertYUVToRGB32Row_MMX) {
Kevin Kofler c87d48
+  base::CPU cpu;
Kevin Kofler c87d48
+  if (!cpu.has_mmx()) {
Kevin Kofler c87d48
+    LOG(WARNING) << "System not supported. Test skipped.";
Kevin Kofler c87d48
+    return;
Kevin Kofler c87d48
+  }
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+  scoped_ptr<uint8[]> yuv_bytes(new uint8[kYUV12Size]);
Kevin Kofler c87d48
+  scoped_ptr<uint8[]> rgb_bytes_reference(new uint8[kRGBSize]);
Kevin Kofler c87d48
+  scoped_ptr<uint8[]> rgb_bytes_converted(new uint8[kRGBSize]);
Kevin Kofler c87d48
+  ReadYV12Data(&yuv_bytes);
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+  const int kWidth = 167;
Kevin Kofler c87d48
+  ConvertYUVToRGB32Row_C(yuv_bytes.get(),
Kevin Kofler c87d48
+                         yuv_bytes.get() + kSourceUOffset,
Kevin Kofler c87d48
+                         yuv_bytes.get() + kSourceVOffset,
Kevin Kofler c87d48
+                         rgb_bytes_reference.get(),
Kevin Kofler c87d48
+                         kWidth,
Kevin Kofler c87d48
+                         GetLookupTable(YV12));
Kevin Kofler c87d48
+  ConvertYUVToRGB32Row_MMX(yuv_bytes.get(),
Kevin Kofler c87d48
+                           yuv_bytes.get() + kSourceUOffset,
Kevin Kofler c87d48
+                           yuv_bytes.get() + kSourceVOffset,
Kevin Kofler c87d48
+                           rgb_bytes_converted.get(),
Kevin Kofler c87d48
+                           kWidth,
Kevin Kofler c87d48
+                           GetLookupTable(YV12));
Kevin Kofler c87d48
+  media::EmptyRegisterState();
Kevin Kofler c87d48
+  EXPECT_EQ(0, memcmp(rgb_bytes_reference.get(),
Kevin Kofler c87d48
+                      rgb_bytes_converted.get(),
Kevin Kofler c87d48
+                      kWidth * kBpp));
Kevin Kofler c87d48
+}
Kevin Kofler c87d48
+
Kevin Kofler c87d48
 TEST(YUVConvertTest, ConvertYUVToRGB32Row_SSE) {
Kevin Kofler c87d48
   base::CPU cpu;
Kevin Kofler c87d48
   if (!cpu.has_sse()) {
Kevin Kofler c87d48
@@ -674,9 +705,40 @@
Kevin Kofler c87d48
                       kWidth * kBpp));
Kevin Kofler c87d48
 }
Kevin Kofler c87d48
 
Kevin Kofler c87d48
-// 64-bit release + component builds on Windows are too smart and optimizes
Kevin Kofler c87d48
-// away the function being tested.
Kevin Kofler c87d48
-#if defined(OS_WIN) && (defined(ARCH_CPU_X86) || !defined(COMPONENT_BUILD))
Kevin Kofler c87d48
+TEST(YUVConvertTest, ScaleYUVToRGB32Row_MMX) {
Kevin Kofler c87d48
+  base::CPU cpu;
Kevin Kofler c87d48
+  if (!cpu.has_mmx()) {
Kevin Kofler c87d48
+    LOG(WARNING) << "System not supported. Test skipped.";
Kevin Kofler c87d48
+    return;
Kevin Kofler c87d48
+  }
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+  scoped_ptr<uint8[]> yuv_bytes(new uint8[kYUV12Size]);
Kevin Kofler c87d48
+  scoped_ptr<uint8[]> rgb_bytes_reference(new uint8[kRGBSize]);
Kevin Kofler c87d48
+  scoped_ptr<uint8[]> rgb_bytes_converted(new uint8[kRGBSize]);
Kevin Kofler c87d48
+  ReadYV12Data(&yuv_bytes);
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+  const int kWidth = 167;
Kevin Kofler c87d48
+  const int kSourceDx = 80000;  // This value means a scale down.
Kevin Kofler c87d48
+  ScaleYUVToRGB32Row_C(yuv_bytes.get(),
Kevin Kofler c87d48
+                       yuv_bytes.get() + kSourceUOffset,
Kevin Kofler c87d48
+                       yuv_bytes.get() + kSourceVOffset,
Kevin Kofler c87d48
+                       rgb_bytes_reference.get(),
Kevin Kofler c87d48
+                       kWidth,
Kevin Kofler c87d48
+                       kSourceDx,
Kevin Kofler c87d48
+                       GetLookupTable(YV12));
Kevin Kofler c87d48
+  ScaleYUVToRGB32Row_MMX(yuv_bytes.get(),
Kevin Kofler c87d48
+                         yuv_bytes.get() + kSourceUOffset,
Kevin Kofler c87d48
+                         yuv_bytes.get() + kSourceVOffset,
Kevin Kofler c87d48
+                         rgb_bytes_converted.get(),
Kevin Kofler c87d48
+                         kWidth,
Kevin Kofler c87d48
+                         kSourceDx,
Kevin Kofler c87d48
+                         GetLookupTable(YV12));
Kevin Kofler c87d48
+  media::EmptyRegisterState();
Kevin Kofler c87d48
+  EXPECT_EQ(0, memcmp(rgb_bytes_reference.get(),
Kevin Kofler c87d48
+                      rgb_bytes_converted.get(),
Kevin Kofler c87d48
+                      kWidth * kBpp));
Kevin Kofler c87d48
+}
Kevin Kofler c87d48
+
Kevin Kofler c87d48
 TEST(YUVConvertTest, ScaleYUVToRGB32Row_SSE) {
Kevin Kofler c87d48
   base::CPU cpu;
Kevin Kofler c87d48
   if (!cpu.has_sse()) {
Kevin Kofler c87d48
@@ -711,6 +773,40 @@
Kevin Kofler c87d48
                       kWidth * kBpp));
Kevin Kofler c87d48
 }
Kevin Kofler c87d48
 
Kevin Kofler c87d48
+TEST(YUVConvertTest, LinearScaleYUVToRGB32Row_MMX) {
Kevin Kofler c87d48
+  base::CPU cpu;
Kevin Kofler c87d48
+  if (!cpu.has_mmx()) {
Kevin Kofler c87d48
+    LOG(WARNING) << "System not supported. Test skipped.";
Kevin Kofler c87d48
+    return;
Kevin Kofler c87d48
+  }
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+  scoped_ptr<uint8[]> yuv_bytes(new uint8[kYUV12Size]);
Kevin Kofler c87d48
+  scoped_ptr<uint8[]> rgb_bytes_reference(new uint8[kRGBSize]);
Kevin Kofler c87d48
+  scoped_ptr<uint8[]> rgb_bytes_converted(new uint8[kRGBSize]);
Kevin Kofler c87d48
+  ReadYV12Data(&yuv_bytes);
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+  const int kWidth = 167;
Kevin Kofler c87d48
+  const int kSourceDx = 80000;  // This value means a scale down.
Kevin Kofler c87d48
+  LinearScaleYUVToRGB32Row_C(yuv_bytes.get(),
Kevin Kofler c87d48
+                             yuv_bytes.get() + kSourceUOffset,
Kevin Kofler c87d48
+                             yuv_bytes.get() + kSourceVOffset,
Kevin Kofler c87d48
+                             rgb_bytes_reference.get(),
Kevin Kofler c87d48
+                             kWidth,
Kevin Kofler c87d48
+                             kSourceDx,
Kevin Kofler c87d48
+                             GetLookupTable(YV12));
Kevin Kofler c87d48
+  LinearScaleYUVToRGB32Row_MMX(yuv_bytes.get(),
Kevin Kofler c87d48
+                               yuv_bytes.get() + kSourceUOffset,
Kevin Kofler c87d48
+                               yuv_bytes.get() + kSourceVOffset,
Kevin Kofler c87d48
+                               rgb_bytes_converted.get(),
Kevin Kofler c87d48
+                               kWidth,
Kevin Kofler c87d48
+                               kSourceDx,
Kevin Kofler c87d48
+                               GetLookupTable(YV12));
Kevin Kofler c87d48
+  media::EmptyRegisterState();
Kevin Kofler c87d48
+  EXPECT_EQ(0, memcmp(rgb_bytes_reference.get(),
Kevin Kofler c87d48
+                      rgb_bytes_converted.get(),
Kevin Kofler c87d48
+                      kWidth * kBpp));
Kevin Kofler c87d48
+}
Kevin Kofler c87d48
+
Kevin Kofler c87d48
 TEST(YUVConvertTest, LinearScaleYUVToRGB32Row_SSE) {
Kevin Kofler c87d48
   base::CPU cpu;
Kevin Kofler c87d48
   if (!cpu.has_sse()) {
Kevin Kofler c87d48
@@ -744,7 +840,6 @@
Kevin Kofler c87d48
                       rgb_bytes_converted.get(),
Kevin Kofler c87d48
                       kWidth * kBpp));
Kevin Kofler c87d48
 }
Kevin Kofler c87d48
-#endif  // defined(OS_WIN) && (ARCH_CPU_X86 || COMPONENT_BUILD)
Kevin Kofler c87d48
 
Kevin Kofler c87d48
 TEST(YUVConvertTest, FilterYUVRows_C_OutOfBounds) {
Kevin Kofler c87d48
   std::unique_ptr<uint8_t[]> src(new uint8_t[16]);
Kevin Kofler c87d48
@@ -761,6 +856,30 @@
Kevin Kofler c87d48
   }
Kevin Kofler c87d48
 }
Kevin Kofler c87d48
 
Kevin Kofler c87d48
+#if defined(MEDIA_MMX_INTRINSICS_AVAILABLE)
Kevin Kofler c87d48
+TEST(YUVConvertTest, FilterYUVRows_MMX_OutOfBounds) {
Kevin Kofler c87d48
+  base::CPU cpu;
Kevin Kofler c87d48
+  if (!cpu.has_mmx()) {
Kevin Kofler c87d48
+    LOG(WARNING) << "System not supported. Test skipped.";
Kevin Kofler c87d48
+    return;
Kevin Kofler c87d48
+  }
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+  scoped_ptr<uint8[]> src(new uint8[16]);
Kevin Kofler c87d48
+  scoped_ptr<uint8[]> dst(new uint8[16]);
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+  memset(src.get(), 0xff, 16);
Kevin Kofler c87d48
+  memset(dst.get(), 0, 16);
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+  media::FilterYUVRows_MMX(dst.get(), src.get(), src.get(), 1, 255);
Kevin Kofler c87d48
+  media::EmptyRegisterState();
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+  EXPECT_EQ(255u, dst[0]);
Kevin Kofler c87d48
+  for (int i = 1; i < 16; ++i) {
Kevin Kofler c87d48
+    EXPECT_EQ(0u, dst[i]);
Kevin Kofler c87d48
+  }
Kevin Kofler c87d48
+}
Kevin Kofler c87d48
+#endif  // defined(MEDIA_MMX_INTRINSICS_AVAILABLE)
Kevin Kofler c87d48
+
Kevin Kofler c87d48
 TEST(YUVConvertTest, FilterYUVRows_SSE2_OutOfBounds) {
Kevin Kofler c87d48
   base::CPU cpu;
Kevin Kofler c87d48
   if (!cpu.has_sse2()) {
Kevin Kofler c87d48
@@ -782,6 +901,38 @@
Kevin Kofler c87d48
   }
Kevin Kofler c87d48
 }
Kevin Kofler c87d48
 
Kevin Kofler c87d48
+#if defined(MEDIA_MMX_INTRINSICS_AVAILABLE)
Kevin Kofler c87d48
+TEST(YUVConvertTest, FilterYUVRows_MMX_UnalignedDestination) {
Kevin Kofler c87d48
+  base::CPU cpu;
Kevin Kofler c87d48
+  if (!cpu.has_mmx()) {
Kevin Kofler c87d48
+    LOG(WARNING) << "System not supported. Test skipped.";
Kevin Kofler c87d48
+    return;
Kevin Kofler c87d48
+  }
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+  const int kSize = 32;
Kevin Kofler c87d48
+  scoped_ptr<uint8[]> src(new uint8[kSize]);
Kevin Kofler c87d48
+  scoped_ptr<uint8[]> dst_sample(new uint8[kSize]);
Kevin Kofler c87d48
+  scoped_ptr<uint8[]> dst(new uint8[kSize]);
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+  memset(dst_sample.get(), 0, kSize);
Kevin Kofler c87d48
+  memset(dst.get(), 0, kSize);
Kevin Kofler c87d48
+  for (int i = 0; i < kSize; ++i)
Kevin Kofler c87d48
+    src[i] = 100 + i;
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+  media::FilterYUVRows_C(dst_sample.get(),
Kevin Kofler c87d48
+                         src.get(), src.get(), 17, 128);
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+  // Generate an unaligned output address.
Kevin Kofler c87d48
+  uint8* dst_ptr =
Kevin Kofler c87d48
+      reinterpret_cast<uint8*>(
Kevin Kofler c87d48
+          (reinterpret_cast<uintptr_t>(dst.get() + 8) & ~7) + 1);
Kevin Kofler c87d48
+  media::FilterYUVRows_MMX(dst_ptr, src.get(), src.get(), 17, 128);
Kevin Kofler c87d48
+  media::EmptyRegisterState();
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+  EXPECT_EQ(0, memcmp(dst_sample.get(), dst_ptr, 17));
Kevin Kofler c87d48
+}
Kevin Kofler c87d48
+#endif  // defined(MEDIA_MMX_INTRINSICS_AVAILABLE)
Kevin Kofler c87d48
+
Kevin Kofler c87d48
 TEST(YUVConvertTest, FilterYUVRows_SSE2_UnalignedDestination) {
Kevin Kofler c87d48
   base::CPU cpu;
Kevin Kofler c87d48
   if (!cpu.has_sse2()) {
Kevin Kofler c87d48
diff -Nur qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/media/BUILD.gn qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/media/BUILD.gn
Kevin Kofler c87d48
--- qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/media/BUILD.gn	2017-05-18 16:51:44.000000000 +0200
Kevin Kofler c87d48
+++ qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/media/BUILD.gn	2017-06-08 22:49:57.704253558 +0200
Kevin Kofler c87d48
@@ -832,6 +832,26 @@
Kevin Kofler c87d48
     "//base",
Kevin Kofler c87d48
     "//ui/gfx/geometry",
Kevin Kofler c87d48
   ]
Kevin Kofler c87d48
+  if (current_cpu == "x86" || current_cpu == "x64") {
Kevin Kofler c87d48
+    deps += [
Kevin Kofler c87d48
+      ":shared_memory_support_sse",
Kevin Kofler c87d48
+    ]
Kevin Kofler c87d48
+  }
Kevin Kofler c87d48
+}
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+if (current_cpu == "x86" || current_cpu == "x64") {
Kevin Kofler c87d48
+  source_set("shared_memory_support_sse") {
Kevin Kofler c87d48
+    sources = [
Kevin Kofler c87d48
+      "base/simd/vector_math_sse.cc",
Kevin Kofler c87d48
+    ]
Kevin Kofler c87d48
+    configs += [
Kevin Kofler c87d48
+      "//media:media_config",
Kevin Kofler c87d48
+      "//media:media_implementation",
Kevin Kofler c87d48
+    ]
Kevin Kofler c87d48
+    if (!is_win) {
Kevin Kofler c87d48
+      cflags = [ "-msse" ]
Kevin Kofler c87d48
+    }
Kevin Kofler c87d48
+  }
Kevin Kofler c87d48
 }
Kevin Kofler c87d48
 
Kevin Kofler c87d48
 # TODO(watk): Refactor tests that could be made to run on Android. See
Kevin Kofler 4182a4
diff -Nur qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/media/filters/wsola_internals.cc qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/media/filters/wsola_internals.cc
Kevin Kofler 4182a4
--- qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/media/filters/wsola_internals.cc	2017-05-18 16:51:44.000000000 +0200
Kevin Kofler 4182a4
+++ qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/media/filters/wsola_internals.cc	2017-06-12 12:30:26.903281839 +0200
Kevin Kofler 4182a4
@@ -15,7 +15,7 @@
Kevin Kofler 4182a4
 #include "base/logging.h"
Kevin Kofler 4182a4
 #include "media/base/audio_bus.h"
Kevin Kofler 4182a4
 
Kevin Kofler 4182a4
-#if defined(ARCH_CPU_X86_FAMILY)
Kevin Kofler 4182a4
+#if defined(ARCH_CPU_X86_FAMILY) && defined(__SSE2__)
Kevin Kofler 4182a4
 #define USE_SIMD 1
Kevin Kofler 4182a4
 #include <xmmintrin.h>
Kevin Kofler 4182a4
 #elif defined(ARCH_CPU_ARM_FAMILY) && defined(USE_NEON)
Kevin Kofler c87d48
diff -Nur qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/skia/BUILD.gn qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/skia/BUILD.gn
Kevin Kofler c87d48
--- qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/skia/BUILD.gn	2017-05-18 16:51:44.000000000 +0200
Kevin Kofler a6e428
+++ qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/skia/BUILD.gn	2017-06-11 12:15:56.825339699 +0200
Kevin Kofler c87d48
@@ -231,11 +231,6 @@
Kevin Kofler c87d48
   if (!is_ios) {
Kevin Kofler c87d48
     sources += [ "ext/platform_canvas.cc" ]
Kevin Kofler c87d48
   }
Kevin Kofler c87d48
-  if (!is_ios && (current_cpu == "x86" || current_cpu == "x64")) {
Kevin Kofler c87d48
-    sources += [ "ext/convolver_SSE2.cc" ]
Kevin Kofler c87d48
-  } else if (current_cpu == "mipsel" && mips_dsp_rev >= 2) {
Kevin Kofler c87d48
-    sources += [ "ext/convolver_mips_dspr2.cc" ]
Kevin Kofler c87d48
-  }
Kevin Kofler c87d48
 
Kevin Kofler c87d48
   # The skia gypi values are relative to the skia_dir, so we need to rebase.
Kevin Kofler c87d48
   sources += skia_core_sources
Kevin Kofler a6e428
@@ -500,6 +495,31 @@
Kevin Kofler a6e428
     }
Kevin Kofler a6e428
   }
Kevin Kofler a6e428
   if (current_cpu == "x86" || current_cpu == "x64") {
Kevin Kofler a6e428
+    source_set("skia_opts_sse2") {
Kevin Kofler a6e428
+      sources = skia_opts.sse2_sources +
Kevin Kofler a6e428
+                [
Kevin Kofler a6e428
+                  # Chrome-specific.
Kevin Kofler a6e428
+                  "ext/convolver_SSE2.cc",
Kevin Kofler a6e428
+                  "ext/convolver_SSE2.h",
Kevin Kofler a6e428
+                ]
Kevin Kofler a6e428
+      sources -= [
Kevin Kofler a6e428
+        # Detection code must not be built with -msse2
Kevin Kofler a6e428
+        "//third_party/skia/src/opts/opts_check_x86.cpp",
Kevin Kofler a6e428
+      ]
Kevin Kofler a6e428
+      if (!is_win || is_clang) {
Kevin Kofler a6e428
+        cflags = [ "-msse2" ]
Kevin Kofler a6e428
+      }
Kevin Kofler a6e428
+      if (is_win) {
Kevin Kofler a6e428
+        defines = [ "SK_CPU_SSE_LEVEL=20" ]
Kevin Kofler a6e428
+      }
Kevin Kofler a6e428
+      visibility = [ ":skia_opts" ]
Kevin Kofler a6e428
+      configs -= [ "//build/config/compiler:chromium_code" ]
Kevin Kofler a6e428
+      configs += [
Kevin Kofler a6e428
+        ":skia_config",
Kevin Kofler a6e428
+        ":skia_library_config",
Kevin Kofler a6e428
+        "//build/config/compiler:no_chromium_code",
Kevin Kofler a6e428
+      ]
Kevin Kofler a6e428
+    }
Kevin Kofler a6e428
     source_set("skia_opts_sse3") {
Kevin Kofler a6e428
       sources = skia_opts.ssse3_sources
Kevin Kofler a6e428
       if (!is_win || is_clang) {
Kevin Kofler a6e428
@@ -608,10 +628,13 @@
Kevin Kofler c87d48
   if (skia_build_no_opts) {
Kevin Kofler c87d48
     sources = skia_opts.none_sources
Kevin Kofler c87d48
   } else if (current_cpu == "x86" || current_cpu == "x64") {
Kevin Kofler c87d48
-    sources = skia_opts.sse2_sources
Kevin Kofler a6e428
+    sources = [
Kevin Kofler a6e428
+      "//third_party/skia/src/opts/opts_check_x86.cpp",
Kevin Kofler a6e428
+    ]
Kevin Kofler c87d48
     deps += [
Kevin Kofler c87d48
       ":skia_opts_avx",
Kevin Kofler c87d48
       ":skia_opts_hsw",
Kevin Kofler a6e428
+      ":skia_opts_sse2",
Kevin Kofler a6e428
       ":skia_opts_sse3",
Kevin Kofler a6e428
       ":skia_opts_sse41",
Kevin Kofler a6e428
       ":skia_opts_sse42",
Kevin Kofler a6e428
@@ -644,6 +667,13 @@
Kevin Kofler c87d48
 
Kevin Kofler c87d48
     if (mips_dsp_rev >= 1) {
Kevin Kofler c87d48
       sources = skia_opts.mips_dsp_sources
Kevin Kofler c87d48
+      if (mips_dsp_rev >= 2) {
Kevin Kofler c87d48
+        sources += [
Kevin Kofler c87d48
+          # Chrome-specific.
Kevin Kofler c87d48
+          "ext/convolver_mips_dspr2.cc",
Kevin Kofler c87d48
+          "ext/convolver_mips_dspr2.h",
Kevin Kofler c87d48
+        ]
Kevin Kofler c87d48
+      }
Kevin Kofler c87d48
     } else {
Kevin Kofler c87d48
       sources = skia_opts.none_sources
Kevin Kofler c87d48
     }
Kevin Kofler c87d48
diff -Nur qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/skia/ext/convolver.cc qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/skia/ext/convolver.cc
Kevin Kofler c87d48
--- qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/skia/ext/convolver.cc	2017-05-18 16:51:44.000000000 +0200
Kevin Kofler c87d48
+++ qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/skia/ext/convolver.cc	2017-06-08 22:50:00.933204857 +0200
Kevin Kofler c87d48
@@ -362,10 +362,13 @@
Kevin Kofler c87d48
 
Kevin Kofler c87d48
 void SetupSIMD(ConvolveProcs *procs) {
Kevin Kofler c87d48
 #ifdef SIMD_SSE2
Kevin Kofler c87d48
-  procs->extra_horizontal_reads = 3;
Kevin Kofler c87d48
-  procs->convolve_vertically = &ConvolveVertically_SSE2;
Kevin Kofler c87d48
-  procs->convolve_4rows_horizontally = &Convolve4RowsHorizontally_SSE2;
Kevin Kofler c87d48
-  procs->convolve_horizontally = &ConvolveHorizontally_SSE2;
Kevin Kofler c87d48
+  base::CPU cpu;
Kevin Kofler c87d48
+  if (cpu.has_sse2()) {
Kevin Kofler c87d48
+    procs->extra_horizontal_reads = 3;
Kevin Kofler c87d48
+    procs->convolve_vertically = &ConvolveVertically_SSE2;
Kevin Kofler c87d48
+    procs->convolve_4rows_horizontally = &Convolve4RowsHorizontally_SSE2;
Kevin Kofler c87d48
+    procs->convolve_horizontally = &ConvolveHorizontally_SSE2;
Kevin Kofler c87d48
+  }
Kevin Kofler c87d48
 #elif defined SIMD_MIPS_DSPR2
Kevin Kofler c87d48
   procs->extra_horizontal_reads = 3;
Kevin Kofler c87d48
   procs->convolve_vertically = &ConvolveVertically_mips_dspr2;
Kevin Kofler c87d48
diff -Nur qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/skia/ext/convolver.h qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/skia/ext/convolver.h
Kevin Kofler c87d48
--- qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/skia/ext/convolver.h	2017-05-18 16:51:44.000000000 +0200
Kevin Kofler c87d48
+++ qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/skia/ext/convolver.h	2017-06-08 22:50:00.998203877 +0200
Kevin Kofler c87d48
@@ -11,6 +11,7 @@
Kevin Kofler c87d48
 #include <vector>
Kevin Kofler c87d48
 
Kevin Kofler c87d48
 #include "build/build_config.h"
Kevin Kofler c87d48
+#include "base/cpu.h"
Kevin Kofler c87d48
 #include "third_party/skia/include/core/SkSize.h"
Kevin Kofler c87d48
 #include "third_party/skia/include/core/SkTypes.h"
Kevin Kofler c87d48
 
Kevin Kofler 114eb3
diff -Nur qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/third_party/angle/BUILD.gn qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/third_party/angle/BUILD.gn
Kevin Kofler 114eb3
--- qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/third_party/angle/BUILD.gn	2017-05-18 16:51:44.000000000 +0200
Kevin Kofler a05504
+++ qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/third_party/angle/BUILD.gn	2017-06-11 03:28:05.966523743 +0200
Kevin Kofler a05504
@@ -160,6 +160,26 @@
Kevin Kofler 114eb3
   public_deps = [
Kevin Kofler 114eb3
     ":angle_common",
Kevin Kofler 114eb3
   ]
Kevin Kofler 114eb3
+
Kevin Kofler e7e2ed
+  if (current_cpu == "x86") {
Kevin Kofler e7e2ed
+    deps = [
Kevin Kofler e7e2ed
+      ":angle_image_util_x86_sse2",
Kevin Kofler e7e2ed
+    ]
Kevin Kofler e7e2ed
+  }
Kevin Kofler 114eb3
+}
Kevin Kofler 114eb3
+
Kevin Kofler 114eb3
+source_set("angle_image_util_x86_sse2") {
Kevin Kofler d8a24a
+  configs -= angle_undefine_configs
Kevin Kofler d8a24a
+  configs += [ ":internal_config" ]
Kevin Kofler d8a24a
+
Kevin Kofler a05504
+  deps = [
Kevin Kofler a05504
+    ":angle_common",
Kevin Kofler a05504
+  ]
Kevin Kofler a05504
+
Kevin Kofler 114eb3
+  sources = [
Kevin Kofler e7e2ed
+    "src/image_util/loadimage_SSE2.cpp",
Kevin Kofler 114eb3
+  ]
Kevin Kofler 114eb3
+  cflags = [ "-msse2", "-mfpmath=sse" ]
Kevin Kofler 114eb3
 }
Kevin Kofler 114eb3
 
Kevin Kofler 114eb3
 static_library("translator") {
Kevin Kofler 114eb3
diff -Nur qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/third_party/angle/src/common/mathutil.h qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/third_party/angle/src/common/mathutil.h
Kevin Kofler 114eb3
--- qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/third_party/angle/src/common/mathutil.h	2017-05-18 16:51:44.000000000 +0200
Kevin Kofler d1867a
+++ qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/third_party/angle/src/common/mathutil.h	2017-06-11 03:04:02.402397018 +0200
Kevin Kofler d1867a
@@ -142,9 +142,42 @@
Kevin Kofler 114eb3
     }
Kevin Kofler 114eb3
 }
Kevin Kofler 114eb3
 
Kevin Kofler 114eb3
-inline bool supportsSSE2()
Kevin Kofler d1867a
+#if defined(ANGLE_USE_SSE) && !defined(__x86_64__) && !defined(__SSE2__) && !defined(_MSC_VER)
Kevin Kofler d1867a
+
Kevin Kofler d1867a
+// From the base/cpu.cc in Chromium, to avoid depending on Chromium headers
Kevin Kofler d1867a
+
Kevin Kofler d1867a
+#if defined(__pic__) && defined(__i386__)
Kevin Kofler d1867a
+
Kevin Kofler d1867a
+static inline void __cpuid(int cpu_info[4], int info_type) {
Kevin Kofler d1867a
+  __asm__ volatile (
Kevin Kofler d1867a
+    "mov %%ebx, %%edi\n"
Kevin Kofler d1867a
+    "cpuid\n"
Kevin Kofler d1867a
+    "xchg %%edi, %%ebx\n"
Kevin Kofler d1867a
+    : "=a"(cpu_info[0]), "=D"(cpu_info[1]), "=c"(cpu_info[2]), "=d"(cpu_info[3])
Kevin Kofler d1867a
+    : "a"(info_type)
Kevin Kofler d1867a
+  );
Kevin Kofler d1867a
+}
Kevin Kofler d1867a
+
Kevin Kofler d1867a
+#else
Kevin Kofler d1867a
+
Kevin Kofler d1867a
+static inline void __cpuid(int cpu_info[4], int info_type) {
Kevin Kofler d1867a
+  __asm__ volatile (
Kevin Kofler d1867a
+    "cpuid\n"
Kevin Kofler d1867a
+    : "=a"(cpu_info[0]), "=b"(cpu_info[1]), "=c"(cpu_info[2]), "=d"(cpu_info[3])
Kevin Kofler d1867a
+    : "a"(info_type)
Kevin Kofler d1867a
+  );
Kevin Kofler d1867a
+}
Kevin Kofler d1867a
+
Kevin Kofler d1867a
+#endif
Kevin Kofler d1867a
+
Kevin Kofler d1867a
+#endif
Kevin Kofler d1867a
+
Kevin Kofler 114eb3
+static inline bool supportsSSE2()
Kevin Kofler 114eb3
 {
Kevin Kofler 114eb3
 #if defined(ANGLE_USE_SSE)
Kevin Kofler 114eb3
+#if defined(__x86_64__) || defined(__SSE2__)
Kevin Kofler 114eb3
+    return true;
Kevin Kofler 114eb3
+#else
Kevin Kofler 114eb3
     static bool checked = false;
Kevin Kofler 114eb3
     static bool supports = false;
Kevin Kofler 114eb3
 
Kevin Kofler d1867a
@@ -153,7 +186,6 @@
Kevin Kofler 114eb3
         return supports;
Kevin Kofler 114eb3
     }
Kevin Kofler 114eb3
 
Kevin Kofler 114eb3
-#if defined(ANGLE_PLATFORM_WINDOWS) && !defined(_M_ARM)
Kevin Kofler d1867a
     {
Kevin Kofler d1867a
         int info[4];
Kevin Kofler d1867a
         __cpuid(info, 0);
Kevin Kofler d1867a
@@ -165,9 +197,9 @@
Kevin Kofler d1867a
             supports = (info[3] >> 26) & 1;
Kevin Kofler d1867a
         }
Kevin Kofler d1867a
     }
Kevin Kofler 114eb3
-#endif  // defined(ANGLE_PLATFORM_WINDOWS) && !defined(_M_ARM)
Kevin Kofler 114eb3
     checked = true;
Kevin Kofler 114eb3
     return supports;
Kevin Kofler 114eb3
+#endif  // defined(x86_64) || defined(__SSE2__)
Kevin Kofler 114eb3
 #else  // defined(ANGLE_USE_SSE)
Kevin Kofler 114eb3
     return false;
Kevin Kofler 114eb3
 #endif
Kevin Kofler 114eb3
diff -Nur qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/third_party/angle/src/common/platform.h qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/third_party/angle/src/common/platform.h
Kevin Kofler 114eb3
--- qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/third_party/angle/src/common/platform.h	2017-05-18 16:51:44.000000000 +0200
Kevin Kofler 114eb3
+++ qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/third_party/angle/src/common/platform.h	2017-06-11 00:43:54.961552623 +0200
Kevin Kofler 114eb3
@@ -81,7 +81,9 @@
Kevin Kofler 114eb3
 #include <intrin.h>
Kevin Kofler 114eb3
 #define ANGLE_USE_SSE
Kevin Kofler 114eb3
 #elif defined(__GNUC__) && (defined(__x86_64__) || defined(__i386__))
Kevin Kofler 114eb3
+#if defined(__x86_64__) || defined(__SSE2__)
Kevin Kofler 114eb3
 #include <x86intrin.h>
Kevin Kofler 114eb3
+#endif
Kevin Kofler 114eb3
 #define ANGLE_USE_SSE
Kevin Kofler 114eb3
 #endif
Kevin Kofler 114eb3
 
Kevin Kofler 114eb3
diff -Nur qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/third_party/angle/src/image_util/loadimage.cpp qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/third_party/angle/src/image_util/loadimage.cpp
Kevin Kofler 114eb3
--- qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/third_party/angle/src/image_util/loadimage.cpp	2017-05-18 16:51:44.000000000 +0200
Kevin Kofler 114eb3
+++ qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/third_party/angle/src/image_util/loadimage.cpp	2017-06-11 00:58:53.706120530 +0200
Kevin Kofler 114eb3
@@ -12,9 +12,17 @@
Kevin Kofler 114eb3
 #include "common/platform.h"
Kevin Kofler 114eb3
 #include "image_util/imageformats.h"
Kevin Kofler 114eb3
 
Kevin Kofler 114eb3
+#if defined(BUILD_ONLY_THE_SSE2_PARTS) && !defined(__SSE2__)
Kevin Kofler 114eb3
+#error SSE2 parts must be built with -msse2
Kevin Kofler 114eb3
+#endif
Kevin Kofler 114eb3
+
Kevin Kofler 114eb3
 namespace angle
Kevin Kofler 114eb3
 {
Kevin Kofler 114eb3
 
Kevin Kofler 114eb3
+#ifdef BUILD_ONLY_THE_SSE2_PARTS
Kevin Kofler 114eb3
+namespace SSE2 {
Kevin Kofler 114eb3
+#endif
Kevin Kofler 114eb3
+
Kevin Kofler 114eb3
 void LoadA8ToRGBA8(size_t width,
Kevin Kofler 114eb3
                    size_t height,
Kevin Kofler 114eb3
                    size_t depth,
Kevin Kofler 114eb3
@@ -28,6 +36,11 @@
Kevin Kofler 114eb3
 #if defined(ANGLE_USE_SSE)
Kevin Kofler 114eb3
     if (gl::supportsSSE2())
Kevin Kofler 114eb3
     {
Kevin Kofler 114eb3
+#if !defined(__x86_64__) && !defined(__SSE2__)
Kevin Kofler 114eb3
+        angle::SSE2::LoadA8ToRGBA8(width, height, depth, input, inputRowPitch,
Kevin Kofler 114eb3
+                                   inputDepthPitch, output, outputRowPitch,
Kevin Kofler 114eb3
+                                   outputDepthPitch);
Kevin Kofler 114eb3
+#else
Kevin Kofler 114eb3
         __m128i zeroWide = _mm_setzero_si128();
Kevin Kofler 114eb3
 
Kevin Kofler 114eb3
         for (size_t z = 0; z < depth; z++)
Kevin Kofler 114eb3
@@ -68,6 +81,7 @@
Kevin Kofler 114eb3
                 }
Kevin Kofler 114eb3
             }
Kevin Kofler 114eb3
         }
Kevin Kofler 114eb3
+#endif
Kevin Kofler 114eb3
 
Kevin Kofler 114eb3
         return;
Kevin Kofler 114eb3
     }
Kevin Kofler 114eb3
@@ -89,6 +103,8 @@
Kevin Kofler 114eb3
     }
Kevin Kofler 114eb3
 }
Kevin Kofler 114eb3
 
Kevin Kofler 114eb3
+#ifndef BUILD_ONLY_THE_SSE2_PARTS
Kevin Kofler 114eb3
+
Kevin Kofler 114eb3
 void LoadA8ToBGRA8(size_t width,
Kevin Kofler 114eb3
                    size_t height,
Kevin Kofler 114eb3
                    size_t depth,
Kevin Kofler 114eb3
@@ -584,6 +600,8 @@
Kevin Kofler 114eb3
     }
Kevin Kofler 114eb3
 }
Kevin Kofler 114eb3
 
Kevin Kofler 114eb3
+#endif
Kevin Kofler 114eb3
+
Kevin Kofler 114eb3
 void LoadRGBA8ToBGRA8(size_t width,
Kevin Kofler 114eb3
                       size_t height,
Kevin Kofler 114eb3
                       size_t depth,
Kevin Kofler 114eb3
@@ -597,6 +615,11 @@
Kevin Kofler 114eb3
 #if defined(ANGLE_USE_SSE)
Kevin Kofler 114eb3
     if (gl::supportsSSE2())
Kevin Kofler 114eb3
     {
Kevin Kofler 114eb3
+#if !defined(__x86_64__) && !defined(__SSE2__)
Kevin Kofler 114eb3
+        angle::SSE2::LoadRGBA8ToBGRA8(width, height, depth, input,
Kevin Kofler 114eb3
+                                      inputRowPitch, inputDepthPitch, output,
Kevin Kofler 114eb3
+                                      outputRowPitch, outputDepthPitch);
Kevin Kofler 114eb3
+#else
Kevin Kofler 114eb3
         __m128i brMask = _mm_set1_epi32(0x00ff00ff);
Kevin Kofler 114eb3
 
Kevin Kofler 114eb3
         for (size_t z = 0; z < depth; z++)
Kevin Kofler 114eb3
@@ -641,6 +664,7 @@
Kevin Kofler 114eb3
                 }
Kevin Kofler 114eb3
             }
Kevin Kofler 114eb3
         }
Kevin Kofler 114eb3
+#endif
Kevin Kofler 114eb3
 
Kevin Kofler 114eb3
         return;
Kevin Kofler 114eb3
     }
Kevin Kofler 114eb3
@@ -663,6 +687,8 @@
Kevin Kofler 114eb3
     }
Kevin Kofler 114eb3
 }
Kevin Kofler 114eb3
 
Kevin Kofler 114eb3
+#ifndef BUILD_ONLY_THE_SSE2_PARTS
Kevin Kofler 114eb3
+
Kevin Kofler 114eb3
 void LoadRGBA8ToBGRA4(size_t width,
Kevin Kofler 114eb3
                       size_t height,
Kevin Kofler 114eb3
                       size_t depth,
Kevin Kofler 114eb3
@@ -1320,4 +1346,10 @@
Kevin Kofler 114eb3
     }
Kevin Kofler 114eb3
 }
Kevin Kofler 114eb3
 
Kevin Kofler 114eb3
+#endif
Kevin Kofler 114eb3
+
Kevin Kofler 114eb3
+#ifdef BUILD_ONLY_THE_SSE2_PARTS
Kevin Kofler 114eb3
+} // namespace SSE2
Kevin Kofler 114eb3
+#endif
Kevin Kofler 114eb3
+
Kevin Kofler 114eb3
 }  // namespace angle
Kevin Kofler 114eb3
diff -Nur qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/third_party/angle/src/image_util/loadimage.h qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/third_party/angle/src/image_util/loadimage.h
Kevin Kofler 114eb3
--- qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/third_party/angle/src/image_util/loadimage.h	2017-05-18 16:51:44.000000000 +0200
Kevin Kofler 114eb3
+++ qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/third_party/angle/src/image_util/loadimage.h	2017-06-11 00:52:18.251030762 +0200
Kevin Kofler 114eb3
@@ -611,6 +611,32 @@
Kevin Kofler 114eb3
                             size_t outputRowPitch,
Kevin Kofler 114eb3
                             size_t outputDepthPitch);
Kevin Kofler 114eb3
 
Kevin Kofler 114eb3
+#if defined(__i386__)
Kevin Kofler 114eb3
+namespace SSE2 {
Kevin Kofler 114eb3
+
Kevin Kofler 114eb3
+void LoadA8ToRGBA8(size_t width,
Kevin Kofler 114eb3
+                   size_t height,
Kevin Kofler 114eb3
+                   size_t depth,
Kevin Kofler 114eb3
+                   const uint8_t *input,
Kevin Kofler 114eb3
+                   size_t inputRowPitch,
Kevin Kofler 114eb3
+                   size_t inputDepthPitch,
Kevin Kofler 114eb3
+                   uint8_t *output,
Kevin Kofler 114eb3
+                   size_t outputRowPitch,
Kevin Kofler 114eb3
+                   size_t outputDepthPitch);
Kevin Kofler 114eb3
+
Kevin Kofler 114eb3
+void LoadRGBA8ToBGRA8(size_t width,
Kevin Kofler 114eb3
+                      size_t height,
Kevin Kofler 114eb3
+                      size_t depth,
Kevin Kofler 114eb3
+                      const uint8_t *input,
Kevin Kofler 114eb3
+                      size_t inputRowPitch,
Kevin Kofler 114eb3
+                      size_t inputDepthPitch,
Kevin Kofler 114eb3
+                      uint8_t *output,
Kevin Kofler 114eb3
+                      size_t outputRowPitch,
Kevin Kofler 114eb3
+                      size_t outputDepthPitch);
Kevin Kofler 114eb3
+
Kevin Kofler 114eb3
+}
Kevin Kofler 114eb3
+#endif // defined(__i386__)
Kevin Kofler 114eb3
+
Kevin Kofler 114eb3
 }  // namespace angle
Kevin Kofler 114eb3
 
Kevin Kofler 114eb3
 #include "loadimage.inl"
Kevin Kofler 114eb3
diff -Nur qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/third_party/angle/src/image_util/loadimage_SSE2.cpp qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/third_party/angle/src/image_util/loadimage_SSE2.cpp
Kevin Kofler 114eb3
--- qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/third_party/angle/src/image_util/loadimage_SSE2.cpp	1970-01-01 01:00:00.000000000 +0100
Kevin Kofler 114eb3
+++ qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/third_party/angle/src/image_util/loadimage_SSE2.cpp	2017-06-11 00:59:45.318349164 +0200
Kevin Kofler 114eb3
@@ -0,0 +1,2 @@
Kevin Kofler 114eb3
+#define BUILD_ONLY_THE_SSE2_PARTS
Kevin Kofler 114eb3
+#include "loadimage.cpp"
Kevin Kofler c87d48
diff -Nur qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/third_party/qcms/BUILD.gn qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/third_party/qcms/BUILD.gn
Kevin Kofler c87d48
--- qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/third_party/qcms/BUILD.gn	2017-05-18 16:51:44.000000000 +0200
Kevin Kofler 114eb3
+++ qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/third_party/qcms/BUILD.gn	2017-06-10 21:27:01.666198494 +0200
Kevin Kofler c87d48
@@ -30,8 +30,8 @@
Kevin Kofler c87d48
     ]
Kevin Kofler c87d48
 
Kevin Kofler c87d48
     if (current_cpu == "x86" || current_cpu == "x64") {
Kevin Kofler c87d48
-      defines = [ "SSE2_ENABLE" ]
Kevin Kofler c87d48
-      sources += [ "src/transform-sse2.c" ]
Kevin Kofler c87d48
+      defines = [ "SSE2_ENABLE" ]  # runtime detection
Kevin Kofler 5ee9cc
+      deps = [ ":qcms_sse2" ]
Kevin Kofler c87d48
     }
Kevin Kofler c87d48
   }
Kevin Kofler c87d48
 
Kevin Kofler c87d48
@@ -74,3 +74,15 @@
Kevin Kofler c87d48
     public_configs = [ ":qcms_config" ]
Kevin Kofler c87d48
   }
Kevin Kofler c87d48
 }
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+source_set("qcms_sse2") {
Kevin Kofler c87d48
+  configs -= [ "//build/config/compiler:chromium_code" ]
Kevin Kofler c87d48
+  configs += [ "//build/config/compiler:no_chromium_code" ]
Kevin Kofler c87d48
+  public_configs = [ ":qcms_config" ]
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+  if (current_cpu == "x86" || current_cpu == "x64") {
Kevin Kofler c87d48
+    defines = [ "SSE2_ENABLE" ]
Kevin Kofler c87d48
+    sources = [ "src/transform-sse2.c" ]
Kevin Kofler c87d48
+    cflags = [ "-msse2" ]
Kevin Kofler c87d48
+  }
Kevin Kofler c87d48
+}
Kevin Kofler c87d48
diff -Nur qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/third_party/WebKit/Source/modules/webaudio/AudioParamTimeline.cpp qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/third_party/WebKit/Source/modules/webaudio/AudioParamTimeline.cpp
Kevin Kofler c87d48
--- qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/third_party/WebKit/Source/modules/webaudio/AudioParamTimeline.cpp	2017-05-18 16:51:44.000000000 +0200
Kevin Kofler c87d48
+++ qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/third_party/WebKit/Source/modules/webaudio/AudioParamTimeline.cpp	2017-06-08 23:59:48.897938821 +0200
Kevin Kofler c87d48
@@ -31,7 +31,7 @@
Kevin Kofler c87d48
 #include "wtf/MathExtras.h"
Kevin Kofler c87d48
 #include <algorithm>
Kevin Kofler c87d48
 
Kevin Kofler c87d48
-#if CPU(X86) || CPU(X86_64)
Kevin Kofler c87d48
+#if (CPU(X86) && defined(__SSE2__)) || CPU(X86_64)
Kevin Kofler c87d48
 #include <emmintrin.h>
Kevin Kofler c87d48
 #endif
Kevin Kofler c87d48
 
Kevin Kofler c87d48
@@ -662,7 +662,7 @@
Kevin Kofler c87d48
     // the next event.
Kevin Kofler c87d48
     if (nextEventType == ParamEvent::LinearRampToValue) {
Kevin Kofler c87d48
       const float valueDelta = value2 - value1;
Kevin Kofler c87d48
-#if CPU(X86) || CPU(X86_64)
Kevin Kofler c87d48
+#if (CPU(X86) && defined(__SSE2__)) || CPU(X86_64)
Kevin Kofler c87d48
       if (fillToFrame > writeIndex) {
Kevin Kofler c87d48
         // Minimize in-loop operations. Calculate starting value and increment.
Kevin Kofler c87d48
         // Next step: value += inc.
Kevin Kofler c87d48
@@ -841,7 +841,7 @@
Kevin Kofler c87d48
             for (; writeIndex < fillToFrame; ++writeIndex)
Kevin Kofler c87d48
               values[writeIndex] = target;
Kevin Kofler c87d48
           } else {
Kevin Kofler c87d48
-#if CPU(X86) || CPU(X86_64)
Kevin Kofler c87d48
+#if (CPU(X86) && defined(__SSE2__)) || CPU(X86_64)
Kevin Kofler c87d48
             if (fillToFrame > writeIndex) {
Kevin Kofler c87d48
               // Resolve recursion by expanding constants to achieve a 4-step
Kevin Kofler c87d48
               // loop unrolling.
Kevin Kofler c87d48
@@ -959,7 +959,7 @@
Kevin Kofler c87d48
           // Oversampled curve data can be provided if sharp discontinuities are
Kevin Kofler c87d48
           // desired.
Kevin Kofler c87d48
           unsigned k = 0;
Kevin Kofler c87d48
-#if CPU(X86) || CPU(X86_64)
Kevin Kofler c87d48
+#if (CPU(X86) && defined(__SSE2__)) || CPU(X86_64)
Kevin Kofler c87d48
           if (fillToFrame > writeIndex) {
Kevin Kofler c87d48
             const __m128 vCurveVirtualIndex = _mm_set_ps1(curveVirtualIndex);
Kevin Kofler c87d48
             const __m128 vCurvePointsPerFrame =
Kevin Kofler c87d48
diff -Nur qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/third_party/WebKit/Source/platform/audio/DirectConvolver.cpp qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/third_party/WebKit/Source/platform/audio/DirectConvolver.cpp
Kevin Kofler c87d48
--- qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/third_party/WebKit/Source/platform/audio/DirectConvolver.cpp	2017-05-18 16:51:44.000000000 +0200
Kevin Kofler c87d48
+++ qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/third_party/WebKit/Source/platform/audio/DirectConvolver.cpp	2017-06-09 00:10:04.104673129 +0200
Kevin Kofler c87d48
@@ -26,6 +26,9 @@
Kevin Kofler c87d48
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Kevin Kofler c87d48
  */
Kevin Kofler c87d48
 
Kevin Kofler c87d48
+// include this first to get it before the CPU() function-like macro
Kevin Kofler c87d48
+#include "base/cpu.h"
Kevin Kofler c87d48
+
Kevin Kofler c87d48
 #include "platform/audio/DirectConvolver.h"
Kevin Kofler c87d48
 
Kevin Kofler c87d48
 #if OS(MACOSX)
Kevin Kofler c87d48
@@ -35,21 +38,47 @@
Kevin Kofler c87d48
 #include "platform/audio/VectorMath.h"
Kevin Kofler c87d48
 #include "wtf/CPU.h"
Kevin Kofler c87d48
 
Kevin Kofler c87d48
-#if (CPU(X86) || CPU(X86_64)) && !OS(MACOSX)
Kevin Kofler c87d48
+#if ((CPU(X86) && defined(__SSE2__)) || CPU(X86_64)) && !OS(MACOSX)
Kevin Kofler c87d48
 #include <emmintrin.h>
Kevin Kofler c87d48
 #endif
Kevin Kofler c87d48
 
Kevin Kofler c87d48
+#if defined(BUILD_ONLY_THE_SSE2_PARTS) && !defined(__SSE2__)
Kevin Kofler c87d48
+#error SSE2 parts must be built with -msse2
Kevin Kofler c87d48
+#endif
Kevin Kofler c87d48
+
Kevin Kofler c87d48
 namespace blink {
Kevin Kofler c87d48
 
Kevin Kofler c87d48
 using namespace VectorMath;
Kevin Kofler c87d48
 
Kevin Kofler c87d48
+#ifndef BUILD_ONLY_THE_SSE2_PARTS
Kevin Kofler c87d48
+
Kevin Kofler c87d48
 DirectConvolver::DirectConvolver(size_t inputBlockSize)
Kevin Kofler c87d48
-    : m_inputBlockSize(inputBlockSize), m_buffer(inputBlockSize * 2) {}
Kevin Kofler c87d48
+    : m_inputBlockSize(inputBlockSize), m_buffer(inputBlockSize * 2) {
Kevin Kofler c87d48
+#if CPU(X86)
Kevin Kofler c87d48
+  base::CPU cpu;
Kevin Kofler c87d48
+  m_haveSSE2 = cpu.has_sse2();
Kevin Kofler c87d48
+#endif
Kevin Kofler c87d48
+}
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+#endif
Kevin Kofler c87d48
 
Kevin Kofler c87d48
+#ifdef BUILD_ONLY_THE_SSE2_PARTS
Kevin Kofler c87d48
+void DirectConvolver::m_processSSE2(AudioFloatArray* convolutionKernel,
Kevin Kofler c87d48
+                                    const float* sourceP,
Kevin Kofler c87d48
+                                    float* destP,
Kevin Kofler c87d48
+                                    size_t framesToProcess) {
Kevin Kofler c87d48
+#else
Kevin Kofler c87d48
 void DirectConvolver::process(AudioFloatArray* convolutionKernel,
Kevin Kofler c87d48
                               const float* sourceP,
Kevin Kofler c87d48
                               float* destP,
Kevin Kofler c87d48
                               size_t framesToProcess) {
Kevin Kofler c87d48
+#endif
Kevin Kofler c87d48
+#if CPU(X86) && !defined(__SSE2__)
Kevin Kofler c87d48
+  if (m_haveSSE2) {
Kevin Kofler c87d48
+    m_processSSE2(convolutionKernel, sourceP, destP, framesToProcess);
Kevin Kofler c87d48
+    return;
Kevin Kofler c87d48
+  }
Kevin Kofler c87d48
+#endif
Kevin Kofler c87d48
   ASSERT(framesToProcess == m_inputBlockSize);
Kevin Kofler c87d48
   if (framesToProcess != m_inputBlockSize)
Kevin Kofler c87d48
     return;
Kevin Kofler c87d48
@@ -83,7 +112,7 @@
Kevin Kofler c87d48
 #endif  // CPU(X86)
Kevin Kofler c87d48
 #else
Kevin Kofler c87d48
   size_t i = 0;
Kevin Kofler c87d48
-#if CPU(X86) || CPU(X86_64)
Kevin Kofler c87d48
+#if (CPU(X86) && defined(__SSE2__)) || CPU(X86_64)
Kevin Kofler c87d48
   // Convolution using SSE2. Currently only do this if both |kernelSize| and
Kevin Kofler c87d48
   // |framesToProcess| are multiples of 4. If not, use the straightforward loop
Kevin Kofler c87d48
   // below.
Kevin Kofler c87d48
@@ -397,7 +426,7 @@
Kevin Kofler c87d48
       }
Kevin Kofler c87d48
       destP[i++] = sum;
Kevin Kofler c87d48
     }
Kevin Kofler c87d48
-#if CPU(X86) || CPU(X86_64)
Kevin Kofler c87d48
+#if (CPU(X86) && defined(__SSE2__)) || CPU(X86_64)
Kevin Kofler c87d48
   }
Kevin Kofler c87d48
 #endif
Kevin Kofler c87d48
 #endif  // OS(MACOSX)
Kevin Kofler c87d48
@@ -406,8 +435,12 @@
Kevin Kofler c87d48
   memcpy(m_buffer.data(), inputP, sizeof(float) * framesToProcess);
Kevin Kofler c87d48
 }
Kevin Kofler c87d48
 
Kevin Kofler c87d48
+#ifndef BUILD_ONLY_THE_SSE2_PARTS
Kevin Kofler c87d48
+
Kevin Kofler c87d48
 void DirectConvolver::reset() {
Kevin Kofler c87d48
   m_buffer.zero();
Kevin Kofler c87d48
 }
Kevin Kofler c87d48
 
Kevin Kofler c87d48
+#endif
Kevin Kofler c87d48
+
Kevin Kofler c87d48
 }  // namespace blink
Kevin Kofler c87d48
diff -Nur qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/third_party/WebKit/Source/platform/audio/DirectConvolver.h qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/third_party/WebKit/Source/platform/audio/DirectConvolver.h
Kevin Kofler c87d48
--- qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/third_party/WebKit/Source/platform/audio/DirectConvolver.h	2017-05-18 16:51:44.000000000 +0200
Kevin Kofler c87d48
+++ qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/third_party/WebKit/Source/platform/audio/DirectConvolver.h	2017-06-09 00:07:03.143398606 +0200
Kevin Kofler c87d48
@@ -32,6 +32,7 @@
Kevin Kofler c87d48
 #include "platform/PlatformExport.h"
Kevin Kofler c87d48
 #include "platform/audio/AudioArray.h"
Kevin Kofler c87d48
 #include "wtf/Allocator.h"
Kevin Kofler c87d48
+#include "wtf/CPU.h"
Kevin Kofler c87d48
 #include "wtf/Noncopyable.h"
Kevin Kofler c87d48
 
Kevin Kofler c87d48
 namespace blink {
Kevin Kofler c87d48
@@ -54,6 +55,14 @@
Kevin Kofler c87d48
   size_t m_inputBlockSize;
Kevin Kofler c87d48
 
Kevin Kofler c87d48
   AudioFloatArray m_buffer;
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+#if CPU(X86)
Kevin Kofler c87d48
+  bool m_haveSSE2;
Kevin Kofler c87d48
+  void m_processSSE2(AudioFloatArray* convolutionKernel,
Kevin Kofler c87d48
+                     const float* sourceP,
Kevin Kofler c87d48
+                     float* destP,
Kevin Kofler c87d48
+                     size_t framesToProcess);
Kevin Kofler c87d48
+#endif
Kevin Kofler c87d48
 };
Kevin Kofler c87d48
 
Kevin Kofler c87d48
 }  // namespace blink
Kevin Kofler c87d48
diff -Nur qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/third_party/WebKit/Source/platform/audio/DirectConvolverSSE2.cpp qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/third_party/WebKit/Source/platform/audio/DirectConvolverSSE2.cpp
Kevin Kofler c87d48
--- qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/third_party/WebKit/Source/platform/audio/DirectConvolverSSE2.cpp	1970-01-01 01:00:00.000000000 +0100
Kevin Kofler c87d48
+++ qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/third_party/WebKit/Source/platform/audio/DirectConvolverSSE2.cpp	2017-06-08 22:50:07.966098783 +0200
Kevin Kofler c87d48
@@ -0,0 +1,2 @@
Kevin Kofler c87d48
+#define BUILD_ONLY_THE_SSE2_PARTS
Kevin Kofler c87d48
+#include "DirectConvolver.cpp"
Kevin Kofler c87d48
diff -Nur qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/third_party/WebKit/Source/platform/audio/SincResampler.cpp qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/third_party/WebKit/Source/platform/audio/SincResampler.cpp
Kevin Kofler c87d48
--- qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/third_party/WebKit/Source/platform/audio/SincResampler.cpp	2017-05-18 16:51:44.000000000 +0200
Kevin Kofler c87d48
+++ qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/third_party/WebKit/Source/platform/audio/SincResampler.cpp	2017-06-09 00:12:04.250863595 +0200
Kevin Kofler c87d48
@@ -26,15 +26,22 @@
Kevin Kofler c87d48
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Kevin Kofler c87d48
  */
Kevin Kofler c87d48
 
Kevin Kofler c87d48
+// include this first to get it before the CPU() function-like macro
Kevin Kofler c87d48
+#include "base/cpu.h"
Kevin Kofler c87d48
+
Kevin Kofler c87d48
 #include "platform/audio/SincResampler.h"
Kevin Kofler c87d48
 #include "platform/audio/AudioBus.h"
Kevin Kofler c87d48
 #include "wtf/CPU.h"
Kevin Kofler c87d48
 #include "wtf/MathExtras.h"
Kevin Kofler c87d48
 
Kevin Kofler c87d48
-#if CPU(X86) || CPU(X86_64)
Kevin Kofler c87d48
+#if (CPU(X86) && defined(__SSE2__)) || CPU(X86_64)
Kevin Kofler c87d48
 #include <emmintrin.h>
Kevin Kofler c87d48
 #endif
Kevin Kofler c87d48
 
Kevin Kofler c87d48
+#if defined(BUILD_ONLY_THE_SSE2_PARTS) && !defined(__SSE2__)
Kevin Kofler c87d48
+#error SSE2 parts must be built with -msse2
Kevin Kofler c87d48
+#endif
Kevin Kofler c87d48
+
Kevin Kofler c87d48
 // Input buffer layout, dividing the total buffer into regions (r0 - r5):
Kevin Kofler c87d48
 //
Kevin Kofler c87d48
 // |----------------|-----------------------------------------|----------------|
Kevin Kofler c87d48
@@ -66,6 +73,8 @@
Kevin Kofler c87d48
 
Kevin Kofler c87d48
 namespace blink {
Kevin Kofler c87d48
 
Kevin Kofler c87d48
+#ifndef BUILD_ONLY_THE_SSE2_PARTS
Kevin Kofler c87d48
+
Kevin Kofler c87d48
 SincResampler::SincResampler(double scaleFactor,
Kevin Kofler c87d48
                              unsigned kernelSize,
Kevin Kofler c87d48
                              unsigned numberOfKernelOffsets)
Kevin Kofler c87d48
@@ -81,6 +90,10 @@
Kevin Kofler c87d48
       m_sourceFramesAvailable(0),
Kevin Kofler c87d48
       m_sourceProvider(nullptr),
Kevin Kofler c87d48
       m_isBufferPrimed(false) {
Kevin Kofler c87d48
+#if CPU(X86)
Kevin Kofler c87d48
+  base::CPU cpu;
Kevin Kofler c87d48
+  m_haveSSE2 = cpu.has_sse2();
Kevin Kofler c87d48
+#endif
Kevin Kofler c87d48
   initializeKernel();
Kevin Kofler c87d48
 }
Kevin Kofler c87d48
 
Kevin Kofler c87d48
@@ -201,9 +214,23 @@
Kevin Kofler c87d48
   }
Kevin Kofler c87d48
 }
Kevin Kofler c87d48
 
Kevin Kofler c87d48
+#endif
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+#ifdef BUILD_ONLY_THE_SSE2_PARTS
Kevin Kofler c87d48
+void SincResampler::m_processSSE2(AudioSourceProvider* sourceProvider,
Kevin Kofler c87d48
+                                  float* destination,
Kevin Kofler c87d48
+                                  size_t framesToProcess) {
Kevin Kofler c87d48
+#else
Kevin Kofler c87d48
 void SincResampler::process(AudioSourceProvider* sourceProvider,
Kevin Kofler c87d48
                             float* destination,
Kevin Kofler c87d48
                             size_t framesToProcess) {
Kevin Kofler c87d48
+#endif
Kevin Kofler c87d48
+#if CPU(X86) && !defined(__SSE2__)
Kevin Kofler c87d48
+  if (m_haveSSE2) {
Kevin Kofler c87d48
+    m_processSSE2(sourceProvider, destination, framesToProcess);
Kevin Kofler c87d48
+    return;
Kevin Kofler c87d48
+  }
Kevin Kofler c87d48
+#endif
Kevin Kofler c87d48
   bool isGood = sourceProvider && m_blockSize > m_kernelSize &&
Kevin Kofler c87d48
                 m_inputBuffer.size() >= m_blockSize + m_kernelSize &&
Kevin Kofler c87d48
                 !(m_kernelSize % 2);
Kevin Kofler c87d48
@@ -269,7 +296,7 @@
Kevin Kofler c87d48
       {
Kevin Kofler c87d48
         float input;
Kevin Kofler c87d48
 
Kevin Kofler c87d48
-#if CPU(X86) || CPU(X86_64)
Kevin Kofler c87d48
+#if (CPU(X86) && defined(__SSE2__)) || CPU(X86_64)
Kevin Kofler c87d48
         // If the sourceP address is not 16-byte aligned, the first several
Kevin Kofler c87d48
         // frames (at most three) should be processed seperately.
Kevin Kofler c87d48
         while ((reinterpret_cast<uintptr_t>(inputP) & 0x0F) && n) {
Kevin Kofler c87d48
diff -Nur qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/third_party/WebKit/Source/platform/audio/SincResampler.h qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/third_party/WebKit/Source/platform/audio/SincResampler.h
Kevin Kofler c87d48
--- qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/third_party/WebKit/Source/platform/audio/SincResampler.h	2017-05-18 16:51:44.000000000 +0200
Kevin Kofler c87d48
+++ qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/third_party/WebKit/Source/platform/audio/SincResampler.h	2017-06-09 00:12:54.187111500 +0200
Kevin Kofler c87d48
@@ -33,6 +33,7 @@
Kevin Kofler c87d48
 #include "platform/audio/AudioArray.h"
Kevin Kofler c87d48
 #include "platform/audio/AudioSourceProvider.h"
Kevin Kofler c87d48
 #include "wtf/Allocator.h"
Kevin Kofler c87d48
+#include "wtf/CPU.h"
Kevin Kofler c87d48
 #include "wtf/Noncopyable.h"
Kevin Kofler c87d48
 
Kevin Kofler c87d48
 namespace blink {
Kevin Kofler c87d48
@@ -96,6 +97,13 @@
Kevin Kofler c87d48
 
Kevin Kofler c87d48
   // The buffer is primed once at the very beginning of processing.
Kevin Kofler c87d48
   bool m_isBufferPrimed;
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+#if CPU(X86)
Kevin Kofler c87d48
+  bool m_haveSSE2;
Kevin Kofler c87d48
+  void m_processSSE2(AudioSourceProvider*,
Kevin Kofler c87d48
+                     float* destination,
Kevin Kofler c87d48
+                     size_t framesToProcess);
Kevin Kofler c87d48
+#endif
Kevin Kofler c87d48
 };
Kevin Kofler c87d48
 
Kevin Kofler c87d48
 }  // namespace blink
Kevin Kofler c87d48
diff -Nur qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/third_party/WebKit/Source/platform/audio/SincResamplerSSE2.cpp qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/third_party/WebKit/Source/platform/audio/SincResamplerSSE2.cpp
Kevin Kofler c87d48
--- qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/third_party/WebKit/Source/platform/audio/SincResamplerSSE2.cpp	1970-01-01 01:00:00.000000000 +0100
Kevin Kofler c87d48
+++ qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/third_party/WebKit/Source/platform/audio/SincResamplerSSE2.cpp	2017-06-08 22:50:07.967098767 +0200
Kevin Kofler c87d48
@@ -0,0 +1,2 @@
Kevin Kofler c87d48
+#define BUILD_ONLY_THE_SSE2_PARTS
Kevin Kofler c87d48
+#include "SincResampler.cpp"
Kevin Kofler c87d48
diff -Nur qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/third_party/WebKit/Source/platform/audio/VectorMath.cpp qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/third_party/WebKit/Source/platform/audio/VectorMath.cpp
Kevin Kofler c87d48
--- qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/third_party/WebKit/Source/platform/audio/VectorMath.cpp	2017-05-18 16:51:44.000000000 +0200
Kevin Kofler c87d48
+++ qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/third_party/WebKit/Source/platform/audio/VectorMath.cpp	2017-06-09 00:26:26.048970670 +0200
Kevin Kofler c87d48
@@ -23,6 +23,9 @@
Kevin Kofler c87d48
  * DAMAGE.
Kevin Kofler c87d48
  */
Kevin Kofler c87d48
 
Kevin Kofler c87d48
+// include this first to get it before the CPU() function-like macro
Kevin Kofler c87d48
+#include "base/cpu.h"
Kevin Kofler c87d48
+
Kevin Kofler c87d48
 #include "platform/audio/VectorMath.h"
Kevin Kofler c87d48
 #include "wtf/Assertions.h"
Kevin Kofler c87d48
 #include "wtf/CPU.h"
Kevin Kofler c87d48
@@ -33,10 +36,14 @@
Kevin Kofler c87d48
 #include <Accelerate/Accelerate.h>
Kevin Kofler c87d48
 #endif
Kevin Kofler c87d48
 
Kevin Kofler c87d48
-#if CPU(X86) || CPU(X86_64)
Kevin Kofler c87d48
+#if (CPU(X86) && defined(__SSE2__)) || CPU(X86_64)
Kevin Kofler c87d48
 #include <emmintrin.h>
Kevin Kofler c87d48
 #endif
Kevin Kofler c87d48
 
Kevin Kofler c87d48
+#if defined(BUILD_ONLY_THE_SSE2_PARTS) && !defined(__SSE2__)
Kevin Kofler c87d48
+#error SSE2 parts must be built with -msse2
Kevin Kofler c87d48
+#endif
Kevin Kofler c87d48
+
Kevin Kofler c87d48
 #if HAVE(ARM_NEON_INTRINSICS)
Kevin Kofler c87d48
 #include <arm_neon.h>
Kevin Kofler c87d48
 #endif
Kevin Kofler c87d48
@@ -165,15 +172,30 @@
Kevin Kofler c87d48
 }
Kevin Kofler c87d48
 #else
Kevin Kofler c87d48
 
Kevin Kofler c87d48
+#ifdef BUILD_ONLY_THE_SSE2_PARTS
Kevin Kofler c87d48
+namespace SSE2 {
Kevin Kofler c87d48
+#endif
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+#if CPU(X86) && !defined(__SSE2__)
Kevin Kofler c87d48
+static base::CPU cpu;
Kevin Kofler c87d48
+#endif
Kevin Kofler c87d48
+
Kevin Kofler c87d48
 void vsma(const float* sourceP,
Kevin Kofler c87d48
           int sourceStride,
Kevin Kofler c87d48
           const float* scale,
Kevin Kofler c87d48
           float* destP,
Kevin Kofler c87d48
           int destStride,
Kevin Kofler c87d48
           size_t framesToProcess) {
Kevin Kofler c87d48
+#if CPU(X86) && !defined(__SSE2__)
Kevin Kofler c87d48
+  if (cpu.has_sse2()) {
Kevin Kofler c87d48
+    blink::VectorMath::SSE2::vsma(sourceP, sourceStride, scale, destP,
Kevin Kofler c87d48
+                                  destStride, framesToProcess);
Kevin Kofler c87d48
+    return;
Kevin Kofler c87d48
+  }
Kevin Kofler c87d48
+#endif
Kevin Kofler c87d48
   int n = framesToProcess;
Kevin Kofler c87d48
 
Kevin Kofler c87d48
-#if CPU(X86) || CPU(X86_64)
Kevin Kofler c87d48
+#if (CPU(X86) && defined(__SSE2__)) || CPU(X86_64)
Kevin Kofler c87d48
   if ((sourceStride == 1) && (destStride == 1)) {
Kevin Kofler c87d48
     float k = *scale;
Kevin Kofler c87d48
 
Kevin Kofler c87d48
@@ -269,9 +291,16 @@
Kevin Kofler c87d48
            float* destP,
Kevin Kofler c87d48
            int destStride,
Kevin Kofler c87d48
            size_t framesToProcess) {
Kevin Kofler c87d48
+#if CPU(X86) && !defined(__SSE2__)
Kevin Kofler c87d48
+  if (cpu.has_sse2()) {
Kevin Kofler c87d48
+    blink::VectorMath::SSE2::vsmul(sourceP, sourceStride, scale, destP,
Kevin Kofler c87d48
+                                   destStride, framesToProcess);
Kevin Kofler c87d48
+    return;
Kevin Kofler c87d48
+  }
Kevin Kofler c87d48
+#endif
Kevin Kofler c87d48
   int n = framesToProcess;
Kevin Kofler c87d48
 
Kevin Kofler c87d48
-#if CPU(X86) || CPU(X86_64)
Kevin Kofler c87d48
+#if (CPU(X86) && defined(__SSE2__)) || CPU(X86_64)
Kevin Kofler c87d48
   if ((sourceStride == 1) && (destStride == 1)) {
Kevin Kofler c87d48
     float k = *scale;
Kevin Kofler c87d48
 
Kevin Kofler c87d48
@@ -360,7 +389,7 @@
Kevin Kofler c87d48
       sourceP += sourceStride;
Kevin Kofler c87d48
       destP += destStride;
Kevin Kofler c87d48
     }
Kevin Kofler c87d48
-#if CPU(X86) || CPU(X86_64)
Kevin Kofler c87d48
+#if (CPU(X86) && defined(__SSE2__)) || CPU(X86_64)
Kevin Kofler c87d48
   }
Kevin Kofler c87d48
 #endif
Kevin Kofler c87d48
 }
Kevin Kofler c87d48
@@ -372,9 +401,17 @@
Kevin Kofler c87d48
           float* destP,
Kevin Kofler c87d48
           int destStride,
Kevin Kofler c87d48
           size_t framesToProcess) {
Kevin Kofler c87d48
+#if CPU(X86) && !defined(__SSE2__)
Kevin Kofler c87d48
+  if (cpu.has_sse2()) {
Kevin Kofler c87d48
+    blink::VectorMath::SSE2::vadd(source1P, sourceStride1, source2P,
Kevin Kofler c87d48
+                                  sourceStride2, destP, destStride,
Kevin Kofler c87d48
+                                  framesToProcess);
Kevin Kofler c87d48
+    return;
Kevin Kofler c87d48
+  }
Kevin Kofler c87d48
+#endif
Kevin Kofler c87d48
   int n = framesToProcess;
Kevin Kofler c87d48
 
Kevin Kofler c87d48
-#if CPU(X86) || CPU(X86_64)
Kevin Kofler c87d48
+#if (CPU(X86) && defined(__SSE2__)) || CPU(X86_64)
Kevin Kofler c87d48
   if ((sourceStride1 == 1) && (sourceStride2 == 1) && (destStride == 1)) {
Kevin Kofler c87d48
     // If the sourceP address is not 16-byte aligned, the first several frames
Kevin Kofler c87d48
     // (at most three) should be processed separately.
Kevin Kofler c87d48
@@ -501,7 +538,7 @@
Kevin Kofler c87d48
       source2P += sourceStride2;
Kevin Kofler c87d48
       destP += destStride;
Kevin Kofler c87d48
     }
Kevin Kofler c87d48
-#if CPU(X86) || CPU(X86_64)
Kevin Kofler c87d48
+#if (CPU(X86) && defined(__SSE2__)) || CPU(X86_64)
Kevin Kofler c87d48
   }
Kevin Kofler c87d48
 #endif
Kevin Kofler c87d48
 }
Kevin Kofler c87d48
@@ -513,9 +550,17 @@
Kevin Kofler c87d48
           float* destP,
Kevin Kofler c87d48
           int destStride,
Kevin Kofler c87d48
           size_t framesToProcess) {
Kevin Kofler c87d48
+#if CPU(X86) && !defined(__SSE2__)
Kevin Kofler c87d48
+  if (cpu.has_sse2()) {
Kevin Kofler c87d48
+    blink::VectorMath::SSE2::vmul(source1P, sourceStride1, source2P,
Kevin Kofler c87d48
+                                  sourceStride2, destP, destStride,
Kevin Kofler c87d48
+                                  framesToProcess);
Kevin Kofler c87d48
+    return;
Kevin Kofler c87d48
+  }
Kevin Kofler c87d48
+#endif
Kevin Kofler c87d48
   int n = framesToProcess;
Kevin Kofler c87d48
 
Kevin Kofler c87d48
-#if CPU(X86) || CPU(X86_64)
Kevin Kofler c87d48
+#if (CPU(X86) && defined(__SSE2__)) || CPU(X86_64)
Kevin Kofler c87d48
   if ((sourceStride1 == 1) && (sourceStride2 == 1) && (destStride == 1)) {
Kevin Kofler c87d48
     // If the source1P address is not 16-byte aligned, the first several frames
Kevin Kofler c87d48
     // (at most three) should be processed separately.
Kevin Kofler c87d48
@@ -614,8 +659,15 @@
Kevin Kofler c87d48
            float* realDestP,
Kevin Kofler c87d48
            float* imagDestP,
Kevin Kofler c87d48
            size_t framesToProcess) {
Kevin Kofler c87d48
+#if CPU(X86) && !defined(__SSE2__)
Kevin Kofler c87d48
+  if (cpu.has_sse2()) {
Kevin Kofler c87d48
+    blink::VectorMath::SSE2::zvmul(real1P, imag1P, real2P, imag2P, realDestP,
Kevin Kofler c87d48
+                                   imagDestP, framesToProcess);
Kevin Kofler c87d48
+    return;
Kevin Kofler c87d48
+  }
Kevin Kofler c87d48
+#endif
Kevin Kofler c87d48
   unsigned i = 0;
Kevin Kofler c87d48
-#if CPU(X86) || CPU(X86_64)
Kevin Kofler c87d48
+#if (CPU(X86) && defined(__SSE2__)) || CPU(X86_64)
Kevin Kofler c87d48
   // Only use the SSE optimization in the very common case that all addresses
Kevin Kofler c87d48
   // are 16-byte aligned.  Otherwise, fall through to the scalar code below.
Kevin Kofler c87d48
   if (!(reinterpret_cast<uintptr_t>(real1P) & 0x0F) &&
Kevin Kofler c87d48
@@ -671,10 +723,17 @@
Kevin Kofler c87d48
             int sourceStride,
Kevin Kofler c87d48
             float* sumP,
Kevin Kofler c87d48
             size_t framesToProcess) {
Kevin Kofler c87d48
+#if CPU(X86) && !defined(__SSE2__)
Kevin Kofler c87d48
+  if (cpu.has_sse2()) {
Kevin Kofler c87d48
+    blink::VectorMath::SSE2::vsvesq(sourceP, sourceStride, sumP,
Kevin Kofler c87d48
+                                    framesToProcess);
Kevin Kofler c87d48
+    return;
Kevin Kofler c87d48
+  }
Kevin Kofler c87d48
+#endif
Kevin Kofler c87d48
   int n = framesToProcess;
Kevin Kofler c87d48
   float sum = 0;
Kevin Kofler c87d48
 
Kevin Kofler c87d48
-#if CPU(X86) || CPU(X86_64)
Kevin Kofler c87d48
+#if (CPU(X86) && defined(__SSE2__)) || CPU(X86_64)
Kevin Kofler c87d48
   if (sourceStride == 1) {
Kevin Kofler c87d48
     // If the sourceP address is not 16-byte aligned, the first several frames
Kevin Kofler c87d48
     // (at most three) should be processed separately.
Kevin Kofler c87d48
@@ -740,10 +799,17 @@
Kevin Kofler c87d48
              int sourceStride,
Kevin Kofler c87d48
              float* maxP,
Kevin Kofler c87d48
              size_t framesToProcess) {
Kevin Kofler c87d48
+#if CPU(X86) && !defined(__SSE2__)
Kevin Kofler c87d48
+  if (cpu.has_sse2()) {
Kevin Kofler c87d48
+    blink::VectorMath::SSE2::vmaxmgv(sourceP, sourceStride, maxP,
Kevin Kofler c87d48
+                                     framesToProcess);
Kevin Kofler c87d48
+    return;
Kevin Kofler c87d48
+  }
Kevin Kofler c87d48
+#endif
Kevin Kofler c87d48
   int n = framesToProcess;
Kevin Kofler c87d48
   float max = 0;
Kevin Kofler c87d48
 
Kevin Kofler c87d48
-#if CPU(X86) || CPU(X86_64)
Kevin Kofler c87d48
+#if (CPU(X86) && defined(__SSE2__)) || CPU(X86_64)
Kevin Kofler c87d48
   if (sourceStride == 1) {
Kevin Kofler c87d48
     // If the sourceP address is not 16-byte aligned, the first several frames
Kevin Kofler c87d48
     // (at most three) should be processed separately.
Kevin Kofler c87d48
@@ -832,6 +898,8 @@
Kevin Kofler c87d48
   *maxP = max;
Kevin Kofler c87d48
 }
Kevin Kofler c87d48
 
Kevin Kofler c87d48
+#ifndef BUILD_ONLY_THE_SSE2_PARTS
Kevin Kofler c87d48
+
Kevin Kofler c87d48
 void vclip(const float* sourceP,
Kevin Kofler c87d48
            int sourceStride,
Kevin Kofler c87d48
            const float* lowThresholdP,
Kevin Kofler c87d48
@@ -889,6 +957,12 @@
Kevin Kofler c87d48
   }
Kevin Kofler c87d48
 }
Kevin Kofler c87d48
 
Kevin Kofler c87d48
+#endif
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+#ifdef BUILD_ONLY_THE_SSE2_PARTS
Kevin Kofler c87d48
+} // namespace SSE2
Kevin Kofler c87d48
+#endif
Kevin Kofler c87d48
+
Kevin Kofler c87d48
 #endif  // OS(MACOSX)
Kevin Kofler c87d48
 
Kevin Kofler c87d48
 }  // namespace VectorMath
Kevin Kofler c87d48
diff -Nur qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/third_party/WebKit/Source/platform/audio/VectorMath.h qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/third_party/WebKit/Source/platform/audio/VectorMath.h
Kevin Kofler c87d48
--- qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/third_party/WebKit/Source/platform/audio/VectorMath.h	2017-05-18 16:51:44.000000000 +0200
Kevin Kofler c87d48
+++ qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/third_party/WebKit/Source/platform/audio/VectorMath.h	2017-06-09 00:27:58.975582370 +0200
Kevin Kofler c87d48
@@ -27,6 +27,7 @@
Kevin Kofler c87d48
 #define VectorMath_h
Kevin Kofler c87d48
 
Kevin Kofler c87d48
 #include "platform/PlatformExport.h"
Kevin Kofler c87d48
+#include "wtf/CPU.h"
Kevin Kofler c87d48
 #include "wtf/build_config.h"
Kevin Kofler c87d48
 #include <cstddef>
Kevin Kofler c87d48
 
Kevin Kofler c87d48
@@ -97,6 +98,62 @@
Kevin Kofler c87d48
                            int destStride,
Kevin Kofler c87d48
                            size_t framesToProcess);
Kevin Kofler c87d48
 
Kevin Kofler c87d48
+#if CPU(X86)
Kevin Kofler c87d48
+namespace SSE2 {
Kevin Kofler c87d48
+// Vector scalar multiply and then add.
Kevin Kofler c87d48
+PLATFORM_EXPORT void vsma(const float* sourceP,
Kevin Kofler c87d48
+                          int sourceStride,
Kevin Kofler c87d48
+                          const float* scale,
Kevin Kofler c87d48
+                          float* destP,
Kevin Kofler c87d48
+                          int destStride,
Kevin Kofler c87d48
+                          size_t framesToProcess);
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+PLATFORM_EXPORT void vsmul(const float* sourceP,
Kevin Kofler c87d48
+                           int sourceStride,
Kevin Kofler c87d48
+                           const float* scale,
Kevin Kofler c87d48
+                           float* destP,
Kevin Kofler c87d48
+                           int destStride,
Kevin Kofler c87d48
+                           size_t framesToProcess);
Kevin Kofler c87d48
+PLATFORM_EXPORT void vadd(const float* source1P,
Kevin Kofler c87d48
+                          int sourceStride1,
Kevin Kofler c87d48
+                          const float* source2P,
Kevin Kofler c87d48
+                          int sourceStride2,
Kevin Kofler c87d48
+                          float* destP,
Kevin Kofler c87d48
+                          int destStride,
Kevin Kofler c87d48
+                          size_t framesToProcess);
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+// Finds the maximum magnitude of a float vector.
Kevin Kofler c87d48
+PLATFORM_EXPORT void vmaxmgv(const float* sourceP,
Kevin Kofler c87d48
+                             int sourceStride,
Kevin Kofler c87d48
+                             float* maxP,
Kevin Kofler c87d48
+                             size_t framesToProcess);
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+// Sums the squares of a float vector's elements.
Kevin Kofler c87d48
+PLATFORM_EXPORT void vsvesq(const float* sourceP,
Kevin Kofler c87d48
+                            int sourceStride,
Kevin Kofler c87d48
+                            float* sumP,
Kevin Kofler c87d48
+                            size_t framesToProcess);
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+// For an element-by-element multiply of two float vectors.
Kevin Kofler c87d48
+PLATFORM_EXPORT void vmul(const float* source1P,
Kevin Kofler c87d48
+                          int sourceStride1,
Kevin Kofler c87d48
+                          const float* source2P,
Kevin Kofler c87d48
+                          int sourceStride2,
Kevin Kofler c87d48
+                          float* destP,
Kevin Kofler c87d48
+                          int destStride,
Kevin Kofler c87d48
+                          size_t framesToProcess);
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+// Multiplies two complex vectors.
Kevin Kofler c87d48
+PLATFORM_EXPORT void zvmul(const float* real1P,
Kevin Kofler c87d48
+                           const float* imag1P,
Kevin Kofler c87d48
+                           const float* real2P,
Kevin Kofler c87d48
+                           const float* imag2P,
Kevin Kofler c87d48
+                           float* realDestP,
Kevin Kofler c87d48
+                           float* imagDestP,
Kevin Kofler c87d48
+                           size_t framesToProcess);
Kevin Kofler c87d48
+}
Kevin Kofler c87d48
+#endif
Kevin Kofler c87d48
+
Kevin Kofler c87d48
 }  // namespace VectorMath
Kevin Kofler c87d48
 }  // namespace blink
Kevin Kofler c87d48
 
Kevin Kofler c87d48
diff -Nur qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/third_party/WebKit/Source/platform/audio/VectorMathSSE2.cpp qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/third_party/WebKit/Source/platform/audio/VectorMathSSE2.cpp
Kevin Kofler c87d48
--- qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/third_party/WebKit/Source/platform/audio/VectorMathSSE2.cpp	1970-01-01 01:00:00.000000000 +0100
Kevin Kofler c87d48
+++ qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/third_party/WebKit/Source/platform/audio/VectorMathSSE2.cpp	2017-06-08 22:50:07.969098737 +0200
Kevin Kofler c87d48
@@ -0,0 +1,2 @@
Kevin Kofler c87d48
+#define BUILD_ONLY_THE_SSE2_PARTS
Kevin Kofler c87d48
+#include "VectorMath.cpp"
Kevin Kofler c87d48
diff -Nur qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/third_party/WebKit/Source/platform/BUILD.gn qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/third_party/WebKit/Source/platform/BUILD.gn
Kevin Kofler c87d48
--- qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/third_party/WebKit/Source/platform/BUILD.gn	2017-05-18 16:51:44.000000000 +0200
Kevin Kofler 139a3d
+++ qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/third_party/WebKit/Source/platform/BUILD.gn	2017-06-12 00:21:47.738315411 +0200
Kevin Kofler c87d48
@@ -1529,6 +1529,10 @@
Kevin Kofler c87d48
     deps += [ ":blink_x86_sse" ]
Kevin Kofler c87d48
   }
Kevin Kofler c87d48
 
Kevin Kofler c87d48
+  if (current_cpu == "x86") {
Kevin Kofler c87d48
+    deps += [ ":blink_x86_sse2" ]
Kevin Kofler c87d48
+  }
Kevin Kofler c87d48
+
Kevin Kofler c87d48
   if (use_webaudio_ffmpeg) {
Kevin Kofler c87d48
     include_dirs += [ "//third_party/ffmpeg" ]
Kevin Kofler c87d48
     deps += [ "//third_party/ffmpeg" ]
Kevin Kofler 139a3d
@@ -1914,6 +1918,26 @@
Kevin Kofler c87d48
     ]
Kevin Kofler 139a3d
   }
Kevin Kofler 139a3d
 }
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+if (current_cpu == "x86") {
Kevin Kofler c87d48
+  source_set("blink_x86_sse2") {
Kevin Kofler c87d48
+    sources = [
Kevin Kofler c87d48
+      "audio/DirectConvolverSSE2.cpp",
Kevin Kofler c87d48
+      "audio/SincResamplerSSE2.cpp",
Kevin Kofler c87d48
+      "audio/VectorMathSSE2.cpp",
Kevin Kofler c87d48
+    ]
Kevin Kofler 4d8875
+    cflags = [ "-msse2", "-mfpmath=sse" ]
Kevin Kofler c87d48
+    deps = [
Kevin Kofler c87d48
+      ":blink_common",
Kevin Kofler c87d48
+    ]
Kevin Kofler 139a3d
+    configs += [
Kevin Kofler 139a3d
+        # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
Kevin Kofler 139a3d
+        "//build/config/compiler:no_size_t_to_int_warning",
Kevin Kofler 139a3d
+        "//third_party/WebKit/Source:config",
Kevin Kofler 139a3d
+        "//third_party/WebKit/Source:non_test_config",
Kevin Kofler 139a3d
+    ]
Kevin Kofler 139a3d
+  }
Kevin Kofler 139a3d
+}
Kevin Kofler c87d48
 
Kevin Kofler 139a3d
 # This source set is used for fuzzers that need an environment similar to unit
Kevin Kofler 139a3d
 # tests.
Kevin Kofler c87d48
diff -Nur qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/third_party/WebKit/Source/platform/graphics/cpu/x86/WebGLImageConversionSSE.h qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/third_party/WebKit/Source/platform/graphics/cpu/x86/WebGLImageConversionSSE.h
Kevin Kofler c87d48
--- qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/third_party/WebKit/Source/platform/graphics/cpu/x86/WebGLImageConversionSSE.h	2017-05-18 16:51:44.000000000 +0200
Kevin Kofler c87d48
+++ qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/third_party/WebKit/Source/platform/graphics/cpu/x86/WebGLImageConversionSSE.h	2017-06-08 22:50:09.251079402 +0200
Kevin Kofler c87d48
@@ -5,7 +5,7 @@
Kevin Kofler c87d48
 #ifndef WebGLImageConversionSSE_h
Kevin Kofler c87d48
 #define WebGLImageConversionSSE_h
Kevin Kofler c87d48
 
Kevin Kofler c87d48
-#if CPU(X86) || CPU(X86_64)
Kevin Kofler c87d48
+#if (CPU(X86) && defined(__SSE2__)) || CPU(X86_64)
Kevin Kofler c87d48
 
Kevin Kofler c87d48
 #include <emmintrin.h>
Kevin Kofler c87d48
 
Kevin Kofler c87d48
diff -Nur qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/third_party/WebKit/Source/platform/graphics/gpu/WebGLImageConversion.cpp qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/third_party/WebKit/Source/platform/graphics/gpu/WebGLImageConversion.cpp
Kevin Kofler c87d48
--- qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/third_party/WebKit/Source/platform/graphics/gpu/WebGLImageConversion.cpp	2017-05-18 16:51:44.000000000 +0200
Kevin Kofler c87d48
+++ qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/third_party/WebKit/Source/platform/graphics/gpu/WebGLImageConversion.cpp	2017-06-09 00:33:14.375866479 +0200
Kevin Kofler c87d48
@@ -441,7 +441,7 @@
Kevin Kofler c87d48
   const uint32_t* source32 = reinterpret_cast_ptr<const uint32_t*>(source);
Kevin Kofler c87d48
   uint32_t* destination32 = reinterpret_cast_ptr<uint32_t*>(destination);
Kevin Kofler c87d48
 
Kevin Kofler c87d48
-#if CPU(X86) || CPU(X86_64)
Kevin Kofler c87d48
+#if (CPU(X86) && defined(__SSE2__)) || CPU(X86_64)
Kevin Kofler c87d48
   SIMD::unpackOneRowOfBGRA8LittleToRGBA8(source32, destination32, pixelsPerRow);
Kevin Kofler c87d48
 #endif
Kevin Kofler c87d48
 #if HAVE(MIPS_MSA_INTRINSICS)
Kevin Kofler c87d48
@@ -467,7 +467,7 @@
Kevin Kofler c87d48
     const uint16_t* source,
Kevin Kofler c87d48
     uint8_t* destination,
Kevin Kofler c87d48
     unsigned pixelsPerRow) {
Kevin Kofler c87d48
-#if CPU(X86) || CPU(X86_64)
Kevin Kofler c87d48
+#if (CPU(X86) && defined(__SSE2__)) || CPU(X86_64)
Kevin Kofler c87d48
   SIMD::unpackOneRowOfRGBA5551LittleToRGBA8(source, destination, pixelsPerRow);
Kevin Kofler c87d48
 #endif
Kevin Kofler c87d48
 #if HAVE(ARM_NEON_INTRINSICS)
Kevin Kofler c87d48
@@ -496,7 +496,7 @@
Kevin Kofler c87d48
     const uint16_t* source,
Kevin Kofler c87d48
     uint8_t* destination,
Kevin Kofler c87d48
     unsigned pixelsPerRow) {
Kevin Kofler c87d48
-#if CPU(X86) || CPU(X86_64)
Kevin Kofler c87d48
+#if (CPU(X86) && defined(__SSE2__)) || CPU(X86_64)
Kevin Kofler c87d48
   SIMD::unpackOneRowOfRGBA4444LittleToRGBA8(source, destination, pixelsPerRow);
Kevin Kofler c87d48
 #endif
Kevin Kofler c87d48
 #if HAVE(ARM_NEON_INTRINSICS)
Kevin Kofler c87d48
@@ -711,7 +711,7 @@
Kevin Kofler c87d48
           uint8_t>(const uint8_t* source,
Kevin Kofler c87d48
                    uint8_t* destination,
Kevin Kofler c87d48
                    unsigned pixelsPerRow) {
Kevin Kofler c87d48
-#if CPU(X86) || CPU(X86_64)
Kevin Kofler c87d48
+#if (CPU(X86) && defined(__SSE2__)) || CPU(X86_64)
Kevin Kofler c87d48
   SIMD::packOneRowOfRGBA8LittleToR8(source, destination, pixelsPerRow);
Kevin Kofler c87d48
 #endif
Kevin Kofler c87d48
 #if HAVE(MIPS_MSA_INTRINSICS)
Kevin Kofler c87d48
@@ -768,7 +768,7 @@
Kevin Kofler c87d48
           uint8_t>(const uint8_t* source,
Kevin Kofler c87d48
                    uint8_t* destination,
Kevin Kofler c87d48
                    unsigned pixelsPerRow) {
Kevin Kofler c87d48
-#if CPU(X86) || CPU(X86_64)
Kevin Kofler c87d48
+#if (CPU(X86) && defined(__SSE2__)) || CPU(X86_64)
Kevin Kofler c87d48
   SIMD::packOneRowOfRGBA8LittleToRA8(source, destination, pixelsPerRow);
Kevin Kofler c87d48
 #endif
Kevin Kofler c87d48
 #if HAVE(MIPS_MSA_INTRINSICS)
Kevin Kofler c87d48
@@ -880,7 +880,7 @@
Kevin Kofler c87d48
           uint8_t>(const uint8_t* source,
Kevin Kofler c87d48
                    uint8_t* destination,
Kevin Kofler c87d48
                    unsigned pixelsPerRow) {
Kevin Kofler c87d48
-#if CPU(X86) || CPU(X86_64)
Kevin Kofler c87d48
+#if (CPU(X86) && defined(__SSE2__)) || CPU(X86_64)
Kevin Kofler c87d48
   SIMD::packOneRowOfRGBA8LittleToRGBA8(source, destination, pixelsPerRow);
Kevin Kofler c87d48
 #endif
Kevin Kofler c87d48
 #if HAVE(MIPS_MSA_INTRINSICS)
Kevin Kofler c87d48
diff -Nur qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/third_party/webrtc/common_audio/real_fourier.cc qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/third_party/webrtc/common_audio/real_fourier.cc
Kevin Kofler c87d48
--- qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/third_party/webrtc/common_audio/real_fourier.cc	2017-05-18 16:51:44.000000000 +0200
Kevin Kofler c87d48
+++ qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/third_party/webrtc/common_audio/real_fourier.cc	2017-06-08 22:50:09.434076641 +0200
Kevin Kofler c87d48
@@ -14,6 +14,7 @@
Kevin Kofler c87d48
 #include "webrtc/common_audio/real_fourier_ooura.h"
Kevin Kofler c87d48
 #include "webrtc/common_audio/real_fourier_openmax.h"
Kevin Kofler c87d48
 #include "webrtc/common_audio/signal_processing/include/signal_processing_library.h"
Kevin Kofler c87d48
+#include "webrtc/system_wrappers/include/cpu_features_wrapper.h"
Kevin Kofler c87d48
 
Kevin Kofler c87d48
 namespace webrtc {
Kevin Kofler c87d48
 
Kevin Kofler c87d48
@@ -23,7 +24,15 @@
Kevin Kofler c87d48
 
Kevin Kofler c87d48
 std::unique_ptr<RealFourier> RealFourier::Create(int fft_order) {
Kevin Kofler c87d48
 #if defined(RTC_USE_OPENMAX_DL)
Kevin Kofler c87d48
+#if defined(WEBRTC_ARCH_X86_FAMILY) && !defined(__SSE2__)
Kevin Kofler c87d48
+  // x86 CPU detection required.
Kevin Kofler c87d48
+  if (WebRtc_GetCPUInfo(kSSE2))
Kevin Kofler c87d48
+    return std::unique_ptr<RealFourier>(new RealFourierOpenmax(fft_order));
Kevin Kofler c87d48
+  else
Kevin Kofler c87d48
+    return std::unique_ptr<RealFourier>(new RealFourierOoura(fft_order));
Kevin Kofler c87d48
+#else
Kevin Kofler c87d48
   return std::unique_ptr<RealFourier>(new RealFourierOpenmax(fft_order));
Kevin Kofler c87d48
+#endif
Kevin Kofler c87d48
 #else
Kevin Kofler c87d48
   return std::unique_ptr<RealFourier>(new RealFourierOoura(fft_order));
Kevin Kofler c87d48
 #endif
Kevin Kofler c87d48
diff -Nur qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/v8/BUILD.gn qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/v8/BUILD.gn
Kevin Kofler c87d48
--- qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/v8/BUILD.gn	2017-05-18 16:51:44.000000000 +0200
Kevin Kofler 0df1d8
+++ qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/v8/BUILD.gn	2017-06-12 14:15:23.270523710 +0200
Kevin Kofler 0df1d8
@@ -117,7 +117,7 @@
Kevin Kofler c87d48
 
Kevin Kofler c87d48
   include_dirs = [ "." ]
Kevin Kofler c87d48
 
Kevin Kofler c87d48
-  if (is_component_build) {
Kevin Kofler c87d48
+  if (is_component_build || v8_build_shared) {
Kevin Kofler c87d48
     defines = [ "BUILDING_V8_SHARED" ]
Kevin Kofler c87d48
   }
Kevin Kofler c87d48
 }
Kevin Kofler 0df1d8
@@ -131,14 +131,14 @@
Kevin Kofler c87d48
 # This config should be applied to code using the libplatform.
Kevin Kofler c87d48
 config("libplatform_config") {
Kevin Kofler c87d48
   include_dirs = [ "include" ]
Kevin Kofler c87d48
-  if (is_component_build) {
Kevin Kofler c87d48
+  if (is_component_build || v8_build_shared) {
Kevin Kofler c87d48
     defines = [ "USING_V8_PLATFORM_SHARED" ]
Kevin Kofler c87d48
   }
Kevin Kofler c87d48
 }
Kevin Kofler c87d48
 
Kevin Kofler c87d48
 # This config should be applied to code using the libbase.
Kevin Kofler c87d48
 config("libbase_config") {
Kevin Kofler c87d48
-  if (is_component_build) {
Kevin Kofler c87d48
+  if (is_component_build || v8_build_shared) {
Kevin Kofler c87d48
     defines = [ "USING_V8_BASE_SHARED" ]
Kevin Kofler c87d48
   }
Kevin Kofler c87d48
   libs = []
Kevin Kofler 0df1d8
@@ -155,7 +155,7 @@
Kevin Kofler c87d48
 # This config should only be applied to code using V8 and not any V8 code
Kevin Kofler c87d48
 # itself.
Kevin Kofler c87d48
 config("external_config") {
Kevin Kofler c87d48
-  if (is_component_build) {
Kevin Kofler c87d48
+  if (is_component_build || v8_build_shared) {
Kevin Kofler c87d48
     defines = [ "USING_V8_SHARED" ]
Kevin Kofler c87d48
   }
Kevin Kofler c87d48
   include_dirs = [ "include" ]
Kevin Kofler 0df1d8
@@ -331,6 +331,9 @@
Kevin Kofler 88ac91
       cflags += [ "/arch:SSE2" ]
Kevin Kofler 88ac91
     }
Kevin Kofler 88ac91
   }
Kevin Kofler 88ac91
+  if (v8_current_cpu == "x87") {
Kevin Kofler 88ac91
+    defines += [ "V8_TARGET_ARCH_X87" ]
Kevin Kofler 88ac91
+  }
Kevin Kofler 88ac91
   if (v8_current_cpu == "x64") {
Kevin Kofler 88ac91
     defines += [ "V8_TARGET_ARCH_X64" ]
Kevin Kofler 88ac91
     if (is_win) {
Kevin Kofler 0df1d8
@@ -2274,7 +2277,7 @@
Kevin Kofler c87d48
 
Kevin Kofler c87d48
   defines = []
Kevin Kofler c87d48
 
Kevin Kofler c87d48
-  if (is_component_build) {
Kevin Kofler c87d48
+  if (is_component_build || v8_build_shared) {
Kevin Kofler c87d48
     defines = [ "BUILDING_V8_BASE_SHARED" ]
Kevin Kofler c87d48
   }
Kevin Kofler c87d48
 
Kevin Kofler 0df1d8
@@ -2364,7 +2367,7 @@
Kevin Kofler c87d48
 
Kevin Kofler c87d48
   configs = [ ":internal_config_base" ]
Kevin Kofler c87d48
 
Kevin Kofler c87d48
-  if (is_component_build) {
Kevin Kofler c87d48
+  if (is_component_build || v8_build_shared) {
Kevin Kofler c87d48
     defines = [ "BUILDING_V8_PLATFORM_SHARED" ]
Kevin Kofler c87d48
   }
Kevin Kofler c87d48
 
Kevin Kofler 0df1d8
@@ -2507,7 +2510,26 @@
Kevin Kofler c87d48
   }
Kevin Kofler c87d48
 }
Kevin Kofler c87d48
 
Kevin Kofler c87d48
-if (is_component_build) {
Kevin Kofler c87d48
+if (v8_build_shared) {
Kevin Kofler c87d48
+  shared_library("v8") {
Kevin Kofler c87d48
+    sources = [
Kevin Kofler c87d48
+      "src/v8dll-main.cc",
Kevin Kofler c87d48
+    ]
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+    deps = [
Kevin Kofler c87d48
+      ":v8_dump_build_config",
Kevin Kofler c87d48
+    ]
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+    public_deps = [
Kevin Kofler c87d48
+      ":v8_base",
Kevin Kofler c87d48
+      ":v8_maybe_snapshot",
Kevin Kofler c87d48
+    ]
Kevin Kofler c87d48
+
Kevin Kofler 2b75cf
+    configs += [ ":internal_config" ]
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+    public_configs = [ ":external_config" ]
Kevin Kofler c87d48
+  }
Kevin Kofler 7b17fa
+} else if (is_component_build) {
Kevin Kofler c87d48
   v8_component("v8") {
Kevin Kofler c87d48
     sources = [
Kevin Kofler c87d48
       "src/v8dll-main.cc",
Kevin Kofler 0df1d8
diff -Nur qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/v8/gni/v8.gni qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/v8/gni/v8.gni
Kevin Kofler 0df1d8
--- qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/v8/gni/v8.gni	2017-05-18 16:51:44.000000000 +0200
Kevin Kofler 0df1d8
+++ qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/v8/gni/v8.gni	2017-06-12 14:15:47.965158851 +0200
Kevin Kofler 0df1d8
@@ -30,6 +30,9 @@
Kevin Kofler 0df1d8
   # Enable ECMAScript Internationalization API. Enabling this feature will
Kevin Kofler 0df1d8
   # add a dependency on the ICU library.
Kevin Kofler 0df1d8
   v8_enable_i18n_support = true
Kevin Kofler 0df1d8
+
Kevin Kofler 0df1d8
+  # Whether to build V8 as a shared library
Kevin Kofler 0df1d8
+  v8_build_shared = false
Kevin Kofler 0df1d8
 }
Kevin Kofler 0df1d8
 
Kevin Kofler 0df1d8
 if (v8_use_external_startup_data == "") {
Kevin Kofler 0df1d8
@@ -42,6 +45,11 @@
Kevin Kofler 0df1d8
   v8_enable_backtrace = is_debug && !v8_optimized_debug
Kevin Kofler 0df1d8
 }
Kevin Kofler 0df1d8
 
Kevin Kofler 0df1d8
+if (v8_current_cpu == "x86" || v8_current_cpu == "x87") {
Kevin Kofler 0df1d8
+  # build V8 shared on x86 so we can swap x87 vs. SSE2 builds
Kevin Kofler 0df1d8
+  v8_build_shared = true
Kevin Kofler 0df1d8
+}
Kevin Kofler 0df1d8
+
Kevin Kofler 0df1d8
 # Points to // in v8 stand-alone or to //v8/ in chromium. We need absolute
Kevin Kofler 0df1d8
 # paths for all configs in templates as they are shared in different
Kevin Kofler 0df1d8
 # subdirectories.
Kevin Kofler c87d48
diff -Nur qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/v8/make-v8-sse2-gyp.sh qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/v8/make-v8-sse2-gyp.sh
Kevin Kofler c87d48
--- qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/v8/make-v8-sse2-gyp.sh	1970-01-01 01:00:00.000000000 +0100
Kevin Kofler c87d48
+++ qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/v8/make-v8-sse2-gyp.sh	2017-06-08 22:50:09.496075706 +0200
Kevin Kofler c87d48
@@ -0,0 +1,56 @@
Kevin Kofler c87d48
+#!/bin/sh
Kevin Kofler c87d48
+# This script renames the v8 targets to _sse2 names so that they do not conflict
Kevin Kofler c87d48
+# with the non-SSE2 versions.
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+# Copyright 2016 Kevin Kofler. All rights reserved.
Kevin Kofler c87d48
+# Redistribution and use in source and binary forms, with or without
Kevin Kofler c87d48
+# modification, are permitted provided that the following conditions are
Kevin Kofler c87d48
+# met:
Kevin Kofler c87d48
+#
Kevin Kofler c87d48
+#     * Redistributions of source code must retain the above copyright
Kevin Kofler c87d48
+#       notice, this list of conditions and the following disclaimer.
Kevin Kofler c87d48
+#     * Redistributions in binary form must reproduce the above
Kevin Kofler c87d48
+#       copyright notice, this list of conditions and the following
Kevin Kofler c87d48
+#       disclaimer in the documentation and/or other materials provided
Kevin Kofler c87d48
+#       with the distribution.
Kevin Kofler c87d48
+#     * Neither the name of Google Inc. nor the names of its
Kevin Kofler c87d48
+#       contributors may be used to endorse or promote products derived
Kevin Kofler c87d48
+#       from this software without specific prior written permission.
Kevin Kofler c87d48
+#
Kevin Kofler c87d48
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
Kevin Kofler c87d48
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
Kevin Kofler c87d48
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
Kevin Kofler c87d48
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
Kevin Kofler c87d48
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
Kevin Kofler c87d48
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
Kevin Kofler c87d48
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
Kevin Kofler c87d48
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
Kevin Kofler c87d48
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
Kevin Kofler c87d48
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Kevin Kofler c87d48
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+# add comment noting that the file is generated
Kevin Kofler c87d48
+echo "# Generated from v8.gyp by make-v8-sse2-gyp.sh" >v8_sse2.gyp
Kevin Kofler c87d48
+# rename all target names
Kevin Kofler c87d48
+SUBTARGETS=`grep "'target_name': '" v8.gyp | sed -e "s/^.*'target_name': '//g" -e "s/',$//g"`
Kevin Kofler c87d48
+SEDS=
Kevin Kofler c87d48
+for SUBTARGET in $SUBTARGETS ; do
Kevin Kofler c87d48
+  SEDS=$SEDS\ -e\ "s/'$SUBTARGET\(['#]\)/'${SUBTARGET}_sse2\1/g"
Kevin Kofler c87d48
+done
Kevin Kofler c87d48
+# in addition:
Kevin Kofler c87d48
+# * set v8_target_arch to "ia32" (instead of "x87")
Kevin Kofler c87d48
+# * rename all actions
Kevin Kofler c87d48
+# * fix mksnapshot_exec to match the renamed target
Kevin Kofler c87d48
+# * rename the generated snapshot.cc (but not mksnapshot.cc) to snapshot_sse2.cc
Kevin Kofler c87d48
+# * rename the generated *libraries.cc to *libraries_sse2.cc
Kevin Kofler c87d48
+# * rename the generated *.bin to *_sse2.bin
Kevin Kofler c87d48
+# * set product_name and product_dir for the v8_sse2 target
Kevin Kofler c87d48
+sed -e "s/^\(  'variables': {\)/\1\n    'v8_target_arch': 'ia32',/g" \
Kevin Kofler c87d48
+    -e "s/\('action_name': '\)/\1v8_sse2_/g" \
Kevin Kofler c87d48
+    $SEDS \
Kevin Kofler c87d48
+    -e "s/\('mksnapshot_exec': '.*mksnapshot\)/\1_sse2/g" \
Kevin Kofler c87d48
+    -e "s#/snapshot\.cc#/snapshot_sse2.cc#g" \
Kevin Kofler c87d48
+    -e "s/libraries\.cc/libraries_sse2.cc/g" \
Kevin Kofler c87d48
+    -e "s/\.bin/_sse2.bin/g" \
Kevin Kofler c87d48
+    -e "s#^\( *\)\('target_name': 'v8_sse2',\)#\1\2\n\1'product_name': 'v8',\n\1'product_dir': '<(PRODUCT_DIR)/lib/sse2',#g" \
Kevin Kofler c87d48
+    v8.gyp >>v8_sse2.gyp
Kevin Kofler 0df1d8
diff -Nur qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/v8/src/inspector/BUILD.gn qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/v8/src/inspector/BUILD.gn
Kevin Kofler 0df1d8
--- qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/v8/src/inspector/BUILD.gn	2017-05-18 16:51:44.000000000 +0200
Kevin Kofler 0df1d8
+++ qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/v8/src/inspector/BUILD.gn	2017-06-12 14:16:16.955730521 +0200
Kevin Kofler 0df1d8
@@ -106,7 +106,7 @@
Kevin Kofler 0df1d8
       "/wd4996",  # Deprecated function call.
Kevin Kofler 0df1d8
     ]
Kevin Kofler 0df1d8
   }
Kevin Kofler 0df1d8
-  if (is_component_build) {
Kevin Kofler 0df1d8
+  if (is_component_build || v8_build_shared) {
Kevin Kofler 0df1d8
     defines = [ "BUILDING_V8_SHARED" ]
Kevin Kofler 0df1d8
   }
Kevin Kofler 0df1d8
 }
Kevin Kofler 0df1d8
diff -Nur qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/v8/test/cctest/BUILD.gn qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/v8/test/cctest/BUILD.gn
Kevin Kofler 0df1d8
--- qtwebengine-opensource-src-5.9.0/src/3rdparty/chromium/v8/test/cctest/BUILD.gn	2017-05-18 16:51:44.000000000 +0200
Kevin Kofler 0df1d8
+++ qtwebengine-opensource-src-5.9.0-no-sse2/src/3rdparty/chromium/v8/test/cctest/BUILD.gn	2017-06-12 14:16:45.945302206 +0200
Kevin Kofler 0df1d8
@@ -335,7 +335,7 @@
Kevin Kofler 0df1d8
 
Kevin Kofler 0df1d8
   defines = []
Kevin Kofler 0df1d8
 
Kevin Kofler 0df1d8
-  if (is_component_build) {
Kevin Kofler 0df1d8
+  if (is_component_build || v8_build_shared) {
Kevin Kofler 0df1d8
     # cctest can't be built against a shared library, so we
Kevin Kofler 0df1d8
     # need to depend on the underlying static target in that case.
Kevin Kofler 0df1d8
     deps += [ "../..:v8_maybe_snapshot" ]
Kevin Kofler c87d48
diff -Nur qtwebengine-opensource-src-5.9.0/src/core/core_module.pro qtwebengine-opensource-src-5.9.0-no-sse2/src/core/core_module.pro
Kevin Kofler c87d48
--- qtwebengine-opensource-src-5.9.0/src/core/core_module.pro	2017-05-19 06:22:04.000000000 +0200
Kevin Kofler 139a3d
+++ qtwebengine-opensource-src-5.9.0-no-sse2/src/core/core_module.pro	2017-06-12 00:25:07.241337485 +0200
Kevin Kofler 139a3d
@@ -41,6 +41,31 @@
Kevin Kofler c87d48
 else: QMAKE_LFLAGS += $$NINJA_LFLAGS
Kevin Kofler c87d48
 POST_TARGETDEPS += $$NINJA_TARGETDEPS
Kevin Kofler c87d48
 
Kevin Kofler c87d48
+# go through the shared libraries that GN wants to link to
Kevin Kofler 139a3d
+# ignore the dummy convert_dict shared library used only to get a .pri file
Kevin Kofler c87d48
+# add the ones NOT in lib/sse2 to LIBS_PRIVATE
Kevin Kofler c87d48
+# don't add those in lib/sse2 that are only replacements for the normal ones
Kevin Kofler c87d48
+# collect all shared libraries, non-SSE2 and SSE2, so they can be installed
Kevin Kofler c87d48
+for(shlib, NINJA_SOLIBS) {
Kevin Kofler 139a3d
+    !contains(shlib, .*convert_dict.*) {
Kevin Kofler 139a3d
+        contains(shlib, .*/lib/sse2/.*) {
Kevin Kofler 139a3d
+            shlibs_sse2 += $$shlib
Kevin Kofler 139a3d
+        } else {
Kevin Kofler 139a3d
+            LIBS_PRIVATE += $$shlib
Kevin Kofler 139a3d
+            shlibs += $$shlib
Kevin Kofler 139a3d
+        }
Kevin Kofler c87d48
+    }
Kevin Kofler c87d48
+}
Kevin Kofler c87d48
+
Kevin Kofler c87d48
+# set the shared libraries to be installed
Kevin Kofler c87d48
+# add an rpath to their installation location
Kevin Kofler c87d48
+shlib_install_path = $$[QT_INSTALL_LIBS]/qtwebengine
Kevin Kofler c87d48
+!isEmpty(shlibs) {
Kevin Kofler c87d48
+    shlibs.files += $$shlibs
Kevin Kofler c87d48
+    shlibs_sse2.files += $$shlibs_sse2
Kevin Kofler c87d48
+    LIBS_PRIVATE += -Wl,--rpath,$$shlib_install_path
Kevin Kofler c87d48
+}
Kevin Kofler c87d48
+
Kevin Kofler c87d48
 
Kevin Kofler c87d48
 LIBS_PRIVATE += -L$$api_library_path
Kevin Kofler c87d48
 CONFIG *= no_smart_library_merge
Kevin Kofler 139a3d
@@ -100,7 +125,12 @@
Kevin Kofler c87d48
         locales.path = $$[QT_INSTALL_TRANSLATIONS]/qtwebengine_locales
Kevin Kofler c87d48
         resources.CONFIG += no_check_exist
Kevin Kofler c87d48
         resources.path = $$[QT_INSTALL_DATA]/resources
Kevin Kofler c87d48
-        INSTALLS += locales resources
Kevin Kofler c87d48
+        # install the shared libraries
Kevin Kofler c87d48
+        shlibs.CONFIG += no_check_exist
Kevin Kofler c87d48
+        shlibs.path = $$shlib_install_path
Kevin Kofler c87d48
+        shlibs_sse2.CONFIG += no_check_exist
Kevin Kofler c87d48
+        shlibs_sse2.path = $$shlib_install_path/sse2
Kevin Kofler c87d48
+        INSTALLS += locales resources shlibs shlibs_sse2
Kevin Kofler c87d48
 
Kevin Kofler c87d48
         !use?(system_icu) {
Kevin Kofler c87d48
             icu.CONFIG += no_check_exist
Kevin Kofler 1a7c1d
diff -Nur qtwebengine-opensource-src-5.9.0/src/process/process.pro qtwebengine-opensource-src-5.9.0-no-sse2/src/process/process.pro
Kevin Kofler 1a7c1d
--- qtwebengine-opensource-src-5.9.0/src/process/process.pro	2017-05-19 06:22:04.000000000 +0200
Kevin Kofler 1a7c1d
+++ qtwebengine-opensource-src-5.9.0-no-sse2/src/process/process.pro	2017-06-12 16:36:03.823777310 +0200
Kevin Kofler 1a7c1d
@@ -9,6 +9,8 @@
Kevin Kofler 1a7c1d
 
Kevin Kofler 1a7c1d
 SOURCES = main.cpp
Kevin Kofler 1a7c1d
 
Kevin Kofler 1a7c1d
+QMAKE_LFLAGS += -Wl,-rpath-link,$$OUT_PWD/../core/Release
Kevin Kofler 1a7c1d
+
Kevin Kofler 1a7c1d
 win32 {
Kevin Kofler 1a7c1d
     SOURCES += \
Kevin Kofler 1a7c1d
         support_win.cpp