mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-13 02:42:09 +02:00
GPU (Linux): disable GPU memory size detection with libpci by default
Ref: #495, #497
This commit is contained in:
@@ -80,6 +80,7 @@ cmake_dependent_option(ENABLE_FREETYPE "Enable freetype" ON "ANDROID" OFF)
|
||||
cmake_dependent_option(ENABLE_PULSE "Enable pulse" ON "LINUX OR BSD" OFF)
|
||||
cmake_dependent_option(ENABLE_DDCUTIL "Enable ddcutil" ON "LINUX" OFF)
|
||||
cmake_dependent_option(ENABLE_THREADS "Enable multithreading" ON "Threads_FOUND" OFF)
|
||||
cmake_dependent_option(ENABLE_PCI_MEMORY "Enable detecting GPU memory size with libpci" OFF "LINUX OR BSD" OFF)
|
||||
|
||||
option(BUILD_TESTS "Build tests" OFF) # Also create test executables
|
||||
option(SET_TWEAK "Add tweak to project version" ON) # This is set to off by github actions for release builds
|
||||
@@ -728,6 +729,10 @@ if(ENABLE_THREADS)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(ENABLE_PCI_MEMORY)
|
||||
target_compile_definitions(libfastfetch PRIVATE FF_USE_PCI_MEMORY)
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
target_link_libraries(libfastfetch
|
||||
PRIVATE "-framework Cocoa"
|
||||
|
||||
@@ -147,7 +147,7 @@ FF_MAYBE_UNUSED static void pciDetectTemp(FFGPUResult* gpu, struct pci_dev* devi
|
||||
}
|
||||
}
|
||||
|
||||
static bool pciDetectMemory(FFGPUResult* gpu, const PCIData* pci, struct pci_dev* device)
|
||||
FF_MAYBE_UNUSED static bool pciDetectMemory(FFGPUResult* gpu, const PCIData* pci, struct pci_dev* device)
|
||||
{
|
||||
gpu->dedicated.used = gpu->shared.used = FF_GPU_VMEM_SIZE_UNSET;
|
||||
|
||||
@@ -180,7 +180,7 @@ static bool pciDetectMemory(FFGPUResult* gpu, const PCIData* pci, struct pci_dev
|
||||
return true;
|
||||
}
|
||||
|
||||
static void pciDetectType(FFGPUResult* gpu)
|
||||
FF_MAYBE_UNUSED static void pciDetectType(FFGPUResult* gpu)
|
||||
{
|
||||
//There is no straightforward way to detect the type of a GPU.
|
||||
//The approach taken here is to look at the memory sizes of the device.
|
||||
@@ -224,11 +224,16 @@ static void pciHandleDevice(FF_MAYBE_UNUSED const FFGPUOptions* options, FFlist*
|
||||
ffStrbufInit(&gpu->driver);
|
||||
pciDetectDriverName(gpu, pci, device);
|
||||
|
||||
pciDetectMemory(gpu, pci, device);
|
||||
pciDetectType(gpu);
|
||||
#if FF_USE_PCI_MEMORY
|
||||
// Libpci reports at least 2 false results (#495, #497)
|
||||
pciDetectMemory(gpu, pci, device);
|
||||
pciDetectType(gpu);
|
||||
#else
|
||||
gpu->dedicated.used = gpu->shared.used = gpu->dedicated.total = gpu->shared.total = FF_GPU_VMEM_SIZE_UNSET;
|
||||
gpu->type = FF_GPU_TYPE_UNKNOWN;
|
||||
#endif
|
||||
|
||||
gpu->coreCount = FF_GPU_CORE_COUNT_UNSET;
|
||||
|
||||
gpu->temperature = FF_GPU_TEMP_UNSET;
|
||||
|
||||
#ifdef __linux__
|
||||
|
||||
Reference in New Issue
Block a user