Android build with different backend

777 views
Skip to first unread message

render dender

unread,
Dec 20, 2022, 8:19:22 AM12/20/22
to skia-discuss
Hello!
I'd like to understand more about Skia backends and thought this would be the place to ask.
Let's say I've got a few Android apps that uses a system lib libhwui with default GLES backend.  
In order to get a clearer picture about bottlenecks I want to rebuild and flush libhwui with CPU backend and maybe Vulkan backend.
I tried to change some flags in skia.gni, for example skia_enable_gpu but that doesn't change anything and I can see in callstack skia GLES functions (with simpleperf).

So, would that be possible? Can I change the skia backend this way? I'd be glad to any suggestions.

___
Thanks!

Jim Van Verth

unread,
Dec 20, 2022, 9:54:23 AM12/20/22
to skia-d...@googlegroups.com
For Skia in general to get only the CPU backend you should be able to set 'skia_enable_gpu=false'. To force Vulkan, use 'skia_use_vulkan=true' and 'skia_use_gl=false'. There may be additional settings you need to get that to work with HWUI though.

--
You received this message because you are subscribed to the Google Groups "skia-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to skia-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/skia-discuss/92b8f59b-4098-49e9-8833-a8ce623b7af9n%40googlegroups.com.


--

Jim Van Verth | Software Engineer | jvan...@google.com | 919-210-7664

Nolan Scobie

unread,
Dec 20, 2022, 10:53:17 AM12/20/22
to skia-d...@googlegroups.com
Expanding on the settings required, note that as you mentioned libhwui is a (shared/dynamically linked) system library. This means it (and the copy of Skia it contains) is bundled with the Android OS on your device, and not something that apps provide. In order to compile and make your own changes to libhwui you would need to build your own copy of Android and flash it to your device. This isn't a typical use case for app developers, and I'm not aware of any official public docs covering all the steps.

All that said, libhwui already exposes the ability to use Vulkan without recompiling anything. This may require a rooted device, but try running `adb shell setprop debug.hwui.renderer skiavk`, and restarting the app.

Since you mention wanting to investigate bottlenecks, I would suggest exploring tracing with Perfetto if you haven't already. `adb shell setprop debug.hwui.skia_atrace_enabled` should get you some more tracing data from the copy of Skia in libhwui, and you could instrument your own app by adding trace events to your code.

Reply all
Reply to author
Forward
0 new messages