wired-tomato / WayGL

Force MC to use wayland on supported systems
MIT License
17 stars 5 forks source link

Unable to run on Prism Launcher #1

Closed ghost closed 5 months ago

ghost commented 10 months ago

Hello!

I can't get Minecraft to run on Prism Launcher in flatpak. My display server is Wayland, and Prism Launcher runs on Wayland socket without X11 (X11 socket is disabled in Flatseal settings).

Mods installed: image

LWJGL version under Instance > Edit > Version > LWJGL 3: 3.3.2

Prism Launcher version: 8.0 (stable)

Logs:

Logs ``` [12:30:58] [main/INFO]: Loading Minecraft 1.20.4 with Fabric Loader 0.15.3 [12:30:59] [main/INFO]: Loading 67 mods: - fabric-api 0.92.0+1.20.4 |-- fabric-api-base 0.4.35+78d798af4f |-- fabric-api-lookup-api-v1 1.6.45+78d798af4f |-- fabric-biome-api-v1 13.0.15+78d798af4f |-- fabric-block-api-v1 1.0.14+78d798af4f |-- fabric-block-view-api-v2 1.0.3+78d798af4f |-- fabric-blockrenderlayer-v1 1.1.45+78d798af4f |-- fabric-client-tags-api-v1 1.1.6+78d798af4f |-- fabric-command-api-v1 1.2.40+f71b366f4f |-- fabric-command-api-v2 2.2.19+78d798af4f |-- fabric-commands-v0 0.2.57+df3654b34f |-- fabric-containers-v0 0.1.81+df3654b34f |-- fabric-content-registries-v0 5.0.9+78d798af4f |-- fabric-convention-tags-v1 1.5.9+78d798af4f |-- fabric-crash-report-info-v1 0.2.22+78d798af4f |-- fabric-data-generation-api-v1 13.1.17+78d798af4f |-- fabric-dimensions-v1 2.1.60+78d798af4f |-- fabric-entity-events-v1 1.5.28+4ced05924f |-- fabric-events-interaction-v0 0.7.0+389931eb4f |-- fabric-events-lifecycle-v0 0.2.71+df3654b34f |-- fabric-game-rule-api-v1 1.0.45+78d798af4f |-- fabric-item-api-v1 2.1.34+78d798af4f |-- fabric-item-group-api-v1 4.0.20+78d798af4f |-- fabric-key-binding-api-v1 1.0.40+78d798af4f |-- fabric-keybindings-v0 0.2.38+df3654b34f |-- fabric-lifecycle-events-v1 2.2.29+78d798af4f |-- fabric-loot-api-v2 2.1.4+78d798af4f |-- fabric-message-api-v1 6.0.4+78d798af4f |-- fabric-mining-level-api-v1 2.1.59+78d798af4f |-- fabric-model-loading-api-v1 1.0.7+78d798af4f |-- fabric-models-v0 0.4.6+9386d8a74f |-- fabric-networking-api-v1 3.1.2+78d798af4f |-- fabric-object-builder-api-v1 13.0.8+06274a474f |-- fabric-particles-v1 1.1.6+78d798af4f |-- fabric-recipe-api-v1 2.0.15+78d798af4f |-- fabric-registry-sync-v0 4.0.13+78d798af4f |-- fabric-renderer-api-v1 3.2.3+78d798af4f |-- fabric-renderer-indigo 1.5.3+78d798af4f |-- fabric-renderer-registries-v1 3.2.50+df3654b34f |-- fabric-rendering-data-attachment-v1 0.3.41+73761d2e4f |-- fabric-rendering-fluids-v1 3.0.32+78d798af4f |-- fabric-rendering-v0 1.1.53+df3654b34f |-- fabric-rendering-v1 3.0.12+78d798af4f |-- fabric-resource-conditions-api-v1 2.3.13+78d798af4f |-- fabric-resource-loader-v0 0.11.15+78d798af4f |-- fabric-screen-api-v1 2.0.16+78d798af4f |-- fabric-screen-handler-api-v1 1.3.50+78d798af4f |-- fabric-sound-api-v1 1.0.16+78d798af4f |-- fabric-transfer-api-v1 4.0.6+78d798af4f \-- fabric-transitive-access-wideners-v1 5.0.13+78d798af4f - fabric-language-kotlin 1.10.17+kotlin.1.9.22 |-- org_jetbrains_kotlin_kotlin-reflect 1.9.22 |-- org_jetbrains_kotlin_kotlin-stdlib 1.9.22 |-- org_jetbrains_kotlin_kotlin-stdlib-jdk7 1.9.22 |-- org_jetbrains_kotlin_kotlin-stdlib-jdk8 1.9.22 |-- org_jetbrains_kotlinx_atomicfu-jvm 0.23.1 |-- org_jetbrains_kotlinx_kotlinx-coroutines-core-jvm 1.7.3 |-- org_jetbrains_kotlinx_kotlinx-coroutines-jdk8 1.7.3 |-- org_jetbrains_kotlinx_kotlinx-datetime-jvm 0.5.0 |-- org_jetbrains_kotlinx_kotlinx-serialization-cbor-jvm 1.6.2 |-- org_jetbrains_kotlinx_kotlinx-serialization-core-jvm 1.6.2 \-- org_jetbrains_kotlinx_kotlinx-serialization-json-jvm 1.6.2 - fabricloader 0.15.3 \-- mixinextras 0.3.2 - java 17 - minecraft 1.20.4 - waygl 1.0.0+1.20.1 [12:30:59] [main/INFO]: SpongePowered MIXIN Subsystem Version=0.8.5 Source=file:/home/user/.var/app/org.prismlauncher.PrismLauncher/data/PrismLauncher/libraries/net/fabricmc/sponge-mixin/0.12.5+mixin.0.8.5/sponge-mixin-0.12.5+mixin.0.8.5.jar Service=Knot/Fabric Env=CLIENT [12:30:59] [main/INFO]: Compatibility level set to JAVA_17 [12:30:59] [main/INFO]: Initializing MixinExtras via com.llamalad7.mixinextras.service.MixinExtrasServiceImpl(version=0.3.2). [12:31:02] [Datafixer Bootstrap/INFO]: 198 Datafixer optimizations took 83 milliseconds [12:31:03] [Render thread/INFO]: Environment: Environment[sessionHost=https://sessionserver.mojang.com, servicesHost=https://api.minecraftservices.com, name=PROD] [12:31:03] [Render thread/INFO]: Setting user: **[REDACTED]** [12:31:03] [Render thread/INFO]: [Indigo] Registering Indigo renderer! [12:31:03] [Render thread/INFO]: Current display server is wayland, forcing glfw to use wayland! [12:31:03] [Render thread/INFO]: Backend library: LWJGL version 3.3.2-snapshot missing software! (we will try basic console input) ___________ / \ | tiny file | | dialogs | \_____ ____/ \| tiny file dialogs on UNIX needs: applescript or kdialog or yad or Xdialog or zenity (or matedialog or shellementary or qarma) or python (2 or 3) + tkinter + python-dbus (optional) or dialog (opens console if needed) ** Disabled by default **/ or xterm + bash (opens console for basic input) or existing console for basic input Minecraft GLFW error 65544: EGL: Failed to clear current context: An EGLDisplay argument does not name a valid EGL display connection. Please make sure you have up-to-date drivers (see aka.ms/mcdriver for instructions). press enter to continue [12:31:03] [Render thread/WARN]: Failed to create window: net.minecraft.class_1041$class_4716: GLFW error 65544: EGL: Failed to clear current context: An EGLDisplay argument does not name a valid EGL display connection at net.minecraft.class_1041.method_4501(class_1041.java:195) ~[client-intermediary.jar:?] at org.lwjgl.glfw.GLFWErrorCallbackI.callback(GLFWErrorCallbackI.java:43) ~[lwjgl-glfw-3.3.2.jar:?] at org.lwjgl.system.JNI.invokePPPP(Native Method) ~[lwjgl-3.3.2.jar:?] at org.lwjgl.glfw.GLFW.nglfwCreateWindow(GLFW.java:2058) ~[lwjgl-glfw-3.3.2.jar:?] at org.lwjgl.glfw.GLFW.glfwCreateWindow(GLFW.java:2229) ~[lwjgl-glfw-3.3.2.jar:?] at net.minecraft.class_1041.(class_1041.java:93) ~[client-intermediary.jar:?] at net.minecraft.class_3682.method_16038(class_3682.java:21) ~[client-intermediary.jar:?] at net.minecraft.class_310.(class_310.java:515) ~[client-intermediary.jar:?] at net.minecraft.client.main.Main.main(Main.java:223) ~[minecraft-1.20.4-client.jar:?] at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:470) ~[fabric-loader-0.15.3.jar:?] at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74) ~[fabric-loader-0.15.3.jar:?] at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23) ~[fabric-loader-0.15.3.jar:?] at org.prismlauncher.launcher.impl.StandardLauncher.launch(StandardLauncher.java:87) ~[NewLaunch.jar:?] at org.prismlauncher.EntryPoint.listen(EntryPoint.java:130) ~[NewLaunch.jar:?] at org.prismlauncher.EntryPoint.main(EntryPoint.java:70) ~[NewLaunch.jar:?] # # A fatal error has been detected by the Java Runtime Environment: # # SIGSEGV (0xb) at pc=0x00007fb6950ae9de, pid=362, tid=522 # # JRE version: OpenJDK Runtime Environment 21.9 (17.0.9+7) (build 17.0.9+7) # Java VM: OpenJDK 64-Bit Server VM 21.9 (17.0.9+7, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64) # Problematic frame: # C [libEGL_nvidia.so.0+0xae9de] # # Core dump will be written. Default location: Core dumps may be processed with "/usr/lib/systemd/systemd-coredump %P %u %g %s %t %c %h" (or dumping to /home/user/.var/app/org.prismlauncher.PrismLauncher/data/PrismLauncher/instances/Paczka 1.20.4/.minecraft/core.362) # # An error report file with more information is saved as: # /home/user/.var/app/org.prismlauncher.PrismLauncher/data/PrismLauncher/instances/Paczka 1.20.4/.minecraft/hs_err_pid362.log # # If you would like to submit a bug report, please visit: # https://bugreport.java.com/bugreport/crash.jsp # ```
wired-tomato commented 10 months ago

Unfortunately, I was unable to recreate this issue on an AMD system. However I'm pretty sure the problem lies in the following Minecraft source code line (net.minecraft.client.util.Window : 94):

this.handle = GLFW.glfwCreateWindow(this.width, this.height, string2, this.fullscreen && monitor != null ? monitor.getHandle() : 0L, 0L);

A possible solution could be to create a mixin forcing Monitor#getHandle to return 0L / MemoryUtil#NULL

However I am unable to test this

ghost commented 10 months ago

I am on Fedora 39 Workstation and my DE is Gnome 45.2 if that matters. Prism Launcher is installed inside flatpak and has x11 socket disabled via Flatseal.

ghost commented 10 months ago

I found a modified LWJGL3 library that modifies the Display class so that a MemoryUtil.NULL argument is always passed to GLFW.glfwCreateWindow:

https://github.com/moehreag/legacy-lwjgl3/blob/895d6214960cf55ddd2c831548631e9b3ae6edbc/src/main/java/org/lwjgl/opengl/Display.java#L161

Could you make a Mixin for your plugin? I have no clue about Minecraft modding :slightly_smiling_face:

wired-tomato commented 10 months ago

Minecraft no longer utilizes the Display class on modern versions, I am working on a solution however testing is difficult as I am unable to reproduce your issue as it appears to be an Nvidia specific issue.

ghost commented 10 months ago

Minecraft no longer utilizes the Display class on modern versions

I linked it just to confirm your assumption of returning MemoryUtil#NULL value in Monitor#getHandle method :smile:

Treetrain1 commented 10 months ago

unfortunately, the error still occurs even after changing the value to MemoryUtil#NULL

tested the fix-nvidia-egl-crash branch as well as some of my own ideas on NVIDIA Geforce RTX 3060 Ti with nvidia proprietary drivers 545.29.06 on arch linux

Treetrain1 commented 10 months ago

I found a fix If i add the environment variable __GL_THREADED_OPTIMIZATIONS=0 it works

Treetrain1 commented 10 months ago

I found a fix If i add the environment variable __GL_THREADED_OPTIMIZATIONS=0 it works

although, the window is missing decoration in GNOME wayland not sure if its like that on other compositors or on AMD

image

4nyNoob commented 9 months ago

by only using the mod with __GL_THREADED_OPTIMIZATIONS=0 in environment variables under the settings of my instance (sadly the env variable doesn't solve it by itself) the problem is fixed, no mode epilepsy triggers :smile: thank you so much everyone

P.S: the window decorations still work under KDE plasma, I'd bet that's because GNOME doesn't implement Server Side Decorations

exalented commented 9 months ago

This is the only thing that allows me to launch minecraft on sway without needing the following patch. Great work! Nvidia user :wave: AUR: glfw-wayland-minecraft-libdecoration https://github.com/Admicos/minecraft-wayland/tree/libdecoration https://github.com/Admicos/minecraft-wayland/blob/libdecoration/0007-libdecor-proper-decorations-with-title-and-window-bu.patch

This works for me on prism, so i think the title should be changed or the scope of the issue redefined.

wired-tomato commented 5 months ago

Latest commit/build will automatically disable Nvidia Threaded Optimization when possible