aboutsummaryrefslogtreecommitdiff
path: root/www
diff options
context:
space:
mode:
authorRobert Nagy <robert@openbsd.org>2022-02-23 21:57:09 +0000
committerRene Ladan <rene@FreeBSD.org>2022-02-23 22:00:01 +0000
commit0a944a40c1adc0f52ea2e7020df0290e792384ac (patch)
tree953c86bd1d78d828b8330ccea52dd8f4dd7c0e7b /www
parent5d3a2cfbe493ca12f6945fc3eca803b13ddffd97 (diff)
downloadports-0a944a40c1adc0f52ea2e7020df0290e792384ac.tar.gz
ports-0a944a40c1adc0f52ea2e7020df0290e792384ac.zip
www/chromium: fix GPU acceleration on NVIDIA
PR: 262156 Reported by: o.hushchenkov@gmail.com Fixes: a23dfd21 "www/chromium: update to 98.0.4758.102" (cherry picked from commit 73fbbd6e9f7ae3369ca9510f0f9ddd90d87435bf)
Diffstat (limited to 'www')
-rw-r--r--www/chromium/Makefile2
-rw-r--r--www/chromium/files/patch-third__party_angle_src_gpu__info__util_SystemInfo__internal.h7
-rw-r--r--www/chromium/files/patch-third__party_angle_src_gpu__info__util_SystemInfo__libpci.cpp90
-rw-r--r--www/chromium/files/patch-third__party_angle_src_gpu__info__util_SystemInfo__linux.cpp20
-rw-r--r--www/chromium/files/patch-third__party_angle_src_gpu__info__util_SystemInfo__x11.cpp12
5 files changed, 119 insertions, 12 deletions
diff --git a/www/chromium/Makefile b/www/chromium/Makefile
index cc137ed98bf4..77b6fc13f377 100644
--- a/www/chromium/Makefile
+++ b/www/chromium/Makefile
@@ -2,7 +2,7 @@
PORTNAME= chromium
PORTVERSION= 98.0.4758.102
-PORTREVISION= 1
+PORTREVISION= 2
CATEGORIES= www
MASTER_SITES= https://commondatastorage.googleapis.com/chromium-browser-official/ \
LOCAL/rene/chromium/:fonts
diff --git a/www/chromium/files/patch-third__party_angle_src_gpu__info__util_SystemInfo__internal.h b/www/chromium/files/patch-third__party_angle_src_gpu__info__util_SystemInfo__internal.h
index 82f282113b57..db6b7e57c3e7 100644
--- a/www/chromium/files/patch-third__party_angle_src_gpu__info__util_SystemInfo__internal.h
+++ b/www/chromium/files/patch-third__party_angle_src_gpu__info__util_SystemInfo__internal.h
@@ -1,11 +1,14 @@
---- third_party/angle/src/gpu_info_util/SystemInfo_internal.h.orig 2022-02-07 13:39:41 UTC
+--- third_party/angle/src/gpu_info_util/SystemInfo_internal.h.orig 2022-02-23 19:25:59 UTC
+++ third_party/angle/src/gpu_info_util/SystemInfo_internal.h
-@@ -14,6 +14,10 @@
+@@ -14,6 +14,13 @@
namespace angle
{
+#if defined(__OpenBSD__) || defined(__FreeBSD__)
+bool CollectMesaCardInfo(std::vector<GPUDeviceInfo> *devices);
++#if defined(__FreeBSD__)
++bool GetPCIDevicesFreeBSD(std::vector<GPUDeviceInfo> *devices);
++#endif
+#endif
+
// Defined in SystemInfo_libpci when GPU_INFO_USE_LIBPCI is defined.
diff --git a/www/chromium/files/patch-third__party_angle_src_gpu__info__util_SystemInfo__libpci.cpp b/www/chromium/files/patch-third__party_angle_src_gpu__info__util_SystemInfo__libpci.cpp
new file mode 100644
index 000000000000..847b0d538010
--- /dev/null
+++ b/www/chromium/files/patch-third__party_angle_src_gpu__info__util_SystemInfo__libpci.cpp
@@ -0,0 +1,90 @@
+--- third_party/angle/src/gpu_info_util/SystemInfo_libpci.cpp.orig 2022-02-23 19:25:59 UTC
++++ third_party/angle/src/gpu_info_util/SystemInfo_libpci.cpp
+@@ -12,6 +12,11 @@
+ #include <pci/pci.h>
+ #include <unistd.h>
+
++#if defined(__FreeBSD__)
++#include <fcntl.h>
++#include <sys/pciio.h>
++#endif
++
+ #include "common/angleutils.h"
+ #include "common/debug.h"
+
+@@ -85,6 +90,75 @@ struct LibPCI : private angle::NonCopyable
+ };
+
+ } // anonymous namespace
++
++#if defined(__FreeBSD__)
++// Adds an entry per PCI GPU found and fills the device and vendor ID.
++bool GetPCIDevicesFreeBSD(std::vector<GPUDeviceInfo> *devices)
++{
++ int fd;
++ struct pci_conf_io conf;
++ struct pci_conf *matches;
++ uint32_t offset = 0;
++
++ fd = open("/dev/pci", O_RDONLY);
++ if (fd < 0)
++ return false;
++
++ matches = new struct pci_conf[32];
++ conf.generation = 0;
++ do {
++ conf.pat_buf_len = 0;
++ conf.num_patterns = 0;
++ conf.patterns = NULL;
++ conf.match_buf_len = 32 * sizeof(struct pci_conf);
++ conf.num_matches = 32;
++ conf.matches = matches;
++ conf.offset = offset;
++ conf.status = PCI_GETCONF_ERROR;
++ if (ioctl(fd, PCIOCGETCONF, &conf) < 0) {
++ if (errno == ENODEV)
++ break;
++ }
++ /* PCI_GETCONF_LIST_CHANGED would require us to start over. */
++ if (conf.status == PCI_GETCONF_ERROR || conf.status == PCI_GETCONF_LIST_CHANGED) {
++ break;
++ }
++
++ for (unsigned int i = 0; i < conf.num_matches; i++) {
++ uint16_t device_class = (matches[i].pc_class << 8) | matches[i].pc_subclass;
++
++ // Skip non-GPU devices
++ switch (device_class)
++ {
++ case PCI_CLASS_DISPLAY_VGA:
++ case PCI_CLASS_DISPLAY_XGA:
++ case PCI_CLASS_DISPLAY_3D:
++ break;
++ default:
++ continue;
++ }
++
++ // Skip unknown devices
++ if (matches[i].pc_vendor == 0 || matches[i].pc_device == 0) {
++ continue;
++ }
++
++ GPUDeviceInfo info;
++ info.vendorId = matches[i].pc_vendor;
++ info.deviceId = matches[i].pc_device;
++
++ devices->push_back(info);
++ }
++ offset += conf.num_matches;
++ } while (conf.status == PCI_GETCONF_MORE_DEVS);
++
++ delete[] matches;
++
++ close(fd);
++
++ return true;
++}
++#endif
+
+ // Adds an entry per PCI GPU found and fills the device and vendor ID.
+ bool GetPCIDevicesWithLibPCI(std::vector<GPUDeviceInfo> *devices)
diff --git a/www/chromium/files/patch-third__party_angle_src_gpu__info__util_SystemInfo__linux.cpp b/www/chromium/files/patch-third__party_angle_src_gpu__info__util_SystemInfo__linux.cpp
index e398a0805102..ef2231b48c21 100644
--- a/www/chromium/files/patch-third__party_angle_src_gpu__info__util_SystemInfo__linux.cpp
+++ b/www/chromium/files/patch-third__party_angle_src_gpu__info__util_SystemInfo__linux.cpp
@@ -1,19 +1,31 @@
---- third_party/angle/src/gpu_info_util/SystemInfo_linux.cpp.orig 2022-02-07 13:39:41 UTC
+--- third_party/angle/src/gpu_info_util/SystemInfo_linux.cpp.orig 2022-02-23 19:25:59 UTC
+++ third_party/angle/src/gpu_info_util/SystemInfo_linux.cpp
-@@ -71,6 +71,12 @@ bool GetPCIDevicesWithLibPCI(std::vector<GPUDeviceInfo
+@@ -71,6 +71,24 @@ bool GetPCIDevicesWithLibPCI(std::vector<GPUDeviceInfo
bool GetSystemInfo(SystemInfo *info)
{
+#if defined(__OpenBSD__) || defined(__FreeBSD__)
+ if (!CollectMesaCardInfo(&(info->gpus)))
+ {
-+ return false;
++#if defined(__FreeBSD__)
++ if (!GetPCIDevicesFreeBSD(&(info->gpus)))
++ {
++#endif
++#if defined(ANGLE_USE_VULKAN_SYSTEM_INFO)
++ // Try vulkan backend to get GPU info
++ return GetSystemInfoVulkan(info);
++#else
++ return false;
++#endif
++#if defined(__FreeBSD__)
++ }
++#endif
+ }
+#else
if (!GetPCIDevicesWithLibPCI(&(info->gpus)))
{
#if defined(ANGLE_USE_VULKAN_SYSTEM_INFO)
-@@ -85,6 +91,7 @@ bool GetSystemInfo(SystemInfo *info)
+@@ -85,6 +103,7 @@ bool GetSystemInfo(SystemInfo *info)
{
return false;
}
diff --git a/www/chromium/files/patch-third__party_angle_src_gpu__info__util_SystemInfo__x11.cpp b/www/chromium/files/patch-third__party_angle_src_gpu__info__util_SystemInfo__x11.cpp
index 9e9fe5ab1a2d..9b174b17ae80 100644
--- a/www/chromium/files/patch-third__party_angle_src_gpu__info__util_SystemInfo__x11.cpp
+++ b/www/chromium/files/patch-third__party_angle_src_gpu__info__util_SystemInfo__x11.cpp
@@ -1,4 +1,4 @@
---- third_party/angle/src/gpu_info_util/SystemInfo_x11.cpp.orig 2022-02-07 13:39:41 UTC
+--- third_party/angle/src/gpu_info_util/SystemInfo_x11.cpp.orig 2022-02-23 20:48:53 UTC
+++ third_party/angle/src/gpu_info_util/SystemInfo_x11.cpp
@@ -8,6 +8,10 @@
@@ -11,7 +11,7 @@
#include <X11/Xlib.h>
#include "common/debug.h"
-@@ -18,8 +22,44 @@
+@@ -18,8 +22,46 @@
# error SystemInfo_x11.cpp compiled without GPU_INFO_USE_X11
#endif
@@ -37,6 +37,9 @@
+ (PFNGLXQUERYRENDERERINTEGERMESAPROC) glXGetProcAddressARB((const GLubyte *)
+ "glXQueryRendererIntegerMESA");
+
++ if (!queryInteger)
++ return false;
++
+ bool vendor_ret =
+ queryInteger(display, 0, 0, GLX_RENDERER_VENDOR_ID_MESA, vid);
+ bool device_ret =
@@ -47,10 +50,9 @@
+ info.vendorId = vid[0];
+ info.deviceId = did[0];
+ devices->push_back(info);
-+ }
-+
++ }
+
-+ return true;
++ return true;
+}
+#endif