From 3c024dd6d90b27dc2f3ae9777a4e44b79bf8a58e Mon Sep 17 00:00:00 2001 From: mangobiche Date: Mon, 1 Sep 2025 09:13:55 -0500 Subject: [PATCH] On systems without /sys/class/drm/card0, gamemode fails to detect the correct NVIDIA GPU index when the GPU device is explicitly set in gamemode.ini. This patch adjusts get_gpu_index_id_nv() to skip over non-NVIDIA devices without prematurely failing, correctly mapping the configured DRM device index to the NVML index. Edit: clang-formatted Fixes: #486 Tested on: RTX 5060 ti (driver 575.64.03) on Ubuntu 25.04, cards 0-2 and some other random numbers were tested --- util/gpuclockctl.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/util/gpuclockctl.c b/util/gpuclockctl.c index 6935204..f367b13 100644 --- a/util/gpuclockctl.c +++ b/util/gpuclockctl.c @@ -131,8 +131,10 @@ static long get_gpu_index_id_nv(struct GameModeGPUInfo *info) } if (nv_device < 0) { - LOG_ERROR("Could not resolve NVIDIA index for DRM card%ld (no NVIDIA cards found up to that index)\n", - info->device); + LOG_ERROR( + "Could not resolve NVIDIA index for DRM card%ld (no NVIDIA cards found up to that " + "index)\n", + info->device); } return nv_device;