Additional QEMU specifications
By default, the options for the following qemu-system-x86_64 commands are set for the QNX Developer Desktop:
sudo qemu-system-x86_64 \
--enable-kvm \
-drive file=output/disk-qemu.vmdk,if=ide,id=drv0 \
-netdev bridge,br=virbr0,id=net0 \
-device virtio-net-pci,netdev=net0,mac=52:54:00:91:01:ea \
-pidfile output/qemu.pid \
-nographic \
-kernel output/ifs.bin \
-serial mon:stdio \
-object rng-random,filename=/dev/urandom,id=rng0 \
-device virtio-rng-pci,rng=rng0 \
-vga none \
-display sdl,gl=on \These options specify the networking, file system, kernel, and serial console.
CPU specification
You can adjust the number of CPUs with the -smp command. For example, to set the number of CPUs to 8, use the following command:
-smp 8 \RAM specification
You can adjust the amount of RAM with the -m command. For example, to set the amount of RAM to 16, use the following command:
-m 16G \Increasing this above 16 GB may result in unexpected behavior.
Physical bit specification
You can make the QEMU CPU use physical bits with the --cpu host command. If you choose to use physical bit, it's also recommended to specify the maximum limit with host-phys-bits-limit.
For AMD architectures, set the limit to 40:
--cpu host,host-phys-bits-limit=40For Intel architectures, set the limit to 39:
--cpu host,host-phys-bits-limit=39GPU specification
The -device command alters the GPU, particularly if QEMU uses OpenGL host offloading.
You can use the following options with this command:
virtio-vga-glImplements the standard Virtio GPU driver without OpenGL host offloading. For example:
-device virtio-vga-glvirtio-gpu-gl-pciImplements the Virtio GPU driver on top of
virgl, enabling OpenGL offloading. It's recommended to update QEMU to version 10 for best performance with this option.Additionally, you can add the following options to the
virtio-gpu-gl-pcioption:blob— Helps QEMU define the resolution and memory for the virtual GPU.venus— Enables Vulkan support through Venus, if your host is capable of it.
For example:
-device virtio-gpu-gl-pci,hostmem=8G,blob=true,venus=true
To set the resolution, set xres and yres to the desired resolution values. You can use these options with the virtio-vga-gl option, although it isn't fully supported on all architectures. Ensure that QEMU is also aware of the updated resolution by altering the /usr/lib/graphics/drm-virtio/graphics-virtio-virgl.conf file. Refer to the section below for more information on increasing the QEMU screen resolution.
To set a GPU without OpenGL host offloading and with a specified resolution, use the following command:
-device virtio-vga-gl,xres=1920,yres=1080To set a GPU with OpenGL host offloading and with a specified resolution, use the following command:
-device virtio-gpu-gl-pci,xres=1920,yres=1080,hostmem=8G,blob=true,venus=trueSample commands
Here are some examples of specifications that you can set:
Start QEMU on an Intel CPU without OpenGL host offloading:
sudo qemu-system-x86_64 \
--enable-kvm \
-drive file=output/disk-qemu.vmdk,if=ide,id=drv0 \
-netdev bridge,br=virbr0,id=net0 \
-device virtio-net-pci,netdev=net0,mac=52:54:00:91:01:ea \
-pidfile output/qemu.pid \
-nographic \
-kernel output/ifs.bin \
-serial mon:stdio \
-object rng-random,filename=/dev/urandom,id=rng0 \
-device virtio-rng-pci,rng=rng0 \
-vga none \
-display sdl,gl=on \
-smp 8 \
-m 16G \
--cpu host,host-phys-bits-limit=39 \
-device virtio-vga-glStart QEMU on an Intel CPU with OpenGL host offloading but without Vulkan support:
sudo qemu-system-x86_64 \
--enable-kvm \
-drive file=output/disk-qemu.vmdk,if=ide,id=drv0 \
-netdev bridge,br=virbr0,id=net0 \
-device virtio-net-pci,netdev=net0,mac=52:54:00:91:01:ea \
-pidfile output/qemu.pid \
-nographic \
-kernel output/ifs.bin \
-serial mon:stdio \
-object rng-random,filename=/dev/urandom,id=rng0 \
-device virtio-rng-pci,rng=rng0 \
-vga none \
-display sdl,gl=on \
-smp 8 \
-m 16G \
--cpu host,host-phys-bits-limit=39 \
-device virtio-gpu-gl-pci,hostmem=8GStart QEMU on an Intel CPU with Vulkan support through Venus:
sudo qemu-system-x86_64 \
--enable-kvm \
-drive file=output/disk-qemu.vmdk,if=ide,id=drv0 \
-netdev bridge,br=virbr0,id=net0 \
-device virtio-net-pci,netdev=net0,mac=52:54:00:91:01:ea \
-pidfile output/qemu.pid \
-nographic \
-kernel output/ifs.bin \
-serial mon:stdio \
-object rng-random,filename=/dev/urandom,id=rng0 \
-device virtio-rng-pci,rng=rng0 \
-vga none \
-display sdl,gl=on \
-smp 8 \
-m 16G \
--cpu host,host-phys-bits-limit=39 \
-device virtio-gpu-gl-pci,hostmem=8G,blob=true,venus=trueStart QEMU on an AMD CPU with Vulkan support through Venus and with a 1920x1080 resolution:
sudo qemu-system-x86_64 \
--enable-kvm \
-drive file=output/disk-qemu.vmdk,if=ide,id=drv0 \
-netdev bridge,br=virbr0,id=net0 \
-device virtio-net-pci,netdev=net0,mac=52:54:00:91:01:ea \
-pidfile output/qemu.pid \
-nographic \
-kernel output/ifs.bin \
-serial mon:stdio \
-object rng-random,filename=/dev/urandom,id=rng0 \
-device virtio-rng-pci,rng=rng0 \
-vga none \
-display sdl,gl=on \
-smp 8 \
-m 16G \
--cpu host,host-phys-bits-limit=40 \
-device virtio-gpu-gl-pci,xres=1920,yres=1080,hostmem=8G,blob=true,venus=trueIncreasing the QEMU screen resolution
To run QEMU with a different resolution, it's recommended to update QEMU to version 10. It's also recommended to enable OpenGL host offloading and Vulkan support; otherwise, performance can be unstable.
To run the newer version of QEMU, and work with a desktop with 1080p resolution and Vulkan support:
Ensure that you're using QEMU 10.
Run the VM with one of the sample commands above and wait for the
apkupdates to complete. It's recommended to perform the first boot without OpenGL host offloading.Log in as root on the console. The password is also root.
Modify the display resolution to 1920 x 1280 in /usr/lib/graphics/drm-virtio/graphics-virtio-virgl.conf. For example:
@@ -23,7 +23,7 @@ begin winmgr end globals begin display 1 - video-mode = 1280 x 768 @ 60 + video-mode = 1920 x 1080 @ 60 defer-framebuffer-creation = false force-composition = true allow-bypass = falseFor more information on the graphics configuration file, refer to "Configuring Screen" in the QNX SDP 8.0 documentation.
Close the screen window to shut down the VM.
Put together a command to start the VM based on your hardware specifications. Ensure that the
xres=andyres=values are set to1920and1080, respectively.Run the command in the VM folder to relaunch the VM. View the "Sample commands" section above for examples.
If you decide to try a larger resolution, such as 4K (3840 x 2160), then set the graphics configuration and the resolution (specified in the virtio-gpu-gl-pci device option in the command) to matching values.
Vulkan support
QEMU 10 enables Vulkan support. Once you've launched the VM, you can run the following command in a terminal to check for available GPUs:
[root@qnxqemu ~]# vulkaninfo | grep "GPU id"
MESA: error: Use of VkSurfacePresentModeCompatibilityEXT without a VkSurfacePresentModeEXT set. This is an application bug.
GPU id : 0 (Virtio-GPU Venus (Intel(R) UHD Graphics 630 (CFL GT2))):
GPU id : 1 (Virtio-GPU Venus (Quadro T1000)):
GPU id : 2 (Virtio-GPU Venus (llvmpipe (LLVM 15.0.7, 256 bits))):
MESA-VIRTIO: debug: failed to dup sync fdVulkan currently only works with the Intel driver, so you should invoke a Vulkan app and target GPU 0. For example:
vkcubepp --gpu_number 0If you see a spinning cube, Vulkan is working as expected in the VM.
