mojira.dev

tulius

Assigned

No issues.

Reported

MC-55045 Race condition in linux fullscreen toggle Fixed

Comments

LWJGL contributor here.

I looked into this briefly, but there is no way (for me) to find out if this is a problem in LWJGL or Minecraft.
For this, one would need to look into the Minecraft source code, especially the part where ESC is handled.
If someone with access to minecraft source code looks into this and can tell me what exactly is called when the pause menu is entered and left and in which order, I will look into this again, but until then I am afraid I have to bounce this back to Mojang. (I am interested in all calls to org.lwjgl.opengl.Display, org.lwjgl.input.Mouse and org.lwjgl.input.Keyboard.)

Sorry, but figuring out what Minecraft does without the source takes way too much time. I did this once with the last minecraft-lwjgl linux issue I worked on, it took many hours, was painful and turned out to be a bug in minecraft, not in LWJGL 🙂

Short update:
The fix for the crash has been merged and should be included in the next nightly LWJGL build.

Unfortunately the experimental fix for the fullscreen issue breaks other things (multi-threaded rendering) and therefore cannot be included in LWJGL.

It is still unknown why exactly the creation of the fullscreen window sometimes fails and sometimes works.
This may be a driver bug, a bug in LWJGL or something else. Since I don't have a system with a AMD graphics I really cannot dig into this any further, sorry for that. (the fix last week was created on a borrowed machine).

As suggested on github, Minecraft may be able to circumvent this by creating the window differently. (that is, destroying it and then creating a new one instead of switching).
Besides, most dev effort is going into LWJGL 3 these days and it is unlikely the way of things internally work in LWJGL 2 will be changed.

Until this is done, 2 things come to my mind that users can do:

1. Continue using the somewhat broken fix I provided above. I will not take it down in the near future and since it seems not to break anything in minecraft this may be the simplest solution (if the launcher can be reliably tricked in to accepting the .jar)
2. Emulate fullscreen with a borderless window. Leave minecraft in windowed mode and instruct your window manager to remove the borders and resize it to your full screen resolution. Depends on your window manager if this is possible for you. I am using KDE and it is definitely possible there. You can even create a rule to apply this automatically when the minecraft window appears.

I dug into this and may have found something.

Same procedure as last time, custom lwjgl.jar is here: https://github.com/tfg13/lwjgl/releases/tag/test2_mc70651

I spare you the details, but the fix is quite experimental and may even break everything with other graphics drivers / operating systems.
The fix works for me, but your mileage may vary - So please test this!

> And as the other lwjgl games had the same problem creating a fullscreen window everything point to lwjgl being at fault in combination with radeonsi

Yes. On the other hand, the way LWJGL creates the fullscreen window is quite simple and didn't change for years.

I'm not really sure how to proceed from here.
Some random thoughts:

  • I assume your system is fully updated?

  • Does anyone know if it worked with older versions of the radeon mesa driver? (for example the one that ships with fedora 19?)

  • You can force LWJGL to create the fullscreen window in another (slighly outdated) way. To do so, open the minecraft profile editor and put the following into "JVM Arguments"

-DLWJGL_DISABLE_NETWM=true

Make sure the checkbox is selected and give it another try!

I'm afraid a lot of games will require the proprietary drivers (for performance, stability, opengl support).
I also tested other LWJGL based games and they had exactly the same problem.

Besides, I traced the lwjgl methods minecraft calls and there was nothing unusual going on.

However, I still find it very interesting that Minecraft worked before.
If you have some spare time, please try figuring out which Minecraft version introduced this behaviour.

I found a system with AMD graphics and was able to reproduce this.

However, the problem vanished when I installed fglrx from the repository.
Could you give fglrx another try? I think your older system with fglrx on RHEL may have suffered from the old race condition, which was fixed with Minecraft 1.8.

Ok, fixing the crash was the easy part. Now on to that race condition.

You said you also had this with 1.7.10, but not with 1.7.x.
Could you please go back one version at a time and figure out exactly which version introduced this problem?

Should be fixed with https://github.com/tfg13/lwjgl/commit/e74811e5e7d288c39ac1c613522b9adda2d564a4
I would like to test the fix before submitting it to the main repository.

Would be great if you could grab the version I just compiled from here: https://github.com/tfg13/lwjgl/releases/tag/test_mc70651.
The rest should be the same as above: Copy it over the original jar file, recalculate the checksum and cut your internet connection before starting the launcher.

Allright, LWJGL stumbles over one of those lines because it slightly differs from what is expected.
I am fixing this right now, stand by.

Thats looks interesting...

Please run "xrandr" on the command line after minecraft crashed and attach the output here.
That would be great.

Yes please 🙂

To trick the launcher into acception custom LWJGL files:

0. Stop the launcher, if already running
1. Download the nightly (from here: http://ci.newdawnsoftware.com/job/LWJGL-git-dist/) (choose latest build --> lwjgl-2.9.2.zip)
2. Unzip it, copy lwjgl.jar from the zip file over minecrafts lwjgl-2.9.1.jar (override it, but keep the name) (usually found in ~/.minecraft/libraries/org/lwjgl/lwjgl/lwjgl/2.9.1)
3. Correct the checksum of the jar in lwjgl-2.9.1.jar.sha with a text editor (calculate the new sum with "sha1sum" on the command line)
4. Block the launcher from accessing the internet. (just disable WiFi/unplug the network cable)
5. Now start the launcher, it will go to offline mode.

Without internet, the launcher will accept the custom library.

Do you know how to test another version of LWJGL?

If yes, please try the latest nightly from here: http://ci.newdawnsoftware.com/job/LWJGL-git-dist/
It contains some important fixes for linux fullscreen.

Confirmed, 14w34d works.

14w34c looks good here on Linux with german umlauts. It is now possible to bind those keys and the displayed name is correct.
Thanks! (Fun fact: there is another minecraft linux bug where LWJGL has been blamed initially: MC-55045)

A note to the devs: It is probably a good idea to upgrade LWJGL to 2.9.2 (nightly).
There are some important fixes in there also related to linux fullscreen. (the one this ticket is about is still a minecraft bug, though)

Also, still there in 14w34a

Updated Environment to make clear most linux desktops are affected.
Still present in 14w31a

Developer of the temporary fix here.
Please note: Everything I say is valid for linux only!

There are multiple (lwjgl) bugs regarding the use of 120 Hz on linux at this time.

1. When exiting minecraft, LWJGL should reset the monitor config to whatever it was before launching minecraft. LWJGL did not remember all of the configuration found at startup. This resulted in the frequency being reset to default after quitting minecraft. And on most system this default is still 60 Hz. I developed a fix for this. If testing goes well, this should be integrated in the next version of LWJGL.

2. LWJGL does not set the frequency correctly when creating a fullscreen window. This is why Minecraft refuses to run at 120 Hz on linux. I also have an idea why this may be, however this is not fixed yet and requires more work.

I will notify you as soon as either of these bugs is fixed in mainline.

This is IMHO a bug in minecraft that also affects the windows version.

The lwjgl bugtracker tells why: https://github.com/LWJGL/lwjgl/issues/59

Edit: Bug still present in Minecraft 1.7.4 with launcher 1.3.7.