View | Details | Raw Unified | Return to bug 230450 | Differences between
and this patch

Collapse All | Expand All

(-)files/patch-third__party_angle_src_gpu_info_util_SystemInfo_internal.h (-3 / +8 lines)
Lines 1-6 Link Here
1
--- third_party/angle/src/gpu_info_util/SystemInfo_internal.h.orig	2017-09-10 02:31:40.635170000 +0200
1
--- third_party/angle/src/gpu_info_util/SystemInfo_internal.h.orig	2018-08-08 12:13:09.000000000 -0700
2
+++ third_party/angle/src/gpu_info_util/SystemInfo_internal.h	2017-09-10 02:32:27.153701000 +0200
2
+++ third_party/angle/src/gpu_info_util/SystemInfo_internal.h	2018-08-20 09:43:56.141492000 -0700
3
@@ -14,6 +14,8 @@
3
@@ -14,8 +14,13 @@
4
 namespace angle
4
 namespace angle
5
 {
5
 {
6
 
6
 
Lines 8-11 Link Here
8
+
8
+
9
 // Defined in SystemInfo_libpci when GPU_INFO_USE_LIBPCI is defined.
9
 // Defined in SystemInfo_libpci when GPU_INFO_USE_LIBPCI is defined.
10
 bool GetPCIDevicesWithLibPCI(std::vector<GPUDeviceInfo> *devices);
10
 bool GetPCIDevicesWithLibPCI(std::vector<GPUDeviceInfo> *devices);
11
+#if defined(__FreeBSD__)
12
+bool GetPCIDevicesFreeBSD(std::vector<GPUDeviceInfo> *devices);
13
+#endif
11
 // Defined in SystemInfo_x11 when GPU_INFO_USE_X11 is defined.
14
 // Defined in SystemInfo_x11 when GPU_INFO_USE_X11 is defined.
15
 bool GetNvidiaDriverVersionWithXNVCtrl(std::string *version);
16
 
(-)files/patch-third__party_angle_src_gpu_info_util_SystemInfo_libpci.cpp (+90 lines)
Line 0 Link Here
1
--- third_party/angle/src/gpu_info_util/SystemInfo_libpci.cpp.orig	2018-08-20 10:00:10.885543000 -0700
2
+++ third_party/angle/src/gpu_info_util/SystemInfo_libpci.cpp	2018-08-20 09:50:32.387980000 -0700
3
@@ -12,6 +12,11 @@
4
 #include <pci/pci.h>
5
 #include <unistd.h>
6
 
7
+#if defined(__FreeBSD__)
8
+#include <fcntl.h>
9
+#include <sys/pciio.h>
10
+#endif
11
+
12
 #include "common/angleutils.h"
13
 #include "common/debug.h"
14
 
15
@@ -82,6 +87,75 @@
16
 };
17
 
18
 }  // anonymous namespace
19
+
20
+#if defined(__FreeBSD__)
21
+// Adds an entry per PCI GPU found and fills the device and vendor ID.
22
+bool GetPCIDevicesFreeBSD(std::vector<GPUDeviceInfo> *devices)
23
+{
24
+    int fd;
25
+    struct pci_conf_io conf;
26
+    struct pci_conf *matches;
27
+    uint32_t offset = 0;
28
+
29
+    fd = open("/dev/pci", O_RDONLY);
30
+    if (fd < 0)
31
+        return false;
32
+
33
+    matches = new struct pci_conf[32];
34
+    conf.generation = 0;
35
+    do {
36
+        conf.pat_buf_len = 0;
37
+        conf.num_patterns = 0;
38
+        conf.patterns = NULL;
39
+        conf.match_buf_len = 32 * sizeof(struct pci_conf);
40
+        conf.num_matches = 32;
41
+        conf.matches = matches;
42
+        conf.offset = offset;
43
+        conf.status = PCI_GETCONF_ERROR;
44
+        if (ioctl(fd, PCIOCGETCONF, &conf) < 0) {
45
+            if (errno == ENODEV)
46
+                break;
47
+        }
48
+        /* PCI_GETCONF_LIST_CHANGED would require us to start over. */
49
+        if (conf.status == PCI_GETCONF_ERROR || conf.status == PCI_GETCONF_LIST_CHANGED) {
50
+            break;
51
+        }
52
+
53
+        for (unsigned int i = 0; i < conf.num_matches; i++) {
54
+            uint16_t device_class = (matches[i].pc_class << 8) |  matches[i].pc_subclass;
55
+
56
+            // Skip non-GPU devices
57
+            switch (device_class)
58
+            {
59
+                case PCI_CLASS_DISPLAY_VGA:
60
+                case PCI_CLASS_DISPLAY_XGA:
61
+                case PCI_CLASS_DISPLAY_3D:
62
+                    break;
63
+                default:
64
+                    continue;
65
+            }
66
+
67
+            // Skip unknown devices
68
+            if (matches[i].pc_vendor == 0 || matches[i].pc_device == 0) {
69
+                continue;
70
+            }
71
+
72
+            GPUDeviceInfo info;
73
+            info.vendorId = matches[i].pc_vendor;
74
+            info.deviceId = matches[i].pc_device;
75
+
76
+            devices->push_back(info);
77
+        }
78
+        offset += conf.num_matches;
79
+    } while (conf.status == PCI_GETCONF_MORE_DEVS);
80
+
81
+    delete[] matches;
82
+
83
+    close(fd);
84
+
85
+    return true;
86
+}
87
+#endif
88
 
89
 // Adds an entry per PCI GPU found and fills the device and vendor ID.
90
 bool GetPCIDevicesWithLibPCI(std::vector<GPUDeviceInfo> *devices)
(-)files/patch-third__party_angle_src_gpu_info_util_SystemInfo_linux.cpp (-4 / +5 lines)
Lines 1-6 Link Here
1
--- third_party/angle/src/gpu_info_util/SystemInfo_linux.cpp.orig	2017-09-10 02:34:01.568975000 +0200
1
--- third_party/angle/src/gpu_info_util/SystemInfo_linux.cpp.orig	2018-08-08 12:13:09.000000000 -0700
2
+++ third_party/angle/src/gpu_info_util/SystemInfo_linux.cpp	2017-09-10 02:35:52.870068000 +0200
2
+++ third_party/angle/src/gpu_info_util/SystemInfo_linux.cpp	2018-08-20 09:50:36.331947000 -0700
3
@@ -71,10 +71,17 @@
3
@@ -71,10 +71,18 @@
4
 
4
 
5
 bool GetSystemInfo(SystemInfo *info)
5
 bool GetSystemInfo(SystemInfo *info)
6
 {
6
 {
Lines 7-13 Link Here
7
+#if defined(__FreeBSD__)
7
+#if defined(__FreeBSD__)
8
+    if (!CollectMesaCardInfo(&(info->gpus)))
8
+    if (!CollectMesaCardInfo(&(info->gpus)))
9
+    {
9
+    {
10
+        return false;
10
+        if (!GetPCIDevicesFreeBSD(&(info->gpus)))
11
+            return false;
11
+    }
12
+    }
12
+#else
13
+#else
13
     if (!GetPCIDevicesWithLibPCI(&(info->gpus)))
14
     if (!GetPCIDevicesWithLibPCI(&(info->gpus)))
(-)files/patch-third__party_angle_src_gpu_info_util_SystemInfo_x11.cpp (-3 / +6 lines)
Lines 1-5 Link Here
1
--- third_party/angle/src/gpu_info_util/SystemInfo_x11.cpp.orig	2017-12-15 02:05:36.000000000 +0100
1
--- third_party/angle/src/gpu_info_util/SystemInfo_x11.cpp.orig	2018-08-08 12:13:09.000000000 -0700
2
+++ third_party/angle/src/gpu_info_util/SystemInfo_x11.cpp	2017-12-30 05:11:53.917801000 +0100
2
+++ third_party/angle/src/gpu_info_util/SystemInfo_x11.cpp	2018-08-20 09:34:48.052352000 -0700
3
@@ -8,6 +8,8 @@
3
@@ -8,6 +8,8 @@
4
 
4
 
5
 #include "gpu_info_util/SystemInfo_internal.h"
5
 #include "gpu_info_util/SystemInfo_internal.h"
Lines 9-15 Link Here
9
 #include <X11/Xlib.h>
9
 #include <X11/Xlib.h>
10
 
10
 
11
 #include "common/debug.h"
11
 #include "common/debug.h"
12
@@ -18,8 +20,40 @@
12
@@ -18,8 +20,43 @@
13
 #error SystemInfo_x11.cpp compiled without GPU_INFO_USE_X11
13
 #error SystemInfo_x11.cpp compiled without GPU_INFO_USE_X11
14
 #endif
14
 #endif
15
 
15
 
Lines 33-38 Link Here
33
+        (PFNGLXQUERYRENDERERINTEGERMESAPROC) glXGetProcAddressARB((const GLubyte *)
33
+        (PFNGLXQUERYRENDERERINTEGERMESAPROC) glXGetProcAddressARB((const GLubyte *)
34
+        "glXQueryRendererIntegerMESA");
34
+        "glXQueryRendererIntegerMESA");
35
+
35
+
36
+    if (!queryInteger)
37
+        return false;
38
+
36
+    bool vendor_ret =
39
+    bool vendor_ret =
37
+        queryInteger(display, 0, 0, GLX_RENDERER_VENDOR_ID_MESA, vid);
40
+        queryInteger(display, 0, 0, GLX_RENDERER_VENDOR_ID_MESA, vid);
38
+    bool device_ret =
41
+    bool device_ret =

Return to bug 230450