From nobody Wed Feb 23 21:59:26 2022 X-Original-To: dev-commits-ports-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 6367E19C86C5; Wed, 23 Feb 2022 21:59:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4K3qgy2LJ7z4Znm; Wed, 23 Feb 2022 21:59:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1645653566; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=PH59GtPvPN8xBNRb05wx7GbqTkE9PgFPXdvhH9F6/OM=; b=wB+9n5gXyle2ISK9MjrcBeUH6mj3Sv83CM6NLvKZjxxJDxtLyTcEkIPzEz6NfJc8hyq0Yv +CjCH93LBL/+NaJhuATD2flbWAzvYPp3oH6Ca0MMfZbqLUId2WSfGYiofe/ITNrgQzVKaI l3Uz7foT275O+9ZYQzjr3xwt3YqxG2Qc4lXuzu1w01M7CpXOqI0gg6TTDKWmLnb8fge00r /UTpYAyPHLOrbwe/M9SJuIqbsBW1tApCDetGqR7cvgeLWFFgbemaYUyL3YleEI4Vb/glAN hwibd+XKLsxACDWIWeBwPGkEogcAsB7jULed5SnjuVhuOuySqYGIPUgkcsWXXg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 257F81FA75; Wed, 23 Feb 2022 21:59:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 21NLxQAt025246; Wed, 23 Feb 2022 21:59:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 21NLxQnr025245; Wed, 23 Feb 2022 21:59:26 GMT (envelope-from git) Date: Wed, 23 Feb 2022 21:59:26 GMT Message-Id: <202202232159.21NLxQnr025245@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Rene Ladan Subject: git: 73fbbd6e9f7a - main - www/chromium: fix GPU acceleration on NVIDIA List-Id: Commits to the main branch of the FreeBSD ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-main@freebsd.org X-BeenThere: dev-commits-ports-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rene X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 73fbbd6e9f7ae3369ca9510f0f9ddd90d87435bf Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1645653566; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=PH59GtPvPN8xBNRb05wx7GbqTkE9PgFPXdvhH9F6/OM=; b=xiYnaaXn2IUqXyJFs0hP5YBUrqFhJIWUAdreggqWj/uYsingEdxJ0ujpWeef2NwFyeaumL oEnAaN0t5ZQPfdZCqG2Lz48K3eHniaqvJae4+AIsY1qwObzfyC8RhcuCy4gtkSfScnSzCn 5Gr56920hQCl4079LqrsL3t9hv/kwZSDjjVDUDMssy13RiWSSd6YM+i+4zX5bQbo09C4GB /nIeIg0G1bBVN5asCyAle+O0EN5kz0Hm/C7LXe15/J0zBnvEL4QRqGUwME/Lm9IdmiEm0u zKs6bioH07ERo+5xQ1ICiIswT75QtnOyKWSxaglG7GvPAgNbWhPZ5rL6ZNc35w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1645653566; a=rsa-sha256; cv=none; b=dzjNV4xA3zRwZQVT6LOEgi7nYkXnsSn1egvJ79OoSMHz3pardi82WSY9ERfx6WHHq0aw4a ZGDMYfJUf1XUyutRHDB4tktU2wWAN8FukdojuR+qQndLh+jFwbh/xKm1Ziv2aaj8C24Reh cw2BCuN+38tB3xZmVlKARkKb2Q8PncgTc1yjlQlJr7gdzktGsOaVKLCGqdXM3BRi+4xIRi nBLYAgGfq9E2fxfH8k9hdbTdxc1wY4v+taUZgbr4fLWMd9SPiFJaCphpq0jRexA284Gh98 19uRI9uvVLPeJFxinUAJWhNyvxJJIGPLb3siGF505EHU0rUuBInuxgU5GuJd2g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by rene: URL: https://cgit.FreeBSD.org/ports/commit/?id=73fbbd6e9f7ae3369ca9510f0f9ddd90d87435bf commit 73fbbd6e9f7ae3369ca9510f0f9ddd90d87435bf Author: Robert Nagy AuthorDate: 2022-02-23 21:57:09 +0000 Commit: Rene Ladan CommitDate: 2022-02-23 21:59:09 +0000 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" --- www/chromium/Makefile | 2 +- ...ngle_src_gpu__info__util_SystemInfo__internal.h | 7 +- ...ngle_src_gpu__info__util_SystemInfo__libpci.cpp | 90 ++++++++++++++++++++++ ...angle_src_gpu__info__util_SystemInfo__linux.cpp | 20 ++++- ...y_angle_src_gpu__info__util_SystemInfo__x11.cpp | 12 +-- 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 *devices); ++#if defined(__FreeBSD__) ++bool GetPCIDevicesFreeBSD(std::vector *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 + #include + ++#if defined(__FreeBSD__) ++#include ++#include ++#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 *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 *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::vectorgpus))) + { -+ 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 #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