flathub / org.freedesktop.Platform.GL.nvidia

42 stars 39 forks source link

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

Open guihkx opened 5 months ago

guihkx commented 5 months ago

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):

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

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 whitespace. For example, to package only the 545.29.06 driver:

DRIVER_VERSIONS='545.29.06'

2. Save the file. 3. Now simply invoke make to build for x86_64 (and i386, simultaneously):

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

4. After the build finishes, we can now create Flatpak bundles, so we can easily install the drivers later:

# 64-bit driver
flatpak build-bundle repo/ nvidia-driver-545.29.06-64bit.flatpak org.freedesktop.Platform.GL.nvidia-545-29-06 1.4 --runtime
# 32-bit driver (only available if building for x86_64)
flatpak build-bundle repo/ nvidia-driver-545.29.06-32bit.flatpak org.freedesktop.Platform.GL32.nvidia-545-29-06 1.4 --runtime

5. And then you can install them with:

flatpak install --bundle nvidia-driver-545.29.06-64bit.flatpak
flatpak install --bundle nvidia-driver-545.29.06-32bit.flatpak

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 commented 5 months ago

Started test build 97853

flathubbot commented 5 months ago

Build 97853 failed

TingPing commented 5 months ago

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 commented 4 months ago

Sync'd with master.

flathubbot commented 4 months ago

Started test build 102118

flathubbot commented 4 months ago

Build 102118 failed

TingPing commented 4 months ago

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

guihkx commented 4 months ago

No worries at all, I completely understand.

guihkx commented 4 days ago

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 commented 3 days ago

@guihkx Sure go ahead.

@barthalion Is this still on your radar?