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

[Bug]: ANGLE EGL device has again experienced poor X11 Server performance #780

Open
hansm629 opened this issue Jan 4, 2025 · 20 comments
Open

Comments

@hansm629
Copy link

hansm629 commented Jan 4, 2025

Problem description

https://github.com/termux/termux-x11/actions/runs/12559148802

Since the above build, the ANGLE EGL device (Exynos 2400: Xclipse 940 GPU) has again experienced poor X11 Server performance symptoms.

Before the ANGLE EGL improvements were reflected,

when moving the window, the screen would be vertically split or the periphery would be broken,

but since the above build, frame drops are also noticeable.

I am currently using the version below, which does not cause the symptoms.

https://github.com/termux/termux-x11/actions/runs/12556174093

What steps will reproduce the bug?

https://github.com/termux/termux-x11/actions/runs/12559148802

If you install the above version, the following symptoms will occur in X11.

  • Vertical splitting symptom when moving the Windows window with the mouse
  • Window periphery breakage symptom when moving the Windows window with the mouse
  • Frame drop when moving the Windows window with the mouse

What is the expected behavior?

No response

@twaik
Copy link
Member

twaik commented Jan 5, 2025

ANGLE EGL improvements were reflected

What EGL improvements?

@twaik
Copy link
Member

twaik commented Jan 5, 2025

And how exactly do you use ANGLE EGL? Termux does not have options to use EGL directly.

@hansm629
Copy link
Author

hansm629 commented Jan 5, 2025

@twaik
Screenshot_20250105_222743_Device Info HW+

As you may remember,
Exynos 1480, 2200, 2400 series

does not support Android EGL and only supports Vulkan driver.

That is why
OpenGL ES3.2 is implemented as ANGLE EGL, a combination of ANGLE + Vulkan driver.

The X11 server performance of Termux-X11 running on ANGLE EGL environment was very poor.

  • The screen is split vertically when moving the window
  • The window periphery is broken when moving the window

There was a symptom like the above,

97bee98

The symptom was completely fixed starting from the above commit.

However,
https://github.com/termux/termux-x11/actions/runs/12559148802

The above build re-occurs with the same symptoms and also causes frame drops.

The same for llvmpipe, virpipe, and zink.

@twaik
Copy link
Member

twaik commented Jan 5, 2025

Does it happen in legacy drawing mode and/or with forcing bgra on the latest build? I mean different combinations of -legacy-drawing and -force-bgra.

@hansm629
Copy link
Author

hansm629 commented Jan 5, 2025

@twaik
I will give you feedback after testing tomorrow.

@hansm629
Copy link
Author

hansm629 commented Jan 6, 2025

@twaik
Sorry for the late feedback.

https://github.com/termux/termux-x11/actions/runs/12629982140

Based on the latest build above,
Even if you run the X11 server by adding the -legacy-drawing or -force-bgra environment variables,

XDG_RUNTIME_DIR=${TMPDIR} termux-x11 :1.0 -legacy-drawing & 
XDG_RUNTIME_DIR=${TMPDIR} termux-x11 :1.0 -force-bgra & 

the following symptoms still occur.

  • Vertical splitting symptom when moving the Windows window with the mouse
  • Window periphery breakage symptom when moving the Windows window with the mouse
  • Frame drop when moving the Windows window with the mouse

llvmpipe, virpipe, zink all occur the same,

and separately from the frame drop,

glmark2, glmark2-es2, vkmark all measured

https://github.com/termux/termux-x11/actions/runs/12556174093

Only about half the performance of the build is shown.

As I mentioned earlier, this symptom occurs only in the Xclipse GPU series where OpenGL ES3.2 is implemented with ANGLE EGL (ANGLE + Vulkan driver).

@twaik
Copy link
Member

twaik commented Jan 6, 2025

  • Vertical splitting symptom when moving the Windows window with the mouse

Do you mean screen tearing?

Window periphery breakage symptom when moving the Windows window with the mouse

You mean visual artifacts?

Frame drop when moving the Windows window with the mouse

You mean stuttering?

Most of these problems may be caused by ANGLE not working with both AHardwareBuffers and regular textures properly, probably the cause of it is not performing drawing in time. I can try to write some kind of alternative renderer which will use vulkan directly in the case if it is available, but it will happen after moving renderer code to activity in order to fix displaying on Huawei and some other devices.

@twaik
Copy link
Member

twaik commented Jan 7, 2025

Should be fixed by f5e0f05 . Check the latest build.

@hansm629
Copy link
Author

hansm629 commented Jan 7, 2025

@twaik
I'll check after work!

@hansm629
Copy link
Author

hansm629 commented Jan 7, 2025

@twaik
https://github.com/termux/termux-x11/actions/runs/12650161419
Tested with the above build.

The test results show that the issue of X11 Server being slow and causing frame drops has been fixed!
The glmark2, glmark2-es2, and vkmark scores that were cut in half are now Good results.

However, there are still tearing symptoms and artifacts appearing in the periphery when moving the window quickly.

llvmpipe, virpipe, and zink are all the same.

Screenshot_20250107_210035_Video Player
Screenshot_20250107_205833_Video Player
Screenshot_20250107_205919_Video Player
Screenshot_20250107_210021_Video Player

@twaik
Copy link
Member

twaik commented Jan 7, 2025

Does it happen with llvmpipe?

@twaik
Copy link
Member

twaik commented Jan 7, 2025

I mean can you please check if it happens with regular llvmpipe/lavapipe without any GPU acceleration?
And can you please check the -legacy-drawing again?
Because it is weird. I added explicit glFinish() call which must ensure all drawing operations are finished before the method returns control back to program to make sure there will be no tearing. And I checked it on my device: I changed scale to 30 to see super big display and tearing was gone.

@hansm629
Copy link
Author

hansm629 commented Jan 7, 2025

@twaik
Yes, it happens the same way. Rather, llvmpipe showed slower performance compared tozink and virpipe.

I'll give you feedback again after adding the -legacy-drawing option.

@hansm629
Copy link
Author

hansm629 commented Jan 7, 2025

@twaik
Oh! I just tested it

With the -legacy-drawing option added, llvmpipe doesn't have the same symptoms.
(Without the -legacy-drawing option, llvmpipe, zink, and virpipe all have the same symptoms)

https://github.com/termux/termux-x11/actions/runs/12556174093

In the above build, both zink and virpipe worked fine without the -legacy-drawing option. Can this be fixed?

@twaik
Copy link
Member

twaik commented Jan 7, 2025

it was before I moved rendering to its own thread. I have no plans to move it back to X11 thread.

@twaik
Copy link
Member

twaik commented Jan 7, 2025

app-arm64-v8a-debug.zip
Check this one.

@hansm629
Copy link
Author

hansm629 commented Jan 7, 2025

@twaik
Oh! In the new build, without the -legacy-drawing option, the symptom still occurs,
but with the -legacy-drawing option, the symptom does not occur in zink.

@hansm629
Copy link
Author

hansm629 commented Jan 7, 2025

@twaik
Hmm, that's a bit weird. After a while, the tearing still occurs intermittently, almost like vsync is going out.

@twaik
Copy link
Member

twaik commented Jan 7, 2025

app-arm64-v8a-debug.zip
I believe this artifact will fix that.

@twaik
Copy link
Member

twaik commented Jan 7, 2025

app-arm64-v8a-debug.zip
Updated artifact.

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

No branches or pull requests

2 participants