Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch from extra-data to normal package (v2) #234

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

guihkx
Copy link
Collaborator

@guihkx guihkx commented Feb 5, 2024

This is my take at solving #203, which is also pretty much a follow-up to #167.

Here are some pros of accepting this PR (in my opinion):

  • Less annoying driver updates (#42, #156)
  • Bypass of potential regional restrictions (#52, #203)
  • The retirement of the i386 build bot

And here are some potential cons (also in my opinion):

  • Potential throttling of download speeds by NVIDIA servers: I built every single driver version we currently have, just to make sure they would at least pass the build step. However, after downloading about half of the drivers at very high speeds (50 MB/s), subsequent downloads were slowed down to only 100 KB/s (!). I made sure to check that this issue wasn't being caused by my ISP, too. So, I'm not sure if Flathub servers will be affected by this, but it's something to keep in mind, because it might significantly slow down the build process.

  • Overall slower build time: This issue is not directly related to the issue above (although this one can be worsened by it), Instead, it has to do with the fact that by switching from extra-data, Flathub now has to download 91 GiB worth of driver files every time a new driver version is added. A potential way mitigate this, would be by Flathub admins allocating ~100 GB of storage to cache all these installers, but this number will only grow with time... :(

    # Estimation of how much GiBs we have to download to build every single driver (aarch64 drivers included)
    $ cat data/* | uniq | awk -F ':' '{sum+=$3}END{print sum/1024/1024/1024" GiB"}'
    94.5296 GiB

Those things aside, I should also note that my testing capabilities are limited because I only have an old NVIDIA GPU, and so the actual testing of the driver was solely done with version 470.223.02.

In any case, I have wrote some instructions below for any contributors willing to build and test this locally.

Closes #42
Closes #156
Closes #203
Closes #217


How to build/package locally

1. Open versions.sh and edit the DRIVER_VERSIONS variable at the very end, informing the versions you want to package, separated by a white space. For example, to package only the 545.29.06 driver:

DRIVER_VERSIONS='545.29.06'

2. Invoke the update-data.sh script to make sure metadata files about the driver exist:

./update-data.sh

3. Invoke the build command to build for your CPU architecture:

# hint: you can build for aarch64 by adding ARCH=aarch64 in front of make
make

4. Create a local Flatpak remote named nvidia-local, pointing to the repo/ directory:

flatpak --user remote-add --no-gpg-verify nvidia-local repo/

5. Check what drivers you have in the repository:

flatpak --user remote-ls nvidia-local

6. Install the drivers accordingly, for example:

flatpak --user install nvidia-local org.freedesktop.Platform.GL.nvidia-560-35-03
# Don't forget the 32-bit driver...
flatpak --user install nvidia-local org.freedesktop.Platform.GL32.nvidia-560-35-03

Testing

Perhaps the easiest way to test this is by installing Flatpak'd Steam. Because Steam requires the multiarch permission by default, testing the 32-bit part of the driver is easier.

My tests consist in downloading x86 and x86_64 binaries of vulkaninfo (to test Vulkan) and glxinfo (to test OpenGL), and then running these two tools within the com.valvesoftware.Steam app, and observe that their output is correct.

Below are command-line only instructions on how to do that.

Testing Vulkan (x86_64 / x86)

# RPM source: https://kojihub.stream.centos.org/koji/buildinfo?buildID=46408
curl -LO https://kojihub.stream.centos.org/kojifiles/packages/vulkan-tools/1.3.268.0/1.el9/x86_64/vulkan-tools-1.3.268.0-1.el9.x86_64.rpm
# Note: You'll need rpmextract to extract vulkaninfo
rpm2cpio vulkan-tools-1.3.268.0-1.el9.x86_64.rpm | zstd -d | cpio -i --to-stdout ./usr/bin/vulkaninfo > vulkaninfo64
# Give it execute permission
chmod +x vulkaninfo64
# Run vulkaninfo within Flatpak'd Steam, and make sure that the output matches your GPU name/model, and not llvmpipe
flatpak run --command=$PWD/vulkaninfo64 --filesystem=$PWD com.valvesoftware.Steam --summary | grep -wm1 deviceName
# RPM source: https://kojihub.stream.centos.org/koji/buildinfo?buildID=46408
curl -LO https://kojihub.stream.centos.org/kojifiles/packages/vulkan-tools/1.3.268.0/1.el9/i686/vulkan-tools-1.3.268.0-1.el9.i686.rpm
# Note: You'll need rpmextract to extract vulkaninfo
rpm2cpio vulkan-tools-1.3.268.0-1.el9.i686.rpm | zstd -d | cpio -i --to-stdout ./usr/bin/vulkaninfo > vulkaninfo32
# Give it execute permission
chmod +x vulkaninfo32
# Run vulkaninfo within Flatpak'd Steam, and make sure that the output matches your GPU name/model, and not llvmpipe
flatpak run --command=$PWD/vulkaninfo32 --filesystem=$PWD com.valvesoftware.Steam --summary | grep -wm1 deviceName

Testing OpenGL (x86_64 / x86)

# RPM source: https://kojihub.stream.centos.org/koji/buildinfo?buildID=19862
curl -LO https://kojihub.stream.centos.org/kojifiles/packages/mesa-demos/8.4.0/5.20181118git1830dcb.el8/x86_64/glx-utils-8.4.0-5.20181118git1830dcb.el8.x86_64.rpm
# Note: You'll need rpmextract to extract glxinfo
rpm2cpio glx-utils-8.4.0-5.20181118git1830dcb.el8.x86_64.rpm | zstd -d | cpio -i --to-stdout ./usr/bin/glxinfo > glxinfo64
# Give it execute permission
chmod +x glxinfo64
# Run glxinfo within Flatpak'd Steam, and make sure that the does not say 'llvmpipe'
flatpak run --command=$PWD/glxinfo64 --filesystem=$PWD com.valvesoftware.Steam -B | grep 'OpenGL renderer string:'
# RPM source: https://kojihub.stream.centos.org/koji/buildinfo?buildID=19862
curl -LO https://kojihub.stream.centos.org/kojifiles/packages/mesa-demos/8.4.0/5.20181118git1830dcb.el8/i686/glx-utils-8.4.0-5.20181118git1830dcb.el8.i686.rpm
# Note: You'll need rpmextract to extract glxinfo
rpm2cpio glx-utils-8.4.0-5.20181118git1830dcb.el8.i686.rpm | zstd -d | cpio -i --to-stdout ./usr/bin/glxinfo > glxinfo32
# Give it execute permission
chmod +x glxinfo32
# Run glxinfo within Flatpak'd Steam, and make sure that the does not say 'llvmpipe'
flatpak run --command=$PWD/glxinfo32 --filesystem=$PWD com.valvesoftware.Steam -B | grep 'OpenGL renderer string:'

@flathubbot
Copy link

Started test build 97853

@flathubbot
Copy link

Build 97853 failed

Makefile Outdated Show resolved Hide resolved
@TingPing
Copy link
Member

TingPing commented Feb 5, 2024

Thanks for finishing up and testing this!

My main concerns are actually about Flathub infrastructure.

barthalion is going to look into this at some point and will ensure that this transition can go smoothly.

Also marking as a draft to ensure no green buttons are accidentally hit.

@guihkx
Copy link
Collaborator Author

guihkx commented Feb 22, 2024

Sync'd with master.

@flathubbot
Copy link

Started test build 102118

@flathubbot
Copy link

Build 102118 failed

@TingPing
Copy link
Member

Sorry about the delay but barts been busy so it might be a while.

@guihkx
Copy link
Collaborator Author

guihkx commented Feb 22, 2024

No worries at all, I completely understand.

@guihkx
Copy link
Collaborator Author

guihkx commented Jul 4, 2024

I'm thinking of opening individual pull requests for some of the commits here, because some of them are fixing actual issues which are unrelated to the move off of extra-data... 🤔

@TingPing Would that be okay with you?

@TingPing
Copy link
Member

TingPing commented Jul 5, 2024

@guihkx Sure go ahead.

@barthalion Is this still on your radar?

@flathubbot
Copy link

Started test build 134664

@flathubbot
Copy link

Build 134664 failed

@flathubbot
Copy link

Started test build 136984

@flathubbot
Copy link

Build 136984 failed

@flathubbot
Copy link

Started test build 138891

@flathubbot
Copy link

Build 138891 failed

@Hyphaed
Copy link

Hyphaed commented Aug 23, 2024

anyone could help me with that?

(base) ferran@z590i:~/Documents/PersonalPackages/org.freedesktop.Platform.GL.nvidia$ flatpak build-bundle repo/ nvidia-driver-560.35.03-32bit.flatpak org.freedesktop.Platform.GL32.nvidia-560-35-03
error: Refspec 'app/org.freedesktop.Platform.GL32.nvidia-560-35-03/x86_64/master' not found

also if I use make I do not get the 32bit version

32bit not here :: gonna ask in the other thread

Remotes found with refs similar to ‘nvidia-560’:

   1) ‘flathub’ (system)
   2) ‘flathub’ (user)
   3) ‘nvidia-local’ (user)

Which do you want to use (0 to abort)? [0-3]: 3
Found ref ‘runtime/org.freedesktop.Platform.GL.nvidia-560-35-03/x86_64/1.4’ in remote ‘nvidia-local’ (user).
Use this ref? [Y/n]: 

@guihkx
Copy link
Collaborator Author

guihkx commented Aug 23, 2024

@Hyphaed Did you make sure to check out my branch before running the instructions? The instructions won't work if you're on the master branch.

EDIT: You also invoked the flatpak build-bundle incorrectly. Please read it again carefully.

NVIDIA has updated its license [1], which in short gives us permission
to distribute their drivers:

2. GRANT OF LICENSE
  2.1 Rights and Limitations of Grant. NVIDIA hereby grants Customer
  the following non-exclusive, non-transferable right to use the
  SOFTWARE, with the following limitations:
    2.1.1 Rights. Customer may install and use multiple copies of the
    SOFTWARE on a shared computer or concurrently on different
    computers, and make multiple back-up copies of the SOFTWARE, solely
    for Customer's use within Customer's Enterprise. "Enterprise" shall
    mean individual use by Customer or any legal entity (such as a
    corporation or university) and the subsidiaries it owns by more
    than fifty percent (50%).
    2.1.2 Linux/FreeBSD Exception. Notwithstanding the foregoing terms
    of Section 2.1.1, SOFTWARE designed exclusively for use on the
    Linux or FreeBSD operating systems, or other operating systems
    derived from the source code to these operating systems, may be
    copied and redistributed, provided that the binary files thereof
    are not modified in any way (except for unzipping of compressed
    files).

[1] https://web.archive.org/web/20240128092200/https://www.nvidia.com/content/DriverDownloads/licence.php?lang=us

Co-authored-by: Patrick Griffis <[email protected]>
@flathubbot
Copy link

Started test build 148286

@flathubbot
Copy link

Build 148286 failed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment