Added ability to set which gpu vendors to enable

fix style

added quotes to highlight options

added braces and fixed indentation
This commit is contained in:
Dustin Miller
2024-11-28 21:06:35 -05:00
committed by Jakob P. Liljenberg
parent efa8ce0466
commit 4fe2a693cf
3 changed files with 21 additions and 4 deletions

View File

@@ -219,6 +219,7 @@ namespace Config {
{"rsmi_measure_pcie_speeds",
"#* Measure PCIe throughput on AMD cards, may impact performance on certain cards."},
{"gpu_mirror_graph", "#* Horizontally mirror the GPU graph."},
{"shown_gpus", "#* Set which GPU vendors to show. Available values are \"nvidia amd intel\""},
{"custom_gpu_name0", "#* Custom gpu0 model name, empty string to disable."},
{"custom_gpu_name1", "#* Custom gpu1 model name, empty string to disable."},
{"custom_gpu_name2", "#* Custom gpu2 model name, empty string to disable."},
@@ -265,7 +266,8 @@ namespace Config {
{"custom_gpu_name3", ""},
{"custom_gpu_name4", ""},
{"custom_gpu_name5", ""},
{"show_gpu_info", "Auto"}
{"show_gpu_info", "Auto"},
{"shown_gpus", "nvidia amd intel"}
#endif
};
std::unordered_map<std::string_view, string> stringsTmp;

View File

@@ -559,6 +559,11 @@ namespace Menu {
"Horizontally mirror the GPU graph.",
"",
"True or False."},
{"shown_gpus",
"Manually set which gpu vendors to show.",
"",
"Available values are \"nvidia\", \"amd\", and \"intel\".",
"Separate values with whitespace."},
{"custom_gpu_name0",
"Custom gpu0 model name in gpu stats box.",
"",

View File

@@ -315,9 +315,19 @@ namespace Shared {
//? Init for namespace Gpu
#ifdef GPU_SUPPORT
Gpu::Nvml::init();
Gpu::Rsmi::init();
Gpu::Intel::init();
auto shown_gpus = Config::getS("shown_gpus");
if (s_contains(shown_gpus, "nvidia")) {
Gpu::Nvml::init();
}
if (s_contains(shown_gpus, "amd")) {
Gpu::Rsmi::init();
}
if (s_contains(shown_gpus, "intel")) {
Gpu::Intel::init();
}
if (not Gpu::gpu_names.empty()) {
for (auto const& [key, _] : Gpu::gpus[0].gpu_percent)
Cpu::available_fields.push_back(key);