mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
Common: Expose CPU extension list directly.
A bit silly to rely on the specific string formatting of a summary.
This commit is contained in:
1 parent
368aba3c8d
commit
09eb509df4
7 files changed
+168
-62
No files matched your search
+38
-16
@@ -339,29 +339,51 @@ void CPUInfo::Detect()
|
||||
#endif
|
||||
}
|
||||
|
||||
std::vector<std::string> CPUInfo::Features() {
|
||||
std::vector<std::string> features;
|
||||
|
||||
struct Flag {
|
||||
bool &flag;
|
||||
const char *str;
|
||||
};
|
||||
const Flag list[] = {
|
||||
{ bSwp, "SWP" },
|
||||
{ bHalf, "Half" },
|
||||
{ bThumb, "Thumb" },
|
||||
{ bFastMult, "FastMult" },
|
||||
{ bEDSP, "EDSP" },
|
||||
{ bThumbEE, "ThumbEE" },
|
||||
{ bTLS, "TLS" },
|
||||
{ bVFP, "VFP" },
|
||||
{ bVFPv3, "VFPv3" },
|
||||
{ bVFPv4, "VFPv4" },
|
||||
{ bNEON, "NEON" },
|
||||
{ bIDIVa, "IDIVa" },
|
||||
{ bIDIVt, "IDIVt" },
|
||||
{ CPU64bit, "64-bit" },
|
||||
};
|
||||
|
||||
for (auto &item : list) {
|
||||
if (item.flag) {
|
||||
features.push_back(item.str);
|
||||
}
|
||||
}
|
||||
|
||||
return features;
|
||||
}
|
||||
|
||||
// Turn the cpu info into a string we can show
|
||||
std::string CPUInfo::Summarize()
|
||||
{
|
||||
std::string CPUInfo::Summarize() {
|
||||
std::string sum;
|
||||
if (num_cores == 1)
|
||||
sum = StringFromFormat("%s, %d core", cpu_string, num_cores);
|
||||
else
|
||||
sum = StringFromFormat("%s, %d cores", cpu_string, num_cores);
|
||||
if (bSwp) sum += ", SWP";
|
||||
if (bHalf) sum += ", Half";
|
||||
if (bThumb) sum += ", Thumb";
|
||||
if (bFastMult) sum += ", FastMult";
|
||||
if (bEDSP) sum += ", EDSP";
|
||||
if (bThumbEE) sum += ", ThumbEE";
|
||||
if (bTLS) sum += ", TLS";
|
||||
if (bVFP) sum += ", VFP";
|
||||
if (bVFPv3) sum += ", VFPv3";
|
||||
if (bVFPv4) sum += ", VFPv4";
|
||||
if (bNEON) sum += ", NEON";
|
||||
if (bIDIVa) sum += ", IDIVa";
|
||||
if (bIDIVt) sum += ", IDIVt";
|
||||
if (CPU64bit) sum += ", 64-bit";
|
||||
|
||||
auto features = Features();
|
||||
for (std::string &feature : features) {
|
||||
sum += ", " + feature;
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
|
||||
|
||||
+56
-32
@@ -481,39 +481,63 @@ void CPUInfo::Detect() {
|
||||
logical_cpu_count = 1;
|
||||
}
|
||||
|
||||
// Turn the cpu info into a string we can show
|
||||
std::string CPUInfo::Summarize()
|
||||
{
|
||||
std::string sum;
|
||||
if (num_cores == 1)
|
||||
sum = StringFromFormat("%s, %d core", cpu_string, num_cores);
|
||||
else
|
||||
{
|
||||
sum = StringFromFormat("%s, %d cores", cpu_string, num_cores);
|
||||
if (HTT) sum += StringFromFormat(" (%i logical threads per physical core)", logical_cpu_count);
|
||||
std::vector<std::string> CPUInfo::Features() {
|
||||
std::vector<std::string> features;
|
||||
|
||||
struct Flag {
|
||||
bool &flag;
|
||||
const char *str;
|
||||
};
|
||||
const Flag list[] = {
|
||||
{ bSSE, "SSE" },
|
||||
{ bSSE2, "SSE2" },
|
||||
{ bSSE3, "SSE3" },
|
||||
{ bSSSE3, "SSSE3" },
|
||||
{ bSSE4_1, "SSE4.1" },
|
||||
{ bSSE4_2, "SSE4.2" },
|
||||
{ bSSE4A, "SSE4A" },
|
||||
{ HTT, "HTT" },
|
||||
{ bAVX, "AVX" },
|
||||
{ bAVX2, "AVX2" },
|
||||
{ bFMA3, "FMA3" },
|
||||
{ bFMA4, "FMA4" },
|
||||
{ bAES, "AES" },
|
||||
{ bSHA, "SHA" },
|
||||
{ bXOP, "XOP" },
|
||||
{ bRTM, "TSX" },
|
||||
{ bF16C, "F16C" },
|
||||
{ bBMI1, "BMI1" },
|
||||
{ bBMI2, "BMI2" },
|
||||
{ bPOPCNT, "POPCNT" },
|
||||
{ bMOVBE, "MOVBE" },
|
||||
{ bLZCNT, "LZCNT" },
|
||||
{ bLongMode, "64-bit support" },
|
||||
};
|
||||
|
||||
for (auto &item : list) {
|
||||
if (item.flag) {
|
||||
features.push_back(item.str);
|
||||
}
|
||||
}
|
||||
|
||||
return features;
|
||||
}
|
||||
|
||||
// Turn the cpu info into a string we can show
|
||||
std::string CPUInfo::Summarize() {
|
||||
std::string sum;
|
||||
if (num_cores == 1) {
|
||||
sum = StringFromFormat("%s, %d core", cpu_string, num_cores);
|
||||
} else {
|
||||
sum = StringFromFormat("%s, %d cores", cpu_string, num_cores);
|
||||
if (HTT)
|
||||
sum += StringFromFormat(" (%i logical threads per physical core)", logical_cpu_count);
|
||||
}
|
||||
|
||||
auto features = Features();
|
||||
for (std::string &feature : features) {
|
||||
sum += ", " + feature;
|
||||
}
|
||||
if (bSSE) sum += ", SSE";
|
||||
if (bSSE2) sum += ", SSE2";
|
||||
if (bSSE3) sum += ", SSE3";
|
||||
if (bSSSE3) sum += ", SSSE3";
|
||||
if (bSSE4_1) sum += ", SSE4.1";
|
||||
if (bSSE4_2) sum += ", SSE4.2";
|
||||
if (bSSE4A) sum += ", SSE4A";
|
||||
if (HTT) sum += ", HTT";
|
||||
if (bAVX) sum += ", AVX";
|
||||
if (bAVX2) sum += ", AVX2";
|
||||
if (bFMA3) sum += ", FMA3";
|
||||
if (bFMA4) sum += ", FMA4";
|
||||
if (bAES) sum += ", AES";
|
||||
if (bSHA) sum += ", SHA";
|
||||
if (bXOP) sum += ", XOP";
|
||||
if (bRTM) sum += ", TSX";
|
||||
if (bF16C) sum += ", F16C";
|
||||
if (bBMI1) sum += ", BMI1";
|
||||
if (bPOPCNT) sum += ", POPCNT";
|
||||
if (bMOVBE) sum += ", MOVBE";
|
||||
if (bLZCNT) sum += ", LZCNT";
|
||||
if (bLongMode) sum += ", 64-bit support";
|
||||
return sum;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
#include "ppsspp_config.h"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
enum CPUVendor {
|
||||
VENDOR_INTEL = 0,
|
||||
@@ -121,6 +122,7 @@ struct CPUInfo {
|
||||
explicit CPUInfo();
|
||||
|
||||
// Turn the cpu info into a string we can show
|
||||
std::vector<std::string> Features();
|
||||
std::string Summarize();
|
||||
|
||||
private:
|
||||
|
||||
@@ -53,11 +53,20 @@ void CPUInfo::Detect()
|
||||
logical_cpu_count = 2;
|
||||
}
|
||||
|
||||
std::vector<std::string> CPUInfo::Features() {
|
||||
std::vector<std::string> features;
|
||||
return features;
|
||||
}
|
||||
|
||||
// Turn the cpu info into a string we can show
|
||||
std::string CPUInfo::Summarize()
|
||||
{
|
||||
std::string CPUInfo::Summarize() {
|
||||
std::string sum;
|
||||
sum = StringFromFormat("%s, %i core", cpu_string, num_cores);
|
||||
|
||||
auto features = Features();
|
||||
for (std::string &feature : features) {
|
||||
sum += ", " + feature;
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
#endif
|
||||
@@ -197,6 +197,28 @@ void CPUInfo::Detect()
|
||||
#endif
|
||||
}
|
||||
|
||||
std::vector<std::string> CPUInfo::Features() {
|
||||
std::vector<std::string> features;
|
||||
|
||||
struct Flag {
|
||||
bool &flag;
|
||||
const char *str;
|
||||
};
|
||||
const Flag list[] = {
|
||||
{ bXBurst1, "XBurst1" },
|
||||
{ bXBurst2, "XBurst2" },
|
||||
{ CPU64bit, "64-bit" },
|
||||
};
|
||||
|
||||
for (auto &item : list) {
|
||||
if (item.flag) {
|
||||
features.push_back(item.str);
|
||||
}
|
||||
}
|
||||
|
||||
return features;
|
||||
}
|
||||
|
||||
// Turn the cpu info into a string we can show
|
||||
std::string CPUInfo::Summarize()
|
||||
{
|
||||
@@ -205,10 +227,11 @@ std::string CPUInfo::Summarize()
|
||||
sum = StringFromFormat("%s, %i core", cpu_string, num_cores);
|
||||
else
|
||||
sum = StringFromFormat("%s, %i cores", cpu_string, num_cores);
|
||||
if (bXBurst1) sum += ", XBurst1";
|
||||
if (bXBurst2) sum += ", XBurst2";
|
||||
if (CPU64bit) sum += ", 64-bit";
|
||||
|
||||
auto features = Features();
|
||||
for (std::string &feature : features) {
|
||||
sum += ", " + feature;
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
|
||||
|
||||
@@ -176,18 +176,45 @@ void CPUInfo::Detect()
|
||||
RiscV_B = ExtensionSupported(hwcap, 'B');
|
||||
}
|
||||
|
||||
std::vector<std::string> CPUInfo::Features() {
|
||||
std::vector<std::string> features;
|
||||
|
||||
struct Flag {
|
||||
bool &flag;
|
||||
const char *str;
|
||||
};
|
||||
const Flag list[] = {
|
||||
{ RiscV_M, "Muldiv" },
|
||||
{ RiscV_A, "Atomic" },
|
||||
{ RiscV_F, "Float" },
|
||||
{ RiscV_D, "Double" },
|
||||
{ RiscV_C, "Compressed" },
|
||||
{ RiscV_V, "Vector" },
|
||||
{ RiscV_B, "Bitmanip" },
|
||||
{ CPU64bit, "64-bit" },
|
||||
};
|
||||
|
||||
for (auto &item : list) {
|
||||
if (item.flag) {
|
||||
features.push_back(item.str);
|
||||
}
|
||||
}
|
||||
|
||||
return features;
|
||||
}
|
||||
|
||||
// Turn the cpu info into a string we can show
|
||||
std::string CPUInfo::Summarize()
|
||||
{
|
||||
std::string CPUInfo::Summarize() {
|
||||
std::string sum;
|
||||
if (num_cores == 1)
|
||||
sum = StringFromFormat("%s, %i core", cpu_string, num_cores);
|
||||
else
|
||||
sum = StringFromFormat("%s, %i cores", cpu_string, num_cores);
|
||||
if (CPU64bit) sum += ", 64-bit";
|
||||
|
||||
//TODO: parse "isa : rv64imafdc" from /proc/cpuinfo
|
||||
|
||||
auto features = Features();
|
||||
for (std::string &feature : features) {
|
||||
sum += ", " + feature;
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
|
||||
|
||||
+3
-4
@@ -704,10 +704,9 @@ void SystemInfoScreen::CreateViews() {
|
||||
tabHolder->AddTab(si->T("CPU Extensions"), cpuExtensionsScroll);
|
||||
|
||||
cpuExtensions->Add(new ItemHeader(si->T("CPU Extensions")));
|
||||
std::vector<std::string> exts;
|
||||
SplitString(cpu_info.Summarize(), ',', exts);
|
||||
for (size_t i = 2; i < exts.size(); i++) {
|
||||
cpuExtensions->Add(new TextView(exts[i], new LayoutParams(FILL_PARENT, WRAP_CONTENT)))->SetFocusable(true);
|
||||
std::vector<std::string> exts = cpu_info.Features();
|
||||
for (std::string &ext : exts) {
|
||||
cpuExtensions->Add(new TextView(ext, new LayoutParams(FILL_PARENT, WRAP_CONTENT)))->SetFocusable(true);
|
||||
}
|
||||
|
||||
ViewGroup *driverBugsScroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT));
|
||||
|
||||
Reference in new issue
Block a user