From 74913618639aceb1f38e3a3e0995a96ab0cc2066 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 24 Sep 2023 22:20:50 +0200 Subject: [PATCH] - do some cleansing of the GPU string and add CPU name when only getting an anonymous series name. The cleansing is mainly for AMD's Linux drivers which report too much extraneous info here. The CPU name helps when classifying anonymous iGPU series. --- src/common/utility/x86.cpp | 2 +- src/common/utility/x86.h | 2 +- src/d_anonstats.cpp | 48 +++++++++++++++++++++++++++++++++++++- 3 files changed, 49 insertions(+), 3 deletions(-) diff --git a/src/common/utility/x86.cpp b/src/common/utility/x86.cpp index 76e880834..78d74fff9 100644 --- a/src/common/utility/x86.cpp +++ b/src/common/utility/x86.cpp @@ -161,7 +161,7 @@ void CheckCPUID(CPUInfo *cpu) } } -FString DumpCPUInfo(const CPUInfo *cpu) +FString DumpCPUInfo(const CPUInfo *cpu, bool brief) { char cpustring[4*4*3+1]; diff --git a/src/common/utility/x86.h b/src/common/utility/x86.h index 25e698d81..8a009efa0 100644 --- a/src/common/utility/x86.h +++ b/src/common/utility/x86.h @@ -229,7 +229,7 @@ struct CPUInfo // 92 bytes extern CPUInfo CPU; void CheckCPUID (CPUInfo *cpu); -FString DumpCPUInfo (const CPUInfo *cpu); +FString DumpCPUInfo (const CPUInfo *cpu, bool brief = false); #endif diff --git a/src/d_anonstats.cpp b/src/d_anonstats.cpp index 00bf78d8b..1c3a240b6 100644 --- a/src/d_anonstats.cpp +++ b/src/d_anonstats.cpp @@ -275,6 +275,52 @@ static void D_DoHTTPRequest(const char *request) } } + +static FString GetDeviceName() +{ + FString device = screen->DeviceName(); + if (device.Compare("AMD Radeon(TM) Graphics") == 0 || + device.Compare("Intel(R) UHD Graphics") == 0 || + //device.Compare("Intel(R) HD Graphics") == 0 || these are not that interesting so leave them alone + device.Compare("Intel(R) Iris(R) Plus Graphics") == 0 || + device.Compare("Intel(R) Iris(R) Xe Graphics") == 0 || + device.Compare("Radeon RX Vega") == 0 || + device.Compare("AMD Radeon Series") == 0) + { + // for these anonymous series names add the CPU name to get an idea what GPU we really have + auto ci = DumpCPUInfo(&CPU, true); + device.AppendFormat(" * %s", ci.GetChars()); + } + // cleanse the GPU info string to allow better searches on the database. + device.Substitute("/SSE2", ""); + device.Substitute("/PCIe", ""); + device.Substitute("/PCI", ""); + device.Substitute("(TM) ", ""); + device.Substitute("Mesa ", ""); + device.Substitute("DRI ", ""); + auto pos = device.IndexOf("Intel(R)"); + if (pos >= 0) + { + device.Substitute("(R) ", ""); + auto pos = device.IndexOf("("); + if (pos >= 0) device.Truncate(pos); + } + + auto pos = device.IndexOf("(LLVM"); + if (pos >= 0) device.Truncate(pos); + pos = device.IndexOf("(DRM"); + if (pos >= 0) device.Truncate(pos); + pos = device.IndexOf("(RADV"); + if (pos >= 0) device.Truncate(pos); + pos = device.IndexOf(", LLVM"); + if (pos >= 0) + { + device.Truncate(pos); + device << ')'; + } + device.StripLeftRight(); + return device; +} void D_DoAnonStats() { #ifndef _DEBUG @@ -292,7 +338,7 @@ void D_DoAnonStats() static char requeststring[1024]; mysnprintf(requeststring, sizeof requeststring, "GET /stats_202309.py?render=%i&cores=%i&os=%s&glversion=%i&vendor=%s&model=%s HTTP/1.1\r\nHost: %s\r\nConnection: close\r\nUser-Agent: %s %s\r\n\r\n", - GetRenderInfo(), GetCoreInfo(), URLencode(GetOSVersion()).GetChars(), GetGLVersion(), URLencode(screen->vendorstring).GetChars(), URLencode(screen->DeviceName()).GetChars(), *anonstats_host, GAMENAME, VERSIONSTR); + GetRenderInfo(), GetCoreInfo(), URLencode(GetOSVersion()).GetChars(), GetGLVersion(), URLencode(screen->vendorstring).GetChars(), URLencode(GetDeviceName()).GetChars(), *anonstats_host, GAMENAME, VERSIONSTR); DPrintf(DMSG_NOTIFY, "Sending %s", requeststring); #if 1//ndef _DEBUG // Don't send info in debug builds