Skip to content

glfw: 3.3.10 -> 3.4 - #293296

Merged
SuperSandro2000 merged 3 commits into
NixOS:masterfrom
getchoo-contrib:pkgs/glfw/3.4
Apr 21, 2024
Merged

glfw: 3.3.10 -> 3.4#293296
SuperSandro2000 merged 3 commits into
NixOS:masterfrom
getchoo-contrib:pkgs/glfw/3.4

Conversation

@getchoo

@getchoo getchoo commented Mar 4, 2024

Copy link
Copy Markdown
Member

Description of changes

Release notes: https://github.com/glfw/glfw/releases/tag/3.4
Diff: glfw/glfw@3.3.10...3.4

Notable changes include better Wayland support, and the deprecation of GLFW_USE_WAYLAND.

I would also suggest following upstream here and enabling both X11 and Wayland on supported platforms (which is done by default), removing the need for the glfw-wayland package; this hasn't been implemented for now though as I wanted to get some feedback.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.05 Release Notes (or backporting 23.05 and 23.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@ofborg
ofborg Bot requested a review from MarcWeber March 4, 2024 17:26
@ofborg ofborg Bot added 10.rebuild-darwin: 11-100 This PR causes between 11 and 100 packages to rebuild on Darwin. 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages to rebuild on Linux. labels Mar 4, 2024
@getchoo

getchoo commented Mar 4, 2024

Copy link
Copy Markdown
Member Author

it looks like this can also allow for the removal of glfw-wayland-minecraft, though we should probably link libdecor here as well
image

@getchoo getchoo mentioned this pull request Mar 4, 2024
13 tasks
@NovaViper

NovaViper commented Mar 17, 2024

Copy link
Copy Markdown
Member

I just tried the PR with Minecraft 1.20.4 but the flickering is still there unfortunately in the XWayland mode but it's not nearly as bad as it was before! I'm wondering how I could make it run in Wayland instead of XWayland 🤔

❯ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.8.0, NixOS, 24.05 (Uakari), 24.05.20240315.2bcf18c`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.1`
 - nixpkgs: `/nix/store/y2k721a8jamdqxqbilyk6ds6374ljcgr-source`

@getchoo

getchoo commented Mar 17, 2024

Copy link
Copy Markdown
Member Author

I'm wondering how I could make it run in Wayland instead of XWayland

try overriding prism with glfw-wayland (i.e., prismlauncher.override { glfw = pkgs.glfw-wayland; }) and enabling native glfw in your instance's settings

we could just remove this package and give glfw wayland support, though

@NovaViper

NovaViper commented Mar 17, 2024

Copy link
Copy Markdown
Member

@getchoo Hey sorry for the delay! I can get Minecraft working using glfw-wayland-minecraft (with prismlauncher-qt5 = prev.prismlauncher-qt5.override { withWaylandGLFW = true; };) makes the game run in Wayland and it doesn't crash nor flicker (but the 65548: Wayland: The platform does not support setting the cursor position error appears in the logs whenever I open any of the GUI elements like the inventory). Looks like the minecraft version of glfw-wayland that's currently in nixpkgs is actually old and hasn't had the patch needed to make the cursor position work properly.

However, when I try to use this PR and override glfw either like this

    prismlauncher-qt5 = prev.prismlauncher-qt5.override {
      glfw = inputs.nixpkgs-glfw.legacyPackages.${prev.system}.glfw-wayland;
    };

or this

     glfw = inputs.nixpkgs-glfw.legacyPackages.${prev.system}.glfw.override {
       waylandSupport = true;
     };
    # use prismlauncher-qt without any additional override

The game now crashes with this error

[13:09:23] [Render thread/WARN]: Failed to create window: 
net.minecraft.class_1041$class_4716: GLFW error 65548: Wayland: The platform does not support setting the window icon
	at net.minecraft.class_1041.method_4501(class_1041.java:196) ~[client-intermediary.jar:?]
	at org.lwjgl.glfw.GLFWErrorCallbackI.callback(GLFWErrorCallbackI.java:43) ~[lwjgl-glfw-3.3.1.jar:?]
	at org.lwjgl.system.JNI.invokePPV(Native Method) ~[lwjgl-3.3.1.jar:?]
	at org.lwjgl.glfw.GLFW.nglfwSetWindowIcon(GLFW.java:2336) ~[lwjgl-glfw-3.3.1.jar:?]
	at org.lwjgl.glfw.GLFW.glfwSetWindowIcon(GLFW.java:2368) ~[lwjgl-glfw-3.3.1.jar:?]
	at net.minecraft.class_1041.method_4491(class_1041.java:175) ~[client-intermediary.jar:?]
	at net.minecraft.class_310.<init>(class_310.java:492) ~[client-intermediary.jar:?]
	at net.minecraft.client.main.Main.main(Main.java:211) ~[minecraft-1.20.1-client.jar:?]
	at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:470) ~[fabric-loader-0.15.7.jar:?]
	at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74) ~[fabric-loader-0.15.7.jar:?]
	at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23) ~[fabric-loader-0.15.7.jar:?]
	at org.prismlauncher.launcher.impl.StandardLauncher.launch(StandardLauncher.java:87) ~[NewLaunch.jar:?]
	at org.prismlauncher.EntryPoint.listen(EntryPoint.java:129) ~[NewLaunch.jar:?]
	at org.prismlauncher.EntryPoint.main(EntryPoint.java:70) ~[NewLaunch.jar:?]
Process exited with code 0.

So there's definitely something in the glfw-wayland-minecraft package that includes changes that makes the game launch in Wayland properly, I'm just unsure of what exactly though 🤷🏾‍♀️

@NovaViper

NovaViper commented Mar 17, 2024

Copy link
Copy Markdown
Member

Also to add, when I add the PR glfw like this to PrismLauncher:

    glfw = inputs.nixpkgs-glfw.legacyPackages.${prev.system}.glfw.override {
      waylandSupport = true;
    };

    prismlauncher-qt5 = prev.prismlauncher-qt5.override {
      glfw = inputs.nixpkgs-glfw.legacyPackages.${prev.system}.glfw;
    };\

I can actually get the game to run through XWayland but it still flickers. However, the flickering isn't as intense or frequent as it was when I just use either the library glfw or the current nixpkg glfw. But the flickering does get worse when I enable shaders, becomes as bad as it is with the nixpkg version/library version

@getchoo

getchoo commented Mar 17, 2024

Copy link
Copy Markdown
Member Author

could you run from the branch directly with this expression (and nix run -f <file>.nix)? this is what works locally for me (note: this should only require building glfw, not all of prism)

let
  nixpkgs = builtins.fetchTarball {
    url = "https://github.com/getchoo/nixpkgs/archive/59f29ad755ff471b94ab65ec433f4665c120c41b.tar.gz";
    sha256 = "19p0y0ib7ds4ligrrsaf32yv55zgqjz36s0kidm2iyk8i074ivhm";
  };

  overlay = final: prev: {
    prismlauncher = prev.prismlauncher.override { glfw = final.glfw-wayland; };
  };
in
  (import nixpkgs {
    system = builtins.currentSystem;
    config = { };
    overlays = [ overlay ];
  })
  .prismlauncher

this could also be a difference in desktop and graphics driver, though. it works great with gnome and plasma 6 on nvidia 550.54.14 - which is probably one of the larger edge cases - so i'd be surprised if it's broken anywhere else

@NovaViper

NovaViper commented Mar 17, 2024

Copy link
Copy Markdown
Member

it works great with gnome and plasma 6 on nvidia 550.54.14 - which is probably one of the larger edge cases - so i'd be surprised if it's broken anywhere else

Extremely weird... I'm running Plasma 6 Wayland with a RTX 2060 (Vulkan_beta build v550.40.55) and it flickers to death for me. Maybe it could be because I'm using the vulkan_beta drivers and not the latest or the production drivers?

could you run from the branch directly with this expression (and nix run -f .nix)? this is what works locally for me (note: this should only require building glfw, not all of prism)

Gave it a try but it still crashes for me with that window icon error still.. I'm gonna go and switch my nvidia drviers just in case

Also here's my NixOS flake if it helps any: https://github.com/NovaViper/NixConfig

@NovaViper

Copy link
Copy Markdown
Member

Just gave that expression a test with the latest drivers (with package = config.boot.kernelPackages.nvidiaPackages.latest and not package = config.boot.kernelPackages.nvidiaPackages.vulkan_beta``) but it sadly still crashes with that same error GLFW error 65548: Wayland: The platform does not support setting the window icon`
PrismLauncher config showing it's using the PR glfw version
image

Quick question, what specific NixOS unstable commit you're using specifically? I wonder if that could be affecting it (since I'm using nixos-unstable-small nixpkgs and it's currently at 24.05.20240315.2bcf18c

@getchoo

getchoo commented Mar 18, 2024

Copy link
Copy Markdown
Member Author

and it flickers to death for me

this makes me think you're still on xwayland, as that's a pretty well known issue there. could you confirm with the kwin debug console -- just as a sanity check?

Quick question, what specific NixOS unstable commit you're using specifically?

d691274 on nixos-unstable

@NovaViper

NovaViper commented Mar 18, 2024

Copy link
Copy Markdown
Member

this makes me think you're still on xwayland, as that's a pretty well known issue there. could you confirm with the kwin debug console -- just as a sanity check?

Yeah the flickering occurs when I run Minecraft through XWayland specifically. But when I use the PR glfw and launch it with Wayland support, it just crashes with that window icon error. But when I use that glfw-wayland-minecraft package, it doesn't crash (as it launches in Wayland) and doesn't flicker at all and runs fine (except for that "cannot set cursor position" error that appears every time I interact with the menu while the game's running.

d691274 on nixos-unstable

Ah, it's probably time for me to update then. Gonna run that real quick.

@fpletz

fpletz commented Mar 26, 2024

Copy link
Copy Markdown
Member

I would also suggest following upstream here and enabling both X11 and Wayland on supported platforms (which is done by default), removing the need for the glfw-wayland package; this hasn't been implemented for now though as I wanted to get some feedback.

👍 IMHO we should follow upstream here. It makes things so much easier for wayland users.

@ofborg ofborg Bot added the 8.has: clean-up This PR removes packages or removes other cruft label Mar 31, 2024
Comment thread pkgs/development/libraries/glfw/3.x.nix Outdated
Comment thread pkgs/top-level/aliases.nix Outdated
Comment thread pkgs/top-level/aliases.nix Outdated
getchoo added 3 commits April 19, 2024 21:28
as of 3.4, upstream now builds with Wayland by default
this follows `glfw-wayland` also being dropped
@SuperSandro2000
SuperSandro2000 merged commit ed36fa3 into NixOS:master Apr 21, 2024
@oxalica

oxalica commented Apr 23, 2024

Copy link
Copy Markdown
Contributor

(but the 65548: Wayland: The platform does not support setting the cursor position error appears in the logs whenever I open any of the GUI elements like the inventory). Looks like the minecraft version of glfw-wayland that's currently in nixpkgs is actually old and hasn't had the patch needed to make the cursor position work properly.

To anyone who may concern, I opened #306264 to update glfw-wayland-minecraft to glfw 3.4 with that set-cursor-position patch applied.

@getchoo
getchoo deleted the pkgs/glfw/3.4 branch April 23, 2024 18:54
@oxalica oxalica mentioned this pull request Apr 26, 2024
13 tasks
@roman3pm

Copy link
Copy Markdown

Hi, I have a little project on OpenGL. I used glfw-wayland and it worked just fine. But after the GLFW 3.4 update, it refuses to start with a GLFW initialization error. The same error occurred if I tried to use glfw (without -wayland) from the stable branch. And it worked if I used glfw-wayland-minecraft. I have to say that something definitely went wrong with GLFW 3.4 for Wayland users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

8.has: clean-up This PR removes packages or removes other cruft 10.rebuild-darwin: 11-100 This PR causes between 11 and 100 packages to rebuild on Darwin. 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants