From 0847d3b4526e45b947e5b8861fe4857411656127 Mon Sep 17 00:00:00 2001 From: Marc Di Luzio Date: Sat, 16 Feb 2019 12:22:47 +0000 Subject: [PATCH] Remove the vendor config value in prep for it to be auto-detected --- daemon/daemon_config.c | 4 ---- daemon/daemon_config.h | 1 - daemon/gamemode-gpu.c | 9 +++++---- daemon/gamemode-tests.c | 7 +++---- example/gamemode.ini | 4 +--- 5 files changed, 9 insertions(+), 16 deletions(-) diff --git a/daemon/daemon_config.c b/daemon/daemon_config.c index db2d3ff..e0265d6 100644 --- a/daemon/daemon_config.c +++ b/daemon/daemon_config.c @@ -87,7 +87,6 @@ struct GameModeConfig { long reaper_frequency; char apply_gpu_optimisations[CONFIG_VALUE_MAX]; - long gpu_vendor; long gpu_device; long nv_core_clock_mhz_offset; long nv_mem_clock_mhz_offset; @@ -231,8 +230,6 @@ static int inih_handler(void *user, const char *section, const char *name, const /* GPU subsection */ if (strcmp(name, "apply_gpu_optimisations") == 0) { valid = get_string_value(value, self->values.apply_gpu_optimisations); - } else if (strcmp(name, "gpu_vendor") == 0) { - valid = get_long_value_hex(name, value, &self->values.gpu_vendor); } else if (strcmp(name, "gpu_device") == 0) { valid = get_long_value(name, value, &self->values.gpu_device); } else if (strcmp(name, "nv_core_clock_mhz_offset") == 0) { @@ -556,7 +553,6 @@ void config_get_apply_gpu_optimisations(GameModeConfig *self, char value[CONFIG_ } /* Define the getters for GPU values */ -DEFINE_CONFIG_GET(gpu_vendor) DEFINE_CONFIG_GET(gpu_device) DEFINE_CONFIG_GET(nv_core_clock_mhz_offset) DEFINE_CONFIG_GET(nv_mem_clock_mhz_offset) diff --git a/daemon/daemon_config.h b/daemon/daemon_config.h index 01acd9d..921b5f9 100644 --- a/daemon/daemon_config.h +++ b/daemon/daemon_config.h @@ -134,7 +134,6 @@ long config_get_ioprio_value(GameModeConfig *self); * Get various config info for gpu optimisations */ void config_get_apply_gpu_optimisations(GameModeConfig *self, char value[CONFIG_VALUE_MAX]); -long config_get_gpu_vendor(GameModeConfig *self); long config_get_gpu_device(GameModeConfig *self); long config_get_nv_core_clock_mhz_offset(GameModeConfig *self); long config_get_nv_mem_clock_mhz_offset(GameModeConfig *self); diff --git a/daemon/gamemode-gpu.c b/daemon/gamemode-gpu.c index ecc01a2..21b341c 100644 --- a/daemon/gamemode-gpu.c +++ b/daemon/gamemode-gpu.c @@ -71,9 +71,11 @@ int game_mode_initialise_gpu(GameModeConfig *config, GameModeGPUInfo **info) memset(new_info, 0, sizeof(GameModeGPUInfo)); /* Get the config parameters */ - new_info->vendor = config_get_gpu_vendor(config); new_info->device = config_get_gpu_device(config); + /* TODO fill in GPU vendor */ + new_info->vendor = 0; + /* verify device ID */ if (new_info->device == -1) { LOG_ERROR( @@ -86,10 +88,9 @@ int game_mode_initialise_gpu(GameModeConfig *config, GameModeGPUInfo **info) /* verify GPU vendor */ if (!GPUVendorValid(new_info->vendor)) { LOG_ERROR( - "Invalid gpu_vendor value (0x%04x) set in configuration, will not apply " - "optimisations!\n", + "Unknown vendor value (0x%04x) found, cannot apply optimisations!\n", (unsigned int)new_info->vendor); - LOG_ERROR("Possible values are: 0x%04x (NVIDIA) 0x%04x (AMD) 0x%04x (Intel)\n", + LOG_ERROR("Known values are: 0x%04x (NVIDIA) 0x%04x (AMD) 0x%04x (Intel)\n", Vendor_NVIDIA, Vendor_AMD, Vendor_Intel); diff --git a/daemon/gamemode-tests.c b/daemon/gamemode-tests.c index a5d36bc..89c1291 100644 --- a/daemon/gamemode-tests.c +++ b/daemon/gamemode-tests.c @@ -421,16 +421,15 @@ int run_gpu_optimisation_tests(struct GameModeConfig *config) /* Get current GPU values */ GameModeGPUInfo gpuinfo; gpuinfo.device = config_get_gpu_device(config); - gpuinfo.vendor = config_get_gpu_vendor(config); - - if (gpuinfo.vendor == Vendor_NVIDIA) - gpuinfo.nv_perf_level = config_get_nv_perf_level(config); if (game_mode_get_gpu(&gpuinfo) != 0) { LOG_ERROR("Could not get current GPU info, see above!\n"); return -1; } + if (gpuinfo.vendor == Vendor_NVIDIA) + gpuinfo.nv_perf_level = config_get_nv_perf_level(config); + /* Store the original values */ long original_core = gpuinfo.core; long original_mem = gpuinfo.mem; diff --git a/example/gamemode.ini b/example/gamemode.ini index da101e4..bfb826a 100644 --- a/example/gamemode.ini +++ b/example/gamemode.ini @@ -43,9 +43,7 @@ inhibit_screensaver=1 ; Setting this to the keyphrase "accept-responsibility" will allow gamemode to apply GPU optimisations such as overclocks ;apply_gpu_optimisations=0 -; You must set these to tell gamemode the Vendor of your graphics card, as well it's device number on the system (usually 0) -; Vendor must be one of 0x10de (NVIDIA), 0x1002 (AMD) or 0x8086 (Intel) -;gpu_vendor=0x0000 +; The device number on the system (usually 0) ;gpu_device=0 ; Nvidia specific settings (these are Mhz offsets from the baseline, ie. 0 applies no change)