mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-29 08:13:44 +01:00
GPU: huge improvement of driver specific detection code
This commit is contained in:
+10
-1
@@ -9,7 +9,7 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#define FF_GPU_NUM_FORMAT_ARGS 10
|
||||
#define FF_GPU_NUM_FORMAT_ARGS 11
|
||||
|
||||
static void printGPUResult(FFGPUOptions* options, uint8_t index, const FFGPUResult* gpu)
|
||||
{
|
||||
@@ -38,6 +38,9 @@ static void printGPUResult(FFGPUOptions* options, uint8_t index, const FFGPUResu
|
||||
if(gpu->coreCount != FF_GPU_CORE_COUNT_UNSET)
|
||||
ffStrbufAppendF(&output, " (%d)", gpu->coreCount);
|
||||
|
||||
if(gpu->frequency != FF_GPU_FREQUENCY_UNSET)
|
||||
ffStrbufAppendF(&output, " @ %.2f MHz", gpu->frequency / 1e6);
|
||||
|
||||
if(gpu->temperature == gpu->temperature) //FF_GPU_TEMP_UNSET
|
||||
{
|
||||
ffStrbufAppendS(&output, " - ");
|
||||
@@ -80,6 +83,7 @@ static void printGPUResult(FFGPUOptions* options, uint8_t index, const FFGPUResu
|
||||
{FF_FORMAT_ARG_TYPE_UINT64, &gpu->dedicated.used},
|
||||
{FF_FORMAT_ARG_TYPE_UINT64, &gpu->shared.total},
|
||||
{FF_FORMAT_ARG_TYPE_UINT64, &gpu->shared.used},
|
||||
{FF_FORMAT_ARG_TYPE_UINT, &gpu->frequency},
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -304,6 +308,11 @@ void ffGenerateGPUJsonResult(FFGPUOptions* options, yyjson_mut_doc* doc, yyjson_
|
||||
yyjson_mut_obj_add_str(doc, obj, "type", type);
|
||||
|
||||
yyjson_mut_obj_add_strbuf(doc, obj, "vendor", &gpu->vendor);
|
||||
|
||||
if (gpu->frequency == FF_GPU_FREQUENCY_UNSET)
|
||||
yyjson_mut_obj_add_null(doc, obj, "frequency");
|
||||
else
|
||||
yyjson_mut_obj_add_uint(doc, obj, "frequency", gpu->frequency);
|
||||
}
|
||||
|
||||
FF_LIST_FOR_EACH(FFGPUResult, gpu, gpus)
|
||||
|
||||
@@ -130,7 +130,7 @@ void ffGenerateVulkanJsonResult(FF_MAYBE_UNUSED FFVulkanOptions* options, yyjson
|
||||
yyjson_mut_obj_add_null(doc, sharedMemory, "used");
|
||||
}
|
||||
|
||||
yyjson_mut_obj_add_uint(doc, gpuObj, "deviceId", vulkanGpu->vulkanDeviceId);
|
||||
yyjson_mut_obj_add_uint(doc, gpuObj, "deviceId", vulkanGpu->deviceId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user