Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(531)

Unified Diff: source/cpu_id.cc

Issue 2378753004: Add MSA optimized I422ToYUY2Row, I422ToUYVYRow functions (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: source/cpu_id.cc
diff --git a/source/cpu_id.cc b/source/cpu_id.cc
index 27e2467b020a326be1f919d3d00067388183e896..26741f21945555d794cc11a2d5d1687fff32bb66 100644
--- a/source/cpu_id.cc
+++ b/source/cpu_id.cc
@@ -27,6 +27,10 @@
#include <stdio.h>
#include <string.h>
+#if defined(__mips__)
+#include <sys/auxv.h> // For getauxval
+#endif
+
#include "libyuv/basic_types.h" // For CPU_X86
#ifdef __cplusplus
@@ -161,16 +165,24 @@ int ArmCpuCaps(const char* cpuinfo_name) {
return 0;
}
+#if defined(__mips__)
+#define HWCAP_MIPS_R6 (1 << 0)
fbarchard1 2016/09/29 17:10:43 R6 not used?
manojkumar.bhosale 2016/09/30 09:00:29 No, not now as R5, R6 both returns MSA HWCAPS so R
+#define HWCAP_MIPS_MSA (1 << 1)
+#endif
+
LIBYUV_API SAFEBUFFERS
int MipsCpuCaps(const char* cpuinfo_name, const char ase[]) {
char cpuinfo_line[512];
int len = (int)strlen(ase);
+ int hwcap = 0;
FILE* f = fopen(cpuinfo_name, "r");
if (!f) {
- // ase enabled if /proc/cpuinfo is unavailable.
- if (strcmp(ase, " msa") == 0) {
+ hwcap = getauxval(AT_HWCAP);
fbarchard1 2016/09/29 17:10:43 this function is also unavailable in sandbox? pref
manojkumar.bhosale 2016/09/30 09:00:29 OK. will split that in new CL
+ if (hwcap & HWCAP_MIPS_MSA) {
return kCpuHasMSA;
}
+
+ // dspr2 enabled if /proc/cpuinfo is unavailable.
if (strcmp(ase, " dspr2") == 0) {
return kCpuHasDSPR2;
}
@@ -180,7 +192,8 @@ int MipsCpuCaps(const char* cpuinfo_name, const char ase[]) {
char* p = strstr(cpuinfo_line, ase);
if (p && (p[len] == ' ' || p[len] == '\n')) {
fclose(f);
- if (strcmp(ase, " msa") == 0) {
+ hwcap = getauxval(AT_HWCAP);
fbarchard1 2016/09/29 17:10:43 this is mixed into string parsing code? getauxva
manojkumar.bhosale 2016/09/30 09:00:29 Removed cpuid code from this CL
+ if (hwcap & HWCAP_MIPS_MSA) {
return kCpuHasMSA;
}
if (strcmp(ase, " dspr2") == 0) {
« no previous file with comments | « source/convert_from_argb.cc ('k') | source/row_any.cc » ('j') | source/row_msa.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698