AvaloniaUI / Avalonia

Develop Desktop, Embedded, Mobile and WebAssembly apps with C# and XAML. The most popular .NET UI client technology
https://avaloniaui.net
MIT License
25.31k stars 2.2k forks source link

[Avalonia.Android] GPU Hardware Acceleration doesn't work. #17042

Open J0nathan550 opened 5 days ago

J0nathan550 commented 5 days ago

Describe the bug

Hello, I was developing an Android Application using Avalonia but noticed that scrolling or anything else in my android app is very laggy.

I started to debug, and find out that Avalonia doesn't use GPU rendering in Android and lags badly.

Below are videos showing (with red and green) that gpu (hardware acceleration) is getting called and optimizes phone to 60 fps. In video there is also demo where those Hardware Acceleration calls are not used, and it's likely that the rendering is done only on CPU. Also there are comparing between Android Studio app (plain application) and Avalonia application.

https://github.com/user-attachments/assets/a589fc3b-9a19-49f1-8ec4-e652fa786b8d

https://github.com/user-attachments/assets/2e3ed868-15be-44a5-a5b4-29378e6d030c

To Reproduce

Setup a listbox (recycler view) with elements you like and scroll, you will see how bad lags it is.

Expected behavior

Not to lag, and work on GPU.

Avalonia version

11.1.3

OS

Android

Additional context

No response

emmauss commented 4 days ago

Which of those is the avalonia app, and are you sure it's running the latest stable?

emmauss commented 4 days ago

Also, the dev options you enabled to show the gpu behavior is called View Updates. It only shows when a view is drawn. It will always show 1 update when the view is created on real GPU accelerated views, like games and our renderer. Because we render directly to the gpu surface provided by the OS. So yeah, what you did isn't a good metric for gpu behavior.

J0nathan550 commented 4 days ago

Which of those is the avalonia app, and are you sure it's running the latest stable?

Black "SoundScapes" app. Where you can search a music.