# --- T2-COPYRIGHT-BEGIN --- # t2/package/*/mangohud/cpu_name.patch # Copyright (C) 2026 The T2 SDE Project # SPDX-License-Identifier: GPL-2.0 or patched project license # --- T2-COPYRIGHT-END --- Quick and clunky patch to add display cpu when adding cpu_name to MangoHud.conf. Also enable cpu_name and gpu_name by default in config example. - NoTag --- MangoHud-v0.8.2/README.md +++ MangoHud-v0.8.2/README.md @@ -407,6 +407,7 @@ Parameters that are enabled by default have to be explicitly disabled. These (cu | `gpu_load_color` | Set the colors for the gpu load change low,medium and high. e.g `gpu_load_color=0000FF,00FFFF,FF00FF` | | `gpu_load_value` | Set the values for medium and high load e.g `gpu_load_value=50,90` | | `gpu_name` | Display GPU name from pci.ids | +| `cpu_name` | Display CPU name from pci.ids | | `gpu_voltage` | Display GPU voltage | | `gpu_list` | List GPUs to display `gpu_list=0,1` | | `gpu_efficiency` | Display GPU efficiency in frames per joule | --- MangoHud-v0.8.2/src/gl/gl_hud.cpp +++ MangoHud-v0.8.2/src/gl/gl_hud.cpp @@ -154,6 +154,32 @@ void imgui_create(gl_context *ctx, const gl_wsi plat) SPDLOG_DEBUG("GL device id: {:04X}", device_id); sw_stats.gpuName = gpu = remove_parentheses(deviceName); SPDLOG_DEBUG("gpu: {}", gpu); + + std::ifstream proc_file; + proc_file.open("/proc/cpuinfo"); + + if (!proc_file.is_open()) { + std::cerr << "Error, can't open /proc/cpuifo" << std::endl; + } + + std::string line; + std::vector res; + while(std::getline(proc_file, line)) { + if (line.find("model name") == 0) { + //std::cout << line << std::endl; + res.push_back(line); + } + } + proc_file.close(); + std::cout << res[0] << std::endl; + + const char sep = ':'; + std::size_t pos = res[0].find(sep); + std::cout << res[0].substr(pos + 2) << std::endl; //+2 to skip separator and space + + sw_stats.cpuName = res[0].substr(pos + 2); + SPDLOG_DEBUG("cpuname: {}", sw_stats.cpuName); + // Setup Dear ImGui context IMGUI_CHECKVERSION(); ImGuiContext *saved_ctx = ImGui::GetCurrentContext(); --- MangoHud-v0.8.2/src/hud_elements.cpp +++ MangoHud-v0.8.2/src/hud_elements.cpp @@ -880,6 +880,16 @@ void HudElements::gpu_name(){ } } +void HudElements::cpu_name() { + if (HUDElements.params->enabled[OVERLAY_PARAM_ENABLED_cpu_name] + && !HUDElements.sw_stats->cpuName.empty()) { + ImguiNextColumnFirstItem(); + ImGui::PushFont(HUDElements.sw_stats->font_secondary); + HUDElements.TextColored(HUDElements.colors.engine, "%s", HUDElements.sw_stats->cpuName.c_str()); + ImGui::PopFont(); + } +} + void HudElements::engine_version(){ if (HUDElements.params->enabled[OVERLAY_PARAM_ENABLED_engine_version]){ ImguiNextColumnFirstItem(); @@ -2053,6 +2063,8 @@ void HudElements::legacy_elements(const overlay_params* temp_params){ ordered_functions.push_back({fps_only, "fps_only", value}); if (temp_params->enabled[OVERLAY_PARAM_ENABLED_engine_version]) ordered_functions.push_back({engine_version, "engine_version", value}); + if (temp_params->enabled[OVERLAY_PARAM_ENABLED_cpu_name]) + ordered_functions.push_back({cpu_name, "cpu_name", value}); if (temp_params->enabled[OVERLAY_PARAM_ENABLED_gpu_name]) ordered_functions.push_back({gpu_name, "gpu_name", value}); if (temp_params->enabled[OVERLAY_PARAM_ENABLED_vulkan_driver]) --- MangoHud-v0.8.2/src/overlay.h +++ MangoHud-v0.8.2/src/overlay.h @@ -70,6 +70,7 @@ struct swapchain_stats { std::string engineName; std::string engineVersion; std::string deviceName; + std::string cpuName; std::string gpuName; std::string driverName; uint32_t applicationVersion; --- MangoHud-v0.8.2/src/hud_elements.h +++ MangoHud-v0.8.2/src/hud_elements.h @@ -85,6 +85,7 @@ class HudElements{ static void fps(); static void engine_version(); static void gpu_name(); + static void cpu_name(); static void vulkan_driver(); static void arch(); static void wine(); --- MangoHud-v0.8.2/src/overlay_params.h +++ MangoHud-v0.8.2/src/overlay_params.h @@ -65,6 +65,7 @@ struct Tracepoint; OVERLAY_PARAM_BOOL(media_player) \ OVERLAY_PARAM_BOOL(version) \ OVERLAY_PARAM_BOOL(vulkan_driver) \ + OVERLAY_PARAM_BOOL(cpu_name) \ OVERLAY_PARAM_BOOL(gpu_name) \ OVERLAY_PARAM_BOOL(engine_version) \ OVERLAY_PARAM_BOOL(histogram) \ --- MangoHud-v0.8.2/src/vulkan.cpp +++ MangoHud-v0.8.2/src/vulkan.cpp @@ -1585,6 +1585,7 @@ static VkResult overlay_CreateSwapchainKHR( swapchain_data->sw_stats.engineVersion = device_data->instance->engineVersion; swapchain_data->sw_stats.engine = device_data->instance->engine; swapchain_data->sw_stats.applicationVersion = device_data->instance->applicationVersion; +// swapchain_data->sw_stats.cpuName = prop.cpuName; HUDElements.vendorID = prop.vendorID; std::stringstream ss; @@ -1611,6 +1612,32 @@ static VkResult overlay_CreateSwapchainKHR( if (!is_blacklisted()) { #ifdef __linux__ swapchain_data->sw_stats.gpuName = remove_parentheses(deviceName); + // TODO: I know code duplication + // use regex_match(), move to cpu.cpp + std::ifstream proc_file; + proc_file.open("/proc/cpuinfo"); + + if (!proc_file.is_open()) { + std::cerr << "Error, can't open /proc/cpuifo" << std::endl; + } + + std::string line; + std::vector res; + while(std::getline(proc_file, line)) { + if (line.find("model name") == 0) { + //std::cout << line << std::endl; + res.push_back(line); + } + } + proc_file.close(); + std::cout << res[0] << std::endl; + + const char sep = ':'; + std::size_t pos = res[0].find(sep); + std::cout << res[0].substr(pos + 2) << std::endl; //+2 to skip separator and space + + swapchain_data->sw_stats.cpuName = res[0].substr(pos + 2); + #endif } swapchain_data->sw_stats.driverName = driverProps.driverInfo; --- MangoHud-v0.8.2/data/MangoHud.conf +++ MangoHud-v0.8.2/data/MangoHud.conf @@ -158,7 +158,8 @@ throttling_status ### Display miscellaneous information # engine_version # engine_short_names -# gpu_name +cpu_name +gpu_name # vulkan_driver # wine # exec_name