Info for QEMU using NVIDIA graphics coming soon

After completing work using NVIDIA graphics, I thought to try virtualization using QEMU+KVM. Not working is -display gtk,gl=on (black screen). The next option was SDL, but QEMU in Clear Linux lacks SDL support due to configure --disable-sdl.

Next, I compiled QEMU with SDL enabled, including the addition to the audio driver list.

--enable-sdl \
--enable-opengl \
--enable-virglrenderer \
--audio-drv-list='pa,alsa,oss,sdl' \

Copy+paste clipboard between the host and QEMU+SDL is not yet supported. It requires a C file ui/sdl-clipboard.c in QEMU.

Here is a teaser screenshot for QEMU+SDL+OpenGL. Not shown in the image is that I was running 2 VMs doing the same thing. I wanted to verify that virglrenderer can handle more than 1 VM. It works!

How is audio latency with that setup?

Testing involved moving the host GNOME Terminal window over two VM windows running simultaneously. I needed to enable ForceCompositionPipeline=On. That rid of sound hip-cups while moving the terminal window around the screen. I’m running NVIDIA driver version 510.85.02.

QEMU+KVM+SDL using NVIDIA graphics is quite nice. Unfortunately, not yet copy+paste clipboard functionality between the host and VM.

I posted my QEMU launch script in the issue ticket, requesting --enable-sdl.

Things I tried:

Spice + QXL (clipboard copy+paste works here, install spice-vdagent in guest)

-spice port=5924,disable-ticketing=on,plaintext-channel=default,seamless-migration=on,image-compression=off,jpeg-wan-compression=never,zlib-glz-wan-compression=never,streaming-video=off,playback-compression=off \
-device qxl-vga,max_outputs=1,ram_size=134217728,vram_size=33554432,vram64_size_mb=0,vgamem_mb=32 \
-device virtio-serial-pci \
-chardev spicevmc,id=charchannel1,name=vdagent \
-device virtserialport,chardev=charchannel1,id=channel1,name=com.redhat.spice.0 \

Spice + OpenGL (clipboard copy+paste works here, install spice-vdagent in guest)

-spice unix=on,addr=/tmp/spice.sock,disable-ticketing=on,plaintext-channel=default,seamless-migration=on,image-compression=off,jpeg-wan-compression=never,zlib-glz-wan-compression=never,streaming-video=off,playback-compression=off \
-display egl-headless,rendernode=/dev/dri/renderD128 \
-device virtio-vga-gl,max_outputs=1 \
-device virtio-serial-pci \
-chardev spicevmc,id=charchannel1,name=vdagent \
-device virtserialport,chardev=charchannel1,id=channel1,name=com.redhat.spice.0 \

SDL + OpenGL

Running OpenGL on top of SDL requires disabling parallel and serial or specify -nodefaults.

-parallel none -serial none \
-display sdl,gl=on,window-close=off \
-device virtio-vga-gl,max_outputs=1 \


-parallel none -serial none \
-display sdl,gl=off,window-close=off \
-device virtio-vga,max_outputs=1 \


-parallel none -serial none \
-display gtk,gl=off,window-close=off \
-device virtio-vga,max_outputs=1 \

Next, I tried Quickemu and Quickgui. To make OpenGL work, I needed to create a wrapper script as quickqui hard-codes to --display spice.

See Grab-on-hover is possible for SDL output · Issue #541 · quickemu-project/quickemu · GitHub

Below, Clear Linux is not in the list. I saw Freedos and had to check it out. That brought back memories. Ubuntu 20.04 (live image) works including OpenGL. Libvirglrenderer may be disabled by the OS vendor (e.g. Ubuntu 22.04). From searching the web, works as expected after installation.

A package+bundle request was submitted for zsync.

They resolved the issue upstream using NVIDIA graphics with recent virglrenderer. But now, recent Mesa in Clear Linux 37120 is broken inside the VM not related to the virglrenderer fixes.

-nodefaults -device virtio-vga-gl -display sdl,gl=on

Clear Linux 37110 is fine.