summaryrefslogtreecommitdiff
path: root/lang/intel-compute-runtime/files/patch-max_freq
diff options
context:
space:
mode:
authorJan Beich <jbeich@FreeBSD.org>2020-11-14 19:42:17 +0000
committerJan Beich <jbeich@FreeBSD.org>2020-11-14 19:42:17 +0000
commit40a197f0f4d7bf277aebde91b3d7c2b1bfa78d16 (patch)
treeb40b3bcfb5c9f5564998a04eb3bab546734a7faf /lang/intel-compute-runtime/files/patch-max_freq
parentlang/intel-compute-runtime: work around crash on exit after r543389 (diff)
lang/intel-compute-runtime: enable DG1 (Intel Xe) support
No kernel support yet. To catch regressions early.
Notes
Notes: svn path=/head/; revision=555140
Diffstat (limited to 'lang/intel-compute-runtime/files/patch-max_freq')
-rw-r--r--lang/intel-compute-runtime/files/patch-max_freq49
1 files changed, 49 insertions, 0 deletions
diff --git a/lang/intel-compute-runtime/files/patch-max_freq b/lang/intel-compute-runtime/files/patch-max_freq
index 16835da58187..f1789e82aaa4 100644
--- a/lang/intel-compute-runtime/files/patch-max_freq
+++ b/lang/intel-compute-runtime/files/patch-max_freq
@@ -51,3 +51,52 @@
return 0;
}
+--- shared/source/os_interface/linux/drm_query_dg1.cpp.orig 2020-11-07 13:04:57 UTC
++++ shared/source/os_interface/linux/drm_query_dg1.cpp
+@@ -13,11 +13,38 @@
+
+ #include <fstream>
+
++#if defined(__FreeBSD__)
++#include <sys/param.h>
++#include <sys/sysctl.h>
++#include <cstdio>
++#include <cstdlib>
++#endif
++
+ namespace NEO {
+ class OsContext;
+
+ int Drm::getMaxGpuFrequency(HardwareInfo &hwInfo, int &maxGpuFrequency) {
+ maxGpuFrequency = 0;
++#if defined(__FreeBSD__)
++ char name[SPECNAMELEN + 1];
++ if (!fdevname_r(getFileDescriptor(), name, sizeof(name))) {
++ return 0;
++ }
++ int id;
++ if (!sscanf(name, "drm/%d", &id) && !sscanf(name, "dri/renderD%d", &id)) {
++ return 0;
++ }
++
++ char oid[MAXPATHLEN + 1];
++ char max_freq[PAGE_SIZE];
++ size_t len = sizeof(max_freq);
++ snprintf(oid, sizeof(oid), "sys.class.drm.card%d.gt_max_freq_mhz", id - 128);
++ if (sysctlbyname(oid, &max_freq, &len, NULL, 0)) {
++ return 0;
++ }
++
++ maxGpuFrequency = std::stoi(max_freq);
++#else
+ std::string clockSysFsPath = getSysFsPciPath();
+
+ clockSysFsPath += "/gt_max_freq_mhz";
+@@ -29,6 +56,7 @@ int Drm::getMaxGpuFrequency(HardwareInfo &hwInfo, int
+
+ ifs >> maxGpuFrequency;
+ ifs.close();
++#endif
+ return 0;
+ }
+