Bug 1342730: clean up MipsCpuCaps r=sotaro
authorRandell Jesup <rjesup@jesup.org>
Tue, 28 Feb 2017 23:20:50 -0500
changeset 345205 f29dad38621ed4462b4416ffa090d25e9c017cde
parent 345204 1a8bcf69e88fb38e2bb18ffa1094997c5092fce6
child 345206 dabb9120d849fec9dd6946ee4c43d15d0b9679ae
push id87530
push userrjesup@wgate.com
push dateWed, 01 Mar 2017 04:25:29 +0000
treeherdermozilla-inbound@f29dad38621e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssotaro
bugs1342730
milestone54.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1342730: clean up MipsCpuCaps r=sotaro MozReview-Commit-ID: 2EwQHcN8gfF
media/libyuv/cpu_id.patch
media/libyuv/libyuv/source/cpu_id.cc
media/libyuv/update.py
new file mode 100644
--- /dev/null
+++ b/media/libyuv/cpu_id.patch
@@ -0,0 +1,34 @@
+diff --git a/media/libyuv/libyuv/source/cpu_id.cc b/media/libyuv/libyuv/source/cpu_id.cc
+--- a/media/libyuv/libyuv/source/cpu_id.cc
++++ b/media/libyuv/libyuv/source/cpu_id.cc
+@@ -172,28 +172,30 @@ LIBYUV_API SAFEBUFFERS int MipsCpuCaps(c
+   if (!f) {
+     // ase enabled if /proc/cpuinfo is unavailable.
+     if (strcmp(ase, " msa") == 0) {
+       return kCpuHasMSA;
+     }
+     if (strcmp(ase, " dspr2") == 0) {
+       return kCpuHasDSPR2;
+     }
++    return 0;
+   }
+   while (fgets(cpuinfo_line, sizeof(cpuinfo_line) - 1, f)) {
+     if (memcmp(cpuinfo_line, "ASEs implemented", 16) == 0) {
+       char* p = strstr(cpuinfo_line, ase);
+       if (p && (p[len] == ' ' || p[len] == '\n')) {
+         fclose(f);
+         if (strcmp(ase, " msa") == 0) {
+           return kCpuHasMSA;
+         }
+         if (strcmp(ase, " dspr2") == 0) {
+           return kCpuHasDSPR2;
+         }
++        return 0;
+       }
+     }
+   }
+   fclose(f);
+   return 0;
+ }
+ 
+ // CPU detect function for SIMD instruction sets.
--- a/media/libyuv/libyuv/source/cpu_id.cc
+++ b/media/libyuv/libyuv/source/cpu_id.cc
@@ -172,28 +172,30 @@ LIBYUV_API SAFEBUFFERS int MipsCpuCaps(c
   if (!f) {
     // ase enabled if /proc/cpuinfo is unavailable.
     if (strcmp(ase, " msa") == 0) {
       return kCpuHasMSA;
     }
     if (strcmp(ase, " dspr2") == 0) {
       return kCpuHasDSPR2;
     }
+    return 0;
   }
   while (fgets(cpuinfo_line, sizeof(cpuinfo_line) - 1, f)) {
     if (memcmp(cpuinfo_line, "ASEs implemented", 16) == 0) {
       char* p = strstr(cpuinfo_line, ase);
       if (p && (p[len] == ' ' || p[len] == '\n')) {
         fclose(f);
         if (strcmp(ase, " msa") == 0) {
           return kCpuHasMSA;
         }
         if (strcmp(ase, " dspr2") == 0) {
           return kCpuHasDSPR2;
         }
+        return 0;
       }
     }
   }
   fclose(f);
   return 0;
 }
 
 // CPU detect function for SIMD instruction sets.
--- a/media/libyuv/update.py
+++ b/media/libyuv/update.py
@@ -32,16 +32,18 @@ def apply_patches():
     # Patch to fix build errors
     os.system("patch -p3 < fix_build_errors.patch")
     # Patch to make mjpeg printfs optional at build time
     os.system("patch -p3 < make_mjpeg_printfs_optional.patch")
     # Patch to allow disabling of inline ASM and AVX2 code
     os.system("patch -p3 < allow_disabling_asm_avx2.patch")
     # Patch to add H444ToARGB() variant
     os.system("patch -p3 < add_H444ToARGB.patch")
+    # Patch for bug 1342730
+    os.system("patch -p3 < cpu_id.patch")
 
 def update_readme(commit):
     with open('README_MOZILLA') as f:
         readme = f.read()
 
     if 'The git commit ID last used to import was ' in readme:
         new_readme = re.sub('The git commit ID last used to import was [v\.a-f0-9]+',
             'The git commit ID last used to import was %s' % commit, readme)