Bug 1342730: clean up MipsCpuCaps r=sotaro

MozReview-Commit-ID: 2EwQHcN8gfF
This commit is contained in:
Randell Jesup 2017-02-28 23:20:50 -05:00
Родитель cebf845be0
Коммит b4b1d2146e
3 изменённых файлов: 38 добавлений и 0 удалений

34
media/libyuv/cpu_id.patch Normal file
Просмотреть файл

@ -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.

Просмотреть файл

@ -177,6 +177,7 @@ LIBYUV_API SAFEBUFFERS int MipsCpuCaps(const char* cpuinfo_name,
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) {
@ -189,6 +190,7 @@ LIBYUV_API SAFEBUFFERS int MipsCpuCaps(const char* cpuinfo_name,
if (strcmp(ase, " dspr2") == 0) {
return kCpuHasDSPR2;
}
return 0;
}
}
}

Просмотреть файл

@ -37,6 +37,8 @@ def apply_patches():
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: