nixdrin db3731b887 chromium: fix libpci GPU detection
Chromium has blocklists that workaround various GPU driver bugs, either
by forcing software rendering [1] or by disabling use of certain GPU
features [2].

These blocklists can only be applied successfully if the GPU vendor and
device is detected correctly. One of the methods used for GPU detection
is to load libpci.so via dlopen() at runtime to read the PCI vendor and
device ID.

The current derivation already contains a sed command to rewrite the
dlopen() to the absolute path of libpci.so in the Nix store, namely

      sed -i -e '/libpci_loader.*Load/s!"\(libpci\.so\)!"${pciutils}/lib/\1!' \
        gpu/config/gpu_info_collector_linux.cc

However, in Chromium 59 (6 years ago), this code was moved into the
ANGLE library used by Chromium [3]. This sed command no longer works.
There is similar code in ANGLE now [4] that must be similarly patched to
ensure the GPU vendor and device is always detected correctly.

Without libpci some GPUs are not detected correctly. For example, in a
VMWare virtual machine opening chrome://gpu in the browser shows:

  VENDOR= 0x0000 [Google Inc. (VMware, Inc.)], DEVICE=0x0000 [ANGLE
   (VMware Inc., SVGA3D; build: RELEASE;  LLVM;, OpenGL 4.1 (Core Profile)
    Mesa 23.0.3)], DRIVER_VENDOR=Mesa, DRIVER_VERSION=23.0.3 *ACTIVE*

Note the VENDOR=0x0000 and DEVICE=0x0000. Adding libpci.so to the
library path fixes this:

  VENDOR= 0x15ad [Google Inc. (VMware, Inc.)], DEVICE=0x0405 [ANGLE
   (VMware Inc., SVGA3D; build: RELEASE;  LLVM;, OpenGL 4.1 (Core Profile)
    Mesa 23.0.3)], DRIVER_VENDOR=Mesa, DRIVER_VERSION=23.0.3 *ACTIVE*

Note the VENDOR=0x15ad and DEVICE=0x0405. Also now the blocklist entries
are applied correctly, fixing some graphical issues.

Fix this by adding pciutils to the rpath set with patchelf. This avoids
having to patch lines in the source code that might get moved around.

[1]: https://chromium.googlesource.com/chromium/src/+/e52f33f30b91b4ddfad649acddc39ab570473b86/gpu/config/software_rendering_list.json
[2]: https://chromium.googlesource.com/chromium/src/+/e52f33f30b91b4ddfad649acddc39ab570473b86/gpu/config/gpu_driver_bug_list.json
[3]: https://github.com/chromium/chromium/commit/873b27d518038be94df98d1128a2e8047e0ef942
[4]: https://github.com/google/angle/blob/05f45adc147393562b518ca1f82a3ccba7ee40f7/src/gpu_info_util/SystemInfo_libpci.cpp#L41
2023-10-19 23:28:01 +02:00
2023-10-19 23:28:01 +02:00

NixOS logo NixOS logo

Contributors badge Open Collective supporters

Nixpkgs is a collection of over 80,000 software packages that can be installed with the Nix package manager. It also implements NixOS, a purely-functional Linux distribution.

Manuals

  • NixOS Manual - how to install, configure, and maintain a purely-functional Linux distribution
  • Nixpkgs Manual - contributing to Nixpkgs and using programming-language-specific Nix expressions
  • Nix Package Manager Manual - how to write Nix expressions (programs), and how to use Nix command line tools

Community

Other Project Repositories

The sources of all official Nix-related projects are in the NixOS organization on GitHub. Here are some of the main ones:

  • Nix - the purely functional package manager
  • NixOps - the tool to remotely deploy NixOS machines
  • nixos-hardware - NixOS profiles to optimize settings for different hardware
  • Nix RFCs - the formal process for making substantial changes to the community
  • NixOS homepage - the NixOS.org website
  • hydra - our continuous integration system
  • NixOS Artwork - NixOS artwork

Continuous Integration and Distribution

Nixpkgs and NixOS are built and tested by our continuous integration system, Hydra.

Artifacts successfully built with Hydra are published to cache at https://cache.nixos.org/. When successful build and test criteria are met, the Nixpkgs expressions are distributed via Nix channels.

Contributing

Nixpkgs is among the most active projects on GitHub. While thousands of open issues and pull requests might seem a lot at first, it helps consider it in the context of the scope of the project. Nixpkgs describes how to build tens of thousands of pieces of software and implements a Linux distribution. The GitHub Insights page gives a sense of the project activity.

Community contributions are always welcome through GitHub Issues and Pull Requests.

For more information about contributing to the project, please visit the contributing page.

Donations

The infrastructure for NixOS and related projects is maintained by a nonprofit organization, the NixOS Foundation. To ensure the continuity and expansion of the NixOS infrastructure, we are looking for donations to our organization.

You can donate to the NixOS foundation through SEPA bank transfers or by using Open Collective:

License

Nixpkgs is licensed under the MIT License.

Note: MIT license does not apply to the packages built by Nixpkgs, merely to the files in this repository (the Nix expressions, build scripts, NixOS modules, etc.). It also might not apply to patches included in Nixpkgs, which may be derivative works of the packages to which they apply. The aforementioned artifacts are all covered by the licenses of the respective packages.

S
Description
No description provided
Readme
5 GiB
Languages
Nix 95%
Shell 2%
Python 1.8%
Rust 0.3%
JavaScript 0.2%
Other 0.4%