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

NVIDIA: Issues with OpenGL support #138

Closed
Anti-Ultimate opened this issue Jun 22, 2016 · 53 comments
Closed

NVIDIA: Issues with OpenGL support #138

Anti-Ultimate opened this issue Jun 22, 2016 · 53 comments

Comments

@Anti-Ultimate
Copy link

Trying to run an application built with OpenGL support using Gnome SDK and 3.20 runtime on a NVIDIA GTX 970.

Driver version: 367.27
Using Arch Linux

from json:
"finish-args": [ "--share=ipc", "--socket=x11", "--socket=pulseaudio", "--socket=wayland", "--share=network", "--device=dri", "--filesystem=home:rw" ],

Using this gives me:
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast

This does not happen on my laptop using an Intel GPU.

@alexlarsson
Copy link
Member

Yeah, you need to use the nvidia driver opengl extension. I wrote some about that before:
https://blogs.gnome.org/alexl/2015/09/23/playing-games-with-runtime-extensions/

But we need to update the scripts, and make this easier to use. Unfortunately we can't actually redistribute the nvidia drivers, so it will never be super easy.

@alexlarsson
Copy link
Member

See also #72

@Anti-Ultimate
Copy link
Author

How would I add this to the json?

@alexlarsson
Copy link
Member

If you're interested in this and have a nvidia machine I'd love it if you could help out.
We need to at least update the script to the latest version of the driver, but it would also be nice if the entire thing could be made buildable with flatpak-builder, including the download. Then the extraction and stuff is properly sandboxed, etc.

@alexlarsson
Copy link
Member

No need to modify the app. As long as you have the right gl extension installed matching the runtime the app uses then it will automatically be used.

@Anti-Ultimate
Copy link
Author

And there's no way you could just skip all of that and use the native driver?

Don't get me wrong, it's a good idea, but is this going to work when e.g. new hardware arrives?

@alexlarsson
Copy link
Member

In general you can't use the native driver because it links to dependencies on the host which can easily conflict with the ones in the runtime. Also, the app can't actually even see the host /usr/lib.

However, in the specific case of the nvidia driver it has a pretty good story wrt dependency issues, so one alternative is to write a script that takes the native gl driver and makes a GL runtime extension from it.

@stuffandthings
Copy link

My second desktop has got a GTX 970, I can help out. I'll hit you up after work today

@hadess
Copy link
Contributor

hadess commented Jun 24, 2016

There's a few problems with making a json file:

  • flatpak-builder doesn't know how to make runtime extensions, as seen when I made the gst-libav extension in flatpak-fusion
  • flatpak-builder doesn't know how to create empty source directories for Makefiles, etc. to be downloaded into (which would be useful for flatpak-games)
  • flatpak-builder doesn't know how to download "file" sources (as seen in the retroarch json in flatpak-fusion)

@hadess
Copy link
Contributor

hadess commented Jun 24, 2016

The current horror:
https://paste.fedoraproject.org/384000/50837146

@fishxz
Copy link

fishxz commented Jun 24, 2016

whos job is it to build the nvidia gl extenstion? im really confused about this.

i tried the extension stuff a few month ago and a simple driver update has broken the extension. so how this can even work this way?

@hadess
Copy link
Contributor

hadess commented Jun 24, 2016

whos job is it to build the nvidia gl extenstion? im really confused about this.

Right now, the end user because we can't ship it.

i tried the extension stuff a few month ago and a simple driver update has broken the extension. so
how this can even work this way?

I have no idea what that means.

@fishxz
Copy link

fishxz commented Jun 24, 2016

I have no idea what that means.

it simply means the extensions stopped working after a driver update.

so the extension has to be build for every nvidia version and has to match it?

@hadess
Copy link
Contributor

hadess commented Jun 24, 2016

What does "stopped working" means? That it complained that the driver didn't match the libGL shipped? That the extension failed to build?

@fishxz
Copy link

fishxz commented Jun 24, 2016

if i remember right, it was a mix of both.

@alexlarsson
Copy link
Member

@hadess Does using "org.freedesktop.Platform.GL.nvidia" really work? The GL extension doesn't do "subdirectories=true", so we should only be able to have one GL extension (called "org.freedesktop.Platform.GL".

Also, I'm thinking of making it possible to create extensions by just having a named directory. Say "~/.local/share/flatpak/extension/org.freedesktop.Platform.GL/x86_64/1.4". This would make it easy to do things like copying the host GL drivers, or installing themes for a particular runtime.

@hadess
Copy link
Contributor

hadess commented Jun 27, 2016

@hadess Does using "org.freedesktop.Platform.GL.nvidia" really work? The GL extension doesn't do "subdirectories=true", so we should only be able to have one GL extension (called "org.freedesktop.Platform.GL".

I didn't actually test this. I guess I need to fix this.

Also, I'm thinking of making it possible to create extensions by just having a named directory. Say "~/.local/share/flatpak/extension/org.freedesktop.Platform.GL/x86_64/1.4". This would make it easy to do things like copying the host GL drivers, or installing themes for a particular runtime.

That'd be useful, but I'd rather have support in flatpak-builder to fix those issues I mentioned above.

@alexlarsson
Copy link
Member

What exactly do you mean by: "flatpak-builder doesn't know how to create empty source directories for Makefiles, etc. to be downloaded into (which would be useful for flatpak-games)"

Can't you use "dest": "subdir"? Which will create a subdirectory and extract/download that source there?

@hadess
Copy link
Contributor

hadess commented Jun 27, 2016

What exactly do you mean by: "flatpak-builder doesn't know how to create empty source directories for Makefiles, etc. to be downloaded into (which would be useful for flatpak-games)"

I don't have any archives to unpack that flatpak-builder would know how to unpack, so I'd want to do have a directory created, and unpack stuff "by hand".

Can't you use "dest": "subdir"? Which will create a subdirectory and extract/download that source there?

It might, do you have an example using this?

@alexlarsson
Copy link
Member

I can't think of one offhand, but something like:

    {
        "type": "file",
        "path": "foo-Makefile",
        "dest-filename": "Makefile"
        "dest": "foo"
    }

Would create a directory "foo" in the toplevel dir and put the "Makefile" file in that.
Similar for an archive type it would extract the archive in that directory.

@clopez
Copy link

clopez commented Nov 4, 2016

Why do you say you can't redistribute the NVIDIA drivers?

The license of the Linux/FreeBSD NVIDIA drivers clearly states that this is allowed.

From http://www.nvidia.com/content/DriverDownload-March2009/licence.php?lang=us:

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

Also, Debian distributes this drivers on the non-free repository (they don't simply distribute a script that fetches the drivers, but the drives themselves repackaged on a .deb) :

@Anti-Ultimate
Copy link
Author

Months later, nothing has changed. You can redistribute the NVIDIA driver just fine, as said above it's perfectly legal. It says the same thing in different languages even.

I really don't understand why you are excluding every single NVIDIA user that wants to use Flatpak.

But I can say that as long as NVIDIA drivers don't work with Flatpak by default, it's going nowhere.

@alexlarsson
Copy link
Member

We want to make the nvidia driver experience better, and some of the work we're doing will help. But sometimes things take slower than you want...

@kwizart
Copy link

kwizart commented Dec 23, 2016

I don't understand why you would want to redistribute the nvidia driver at all, (nor any libGL libs).

It should be part of the base system . If you start to redistribute theses, you will need to redistribute the matching libGL version than the nvidia kernel module version. So it means you will need to redistribute all possible nvidia libGL version.(past and future)
Of course this is totally broken by design.

@kwizart
Copy link

kwizart commented Dec 23, 2016

To me a "runtime" could eventually bundle libglvnd (that will provide libGL.so but dlopen the appropriate libGLX backend (either Mesa or NVIDIA , etc). But that's just move the problem, something (libGL.so, or libGLX, and others) has to be taken from the host.

@alexlarsson
Copy link
Member

Initial work on this happening: https://lists.freedesktop.org/archives/xdg-app/2017-February/000534.html

@jiri-janousek
Copy link

Hello guys. An user of my app has nvidia driver 375.66, which is not listed in flatpak remote-ls gnome | grep nvidia. I hope it will be packaged soon. Meanwhile, is there any way an app inside flatpak sandbox can detect that there is no matching org.freedesktop.Platform.GL.nvidia extension? I would like to provide users with a helpful message instead of crashing with "The program 'WebKitWebProcess' received an X Window System error. This probably reflects a bug in the program". Thanks.

@achernetsov
Copy link

fenryxo, solved similar issue (with nvidia 375.66 version) by updating drivers to 381.22 (https://launchpad.net/~graphics-drivers/+archive/ubuntu/ppa) then reinstalling application in flatpak

@jiri-janousek
Copy link

It still doesn't solve this:

Meanwhile, is there any way an app inside flatpak sandbox can detect that there is no matching org.freedesktop.Platform.GL.nvidia extension? I would like to provide users with a helpful message instead of crashing with "The program 'WebKitWebProcess' received an X Window System error. This probably reflects a bug in the program".

For now, I use --filesystem=/sys/module/nvidia:ro and check whether there is the corresponding /usr/lib/GL/nvidia-XXX directory, but it feels hacky.

@valentindavid
Copy link
Contributor

I am getting the same problem unless I put manually /usr/lib/GL/nvidia-xxx into the LD_LIBRARY_PATH. I wonder why org.freedesktop.Platform.GL.nvidia does not put its directories into the ldconfig cache.

@valentindavid
Copy link
Contributor

Oops. I have just figured out that LD_LIBRARY_PATH was initialized by flatpak to contain /usr/lib/GL/nvidia-xxx and I overwrote it. I was not expecting Flatpak would used that variable.

@alexlarsson
Copy link
Member

We have to use LD_LIBRARY_PATH. the ld.so.cache is in the runtime, so it is fixed and cannot be different at runtime or between different apps.

If you need to use LD_LIBRARY_PATH in an app you need to extend it, not replace it.

@RyanNerd
Copy link

What a mess ==> the tail (game devs) have been wagging the dog (Nvidia) for years now.
I love flatpak (especially now that Linux Mint 18.3 supports it out of the box).
However, I have the Nvidia 387.34 driver installed and I installed Godot but upon launching I get this log vomit from flatpak:

flatpak run --branch=stable --arch=x86_64 --command=/app/bin/godot --file-forwarding org.godotengine.Godot
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  154 (GLX)
  Minor opcode of failed request:  3 (X_GLXCreateContext)
  Value in failed request:  0x0
  Serial number of failed request:  37
  Current serial number in output stream:  38

Any workarounds for this issue? Adding the --filesystem=/sys/module/nvidia:ro switch didn't help.

@hadess
Copy link
Contributor

hadess commented Nov 29, 2017

What a mess ==> the tail (game devs) have been wagging the dog (Nvidia) for years now.

We're really not interested in this sort of comments.

@TingPing
Copy link
Member

I believe this can be closed?

@jiri-janousek
Copy link

What does happen when Nvidia Flatpak driver is not installed? Does it still crash with libGL error: failed to load driver: swrast or is software rasterizer used as a fallback?

@CWhyMedia
Copy link

I was able to launch Signal, not sure if it had software fallback. But Gravit Designer just gave a black rectangle, and Gnome MPV crashed, and both mentioned that libGL error. Thanks to TingPing I've now ran "flatpak update", and they both run fine.

@TingPing
Copy link
Member

Does it still crash with libGL error: failed to load driver: swrast or is software rasterizer used as a fallback?

Sadly not. I have reported this issue here where it belongs though: https://gitlab.com/freedesktop-sdk/freedesktop-sdk/issues/350

@gigglylo
Copy link

any news about this issue?

@yhojann-cl
Copy link

Any update for this? have same problem using Steam in Flatpack with War Robots game and Nvidia 1060 with 510 driver from ubuntu lts 20.04.

@andreyadrian
Copy link

aint no way this still open

@TingPing
Copy link
Member

TingPing commented Oct 21, 2023

Closing since I don't know that anything here is actionable.

Nvidia drivers have been packaged for many years.

It not falling back to software is tracked in FDO above, not related to flatpak itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests