/sys/bus/pci/devices doesn't exist as kms-drm exports sysfs via sysctl $ clinfo | fgrep clock Max clock frequency 0MHz --- core/os_interface/linux/drm_neo.cpp.orig 2020-01-23 10:09:13 UTC +++ core/os_interface/linux/drm_neo.cpp @@ -18,6 +18,11 @@ #include #include +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) +#include +#include +#endif + namespace NEO { const char *Drm::sysFsDefaultGpuPath = "/drm/card0"; @@ -68,6 +73,16 @@ int Drm::getEnabledPooledEu(int &enabled) { int Drm::getMaxGpuFrequency(int &maxGpuFrequency) { maxGpuFrequency = 0; +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) + char max_freq[PAGE_SIZE]; + size_t len = sizeof(max_freq); + + if (sysctlbyname("sys.class.drm.card0.gt_max_freq_mhz", &max_freq, &len, NULL, 0)) { + return 0; + } + + maxGpuFrequency = std::stoi(max_freq); +#else int deviceID = 0; int ret = getDeviceID(deviceID); if (ret != 0) { @@ -89,6 +104,7 @@ int Drm::getMaxGpuFrequency(int &maxGpuFrequency) { ifs >> maxGpuFrequency; ifs.close(); +#endif return 0; }