diff --git a/src/detection/gpu/gpu.h b/src/detection/gpu/gpu.h index 7a269f5be..95a7aab41 100644 --- a/src/detection/gpu/gpu.h +++ b/src/detection/gpu/gpu.h @@ -28,7 +28,7 @@ typedef struct FFGPUMemory typedef struct FFGPUResult { - uint8_t index; + uint32_t index; FFGPUType type; FFstrbuf vendor; FFstrbuf name; diff --git a/src/detection/gpu/gpu_amd.c b/src/detection/gpu/gpu_amd.c index 1510019ea..2b55c80d2 100644 --- a/src/detection/gpu/gpu_amd.c +++ b/src/detection/gpu/gpu_amd.c @@ -65,5 +65,8 @@ const char* ffDetectAmdGpuInfo(const FFGpuDriverCondition* cond, FFGpuDriverResu if (result.type) *result.type = device->isAPU ? FF_GPU_TYPE_INTEGRATED : FF_GPU_TYPE_DISCRETE; + if (result.index) + *result.type = (uint32_t) device->adlAdapterIndex; + return NULL; } diff --git a/src/detection/gpu/gpu_apple.m b/src/detection/gpu/gpu_apple.m index 709acf6fb..aead1c217 100644 --- a/src/detection/gpu/gpu_apple.m +++ b/src/detection/gpu/gpu_apple.m @@ -43,7 +43,7 @@ const char* ffGpuDetectMetal(FFlist* gpus) ffStrbufSetStatic(&gpu->platformApi, "Metal Common 1"); gpu->type = device.hasUnifiedMemory ? FF_GPU_TYPE_INTEGRATED : FF_GPU_TYPE_DISCRETE; - gpu->index = (uint8_t)device.locationNumber; + gpu->index = (uint32_t) device.locationNumber; #endif } return NULL; diff --git a/src/detection/gpu/gpu_driver_specific.h b/src/detection/gpu/gpu_driver_specific.h index a163b9810..989ef6093 100644 --- a/src/detection/gpu/gpu_driver_specific.h +++ b/src/detection/gpu/gpu_driver_specific.h @@ -37,7 +37,7 @@ typedef struct FFGpuDriverCondition // detect x if not NULL typedef struct FFGpuDriverResult { - uint8_t* index; + uint32_t* index; double* temp; FFGPUMemory* memory; uint32_t* coreCount; diff --git a/src/detection/gpu/gpu_mthreads.c b/src/detection/gpu/gpu_mthreads.c index 39cd955fc..7af21c58f 100644 --- a/src/detection/gpu/gpu_mthreads.c +++ b/src/detection/gpu/gpu_mthreads.c @@ -138,7 +138,7 @@ const char *ffDetectMthreadsGpuInfo(const FFGpuDriverCondition *cond, FFGpuDrive { unsigned int value; if (mtmlData.ffmtmlDeviceGetIndex(device, &value) == MTML_SUCCESS) - *result.index = (uint8_t)value; + *result.index = value; } if (result.temp) diff --git a/src/detection/gpu/gpu_nvidia.c b/src/detection/gpu/gpu_nvidia.c index 9738c8566..c2cc33d1d 100644 --- a/src/detection/gpu/gpu_nvidia.c +++ b/src/detection/gpu/gpu_nvidia.c @@ -111,9 +111,9 @@ const char* ffDetectNvidiaGpuInfo(const FFGpuDriverCondition* cond, FFGpuDriverR { unsigned int value; if (nvmlData.ffnvmlDeviceGetIndex(device, &value) == NVML_SUCCESS) - *result.index = (uint8_t)value; + *result.index = value; } - + if (result.temp) { diff --git a/src/modules/gpu/gpu.c b/src/modules/gpu/gpu.c index 32c719eb2..1d449d33a 100644 --- a/src/modules/gpu/gpu.c +++ b/src/modules/gpu/gpu.c @@ -10,7 +10,7 @@ #include -#define FF_GPU_NUM_FORMAT_ARGS 12 +#define FF_GPU_NUM_FORMAT_ARGS 13 static void printGPUResult(FFGPUOptions* options, uint8_t index, const FFGPUResult* gpu) { @@ -103,6 +103,7 @@ static void printGPUResult(FFGPUOptions* options, uint8_t index, const FFGPUResu FF_FORMAT_ARG(sUsed, "shared-used"), FF_FORMAT_ARG(gpu->platformApi, "platform-api"), FF_FORMAT_ARG(frequency, "frequency"), + FF_FORMAT_ARG(index, "index"), })); } } @@ -323,13 +324,10 @@ void ffGenerateGPUJsonResult(FFGPUOptions* options, yyjson_mut_doc* doc, yyjson_ { yyjson_mut_val* obj = yyjson_mut_arr_add_obj(doc, arr); - if (gpu->index != FF_GPU_INDEX_UNSET){ - yyjson_mut_obj_add_uint(doc, obj, "index", (uint64_t)gpu->index); - } + if (gpu->index != FF_GPU_INDEX_UNSET) + yyjson_mut_obj_add_uint(doc, obj, "index", gpu->index); else - { yyjson_mut_obj_add_null(doc, obj, "index"); - } if (gpu->coreCount != FF_GPU_CORE_COUNT_UNSET) yyjson_mut_obj_add_int(doc, obj, "coreCount", gpu->coreCount); @@ -411,6 +409,7 @@ void ffPrintGPUHelpFormat(void) "GPU used shared memory - shared-used", "The platform API used when detecting the GPU - platform-api", "Current frequency in GHz - frequency", + "GPU vendor specific index - index", })); }