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

Update glutin to 0.30.2 to solve Wayland vsync error #187

Closed
riverfr0zen opened this issue Nov 29, 2022 · 16 comments · Fixed by #192
Closed

Update glutin to 0.30.2 to solve Wayland vsync error #187

riverfr0zen opened this issue Nov 29, 2022 · 16 comments · Fixed by #192
Labels
bug Something isn't working
Milestone

Comments

@riverfr0zen
Copy link

I recently switched to Wayland from X11 on my Linux dev box (running Nvidia 520 proprietary drivers) and found that apps that try to enable vsync (e.g. WindowConfig::default().vsync(true); crash with the following error:

Error: "Couldn't find any pixel format that matches the criteria."

The apps worked fine when I was on X11.

I think I've traced the problem to this issue: rust-windowing/glutin#1444

Looks like it's been fixed there, so can we upgrade glutin for notan to 0.30.2 to fix this problem? Let me know if you need any more info.

@Nazariglez
Copy link
Owner

We had a similar issue with SRGB issues that shows the same error (#95), this seems to be a different error though.

I tried to migrate to glutin 0.30 for v0.8.0 but the API on their end changed a bit, so I thought that it was better to await until after the release. I will try to take a look at this soon, probably it will be included with v0.9, or if the change doesn't break or change anything on our end, we can think about releasing it as 0.8.1. I will keep you updated.

Thanks!

@Nazariglez Nazariglez added the bug Something isn't working label Dec 1, 2022
@Nazariglez Nazariglez linked a pull request Dec 6, 2022 that will close this issue
@Nazariglez
Copy link
Owner

Hey @riverfr0zen! I created a new branch with the migration to Glutin 0.30.2 at #192.

It wasn't a trivial change, so I am worried about breaking something with it, it seems to work fine on MacOS, I'll try it on Windows and X11, can you test it a little on Wayland if you have time? Thanks!

@riverfr0zen
Copy link
Author

riverfr0zen commented Dec 6, 2022

@Nazariglez Tried the branch out on Wayland and my apps crash every time now, regardless of whether vsync is set to true. Crashes with the following error:

[destroyed object]: error 7: failed to import supplied dmabufs: Unsupported buffer format 875713345

On X11 there is no crash, but I noticed that my app seems to be frame-limiting somehow, even though I did not enable vsync and didn't use the FPS limit plugin. Almost as though vsync was on by default. Definite difference from the 0.8.0 branch.

@Nazariglez
Copy link
Owner

Agh, I'll recheck it, thanks for taking the time to test it.

@riverfr0zen
Copy link
Author

Sure thing, let me know if you want me to test again.

@Nazariglez
Copy link
Owner

It seems that glutin applies vsync by default. It's fixed for x11 now, we're disabling and enabling the vsync all the time, without making assumptions about if it's enable or not by default.

About Wayland, I guess this fix should allow you to run the app without crashing with vsync disabled, but is not going to fix it for when it's enabled. I was doing some search online and it seems that the error is related to Nvidia GPUs, and in other cases egl driver issues. So, this leads me to the next questions:

Thank you so much for your help!

@riverfr0zen
Copy link
Author

riverfr0zen commented Dec 10, 2022

Yes, I am using an Nvidia card (proprietary drivers 525). Definitely finding them quite them troublesome on Wayland.

I cloned glutin and ran the example -- it worked successfully. I do see that they released a new version since your c/glutin branch, if that helps.

@riverfr0zen
Copy link
Author

I also tested with the 0.30.2 tag on Wayland, and that worked too.

@Nazariglez
Copy link
Owner

Did you tried with latest commit? I am running out of ideas, I tried to reproduce this in several ways already, no luck, I must to say that wayland and nvidia is a mess still. I got finally working fedora with wayland on a nvidia card but using "mesa" because it's impossible to me to install proprietary drivers, and it seems to work.

If you can try again and it works with sync off, I think that we can merge and see if somebody on the glutin repo know what's going on.

This issue with drivers, opengl and wayland is awful, I hope to be able to start working on the wgpu backend soon and leave this issues behind.

@riverfr0zen
Copy link
Author

Just tried with the latest

Compiling notan v0.8.0 (https://github.com/Nazariglez/notan.git?branch=c/glutin#153dc87b)

but still getting the same error, regardless of vsync setting:

[destroyed object]: error 7: failed to import supplied dmabufs: Unsupported buffer format 875713345

I think you should just go ahead merge it and wait for the Nvidia/Wayland situation to get better. I myself, after I think a pretty valiant effort to get my various apps/tools working, am going back to X11 for now too :)

@Nazariglez
Copy link
Owner

I asked the Glutin's people for some help, fingers crossed. Thanks for the help @riverfr0zen !

@kchibisov
Copy link

On X11 there is no crash, but I noticed that my app seems to be frame-limiting somehow, even though I did not enable vsync and didn't use the FPS limit plugin. Almost as though vsync was on by default. Definite difference from the 0.8.0 branch.

Vsync whether vsync will be applied or not it's up to display. Be explicit whether you want it or not. On X11 vsync is default that comes from the driver, not from the glutin. See https://docs.rs/glutin/0.30.3/glutin/surface/enum.SwapInterval.html .

@riverfr0zen could you provide the log from WAYLAND_DEBUG=1 when you have a crash and the same log from the glutin example, which works for you?

@Nazariglez have you tried using the exact same config glutin example is using?

@riverfr0zen
Copy link
Author

Hi @kchibisov -- I think this is what you were asking for -- let me know otherwise.

notan_draw_projection_example.wayland_debug.txt

glutin_window_example.wayland_debug.txt

@kchibisov
Copy link

It's clearly an nvidia bug, it tries to use dmabuf format that wasn't advertised to it by the system. Like you really can't do much here I'd say, but I suggest to use different config.

What nvidia should do is advertise EGL configs it can actually use, not just all.

@kchibisov
Copy link

You could be lucky if you use the glutin default config from example, since it happens to pick something working...

@Nazariglez
Copy link
Owner

Hey @kchibisov! Sorry for the delay. This is a hard issue to work around because there is no easy way to detect when a machine is running under wayland with nvidia drivers, so, following your advice of using the same config as glutin example does, I added a new feature "opt-in" to be used if you care about this platform. @riverfr0zen Can you test whenever you have time? (no rush). The PR is on #198 and the feature is nvidia-wayland.

Thank you so much for your help here @kchibisov.
Thank you too @riverfr0zen for all the information and testing that you're doing to make this work.

@Nazariglez Nazariglez added this to the 0.9.0 milestone Jan 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants