Guide: run Minecraft at full speed on Rock 5B

  1. Compile install gl4es https://github.com/ptitSeb/gl4es
git clone https://github.com/ptitSeb/gl4es.git
cd gl4es
mkdir build
cd build
cmake .. -DODROID=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo
make -j8 
sudo make install
  1. Export gl4es libGL.so
export LD_LIBRARY_PATH=/usr/lib/gl4es/

You can use glxgears to check if the gl4es works.

  1. Install minecraft arm64
  • Install arm64 JRE from apt or anywhere else. Personally I recommend using the dragonwell JDK for a free 20% performance boost and 30% less memory usage.
  • Install minecraft. You can use any launcher that supports ARM64 version of Minecraft. I am using HMCL that is confirmed working.
  1. Install mods
    The vanilla Minecraft works but performance is very poor(~30fps unstable)
    Use the 1.16.5 version and install these mods:
  • fabric
  • fabric api 0.42.0
  • sodium 0.2.0
  • reese’s sodium options 1.4.7
    (note: these versions is confirmed working but you can use others as well.)
  1. Change some settings
    Launch your game and turn off the “Use compact vertex format” option in the video settings, or the game will crash when entering any world.

  2. Enjoy Minecraft!
    Join any world, enter fullscreen and toggle VSync in the video setting several times, finally leave it ON.
    Then the Minecraft should be very smooth.

The performance is very impressive: ~90fps multiplayer without too many entity, ~60fps singleplayer.

8 Likes

Kudos to ptitSeb.

1 Like

Some screenshots:

~70fps singleplayer @ view distance 12 chunks, fancy graphic

~80fps multiplayer @ view distance 12 chunks, fancy graphic
(Taken at Almuj entrance, Wynncraft server)

2 Likes

Hi! I tried this on my Rock5B and follow the full instruction, but I only get 20+ FPS at the same settings.

Can you show more details about your system environment?

This is the system image I am using now: https://github.com/amazingfate/armbian-rock5b-images
and installed Mesa via this : https://launchpad.net/~liujianfeng1994/+archive/ubuntu/panfork-mesa

It is expected that performance with Mesa is not yet as good as the blob driver.

It would be useful if you can install apitrace and upload a trace of Minecraft somewhere so that I can use it to optimise performance—note that gl4es should not be required for this.


Until I can improve performance, you may wish to play with the blob driver:

If you are using Wayland, you will need to compile https://gitlab.com/panfork/dri2to3.

You will also have to open the src/gl/loader.c file from gl4es and remove these two lines, then recompile and reinstall:

    if(!sanitizer)
        flags |= RTLD_DEEPBIND;

To actually download the blob driver is something like this:

mkdir -p ~/libmali/x11
cd ~/libmali/x11
wget https://github.com/JeffyCN/rockchip_mirrors/raw/libmali/lib/aarch64-linux-gnu/libmali-valhall-g610-g6p0-x11-gbm.so
ln -s libmali-valhall-g610-g6p0-x11-gbm.so libmali.so.1
for l in libEGL.so libEGL.so.1 libgbm.so.1 libGLESv2.so libGLESv2.so.2 libOpenCL.so.1; do ln -s libmali.so.1 $l; done

Then you would set these environment variables:

export LD_PRELOAD=~/dri2to3/build/libdri2to3.so LD_LIBRARY_PATH=/usr/lib/gl4es:~/libmali/x11

2 Likes

THX~ I tried it and now can get 60~FPS
But will it conflict when both panfrost and blob installed ?

As long as you use LD_LIBRARY_PATH when you want to use the blob rather than installing it to a system library directory, there should be no conflict.

There is no requirement to use a single driver at a time—as long as both the display server and application can speak the same protocol (DRI2/3 for Xorg, wl-drm/linux-dmabuf/mali-buffer-sharing for Wayland) then different drivers can be used together.

Note that this may change after the eventual migration to the panfrost.ko kernel driver, as the blob only knows how to deal with kbase.

I see there are several blobs in JeffyCN’s repo: x11, wayland, x11-wayland, gdm…
What’s the difference betwen them? Is it possible to use a blob driver by default, and what are the downsides?
If I’m mainly using Wayland, how should I make most apps (e.g. Chromium, but maybe also things like OpenCL, fullscreen apps like Kodi or RetroPie emulators) use the blob driver, and should I do that in the first place?

The blobs differ in what windowing systems are supported. Probably you would either want to use wayland-gbm or x11-gbm (the x11-wayland-gbm one seems to be broken).

It is possible to exclusively use the blob driver, but you lose desktop OpenGL support (only OpenGL ES is supported), and also:

  • For Wayland, applications using Xwayland are unaccelerated
  • For X11, a patched (and broken) version of Xorg is required

So probably you’d want to only use the blob for applications, which means using LD_LIBRARY_PATH rather than installing it systemwide.

To make the blob be used by default for a single application, you can use a menu editor to change the environment variables, or just do it manually by copying the .desktop file from /usr/share/applications into ~/.local/share/applications, and changing the Exec= line to set LD_LIBRARY_PATH and (for X11 applications, if you are using Wayland) LD_PRELOAD.

1 Like

Good day.
I try to run 3d test with blob.
System ArmBian+enabled 3d acceleration panfork.
I have builded and installed gl4es & dri2to3
Downloaded libmali-valhall-g610-g6p0-x11-gbm.so
Maked links on that library
exporting variables
export LD_PRELOAD=~/dri2to3/build/libdri2to3.so
export LD_LIBRARY_PATH=/usr/lib/gl4es:~/libmali/x11/libEGL.so
$ ls ~/libmali/x11/ libEGL.so libgbm.so.1 libGLESv2.so.2 libmali-valhall-g610-g6p0-x11-gbm.so …
$ ls /usr/lib/gl4es/ libGL.so.1
$ ls ~/dri2to3/build/ libdri2to3.so libdri2to3.so.p
Everything looks good.
Now im trying run glmark2-es2-wayland in all variants of variables exportings ,
enable and disable LD_PRELOAD and LD_LIBRARY_PATH, and i have only one variant of running.

glmark2 2021.02
OpenGL Information
GL_VENDOR:     Panfrost
GL_RENDERER:   Mali-G610 (Panfrost)
GL_VERSION:    OpenGL ES 3.1 Mesa 23.0.0-devel

What is going wrong?

That looks wrong, it should be just export LD_LIBRARY_PATH=/usr/lib/gl4es:~/libmali/x11.

I have changed parameter LD_LIBRARY_PATH and now i have error Segmentation fault
$ glmark2-wayland
Segmentation fault
$ glmark2-es2-wayland
Segmentation fault
$ echo $XDG_SESSION_TYPE
wayland
i tried run SuperTusKart for test, it’s get same error.

glmark2-es2-wayland -d
Debug: Using eglGetPlatformDisplayEXT()
Debug: eglGetPlatformDisplayEXT() failed with error: 0x300c
Debug: Falling back to eglGetDisplay()
Segmentation fault

$ glxinfo
LIBGL: Initialising gl4es
LIBGL: v1.1.5 built on Dec 28 2022 20:12:50
LIBGL: Using GLES 2.0 backend
LIBGL: loaded: libGLESv2.so
LIBGL: loaded: libEGL.so
LIBGL: Using GLES 2.0 backend
arm_release_ver of this libmali is ‘g6p0-01eac0’, rk_so_ver is ‘5’.
X connection to :0 broken (explicit kill or server shutdown).

but i can run glmark2-es2
$ echo $XDG_SESSION_TYPE
wayland
$ glmark2-es2
arm_release_ver of this libmali is ‘g6p0-01eac0’, rk_so_ver is ‘5’.
arm_release_ver of this libmali is ‘g6p0-01eac0’, rk_so_ver is ‘5’.
glmark2 2021.02
OpenGL Information
GL_VENDOR: ARM
GL_RENDERER: Mali-LODX
GL_VERSION: OpenGL ES 3.2 v1.g6p0-01eac0.efb75e2978d783a80fe78be1bfb0efc1
[build] use-vbo=false: FPS: 1037 FrameTime: 0.964 ms
[build] use-vbo=true: FPS: 918 FrameTime: 1.089 ms

Has anyone been able to get lwglw 2? For minecraft 1.8.9

For Wayland applications, you will have to download the Wayland blob from https://github.com/JeffyCN/rockchip_mirrors/raw/libmali/lib/aarch64-linux-gnu/libmali-valhall-g610-g6p0-wayland-gbm.so. dri2to3 is not required.

Plain glmark2-wayland is expected to not work as it uses desktop OpenGL, which the blob does not support, and I think gl4es still does not support Wayland.

Thanks a lot for your help. I tried run tux kart on x11 with and without blob. Difference in two times. 100 vs 50 fps on full hd full screen.
On wayland didn’t work.

Heads-up that the latest version of gl4es (as of Jan. 12th, 2023) doesn’t work. Minecraft will hang as soon as it starts loading a world. I had to checkout an earlier commit hash (from the Oct. 2022 set of changes) to make it work again.

Good day

I have problem starting. minecraft won’t start
error message: (GLFW error 65543: GLX: Failed to create context: GLXBadFBConfig.)
i use rock b5. with RebornOS. gpu driver is installed: mesa-panfork-git, java-19-openjdk!
what do i have to do to make it work?

found another possibility in android there is an app (PojavLauncher)
there you can play the current minecraft java version and including mods.

Minecraft Java + Bedrock Server Together – Geyser + Floodgate

I have found this docker image that straight up works with zero extra setup required other than port forwarding from your router to rock5 both Java and Bedrock ports.

I have had this working perfectly on Armbian + OMV6 (linked in this forum), Armbian Afterburner (latest img with Redroid, linked in this forum) and have also just cloned it directly and run it outside of Docker.

This is mindblowing what they have been able to achieve and the work this dude put into the Docker container is impressive.

oh and fyi - this allows Bedrock and Java players to play together :slight_smile:

1 Like