waydroid / waydroid

Waydroid uses a container-based approach to boot a full Android system on a regular GNU/Linux system like Ubuntu.
https://waydro.id
GNU General Public License v3.0
7.7k stars 317 forks source link

Make A Waydroid Like An Android Studio Without Loss An Performance #1402

Open IslamMohammedSalama opened 4 months ago

IslamMohammedSalama commented 4 months ago

I Want This Emulator To Have Around And On The Right Side A Button To Close The Emulator And Other Buttons Such As Android Studio Emulators Without Paying Attention To The Terminal And Stopping It In The Traditional Way And I Want To Hold The Upper Side Of The Emulator And Drag It To Move Its Place Without Pressing The Super Key And It Will Be Solved The Problem Of Switching Between Languages Using Keyborad So It Not Working And Having It Be Like The Android Studio Emulators Without Affecting The Performance And I Want The Performance To Be Faster Than That And I Hope That These Features Will Be Added So That The Use Of This Emulator Is Easy And Smooth, So I Use Ubuntu 22.4.4 And I Hope That The Update Reaches This The Operating System.

kotenok2000 commented 4 months ago

image

LFRon commented 3 months ago

Actually,I was thinking running it through qemu.Because qemu 8.2 includes a big merge:virtio-gpu-rutabaga_gfxstream,which could realize the Wayland screen passthrough,means you can use emulator like waydroid,and Google ARCVM has realized but it is closed-source project.So maybe qemu with virtio-gpu-rutabaga is a better choice for Running Android with safety and full-SELinux support:https://www.qemu.org/docs/master/system/devices/virtio-gpu.html But you should compile rutabaga_gfxstream,I have a good guide:https://linaro.atlassian.net/wiki/spaces/ORKO/pages/28985622530/Building+QEMU+with+virtio-gpu+and+rutabaga+gfx

LFRon commented 3 months ago

Actually,I was thinking running it through qemu.Because qemu 8.2 includes a big merge:virtio-gpu-rutabaga_gfxstream,which could realize the Wayland screen passthrough,means you can use emulator like waydroid,and Google ARCVM has realized but it is closed-source project.So maybe qemu with virtio-gpu-rutabaga is a better choice for Running Android with safety and full-SELinux support:https://www.qemu.org/docs/master/system/devices/virtio-gpu.html But you should compile rutabaga_gfxstream,I have a good guide:https://linaro.atlassian.net/wiki/spaces/ORKO/pages/28985622530/Building+QEMU+with+virtio-gpu+and+rutabaga+gfx

IslamMohammedSalama commented 3 months ago

Actually,I was thinking running it through qemu.Because qemu 8.2 includes a big merge:virtio-gpu-rutabaga_gfxstream,which could realize the Wayland screen passthrough,means you can use emulator like waydroid,and Google ARCVM has realized but it is closed-source project.So maybe qemu with virtio-gpu-rutabaga is a better choice for Running Android with safety and full-SELinux support:https://www.qemu.org/docs/master/system/devices/virtio-gpu.html But you should compile rutabaga_gfxstream,I have a good guide:https://linaro.atlassian.net/wiki/spaces/ORKO/pages/28985622530/Building+QEMU+with+virtio-gpu+and+rutabaga+gfx

The Idea Of ​​Running Waydroid On QEMU Is A Bad Idea Because It Will Consume The Device's Resources Much More! What Distribution Will I Install On The v Virtual Machine????

LFRon commented 3 months ago

Actually,I was thinking running it through qemu.Because qemu 8.2 includes a big merge:virtio-gpu-rutabaga_gfxstream,which could realize the Wayland screen passthrough,means you can use emulator like waydroid,and Google ARCVM has realized but it is closed-source project.So maybe qemu with virtio-gpu-rutabaga is a better choice for Running Android with safety and full-SELinux support:https://www.qemu.org/docs/master/system/devices/virtio-gpu.html But you should compile rutabaga_gfxstream,I have a good guide:https://linaro.atlassian.net/wiki/spaces/ORKO/pages/28985622530/Building+QEMU+with+virtio-gpu+and+rutabaga+gfx

The Idea Of ​​Running Waydroid On QEMU Is A Bad Idea Because It Will Consume The Device's Resources Much More! What Distribution Will I Install On The v Virtual Machine????

Actually it consumes resources much more because which uses VirGL so it will cause the stuck feeling when you are using,but if you realize it through rutabaga_gfxstream,you could directly use your GPU to render graphics with lowest delay(even directly through the wayland compositor) and the best performace.

IslamMohammedSalama commented 3 months ago

Actually,I was thinking running it through qemu.Because qemu 8.2 includes a big merge:virtio-gpu-rutabaga_gfxstream,which could realize the Wayland screen passthrough,means you can use emulator like waydroid,and Google ARCVM has realized but it is closed-source project.So maybe qemu with virtio-gpu-rutabaga is a better choice for Running Android with safety and full-SELinux support:https://www.qemu.org/docs/master/system/devices/virtio-gpu.html But you should compile rutabaga_gfxstream,I have a good guide:https://linaro.atlassian.net/wiki/spaces/ORKO/pages/28985622530/Building+QEMU+with+virtio-gpu+and+rutabaga+gfx

The Idea Of ​​Running Waydroid On QEMU Is A Bad Idea Because It Will Consume The Device's Resources Much More! What Distribution Will I Install On The v Virtual Machine????

Actually it consumes resources much more because which uses VirGL so it will cause the stuck feeling when you are using,but if you realize it through rutabaga_gfxstream,you could directly use your GPU to render graphics with lowest delay(even directly through the wayland compositor) and the best performace.

It Will Consume The Device's Resources More, Not Because Of WayDroid, But Because Of The Operating System That Will Be Used In The Virtual Device, Especially Since I Use It To Build Android Applications Using Flutter And The Process Of Building The Application's APK File, And This Consumes Many Resources From The Application, And Using A Virtual Device And Running The Application. Flutter Consumes A Lot Of Resources. The Solution Is To Make WayDroid Like The Android Studio Emulators Without Losing Performance .

kotenok2000 commented 3 months ago

You want to make android studio use waydroid instead of qemu? As opposed to making waydroid use qemu like android studio currently does?

IslamMohammedSalama commented 3 months ago

You want to make android studio use waydroid instead of qemu? As opposed to making waydroid use qemu like android studio currently does?

No , So What Distribution I Use It On Virt Manager ???

hgkamath commented 2 months ago

The upcoming qemu-9.1.0 (2024-Aug), is going get a updated version of VirGL with Venus and blob-memory support that will allow a qemu-vm/guest-OS to have vulkan passthrough. It is expected to improve rendering for android via the virtio-vga-gl and/or virtio-vga-rutabaga backends.

What I am understanding from the above discussion, is that waydroid uses containers (lxc), and presently there isn't a hardware agnostic and standardized way to do true hardware-accelerated GL or vulkan inside a container (and not using llvmpipe based CPU software rendering) ?

There exist some proprietary and non-hw-agnostic container technology like rocker, nvidia-containers etc.
There exist good but suboptimal ways of tunneling opengl or the virgl-protocol via sockets out from the container.

right/wrong ? what is the roadmap to bring hardware acceleration to containers in a hardware agnostic way ?

Ref:

LFRon commented 2 months ago

The upcoming qemu-9.1.0 (2024-Aug), is going get a updated version of VirGL with Venus and blob-memory support that will allow a qemu-vm/guest-OS to have vulkan passthrough. It is expected to improve rendering for android via the virtio-vga-gl and/or virtio-vga-rutabaga backends.即将推出的 qemu-9.1.0(2024 年 8 月)将获得 VirGL 的更新版本,支持 Venus 和 blob-memory,允许 qemu-vm/guest-OS 进行 vulkan 直通。预计它将通过 virtio-vga-gl 和/或 virtio-vga-rutabaga 后端改进 android 的渲染。

What I am understanding from the above discussion, is that waydroid uses containers (lxc), and presently there isn't a hardware agnostic and standardized way to do true hardware-accelerated GL or vulkan inside a container (and not using llvmpipe based CPU software rendering) ?我从上面的讨论中了解到,waydroid 使用容器 (lxc),目前没有一种与硬件无关且标准化的方式可以在容器内执行真正的硬件加速 GL 或 vulkan(而不是使用基于 llvmpipe 的 CPU 软件渲染)?

There exist some proprietary and non-hw-agnostic container technology like rocker, nvidia-containers etc.存在一些专有的和与硬件无关的容器技术,如 rocker、nvidia-containers 等。 There exist good but suboptimal ways of tunneling opengl or the virgl-protocol via sockets out from the container.有一些好的,但不是最优的方法,可以通过套接字从容器中传出来隧道 opengl 或 virgl 协议。

right/wrong ? what is the roadmap to bring hardware acceleration to containers in a hardware agnostic way ?对/错?以与硬件无关的方式为容器带来硬件加速的路线图是什么?

Ref: 裁判:

* 20240701 Re: [PATCH v16 00/13] Support blob memory and venus on qemu20240701 回复:[PATCH v16 00/13] 在 qemu 上支持 blob 内存和 venus
  https://lists.gnu.org/archive/html/qemu-devel/2024-07/msg00061.html

* 20240615 Waydroid VS Bliss OS - PERFORMANCE TEST - Android Gaming on Linux20240615 Waydroid VS Bliss OS - 性能测试 - Linux 上的 Android 游戏
  https://www.youtube.com/watch?v=iNkgQzcnBis

I have tested the performance on Cuttlefish(gfxstream) and Waydroid This is cuttlefish👇 Image_1719823671368

And this is Waydroid👇 Image_1719823672487

Through my test,Gfxstream has at least 92% of original performance,but this number includes WebRTC and Google virtual wayland socket's loss. Why I choose VM nor waydroid?Because you will find Waydroid could not turn on the SELinux only inside the container,SELinux is outdated on Linux Desktop but it is needed on Android,SELinux Disabled doesn't conform to the standard of Android CDD so many Apps refuse to run because they think your environment is very dangerous.Also,Magisk above 26.3 has removed the support of no-SELinux device,LSPosed and ZygiskNext also dropped the support of SELinux-Disabled device.So now Android subsystem on Linux only through VM could turn on SELinux independently.

Virtio-Venus has a possibility of Host GPU-passthrough,but it might not provide a way to have Wayland-passthrough like crosvm/gfxstream. Gfxstream not only could have nearly native performace,but also realize the Multi_windows function like Google ARCVM.So I preferred this more.