redroid-doc icon indicating copy to clipboard operation
redroid-doc copied to clipboard

Can I enable hardware acceleration with a Turing architecture graphics card (GTX 1660 TI etc.) ?

Open ayasa520 opened this issue 3 years ago • 2 comments

I tried to create a virtual machine with VirtIO-GPU, but it failed. My situation is the same as https://forum.artixlinux.org/index.php/topic,3725.0.html.

Whenever, I try to enable 3D acceleration on any of my vms in virt-manager by changing video to Virtio, turning on 3D acceleration, changing Listen type to None and enabling OpenGL I get this error message:

Error starting domain: internal error: process exited while connecting to monitor: 2022-02-20T20:56:39.150589Z qemu-system-x86_64: egl: eglInitialize failed
2022-02-20T20:56:39.150663Z qemu-system-x86_64: Failed to initialize EGL render node for SPICE GL

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/asyncjob.py", line 65, in cb_wrapper
    callback(asyncjob, *args, **kwargs)
  File "/usr/share/virt-manager/virtManager/asyncjob.py", line 101, in tmpcb
    callback(*args, **kwargs)
  File "/usr/share/virt-manager/virtManager/object/libvirtobject.py", line 57, in newfn
    ret = fn(self, *args, **kwargs)
  File "/usr/share/virt-manager/virtManager/object/domain.py", line 1329, in startup
    self._backend.create()
  File "/usr/lib/python3.10/site-packages/libvirt.py", line 1353, in create
    raise libvirtError('virDomainCreate() failed')
libvirt.libvirtError: internal error: process exited while connecting to monitor: 2022-02-20T20:56:39.150589Z qemu-system-x86_64: egl: eglInitialize failed
2022-02-20T20:56:39.150663Z qemu-system-x86_64: Failed to initialize EGL render node for SPICE GL

At the end of this page someone said

AFAIK 3d acceleration is not supported with Nvidia drivers/cards.

ayasa520 avatar Oct 17 '22 16:10 ayasa520

But it is mentioned in https://github.com/remote-android/redroid-doc/issues/158#issuecomment-1135347441

some options for NVIDIA GPU:

  • virtio-gpu (already support in redroid)

So I'm a little confused

ayasa520 avatar Oct 17 '22 16:10 ayasa520

For virtio-gpu support (libvirt):

  1. setup native drivers in your host OS
  2. edit /etc/libvirt/qemu.conf to allow device access (cgroup_device_acl)
  3. start VM with virtio-gpu support (adjust render node as needed)
<graphics type='egl-headless'>
      <gl rendernode='/dev/dri/renderD128'/>
    </graphics>
    <video>
      <model type='virtio' heads='1' primary='yes'>
        <acceleration accel3d='yes'/>
      </model>
    </video>

zhouziyang avatar Oct 18 '22 00:10 zhouziyang

Now I use the below command to start the virtual machine. It looks more intuitive and works

qemu-system-x86_64 c  -enable-kvm -smp 4 -device intel-hda -device hda-duplex  -device virtio-vga-gl  -net nic -net user,hostfwd=tcp::5555-:5555    -cpu host  -m 4096  -display sdl,gl=on -hda ubuntu.qcow2

ayasa520 avatar Oct 23 '22 16:10 ayasa520