[Bf-blender-cvs] [ffa70e76901] blender-v2.93-release: Fix missing Cycles CPU name for Arm processors
Patrick Mours
noreply at git.blender.org
Thu Apr 29 15:59:34 CEST 2021
Commit: ffa70e769010a3b7e6b80be6f80b21dfb8713f13
Author: Patrick Mours
Date: Thu Apr 29 15:51:29 2021 +0200
Branches: blender-v2.93-release
https://developer.blender.org/rBffa70e769010a3b7e6b80be6f80b21dfb8713f13
Fix missing Cycles CPU name for Arm processors
===================================================================
M intern/cycles/util/util_system.cpp
===================================================================
diff --git a/intern/cycles/util/util_system.cpp b/intern/cycles/util/util_system.cpp
index 2c1716ce515..6500a59e42c 100644
--- a/intern/cycles/util/util_system.cpp
+++ b/intern/cycles/util/util_system.cpp
@@ -166,12 +166,33 @@ static void __cpuid(int data[4], int selector)
string system_cpu_brand_string()
{
+#if !defined(WIN32) && !defined(__x86_64__) && !defined(__i386__)
+ FILE *cpuinfo = fopen("/proc/cpuinfo", "r");
+ if (cpuinfo != nullptr) {
+ char cpuinfo_buf[513] = "";
+ fread(cpuinfo_buf, sizeof(cpuinfo_buf) - 1, 1, cpuinfo);
+ fclose(cpuinfo);
+
+ char *modelname = strstr(cpuinfo_buf, "model name");
+ if (modelname != nullptr) {
+ modelname = strchr(modelname, ':');
+ if (modelname != nullptr) {
+ modelname += 2;
+ char *modelname_end = strchr(modelname, '\n');
+ if (modelname_end != nullptr) {
+ *modelname_end = '\0';
+ return modelname;
+ }
+ }
+ }
+ }
+#else
char buf[49] = {0};
int result[4] = {0};
__cpuid(result, 0x80000000);
- if (result[0] >= (int)0x80000004) {
+ if (result[0] != 0 && result[0] >= (int)0x80000004) {
__cpuid((int *)(buf + 0), 0x80000002);
__cpuid((int *)(buf + 16), 0x80000003);
__cpuid((int *)(buf + 32), 0x80000004);
@@ -183,7 +204,7 @@ string system_cpu_brand_string()
return brand;
}
-
+#endif
return "Unknown CPU";
}
More information about the Bf-blender-cvs
mailing list