PrismLauncher / meta

Prism Launcher Metadata generation scripts
Microsoft Public License
16 stars 16 forks source link

use gman patched lwjgl jemalloc for ARM64 Linux #9

Closed theofficialgman closed 1 year ago

theofficialgman commented 1 year ago

Asahi Linux compat (jemalloc compiled with 16K pages support). Includes both lwjgl 3.2.2 and 3.3.1 natives for arm64 linux. Compiled following lwjgl commands with added 16K (--with-lg-page=16) pages support

CFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0" ./autogen.sh --with-jemalloc-prefix=je_ --disable-stats --disable-fill --disable-cxx --with-lg-page=16 --disable-initial-exec-tls

Untested on Asahi Linux. Still works on regular 4K pages systems (tested on Nintendo Switch). I don't own macos ARM hardware. I have up till this point been unsuccessful at contacting Asahi Linya, Alyssa Rosenzweig, or yuka for testing.

@Ella-0 if you have a way of contacting these users via github please let me know.

I also requested upstream to make the same change (so future lwjgl versions are compatible without changes) https://github.com/LWJGL/lwjgl3/issues/828

theofficialgman commented 1 year ago

force pushed just to add signed off message

theofficialgman commented 1 year ago

@asahilina @alyssarosenzweig can you get this message to Yuka to test? regarding ->https://social.treehouse.systems/@alyssa/109378606742926582

please test these updated jemalloc binaries

you should be able to right click and customize the lwjgl 3.2.2 from your prism launcher instance settings find these strings and replace with the new ones

current/old:

            "natives-linux-arm64": {
              "sha1": "19c7d57e1ab7fee54f35a8615babd5defc355d78",
              "size": 156163,
              "url": "https://github.com/theofficialgman/lwjgl3-binaries-arm64/raw/lwjgl-3.2.2/lwjgl-jemalloc-natives-linux-arm64.jar"
            }

new patched jemalloc:

            "natives-linux-arm64": {
              "sha1": "762d7d80c9cdf3a3f3fc80c8a5f86612255edfe0",
              "size": 156343,
              "url": "https://github.com/theofficialgman/lwjgl3-binaries-arm64/raw/lwjgl-3.2.2/lwjgl-jemalloc-patched-natives-linux-arm64.jar"
            }

regarding native wayland glfw, there really is nothing that can be done there, its just very broken in many ways that need to be fixed upstream. the patches that have been developed don't solve everything either. hopefully you can get xwayland working nicely at some point.

zimsneexh commented 1 year ago

Can't get Minecraft to run with these on AsahiLinux / base M1. Tried replacing these strings as instructed but am still getting unsupported page size:

[17:24:53] [Render thread/INFO]: Backend library: LWJGL version 3.2.2 SNAPSHOT jemalloc: Unsupported system page size jemalloc: Unsupported system page size

theofficialgman commented 1 year ago

@zimsneexh you need to use the Help -> clear metadata cache button in prism launcher first in order to use the new jars if you have already downloaded the old ones

theofficialgman commented 1 year ago

you could also bump the version under the name which should force an update

old:

            "natives-linux-arm64": {
              "sha1": "19c7d57e1ab7fee54f35a8615babd5defc355d78",
              "size": 156163,
              "url": "https://github.com/theofficialgman/lwjgl3-binaries-arm64/raw/lwjgl-3.2.2/lwjgl-jemalloc-natives-linux-arm64.jar"
            }
          }
        },
        "name": "org.lwjgl:lwjgl-jemalloc:3.2.2-gman64.1",
        "natives": {
          "linux-arm64": "natives-linux-arm64"
        },

new:

            "natives-linux-arm64": {
              "sha1": "762d7d80c9cdf3a3f3fc80c8a5f86612255edfe0",
              "size": 156343,
              "url": "https://github.com/theofficialgman/lwjgl3-binaries-arm64/raw/lwjgl-3.2.2/lwjgl-jemalloc-patched-natives-linux-arm64.jar"
            }
          }
        },
        "name": "org.lwjgl:lwjgl-jemalloc:3.2.2-gman64.2",
        "natives": {
          "linux-arm64": "natives-linux-arm64"
        },
zimsneexh commented 1 year ago

That got the game to launch! Very slowly, but it does launch.

theofficialgman commented 1 year ago

@Scrumplex confirmed working by the above user and ready to merge

I updated the 3.3.1 jar to match the original folder structure at your request as welll

MWHunter commented 1 year ago

@zimsneexh Very slowly as in two seconds per frame, or is something wrong with my setup?

I wasn't sure how https://social.treehouse.systems/@alyssa/109378606742926582 was getting so much performance other than them being a dev and therefore being on more bleeding edge drivers than what was released to the public.

theofficialgman commented 1 year ago

@zimsneexh Very slowly as in two seconds per frame, or is something wrong with my setup?

gpu userspace drivers for asahi linux were just released less than 24hrs ago. you were probably running with lllvmpipe. see the release post and how to installl them https://asahilinux.org/2022/12/gpu-drivers-now-in-asahi-linux/

MWHunter commented 1 year ago

The repository I was using must have been a few hours outdated since I got the right drivers after I did pacman -Syu again.

I'm getting around 2 FPS though, but with fabulously optimized modpack I get a playable 60 fps.

zimsneexh commented 1 year ago

@MWHunter I get like 2FPS with Fabulously optimized modpack on a superflat map, but it does run.

MWHunter commented 1 year ago

You sure you are using GPU acceleration?

theofficialgman commented 1 year ago

you need to keep in mind that 1.16.5 and older relesaes of minecraft only require openGL 2.1 while newer releases require openGL 3.3 as a minimum.

if the driver has enough capabilities beyond opengl 2.1, you can add the mesa overrides to lie and state that you have opengl 3.3.

its also very easy to see what driver you are using currently. open the F3 screen, look on the right side. if you see llvmpipe, that is software rendering. if you see Apple MX GPU, then you are using hardware accelerated rendering.

zimsneexh commented 1 year ago

It does state that it's running on the GPU (lists Asahi in F3 menu). CPU usage also seems normal to me.

theofficialgman commented 1 year ago

It does state that it's running on the GPU (lists Asahi in F3 menu). CPU usage also seems normal to me.

@zimsneexh no, read what I said. Asahi does NOT mean that it is running on the gpu. Asahi is the display name vendor.

this is the important part that needs to be there image

this is all unrelated to this PR, please take your questions to the appropriate resources in Asahi chats