Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhancement(main/{mesa,virglrenderer-android}): making virpipe a bit faster #22385

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

twaik
Copy link
Member

@twaik twaik commented Nov 25, 2024

This change makes virgl_test_server_android communicate with X server directly. In this case we can avoid overhead caused by util_rect_copy (memcpy for pixmap) so we will have one less CPU copy per frame.

Before
~ $ GALLIUM_DRIVER=virpipe glmark2 | grep -v -e "Failed to set swap interval." -e "GLX_EXT_swap_control"
=======================================================
    glmark2 2023.01
=======================================================
    OpenGL Information
    GL_VENDOR:      Mesa
    GL_RENDERER:    virgl (ANGLE (ARM, Vulkan 1.1.213 (Mali-G77 (0x90800011)), ...)
    GL_VERSION:     2.1 Mesa 24.2.7
    Surface Config: buf=32 r=8 g=8 b=8 a=8 depth=32 stencil=0 samples=0
    Surface Size:   800x600 windowed
=======================================================
[build] use-vbo=false: FPS: 74 FrameTime: 13.555 ms
[build] use-vbo=true: FPS: 79 FrameTime: 12.697 ms
[texture] texture-filter=nearest: FPS: 86 FrameTime: 11.664 ms
[texture] texture-filter=linear: FPS: 81 FrameTime: 12.468 ms
[texture] texture-filter=mipmap: FPS: 77 FrameTime: 13.127 ms
[shading] shading=gouraud: FPS: 79 FrameTime: 12.668 ms
[shading] shading=blinn-phong-inf: FPS: 81 FrameTime: 12.384 ms
[shading] shading=phong: FPS: 77 FrameTime: 13.051 ms
[shading] shading=cel: FPS: 76 FrameTime: 13.270 ms
[bump] bump-render=high-poly: FPS: 65 FrameTime: 15.446 ms
[bump] bump-render=normals: FPS: 86 FrameTime: 11.680 ms
[bump] bump-render=height: FPS: 83 FrameTime: 12.186 ms
[effect2d] kernel=0,1,0;1,-4,1;0,1,0;: FPS: 75 FrameTime: 13.393 ms
[effect2d] kernel=1,1,1,1,1;1,1,1,1,1;1,1,1,1,1;: FPS: 94 FrameTime: 10.642 ms
[pulsar] light=false:quads=5:texture=false: FPS: 96 FrameTime: 10.420 ms
[desktop] blur-radius=5:effect=blur:passes=1:separable=true:windows=4: FPS: 58 FrameTime: 17.540 ms
[desktop] effect=shadow:windows=4: FPS: 77 FrameTime: 13.129 ms
[buffer] columns=200:interleave=false:update-dispersion=0.9:update-fraction=0.5:update-method=map: FPS: 50 FrameTime: 20.002 ms
[buffer] columns=200:interleave=false:update-dispersion=0.9:update-fraction=0.5:update-method=subdata: FPS: 62 FrameTime: 16.235 ms
[buffer] columns=200:interleave=true:update-dispersion=0.9:update-fraction=0.5:update-method=map: FPS: 57 FrameTime: 17.589 ms
[ideas] speed=duration: FPS: 62 FrameTime: 16.326 ms
[jellyfish] <default>: FPS: 87 FrameTime: 11.627 ms
[terrain] <default>: FPS: 30 FrameTime: 33.799 ms
[shadow] <default>: FPS: 85 FrameTime: 11.779 ms
[refract] <default>: FPS: 41 FrameTime: 24.830 ms
[conditionals] fragment-steps=0:vertex-steps=0: FPS: 92 FrameTime: 10.926 ms
[conditionals] fragment-steps=5:vertex-steps=0: FPS: 94 FrameTime: 10.647 ms
[conditionals] fragment-steps=0:vertex-steps=5: FPS: 88 FrameTime: 11.471 ms
[function] fragment-complexity=low:fragment-steps=5: FPS: 89 FrameTime: 11.311 ms
[function] fragment-complexity=medium:fragment-steps=5: FPS: 85 FrameTime: 11.870 ms
[loop] fragment-loop=false:fragment-steps=5:vertex-steps=5: FPS: 86 FrameTime: 11.733 ms
[loop] fragment-steps=5:fragment-uniform=false:vertex-steps=5: FPS: 87 FrameTime: 11.592 ms
[loop] fragment-steps=5:fragment-uniform=true:vertex-steps=5: FPS: 92 FrameTime: 10.901 ms
=======================================================
                                  glmark2 Score: 75 
=======================================================
After
~ $ GALLIUM_DRIVER=virpipe glmark2 | grep -v -e "Failed to set swap interval." -e "GLX_EXT_swap_control"
=======================================================
    glmark2 2023.01
=======================================================
    OpenGL Information
    GL_VENDOR:      Mesa
    GL_RENDERER:    virgl (ANGLE (ARM, Vulkan 1.1.213 (Mali-G77 (0x90800011)), ...)
    GL_VERSION:     2.1 Mesa 24.2.7
    Surface Config: buf=32 r=8 g=8 b=8 a=8 depth=32 stencil=0 samples=0
    Surface Size:   800x600 windowed
=======================================================
[build] use-vbo=false: FPS: 107 FrameTime: 9.411 ms
[build] use-vbo=true: FPS: 110 FrameTime: 9.113 ms
[texture] texture-filter=nearest: FPS: 113 FrameTime: 8.885 ms
[texture] texture-filter=linear: FPS: 109 FrameTime: 9.205 ms
[texture] texture-filter=mipmap: FPS: 102 FrameTime: 9.854 ms
[shading] shading=gouraud: FPS: 91 FrameTime: 11.079 ms
[shading] shading=blinn-phong-inf: FPS: 100 FrameTime: 10.060 ms
[shading] shading=phong: FPS: 87 FrameTime: 11.553 ms
[shading] shading=cel: FPS: 98 FrameTime: 10.290 ms
[bump] bump-render=high-poly: FPS: 72 FrameTime: 14.040 ms
[bump] bump-render=normals: FPS: 107 FrameTime: 9.389 ms
[bump] bump-render=height: FPS: 103 FrameTime: 9.760 ms
[effect2d] kernel=0,1,0;1,-4,1;0,1,0;: FPS: 95 FrameTime: 10.540 ms
[effect2d] kernel=1,1,1,1,1;1,1,1,1,1;1,1,1,1,1;: FPS: 67 FrameTime: 15.031 ms
[pulsar] light=false:quads=5:texture=false: FPS: 99 FrameTime: 10.130 ms
[desktop] blur-radius=5:effect=blur:passes=1:separable=true:windows=4: FPS: 60 FrameTime: 16.850 ms
[desktop] effect=shadow:windows=4: FPS: 95 FrameTime: 10.598 ms
[buffer] columns=200:interleave=false:update-dispersion=0.9:update-fraction=0.5:update-method=map: FPS: 54 FrameTime: 18.521 ms
[buffer] columns=200:interleave=false:update-dispersion=0.9:update-fraction=0.5:update-method=subdata: FPS: 65 FrameTime: 15.603 ms
[buffer] columns=200:interleave=true:update-dispersion=0.9:update-fraction=0.5:update-method=map: FPS: 61 FrameTime: 16.623 ms
[ideas] speed=duration: FPS: 61 FrameTime: 16.405 ms
[jellyfish] <default>: FPS: 81 FrameTime: 12.355 ms
[terrain] <default>: FPS: 30 FrameTime: 33.336 ms
[shadow] <default>: FPS: 82 FrameTime: 12.273 ms
[refract] <default>: FPS: 40 FrameTime: 25.172 ms
[conditionals] fragment-steps=0:vertex-steps=0: FPS: 87 FrameTime: 11.572 ms
[conditionals] fragment-steps=5:vertex-steps=0: FPS: 90 FrameTime: 11.164 ms
[conditionals] fragment-steps=0:vertex-steps=5: FPS: 93 FrameTime: 10.815 ms
[function] fragment-complexity=low:fragment-steps=5: FPS: 93 FrameTime: 10.784 ms
[function] fragment-complexity=medium:fragment-steps=5: FPS: 88 FrameTime: 11.411 ms
[loop] fragment-loop=false:fragment-steps=5:vertex-steps=5: FPS: 88 FrameTime: 11.446 ms
[loop] fragment-steps=5:fragment-uniform=false:vertex-steps=5: FPS: 89 FrameTime: 11.285 ms
[loop] fragment-steps=5:fragment-uniform=true:vertex-steps=5: FPS: 90 FrameTime: 11.121 ms
=======================================================
                                  glmark2 Score: 84 
=======================================================

@twaik
Copy link
Member Author

twaik commented Nov 25, 2024

@hansm629 test please?

@twaik twaik requested review from licy183 and removed request for Grimler91 and TomJo2000 November 25, 2024 21:22
if (has_feature(feat_texture_mirror_clamp_to_edge))
caps->v2.capability_bits_v2 |= VIRGL_CAP_V2_MIRROR_CLAMP_TO_EDGE;

+ if (vrend_state.xcb.conn)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better make it an option so that user can disable it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

User can use unset DISPLAY before starting virglrenderer-android so it will not connect to X server and will not advertise its ability to connect X server. I think I will add an option for virglrenderer-android.

robertkirkman added a commit to robertkirkman/termux-packages that referenced this pull request Nov 26, 2024
Copied and pasted from https://github.com/termux-user-repository/tur/tree/master/tur/luanti

Previous documentation here:
- termux-user-repository/tur#1295
- termux-user-repository/tur#1296
- termux-user-repository/tur#1331
- termux-user-repository/tur#1327

Summary of key points:

- for better performance than normal virglrenderer-android, test using [termux-wsi-layer](termux#22353) or [new virglrenderer](termux#22385)

- to use touchscreen input, set "Touchscreen input mode: Direct touch" in Termux:X11 settings

- to use keyboard input, set "Prefer scancodes" in Termux:X11 settings

- mouse input unimplemented/bugged
@hansm629
Copy link

@twaik

It doesn't seem to work on Xclipse 940. I'll test it on Adreno 7xx series and get back to you with feedback.

~$ GALLIUM_DRIVER=virpipe glmark2 | grep -v -e "Failed to set swap interval." -e "GLX_EXT_swap_control"
lost connection to rendering server on 8 read -1 104

@twaik
Copy link
Member Author

twaik commented Nov 26, 2024

lost connection to rendering server on 8 read -1 104 usually means you did not start the virgl_test_server_android...

@hansm629
Copy link

@twaik
After running xfce4 with the command below, it works.

~$ termux-x11 :1 -xstartup "dbus-launch --exit-with-session xfce4-session"
~$ virgl_test_server_android --angle-vulkan & > /dev/null 2>&1
[1] 29299
Samsung Xclipse 940 = Score: 148

~$ GALLIUM_DRIVER=virpipe glmark2 | grep -v -e "Failed to set swap interval." -e "GLX_EXT_swap_control"
vtest_client_dispatch_commands: client context created.
=======================================================
    glmark2 2023.01
=======================================================
    OpenGL Information
    GL_VENDOR:      Mesa
    GL_RENDERER:    virgl (ANGLE (Samsung Electronics Co. Ltd., Vulkan 1.3.264 ...)
    GL_VERSION:     2.1 Mesa 24.2.7
    Surface Config: buf=32 r=8 g=8 b=8 a=8 depth=32 stencil=0 samples=0
    Surface Size:   800x600 windowed
=======================================================
[build] use-vbo=false: FPS: 163 FrameTime: 6.168 ms
[build] use-vbo=true: FPS: 162 FrameTime: 6.175 ms
[texture] texture-filter=nearest: FPS: 177 FrameTime: 5.663 ms
[texture] texture-filter=linear: FPS: 181 FrameTime: 5.542 ms
[texture] texture-filter=mipmap: FPS: 168 FrameTime: 5.964 ms
[shading] shading=gouraud: FPS: 148 FrameTime: 6.761 ms
[shading] shading=blinn-phong-inf: FPS: 145 FrameTime: 6.940 ms
[shading] shading=phong: FPS: 154 FrameTime: 6.515 ms
[shading] shading=cel: FPS: 187 FrameTime: 5.375 ms
[bump] bump-render=high-poly: FPS: 123 FrameTime: 8.140 ms
[bump] bump-render=normals: FPS: 180 FrameTime: 5.573 ms
[bump] bump-render=height: FPS: 169 FrameTime: 5.943 ms
[effect2d] kernel=0,1,0;1,-4,1;0,1,0;: FPS: 163 FrameTime: 6.152 ms
[effect2d] kernel=1,1,1,1,1;1,1,1,1,1;1,1,1,1,1;: FPS: 140 FrameTime: 7.174 ms
[pulsar] light=false:quads=5:texture=false: FPS: 171 FrameTime: 5.852 ms
[desktop] blur-radius=5:effect=blur:passes=1:separable=true:windows=4: FPS: 122 FrameTime: 8.230 ms
[desktop] effect=shadow:windows=4: FPS: 131 FrameTime: 7.655 ms
[buffer] columns=200:interleave=false:update-dispersion=0.9:update-fraction=0.5:update-method=map: FPS: 96 FrameTime: 10.428 ms
[buffer] columns=200:interleave=false:update-dispersion=0.9:update-fraction=0.5:update-method=subdata: FPS: 109 FrameTime: 9.201 ms
[buffer] columns=200:interleave=true:update-dispersion=0.9:update-fraction=0.5:update-method=map: FPS: 122 FrameTime: 8.227 ms
[ideas] speed=duration: FPS: 176 FrameTime: 5.711 ms
[jellyfish] <default>: FPS: 166 FrameTime: 6.040 ms
[terrain] <default>: FPS: 57 FrameTime: 17.645 ms
[shadow] <default>: FPS: 165 FrameTime: 6.095 ms
[refract] <default>: FPS: 75 FrameTime: 13.423 ms
[conditionals] fragment-steps=0:vertex-steps=0: FPS: 166 FrameTime: 6.025 ms
[conditionals] fragment-steps=5:vertex-steps=0: FPS: 166 FrameTime: 6.035 ms
[conditionals] fragment-steps=0:vertex-steps=5: FPS: 159 FrameTime: 6.294 ms
[function] fragment-complexity=low:fragment-steps=5: FPS: 160 FrameTime: 6.278 ms
[function] fragment-complexity=medium:fragment-steps=5: FPS: 156 FrameTime: 6.436 ms
[loop] fragment-loop=false:fragment-steps=5:vertex-steps=5: FPS: 154 FrameTime: 6.500 ms
[loop] fragment-steps=5:fragment-uniform=false:vertex-steps=5: FPS: 160 FrameTime: 6.279 ms
[loop] fragment-steps=5:fragment-uniform=true:vertex-steps=5: FPS: 161 FrameTime: 6.220 ms
=======================================================
                                  glmark2 Score: 148 
=======================================================
client: VTEST_CLIENT_DISCONNECTED

Qualcomm Adreno 750 = Score: 151

~$ GALLIUM_DRIVER=virpipe glmark2 | grep -v -e "Failed to set swap interval." -e "GLX_EXT_swap_control"
vtest_client_dispatch_commands: client context created.
=======================================================
    glmark2 2023.01
=======================================================
    OpenGL Information
    GL_VENDOR:      Mesa
    GL_RENDERER:    virgl (ANGLE (Qualcomm, Vulkan 1.3.128 (Adreno (TM) 750 (0x...)
    GL_VERSION:     2.1 Mesa 24.2.7
    Surface Config: buf=32 r=8 g=8 b=8 a=8 depth=32 stencil=0 samples=0
    Surface Size:   800x600 windowed
=======================================================
[build] use-vbo=false: FPS: 161 FrameTime: 6.228 ms
[build] use-vbo=true: FPS: 174 FrameTime: 5.777 ms
[texture] texture-filter=nearest: FPS: 174 FrameTime: 5.758 ms
[texture] texture-filter=linear: FPS: 179 FrameTime: 5.593 ms
[texture] texture-filter=mipmap: FPS: 181 FrameTime: 5.534 ms
[shading] shading=gouraud: FPS: 141 FrameTime: 7.116 ms
[shading] shading=blinn-phong-inf: FPS: 148 FrameTime: 6.769 ms
[shading] shading=phong: FPS: 181 FrameTime: 5.536 ms
[shading] shading=cel: FPS: 140 FrameTime: 7.178 ms
[bump] bump-render=high-poly: FPS: 124 FrameTime: 8.130 ms
[bump] bump-render=normals: FPS: 184 FrameTime: 5.452 ms
[bump] bump-render=height: FPS: 187 FrameTime: 5.375 ms
[effect2d] kernel=0,1,0;1,-4,1;0,1,0;: FPS: 190 FrameTime: 5.275 ms
[effect2d] kernel=1,1,1,1,1;1,1,1,1,1;1,1,1,1,1;: FPS: 161 FrameTime: 6.215 ms
[pulsar] light=false:quads=5:texture=false: FPS: 156 FrameTime: 6.428 ms
[desktop] blur-radius=5:effect=blur:passes=1:separable=true:windows=4: FPS: 129 FrameTime: 7.762 ms
[desktop] effect=shadow:windows=4: FPS: 145 FrameTime: 6.920 ms
[buffer] columns=200:interleave=false:update-dispersion=0.9:update-fraction=0.5:update-method=map: FPS: 109 FrameTime: 9.177 ms
[buffer] columns=200:interleave=false:update-dispersion=0.9:update-fraction=0.5:update-method=subdata: FPS: 112 FrameTime: 8.985 ms
virgl_fence_set_fd: failed err=-1
failed to export fence sync object
[buffer] columns=200:interleave=true:update-dispersion=0.9:update-fraction=0.5:update-method=map: FPS: 118 FrameTime: 8.530 ms
[ideas] speed=duration: FPS: 101 FrameTime: 9.905 ms
[jellyfish] <default>: FPS: 139 FrameTime: 7.205 ms
[terrain] <default>: FPS: 63 FrameTime: 15.904 ms
[shadow] <default>: FPS: 128 FrameTime: 7.817 ms
[refract] <default>: FPS: 81 FrameTime: 12.354 ms
[conditionals] fragment-steps=0:vertex-steps=0: FPS: 180 FrameTime: 5.562 ms
[conditionals] fragment-steps=5:vertex-steps=0: FPS: 178 FrameTime: 5.643 ms
[conditionals] fragment-steps=0:vertex-steps=5: FPS: 176 FrameTime: 5.690 ms
[function] fragment-complexity=low:fragment-steps=5: FPS: 182 FrameTime: 5.504 ms
[function] fragment-complexity=medium:fragment-steps=5: FPS: 183 FrameTime: 5.480 ms
[loop] fragment-loop=false:fragment-steps=5:vertex-steps=5: FPS: 177 FrameTime: 5.658 ms
[loop] fragment-steps=5:fragment-uniform=false:vertex-steps=5: FPS: 181 FrameTime: 5.530 ms
[loop] fragment-steps=5:fragment-uniform=true:vertex-steps=5: FPS: 182 FrameTime: 5.507 ms
=======================================================
                                  glmark2 Score: 151 
=======================================================
client: VTEST_CLIENT_DISCONNECTED

But it's strange.
Before the pull request package, XFCE4 was executed with the script shell below,

but now it no longer executes and the X11 server is displayed with a black screen.

#!/bin/bash

# Enable PulseAudio over Network
pulseaudio --start --load="module-native-protocol-tcp auth-ip-acl=127.0.0.1 auth-anonymous=1" --exit-idle-time=-1 > /dev/null 2>&1

XDG_RUNTIME_DIR=${TMPDIR} termux-x11 :1.0 & > /dev/null 2>&1
sleep 1

am start --user 0 -n com.termux.x11/com.termux.x11.MainActivity > /dev/null 2>&1
sleep 1

virgl_test_server_android --angle-vulkan & > /dev/null 2>&1

env DISPLAY=:1.0 MESA_NO_ERROR=1 GALLIUM_DRIVER=virpipe MESA_GL_VERSION_OVERRIDE=4.6COMPAT MESA_GLES_VERSION_OVERRIDE=3.2 dbus-launch --exit-with-session xfce4-session & > /dev/null 2>&1
# Set audio server
export PULSE_SERVER=127.0.0.1 > /dev/null 2>&1

sleep 5
process_id=$(ps -aux | grep '[x]fce4-screensaver' | awk '{print $2}')
kill "$process_id" > /dev/null 2>&1

@hansm629
Copy link

@twaik
After further testing, the existing virglrenderer-android-1.0.1-3 runs XFCE4 well, but starting from 1.0.1-4, XFCE4 does not run and the X11 server displays a black screen.

robertkirkman added a commit to robertkirkman/termux-packages that referenced this pull request Nov 26, 2024
Copied and pasted from https://github.com/termux-user-repository/tur/tree/master/tur/luanti

Previous documentation here:
- termux-user-repository/tur#1295
- termux-user-repository/tur#1296
- termux-user-repository/tur#1331
- termux-user-repository/tur#1327

Summary of key points:

- for better performance than normal virglrenderer-android, test using [termux-wsi-layer](termux#22353) or [new virglrenderer](termux#22385)

- to use touchscreen input, set "Touchscreen input mode: Direct touch" in Termux:X11 settings

- to use keyboard input, set "Prefer scancodes" in Termux:X11 settings

- to use mouse input, set "Capture external pointer devices" in
  Termux:X11 settings
@twaik twaik force-pushed the virglrenderer-direct-x-connection branch from 52e89ea to 26df72f Compare November 26, 2024 16:43
robertkirkman added a commit to robertkirkman/termux-packages that referenced this pull request Nov 26, 2024
Copied and pasted from https://github.com/termux-user-repository/tur/tree/master/tur/luanti

Previous documentation here:
- termux-user-repository/tur#1295
- termux-user-repository/tur#1296
- termux-user-repository/tur#1331
- termux-user-repository/tur#1327

Summary of key points:

- for better performance than normal virglrenderer-android, test using [termux-wsi-layer](termux#22353) or [new virglrenderer](termux#22385)

- to use touchscreen input, set "Touchscreen input mode: Direct touch" in Termux:X11 settings

- to use keyboard input, set "Prefer scancodes" in Termux:X11 settings

- to use mouse input, set "Capture external pointer devices" in Termux:X11 settings
@twaik
Copy link
Member Author

twaik commented Nov 26, 2024

Seems like it was some linking problem, fixed it in latest build.

@twaik twaik force-pushed the virglrenderer-direct-x-connection branch 3 times, most recently from a77ad6b to 91e4a6c Compare November 26, 2024 22:14
robertkirkman added a commit to robertkirkman/termux-packages that referenced this pull request Nov 27, 2024
Copied and pasted from https://github.com/termux-user-repository/tur/tree/master/tur/luanti

Previous documentation here:
- termux-user-repository/tur#1295
- termux-user-repository/tur#1296
- termux-user-repository/tur#1331
- termux-user-repository/tur#1327

Summary of key points:

- for better performance than normal virglrenderer-android, test using [termux-wsi-layer](termux#22353) or [new virglrenderer](termux#22385)

- to use touchscreen input, set "Touchscreen input mode: Direct touch" in Termux:X11 settings

- to use keyboard input, set "Prefer scancodes" in Termux:X11 settings

- to use mouse input, set "Capture external pointer devices" in Termux:X11 settings

- I made 6 patches, but the patch 0001-enable-egl-without-sdl2.patch is
  a cherry pick of minetest/minetest@4838eb2
robertkirkman added a commit to robertkirkman/termux-packages that referenced this pull request Nov 27, 2024
Copied and pasted from https://github.com/termux-user-repository/tur/tree/master/tur/luanti

Previous documentation here:
- termux-user-repository/tur#1295
- termux-user-repository/tur#1296
- termux-user-repository/tur#1331
- termux-user-repository/tur#1327

Summary of key points:

- for better performance than normal virglrenderer-android, test using [termux-wsi-layer](termux#22353) or [new virglrenderer](termux#22385)

- to use touchscreen input, set "Touchscreen input mode: Direct touch" in Termux:X11 settings

- to use keyboard input, set "Prefer scancodes" in Termux:X11 settings

- to use mouse input, set "Capture external pointer devices" in Termux:X11 settings

- I made 6 patches, but the patch 0001-enable-egl-without-sdl2.patch is
  a cherry pick of minetest/minetest@4838eb2
robertkirkman added a commit to robertkirkman/termux-packages that referenced this pull request Nov 27, 2024
Copied and pasted from https://github.com/termux-user-repository/tur/tree/master/tur/luanti

Previous documentation here:
- termux-user-repository/tur#1295
- termux-user-repository/tur#1296
- termux-user-repository/tur#1331
- termux-user-repository/tur#1327

Summary of key points:

- for better performance than normal virglrenderer-android, test using [termux-wsi-layer](termux#22353) or [new virglrenderer](termux#22385)

- to use touchscreen input, set "Touchscreen input mode: Direct touch" in Termux:X11 settings

- to use keyboard input, set "Prefer scancodes" in Termux:X11 settings

- to use mouse input, set "Capture external pointer devices" in Termux:X11 settings

- I made 6 patches, but the patch 0001-enable-egl-without-sdl2.patch is
  a cherry pick of minetest/minetest@4838eb2
@hansm629
Copy link

hansm629 commented Nov 27, 2024

@twaik
XFCE4 works fine with the latest build of virglrenderer-android-1.0.1-4!
Screenshot_2024-11-27_22-38-14

Below are the glmark2 test results.

glmark2 results

Termux Native XFCE4 | Samsung Xclipse 940 = Score: 116

~$ GALLIUM_DRIVER=virpipe glmark2 | grep -v -e "Failed to set swap interval." -e "GLX_EXT_swap_control"
=======================================================
    glmark2 2023.01
=======================================================
    OpenGL Information
    GL_VENDOR:      Mesa
    GL_RENDERER:    virgl (ANGLE (Samsung Electronics Co. Ltd., Vulkan 1.3.264 ...)
    GL_VERSION:     4.6 (Compatibility Profile) Mesa 24.2.7
    Surface Config: buf=32 r=8 g=8 b=8 a=8 depth=32 stencil=0 samples=0
    Surface Size:   800x600 windowed
=======================================================
[build] use-vbo=false: FPS: 136 FrameTime: 7.404 ms
[build] use-vbo=true: FPS: 129 FrameTime: 7.811 ms
[texture] texture-filter=nearest: FPS: 134 FrameTime: 7.512 ms
[texture] texture-filter=linear: FPS: 124 FrameTime: 8.072 ms
[texture] texture-filter=mipmap: FPS: 138 FrameTime: 7.254 ms
[shading] shading=gouraud: FPS: 128 FrameTime: 7.873 ms
[shading] shading=blinn-phong-inf: FPS: 125 FrameTime: 8.036 ms
[shading] shading=phong: FPS: 129 FrameTime: 7.780 ms
[shading] shading=cel: FPS: 125 FrameTime: 8.052 ms
[bump] bump-render=high-poly: FPS: 106 FrameTime: 9.444 ms
[bump] bump-render=normals: FPS: 128 FrameTime: 7.844 ms
[bump] bump-render=height: FPS: 140 FrameTime: 7.191 ms
[effect2d] kernel=0,1,0;1,-4,1;0,1,0;: FPS: 128 FrameTime: 7.826 ms
[effect2d] kernel=1,1,1,1,1;1,1,1,1,1;1,1,1,1,1;: FPS: 123 FrameTime: 8.137 ms
[pulsar] light=false:quads=5:texture=false: FPS: 127 FrameTime: 7.889 ms
[desktop] blur-radius=5:effect=blur:passes=1:separable=true:windows=4: FPS: 102 FrameTime: 9.824 ms
[desktop] effect=shadow:windows=4: FPS: 122 FrameTime: 8.201 ms
[buffer] columns=200:interleave=false:update-dispersion=0.9:update-fraction=0.5:update-method=map: FPS: 81 FrameTime: 12.436 ms
[buffer] columns=200:interleave=false:update-dispersion=0.9:update-fraction=0.5:update-method=subdata: FPS: 87 FrameTime: 11.510 ms
[buffer] columns=200:interleave=true:update-dispersion=0.9:update-fraction=0.5:update-method=map: FPS: 89 FrameTime: 11.315 ms
[ideas] speed=duration: FPS: 122 FrameTime: 8.220 ms
[jellyfish] <default>: FPS: 123 FrameTime: 8.174 ms
[terrain] <default>: FPS: 51 FrameTime: 19.889 ms
[shadow] <default>: FPS: 116 FrameTime: 8.646 ms
[refract] <default>: FPS: 57 FrameTime: 17.626 ms
[conditionals] fragment-steps=0:vertex-steps=0: FPS: 129 FrameTime: 7.755 ms
[conditionals] fragment-steps=5:vertex-steps=0: FPS: 129 FrameTime: 7.801 ms
[conditionals] fragment-steps=0:vertex-steps=5: FPS: 126 FrameTime: 7.995 ms
[function] fragment-complexity=low:fragment-steps=5: FPS: 128 FrameTime: 7.844 ms
[function] fragment-complexity=medium:fragment-steps=5: FPS: 125 FrameTime: 8.017 ms
[loop] fragment-loop=false:fragment-steps=5:vertex-steps=5: FPS: 125 FrameTime: 8.023 ms
[loop] fragment-steps=5:fragment-uniform=false:vertex-steps=5: FPS: 125 FrameTime: 8.038 ms
[loop] fragment-steps=5:fragment-uniform=true:vertex-steps=5: FPS: 125 FrameTime: 8.043 ms
=======================================================
                                  glmark2 Score: 116 
=======================================================

PRoot-Distro Debian | Samsung Xclipse 940 = Score: 91

~$ GALLIUM_DRIVER=virpipe glmark2 | grep -v -e "Failed to set swap interval." -e "GLX_EXT_swap_control"
=======================================================
    glmark2 2023.01
=======================================================
    OpenGL Information
    GL_VENDOR:      Mesa/X.org
    GL_RENDERER:    virgl (ANGLE (Samsung Electronics Co. Ltd., Vulkan 1.3.264 ...)
    GL_VERSION:     4.6 (Compatibility Profile) Mesa 22.3.6
    Surface Config: buf=32 r=8 g=8 b=8 a=8 depth=32 stencil=0 samples=0
    Surface Size:   800x600 windowed
=======================================================
[build] use-vbo=false: FPS: 100 FrameTime: 10.020 ms
[build] use-vbo=true: FPS: 101 FrameTime: 9.965 ms
[texture] texture-filter=nearest: FPS: 106 FrameTime: 9.522 ms
[texture] texture-filter=linear: FPS: 97 FrameTime: 10.331 ms
[texture] texture-filter=mipmap: FPS: 98 FrameTime: 10.266 ms
[shading] shading=gouraud: FPS: 95 FrameTime: 10.571 ms
[shading] shading=blinn-phong-inf: FPS: 96 FrameTime: 10.485 ms
[shading] shading=phong: FPS: 94 FrameTime: 10.668 ms
[shading] shading=cel: FPS: 97 FrameTime: 10.335 ms
[bump] bump-render=high-poly: FPS: 76 FrameTime: 13.301 ms
[bump] bump-render=normals: FPS: 105 FrameTime: 9.572 ms
[bump] bump-render=height: FPS: 106 FrameTime: 9.513 ms
[effect2d] kernel=0,1,0;1,-4,1;0,1,0;: FPS: 108 FrameTime: 9.267 ms
[effect2d] kernel=1,1,1,1,1;1,1,1,1,1;1,1,1,1,1;: FPS: 95 FrameTime: 10.587 ms
[pulsar] light=false:quads=5:texture=false: FPS: 106 FrameTime: 9.457 ms
[desktop] blur-radius=5:effect=blur:passes=1:separable=true:windows=4: FPS: 80 FrameTime: 12.585 ms
[desktop] effect=shadow:windows=4: FPS: 93 FrameTime: 10.787 ms
[buffer] columns=200:interleave=false:update-dispersion=0.9:update-fraction=0.5:update-method=map: FPS: 69 FrameTime: 14.557 ms
[buffer] columns=200:interleave=false:update-dispersion=0.9:update-fraction=0.5:update-method=subdata: FPS: 72 FrameTime: 13.998 ms
[buffer] columns=200:interleave=true:update-dispersion=0.9:update-fraction=0.5:update-method=map: FPS: 67 FrameTime: 14.958 ms
[ideas] speed=duration: FPS: 94 FrameTime: 10.733 ms
[jellyfish] <default>: FPS: 96 FrameTime: 10.486 ms
[terrain] <default>: FPS: 46 FrameTime: 22.169 ms
[shadow] <default>: FPS: 91 FrameTime: 11.099 ms
[refract] <default>: FPS: 52 FrameTime: 19.417 ms
[conditionals] fragment-steps=0:vertex-steps=0: FPS: 103 FrameTime: 9.732 ms
[conditionals] fragment-steps=5:vertex-steps=0: FPS: 101 FrameTime: 9.935 ms
[conditionals] fragment-steps=0:vertex-steps=5: FPS: 105 FrameTime: 9.566 ms
[function] fragment-complexity=low:fragment-steps=5: FPS: 98 FrameTime: 10.285 ms
[function] fragment-complexity=medium:fragment-steps=5: FPS: 102 FrameTime: 9.815 ms
[loop] fragment-loop=false:fragment-steps=5:vertex-steps=5: FPS: 99 FrameTime: 10.144 ms
[loop] fragment-steps=5:fragment-uniform=false:vertex-steps=5: FPS: 101 FrameTime: 9.942 ms
[loop] fragment-steps=5:fragment-uniform=true:vertex-steps=5: FPS: 98 FrameTime: 10.245 ms
=======================================================
                                  glmark2 Score: 91 
=======================================================

Performance seems to be better in the build before the latest build.

@twaik
Copy link
Member Author

twaik commented Nov 27, 2024

Proot-distro's mesa is not patched to use virglrenderer's direct x connection feature. I made a patch only for termux's mesa.

@hansm629
Copy link

@twaik
In the build version where XFCE4 was not running and the X11 server was showing a black screen,
I was able to achieve a maximum score of 148,

but now it seems that the limit is 115-116.

Samsung Xclipse 940 = Score: 148

~$ GALLIUM_DRIVER=virpipe glmark2 | grep -v -e "Failed to set swap interval." -e "GLX_EXT_swap_control"
vtest_client_dispatch_commands: client context created.
=======================================================
    glmark2 2023.01
=======================================================
    OpenGL Information
    GL_VENDOR:      Mesa
    GL_RENDERER:    virgl (ANGLE (Samsung Electronics Co. Ltd., Vulkan 1.3.264 ...)
    GL_VERSION:     2.1 Mesa 24.2.7
    Surface Config: buf=32 r=8 g=8 b=8 a=8 depth=32 stencil=0 samples=0
    Surface Size:   800x600 windowed
=======================================================
[build] use-vbo=false: FPS: 163 FrameTime: 6.168 ms
[build] use-vbo=true: FPS: 162 FrameTime: 6.175 ms
[texture] texture-filter=nearest: FPS: 177 FrameTime: 5.663 ms
[texture] texture-filter=linear: FPS: 181 FrameTime: 5.542 ms
[texture] texture-filter=mipmap: FPS: 168 FrameTime: 5.964 ms
[shading] shading=gouraud: FPS: 148 FrameTime: 6.761 ms
[shading] shading=blinn-phong-inf: FPS: 145 FrameTime: 6.940 ms
[shading] shading=phong: FPS: 154 FrameTime: 6.515 ms
[shading] shading=cel: FPS: 187 FrameTime: 5.375 ms
[bump] bump-render=high-poly: FPS: 123 FrameTime: 8.140 ms
[bump] bump-render=normals: FPS: 180 FrameTime: 5.573 ms
[bump] bump-render=height: FPS: 169 FrameTime: 5.943 ms
[effect2d] kernel=0,1,0;1,-4,1;0,1,0;: FPS: 163 FrameTime: 6.152 ms
[effect2d] kernel=1,1,1,1,1;1,1,1,1,1;1,1,1,1,1;: FPS: 140 FrameTime: 7.174 ms
[pulsar] light=false:quads=5:texture=false: FPS: 171 FrameTime: 5.852 ms
[desktop] blur-radius=5:effect=blur:passes=1:separable=true:windows=4: FPS: 122 FrameTime: 8.230 ms
[desktop] effect=shadow:windows=4: FPS: 131 FrameTime: 7.655 ms
[buffer] columns=200:interleave=false:update-dispersion=0.9:update-fraction=0.5:update-method=map: FPS: 96 FrameTime: 10.428 ms
[buffer] columns=200:interleave=false:update-dispersion=0.9:update-fraction=0.5:update-method=subdata: FPS: 109 FrameTime: 9.201 ms
[buffer] columns=200:interleave=true:update-dispersion=0.9:update-fraction=0.5:update-method=map: FPS: 122 FrameTime: 8.227 ms
[ideas] speed=duration: FPS: 176 FrameTime: 5.711 ms
[jellyfish] <default>: FPS: 166 FrameTime: 6.040 ms
[terrain] <default>: FPS: 57 FrameTime: 17.645 ms
[shadow] <default>: FPS: 165 FrameTime: 6.095 ms
[refract] <default>: FPS: 75 FrameTime: 13.423 ms
[conditionals] fragment-steps=0:vertex-steps=0: FPS: 166 FrameTime: 6.025 ms
[conditionals] fragment-steps=5:vertex-steps=0: FPS: 166 FrameTime: 6.035 ms
[conditionals] fragment-steps=0:vertex-steps=5: FPS: 159 FrameTime: 6.294 ms
[function] fragment-complexity=low:fragment-steps=5: FPS: 160 FrameTime: 6.278 ms
[function] fragment-complexity=medium:fragment-steps=5: FPS: 156 FrameTime: 6.436 ms
[loop] fragment-loop=false:fragment-steps=5:vertex-steps=5: FPS: 154 FrameTime: 6.500 ms
[loop] fragment-steps=5:fragment-uniform=false:vertex-steps=5: FPS: 160 FrameTime: 6.279 ms
[loop] fragment-steps=5:fragment-uniform=true:vertex-steps=5: FPS: 161 FrameTime: 6.220 ms
=======================================================
                                  glmark2 Score: 148 
=======================================================
client: VTEST_CLIENT_DISCONNECTED

robertkirkman added a commit to robertkirkman/termux-packages that referenced this pull request Nov 27, 2024
Copied and pasted from https://github.com/termux-user-repository/tur/tree/master/tur/luanti

Previous documentation here:
- termux-user-repository/tur#1295
- termux-user-repository/tur#1296
- termux-user-repository/tur#1331
- termux-user-repository/tur#1327

Summary of key points:

- for better performance than normal virglrenderer-android, test using [termux-wsi-layer](termux#22353) or [new virglrenderer](termux#22385)

- to use touchscreen input, set "Touchscreen input mode: Direct touch" in Termux:X11 settings

- to use keyboard input, set "Prefer scancodes" in Termux:X11 settings

- to use mouse input, set "Capture external pointer devices" in Termux:X11 settings

- I made 6 patches, but the patch 0001-enable-egl-without-sdl2.patch is
  a cherry pick of minetest/minetest@4838eb2
…faster

This change makes virgl_test_server_android communicate with X server directly.
In this case we can avoid overhead caused by `util_rect_copy` (`memcpy` for pixmap)
so we will have one less CPU copy per frame.
@twaik twaik force-pushed the virglrenderer-direct-x-connection branch from 91e4a6c to f4ba661 Compare November 27, 2024 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants