remote-android / redroid-doc

redroid (Remote-Android) is a multi-arch, GPU enabled, Android in Cloud solution. Track issues / docs here
4.28k stars 308 forks source link

请教一下 redroid 支持 vgpu 吗 #480

Open ctaoist opened 1 year ago

ctaoist commented 1 year ago

pve 起了一个 ubuntu 20.04,分配了一个 vgpu,型号 P4-2Q,运行一个游戏,使用 nvidia-smi 查看,没有任何进程占用 vgpu,显存也没有任何的消耗:

+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 535.54.03              Driver Version: 535.54.03    CUDA Version: 12.2     |
|-----------------------------------------+----------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |         Memory-Usage | GPU-Util  Compute M. |
|                                         |                      |               MIG M. |
|=========================================+======================+======================|
|   0  GRID P4-2Q                     On  | 00000000:01:00.0 Off |                    0 |
| N/A   N/A    P8              N/A /  N/A |      0MiB /  2048MiB |      0%      Default |
|                                         |                      |             Disabled |
+-----------------------------------------+----------------------+----------------------+

+---------------------------------------------------------------------------------------+
| Processes:                                                                            |
|  GPU   GI   CI        PID   Type   Process name                            GPU Memory |
|        ID   ID                                                             Usage      |
|=======================================================================================|
|  No running processes found                                                           |
+---------------------------------------------------------------------------------------+
zhouziyang commented 1 year ago

For Nvidia GPU, virtio-gpu is recommended.

ctaoist commented 1 year ago

For Nvidia GPU, virtio-gpu is recommended.

如果只分配 virtio-gpu 这个显卡的话,容器可以启动,但 adb 连不上。如果分配 vgpu,游戏动画有点卡顿

zhouziyang commented 1 year ago

Possible software rendering is performed while vgpu is used.

Did you correctly setup virtio-gpu in host (qemu or libvirt)?

ctaoist commented 1 year ago

For Nvidia GPU, virtio-gpu is recommended.

screenshot-20231027-100848

连接容器后 dmesg -T|grep gpu 结果:

dmesg -T|grep gpu

[Fri Oct 27 02:25:58 2023] init: Parsing file /system/etc/init/gpuservice.rc...
[Fri Oct 27 02:26:39 2023] init: starting service 'exec 18 (/vendor/bin/gpu_config.sh)'...
[Fri Oct 27 02:26:39 2023] init: SVC_EXEC service 'exec 18 (/vendor/bin/gpu_config.sh)' pid 91 (uid 0 gid 0+0 context default) started; waiting...
[Fri Oct 27 02:26:39 2023] init: Service 'exec 18 (/vendor/bin/gpu_config.sh)' (pid 91) exited with status 0 waiting took 0.112000 seconds
[Fri Oct 27 02:26:39 2023] init: Sending signal 9 to service 'exec 18 (/vendor/bin/gpu_config.sh)' (pid 91) process group...
[Fri Oct 27 02:26:39 2023] init: starting service 'gpu'...

启动 adbd 服务查看端口:

ss -nltp
State      Recv-Q Send-Q       Local Address:Port                Peer Address:Port              
LISTEN     0      0            *:5555                            *:*                   users:(("adbd",pid=148,fd=14))

只有一个端口,外部使用 adb connect ip:5555 连不上,正常情况下应该还有一个端口的,好像是 5357 之类的来着

940842546 commented 1 year ago

For Nvidia GPU, virtio-gpu is recommended.

screenshot-20231027-100848

连接容器后 dmesg -T|grep gpu 结果:

dmesg -T|grep gpu

[Fri Oct 27 02:25:58 2023] init: Parsing file /system/etc/init/gpuservice.rc...
[Fri Oct 27 02:26:39 2023] init: starting service 'exec 18 (/vendor/bin/gpu_config.sh)'...
[Fri Oct 27 02:26:39 2023] init: SVC_EXEC service 'exec 18 (/vendor/bin/gpu_config.sh)' pid 91 (uid 0 gid 0+0 context default) started; waiting...
[Fri Oct 27 02:26:39 2023] init: Service 'exec 18 (/vendor/bin/gpu_config.sh)' (pid 91) exited with status 0 waiting took 0.112000 seconds
[Fri Oct 27 02:26:39 2023] init: Sending signal 9 to service 'exec 18 (/vendor/bin/gpu_config.sh)' (pid 91) process group...
[Fri Oct 27 02:26:39 2023] init: starting service 'gpu'...

启动 adbd 服务查看端口:

ss -nltp
State      Recv-Q Send-Q       Local Address:Port                Peer Address:Port              
LISTEN     0      0            *:5555                            *:*                   users:(("adbd",pid=148,fd=14))

只有一个端口,外部使用 adb connect ip:5555 连不上,正常情况下应该还有一个端口的,好像是 5357 之类的来着

虚拟机里正确识别出virtio-gpu得卡了吗 lsgpu看下

ctaoist commented 11 months ago

For Nvidia GPU, virtio-gpu is recommended.

screenshot-20231027-100848 连接容器后 dmesg -T|grep gpu 结果:

dmesg -T|grep gpu

[Fri Oct 27 02:25:58 2023] init: Parsing file /system/etc/init/gpuservice.rc...
[Fri Oct 27 02:26:39 2023] init: starting service 'exec 18 (/vendor/bin/gpu_config.sh)'...
[Fri Oct 27 02:26:39 2023] init: SVC_EXEC service 'exec 18 (/vendor/bin/gpu_config.sh)' pid 91 (uid 0 gid 0+0 context default) started; waiting...
[Fri Oct 27 02:26:39 2023] init: Service 'exec 18 (/vendor/bin/gpu_config.sh)' (pid 91) exited with status 0 waiting took 0.112000 seconds
[Fri Oct 27 02:26:39 2023] init: Sending signal 9 to service 'exec 18 (/vendor/bin/gpu_config.sh)' (pid 91) process group...
[Fri Oct 27 02:26:39 2023] init: starting service 'gpu'...

启动 adbd 服务查看端口:

ss -nltp
State      Recv-Q Send-Q       Local Address:Port                Peer Address:Port              
LISTEN     0      0            *:5555                            *:*                   users:(("adbd",pid=148,fd=14))

只有一个端口,外部使用 adb connect ip:5555 连不上,正常情况下应该还有一个端口的,好像是 5357 之类的来着

虚拟机里正确识别出virtio-gpu得卡了吗 lsgpu看下

虚拟机里应该是识别到了 virtio-gpu 的卡,现在只保留了 virtio-gpu,删掉了 VGPU:

image

ForsakenRei commented 11 months ago

Possible software rendering is performed while vgpu is used.

Did you correctly setup virtio-gpu in host (qemu or libvirt)?

Not really related but does the passthrough GPU need hardware encoders for androidboot.redroid_gpu_mode=host to work?

zhouziyang commented 11 months ago

@ForsakenRei Proprietary Nvidia drivers for Android required (the open source nouveau possible works)

ForsakenRei commented 11 months ago

@ForsakenRei Proprietary Nvidia drivers for Android required (the open source nouveau possible works)

Uh, I had some really bad experiences with Nvidia driver on Linux recently, have a RX 6400 lying around and wondering if it will work for redroid. It doesn't have hardware encoders so streaming is a no go, but I guess GPU rendering for redroid will probably be fine?

zhouziyang commented 11 months ago

AMD / Intel GPUs should work out of the box.

ForsakenRei commented 11 months ago

AMD / Intel GPUs should work out of the box.

Got it working perfectly, thanks!

wangruiqi-git commented 6 months ago

哥 你pve不起ubantu能直接运行redroid吗?

wangweijun007 commented 4 months ago

I have the same problem. Nvidia1050TI, pve(vgpu)+ubuntu(vm)+docker+redroid. use androidboot.redroid_gpu_mode=host can not connect ip:5555. change androidboot.redroid_gpu_mode=guest could connect。