Roll skcms from da218e6af725 to 5404be4a2703 (1 revision)

https://skia.googlesource.com/skcms.git/+log/da218e6af725..5404be4a2703

2020-05-26 mtklein@google.com add function to disable CPU detection

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/skcms-skia-autoroll
Please CC westont@google.com,mtklein@google.com on the revert to ensure that a human
is aware of the problem.

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/master/autoroll/README.md

Change-Id: I26a9428c3d80c249e6e66e7fffc3fb76245a1be6
Cq-Include-Trybots: luci.chromium.try:linux-blink-rel
Tbr: westont@google.com,mtklein@google.com
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/291898
Reviewed-by: skia-autoroll <skia-autoroll@skia-public.iam.gserviceaccount.com>
Commit-Queue: skia-autoroll <skia-autoroll@skia-public.iam.gserviceaccount.com>
diff --git a/include/third_party/skcms/skcms.h b/include/third_party/skcms/skcms.h
index 486844a..eec1442 100644
--- a/include/third_party/skcms/skcms.h
+++ b/include/third_party/skcms/skcms.h
@@ -307,6 +307,9 @@
                                        float wx, float wy,
                                        skcms_Matrix3x3* toXYZD50);
 
+// Call before your first call to skcms_Transform() to skip runtime CPU detection.
+SKCMS_API void skcms_DisableRuntimeCPUDetection(void);
+
 // Utilities for programmatically constructing profiles
 static inline void skcms_Init(skcms_ICCProfile* p) {
     memset(p, 0, sizeof(*p));
diff --git a/third_party/skcms/skcms.cc b/third_party/skcms/skcms.cc
index 5d6ae3d..92af963 100644
--- a/third_party/skcms/skcms.cc
+++ b/third_party/skcms/skcms.cc
@@ -32,6 +32,11 @@
     #endif
 #endif
 
+static bool runtime_cpu_detection = true;
+void skcms_DisableRuntimeCPUDetection() {
+    runtime_cpu_detection = false;
+}
+
 // sizeof(x) will return size_t, which is 32-bit on some machines and 64-bit on others.
 // We have better testing on 64-bit machines, so force 32-bit machines to behave like 64-bit.
 //
@@ -2143,6 +2148,9 @@
         enum class CpuType { None, HSW, SKX };
         static CpuType cpu_type() {
             static const CpuType type = []{
+                if (!runtime_cpu_detection) {
+                    return CpuType::None;
+                }
                 // See http://www.sandpile.org/x86/cpuid.htm
 
                 // First, a basic cpuid(1) lets us check prerequisites for HSW, SKX.
diff --git a/third_party/skcms/version.sha1 b/third_party/skcms/version.sha1
index 7ca0062..d068705 100755
--- a/third_party/skcms/version.sha1
+++ b/third_party/skcms/version.sha1
@@ -1 +1 @@
-da218e6af7250a97c0ae0439695833fd4a60cdda
+5404be4a27033669abfc1eb9f1c45e09b597ccfa