Revert "GPU: support detection by EGLext"

Works only for NVIDIA GPUs

This reverts commits 9ef8580d93f43ae6225e7551c77fe2cf0f5f5de5 and 9342d74c932b259f107a17bd137a8b99464c0826.
This commit is contained in:
李通洲 2024-12-31 09:56:35 +08:00 committed by Carter Li
parent a378d2ad62
commit aa63c4f5f2
8 changed files with 0 additions and 77 deletions

View File

@ -354,7 +354,6 @@ set(LIBFASTFETCH_SRC
src/detection/editor/editor.c
src/detection/font/font.c
src/detection/gpu/gpu.c
src/detection/gpu/gpu_eglext.c
src/detection/media/media.c
src/detection/netio/netio.c
src/detection/opencl/opencl.c

View File

@ -2041,7 +2041,6 @@
"pci",
"vulkan",
"opencl",
"eglext",
"opengl"
],
"default": "auto"

View File

@ -1132,7 +1132,6 @@
"pci": "Search PCI devices, which do not requires GPU driver installed. Not supported on Windows and macOS",
"vulkan": "Use Vulkan API. Slow and requires proper vulkan driver installed. Used for Android",
"opencl": "Use OpenCL API. Slow and requires proper OpenCL driver installed",
"eglext": "Use extensions of EGL API. Slow but support multiple GPUs",
"opengl": "Use OpenGL API. Slow and only detects one GPU"
},
"default": "auto"

View File

@ -114,11 +114,6 @@ const char* ffDetectGPU(const FFGPUOptions* options, FFlist* result)
return NULL;
}
}
if (options->detectionMethod <= FF_GPU_DETECTION_METHOD_EGLEXT)
{
if (ffGPUDetectByEglext(result) == NULL)
return NULL;
}
if (options->detectionMethod <= FF_GPU_DETECTION_METHOD_OPENGL)
{
if (detectByOpenGL(result) == NULL)

View File

@ -47,7 +47,6 @@ const char* ffDetectGPU(const FFGPUOptions* options, FFlist* result);
const char* ffDetectGPUImpl(const FFGPUOptions* options, FFlist* gpus);
const char* ffGPUGetVendorString(unsigned vendorId);
const char* ffGPUDetectByEglext(FFlist* gpus);
#if defined(__linux__) || defined(__FreeBSD__) || defined(__sun) || defined(__NetBSD__) || defined(__OpenBSD__)
void ffGPUFillVendorAndName(uint8_t subclass, uint16_t vendor, uint16_t device, FFGPUResult* gpu);

View File

@ -1,62 +0,0 @@
#include "detection/gpu/gpu.h"
#include "common/library.h"
#if defined(FF_HAVE_EGL) || __has_include(<EGL/egl.h>)
#include <EGL/egl.h>
#include <EGL/eglext.h>
#ifndef EGL_RENDERER_EXT
#define EGL_RENDERER_EXT 0x335F
#endif
#ifndef EGL_DRIVER_NAME_EXT
#define EGL_DRIVER_NAME_EXT 0x335E
#endif
const char* ffGPUDetectByEglext(FFlist* gpus)
{
FF_LIBRARY_LOAD(egl, "dlopen libEGL" FF_LIBRARY_EXTENSION " failed", "libEGL" FF_LIBRARY_EXTENSION, 1);
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(egl, eglGetProcAddress);
PFNEGLQUERYDEVICESEXTPROC ffeglQueryDevicesEXT = (PFNEGLQUERYDEVICESEXTPROC) ffeglGetProcAddress("eglQueryDevicesEXT");
if (!ffeglQueryDevicesEXT)
return "eglGetProcAddress(\"eglQueryDevicesEXT\") returned NULL";
PFNEGLQUERYDEVICESTRINGEXTPROC ffeglQueryDeviceStringEXT = (PFNEGLQUERYDEVICESTRINGEXTPROC) ffeglGetProcAddress("eglQueryDeviceStringEXT");
if (!ffeglQueryDeviceStringEXT)
return "eglGetProcAddress(\"eglQueryDeviceStringEXT\") returned NULL";
EGLDeviceEXT devs[32];
EGLint numDevs;
if (ffeglQueryDevicesEXT(ARRAY_SIZE(devs), devs, &numDevs))
{
for (EGLint i = 0; i < numDevs; i++)
{
const char* renderer = ffeglQueryDeviceStringEXT(devs[i], EGL_RENDERER_EXT);
if (!renderer) continue;
FFGPUResult* gpu = (FFGPUResult*) ffListAdd(gpus);
ffStrbufInitS(&gpu->name, renderer);
ffStrbufInitS(&gpu->vendor, ffeglQueryDeviceStringEXT(devs[i], EGL_VENDOR));
ffStrbufInitS(&gpu->driver, ffeglQueryDeviceStringEXT(devs[i], EGL_DRIVER_NAME_EXT));
gpu->index = FF_GPU_INDEX_UNSET;
gpu->coreCount = FF_GPU_CORE_COUNT_UNSET;
gpu->coreUsage = FF_GPU_CORE_USAGE_UNSET;
gpu->temperature = FF_GPU_TEMP_UNSET;
gpu->frequency = FF_GPU_FREQUENCY_UNSET;
gpu->type = FF_GPU_TYPE_UNKNOWN;
gpu->dedicated.total = gpu->dedicated.used = gpu->shared.total = gpu->shared.used = FF_GPU_VMEM_SIZE_UNSET;
gpu->deviceId = 0;
ffStrbufInitStatic(&gpu->platformApi, "EGLext");
}
}
return NULL;
}
#else
const char* ffGPUDetectByEglext(FF_MAYBE_UNUSED FFlist* gpus)
{
return "fastfetch was compiled without egl support";
}
#endif

View File

@ -165,7 +165,6 @@ bool ffParseGPUCommandOptions(FFGPUOptions* options, const char* key, const char
{ "pci", FF_GPU_DETECTION_METHOD_PCI },
{ "vulkan", FF_GPU_DETECTION_METHOD_VULKAN },
{ "opencl", FF_GPU_DETECTION_METHOD_OPENCL },
{ "eglext", FF_GPU_DETECTION_METHOD_EGLEXT },
{ "opengl", FF_GPU_DETECTION_METHOD_OPENGL },
{},
});
@ -222,7 +221,6 @@ void ffParseGPUJsonObject(FFGPUOptions* options, yyjson_val* module)
{ "pci", FF_GPU_DETECTION_METHOD_PCI },
{ "vulkan", FF_GPU_DETECTION_METHOD_VULKAN },
{ "opencl", FF_GPU_DETECTION_METHOD_OPENCL },
{ "eglext", FF_GPU_DETECTION_METHOD_EGLEXT },
{ "opengl", FF_GPU_DETECTION_METHOD_OPENGL },
{},
});
@ -282,9 +280,6 @@ void ffGenerateGPUJsonConfig(FFGPUOptions* options, yyjson_mut_doc* doc, yyjson_
case FF_GPU_DETECTION_METHOD_OPENCL:
yyjson_mut_obj_add_str(doc, module, "detectionMethod", "opencl");
break;
case FF_GPU_DETECTION_METHOD_EGLEXT:
yyjson_mut_obj_add_str(doc, module, "detectionMethod", "eglext");
break;
case FF_GPU_DETECTION_METHOD_OPENGL:
yyjson_mut_obj_add_str(doc, module, "detectionMethod", "opengl");
break;

View File

@ -18,7 +18,6 @@ typedef enum __attribute__((__packed__)) FFGPUDetectionMethod
FF_GPU_DETECTION_METHOD_PCI,
FF_GPU_DETECTION_METHOD_VULKAN,
FF_GPU_DETECTION_METHOD_OPENCL,
FF_GPU_DETECTION_METHOD_EGLEXT,
FF_GPU_DETECTION_METHOD_OPENGL,
} FFGPUDetectionMethod;