GPU (Linux): pad device and revision IDs when querying amdgpu.ids

In libdrm/amdgpu.ids, device IDs are formatted with 4 hex digits and
revision IDs with 2 uppercase hex digits (e.g. `1681,\t0B,`). Using
`%04X,\t%02X,` ensures both fields match the file syntax even when
values have leading zeros.
This commit is contained in:
Kushagra Kumar
2026-10-31 02:07:37 +05:30
committed by Carter Li
parent 44b32e9f84
commit 2eea01aac3
2 changed files with 2 additions and 1 deletions
+1
View File
@@ -1,6 +1,7 @@
# Unreleased
Bugfixes:
* Fixed AMD GPU name detection in amdgpu.ids when PCI device ID or revision ID has leading zeros. (GPU, Linux)
* Improved uptime detection on SunOS via kstat. (#2674, Uptime, SunOS)
* Fixed substring formatting returning the remaining string when a negative end index is before the start of the string. (General)
+1 -1
View File
@@ -272,7 +272,7 @@ static bool loadAmdGpuIdsInc(uint16_t deviceId, uint8_t revision, FFGPUResult* g
static void parseAmdGpuIdsFile(uint16_t deviceId, uint8_t revision, FFGPUResult* gpu) {
char query[32];
snprintf(query, ARRAY_SIZE(query), "%X,\t%X,", (unsigned) deviceId, (unsigned) revision);
snprintf(query, ARRAY_SIZE(query), "%04X,\t%02X,", (unsigned) deviceId, (unsigned) revision);
#ifdef FF_CUSTOM_AMDGPU_IDS_PATH
FF_DEBUG("Searching AMD GPU IDs at custom path '%s' for device=0x%04x revision=0x%02x", FF_STR(FF_CUSTOM_AMDGPU_IDS_PATH), deviceId, revision);
ffParsePropFile(FF_STR(FF_CUSTOM_AMDGPU_IDS_PATH), query, &gpu->name);