GPU (OpenBSD): adds DRM method

This commit is contained in:
李通洲
2026-06-12 21:37:06 +08:00
parent 265c334399
commit 14dfe171fb
3 changed files with 19 additions and 2 deletions
+2
View File
@@ -356,6 +356,7 @@ const char* ffDrmDetectNouveau(FFGPUResult* gpu, int fd) {
#include "gpu_driver_specific.h"
const char* ffGPUDetectDriverSpecific(const FFGPUOptions* options, FFGPUResult* gpu, FFGpuDriverPciBusId pciBusId) {
#if !__OpenBSD__
__typeof__(&ffDetectNvidiaGpuInfo) detectFn;
const char* soName;
if (getDriverSpecificDetectionFn(gpu->vendor.chars, &detectFn, &soName) && (options->temp || options->driverSpecific)) {
@@ -375,6 +376,7 @@ const char* ffGPUDetectDriverSpecific(const FFGPUOptions* options, FFGPUResult*
},
soName);
}
#endif
return "No driver-specific detection function found for the GPU vendor";
}
+14 -1
View File
@@ -27,7 +27,7 @@ static inline int pciReadConf(int fd, uint8_t bus, uint8_t device, uint8_t func,
return 0;
}
const char* ffDetectGPUImpl(FF_A_UNUSED const FFGPUOptions* options, FFlist* gpus) {
const char* detectByPci(FF_A_UNUSED const FFGPUOptions* options, FFlist* gpus) {
char pciDevPath[] = "/dev/pci0";
FF_AUTO_CLOSE_FD int pcifd = open(pciDevPath, O_RDONLY | O_CLOEXEC);
if (pcifd < 0) {
@@ -99,3 +99,16 @@ const char* ffDetectGPUImpl(FF_A_UNUSED const FFGPUOptions* options, FFlist* gpu
return NULL;
}
const char* ffDetectGPUImpl(const FFGPUOptions* options, FFlist* gpus) {
#if FF_HAVE_DRM
if (options->detectionMethod == FF_GPU_DETECTION_METHOD_AUTO) {
ffGPUDetectByDrmBSD(options, gpus);
if (gpus->length > 0) {
return NULL;
}
}
#endif
return detectByPci(options, gpus);
}