Proxmox

How to Enable VirtIO-GL/VirGL 3D Acceleration on Proxmox VE 8 Virtual Machines

VirtIO-GL/VirGL is a feature of the KVM/QEMU/libvirt hypervisor that is used to provide the KVM/QEMU/libvirt virtual machines with 3D acceleration capabilities. The 3D acceleration allows the virtual machines (with a graphical user interface installed) to use the GPU of the host to make the graphical user interface more responsive and capable of running the 3D productivity software or games.

Proxmox VE uses the KVM/QEMU/libvirt technology for its virtual machines. Starting with Proxmox VE 8, you can use the VirtIO-GL/VirGL 3D acceleration on the Linux virtual machines for a better graphical user experience.

In this article, we will show you how to enable the VirtIO-GL/VirGL 3D acceleration on Proxmox VE 8 virtual machines.

Topic of Contents:

  1. Installing the GPU Drivers on Proxmox VE 8
  2. Installing the Required Libraries for VirtIO-GL/VirGL 3D Acceleration on Proxmox VE 8
  3. Enabling the VirtIO-GL/VirGL GPU 3D Acceleration on a Proxmox VE 8 Virtual Machine
  4. Testing If the VirtIO-GL/VirGL GPU 3D Acceleration Is Working on Proxmox VE Virtual Machine
  5. Conclusion

Installing the GPU Drivers on Proxmox VE 8

For the VirtIO-GL/VirGL 3D acceleration to work on Proxmox VE 8, you must have the following:

  • An installed GPU on your Proxmox VE 8 server
  • Installed GPU drivers on your Proxmox VE 8 server

The Intel GPU drivers should be installed on your Proxmox VE 8 server by default if you have the Intel iGPU (integrated GPU) available. You don’t need any manual intervention.

If you have an NVIDIA GPU on your Proxmox VE 8 server and you want to use it for VirtIO-GL/VirGL, you must download the NVIDIA GPU drivers manually and install them yourself on your Proxmox VE 8 server. If you need any assistance in installing the NVIDIA GPU drivers on your Proxmox VE 8 server, read this article.

If you have an AMD GPU on your Proxmox VE 8 server, you may also need to install the required GPU drivers on your Proxmox VE 8 server. We don’t have an AMD GPU. So, we haven’t tested it. But if you’re using an AMD APU (AMD processor with integrated GPU), the GPU drivers should be installed by default as far as we know. We will update this article if we get a chance to test it.

Installing the Required Libraries for VirtIO-GL/VirGL 3D Acceleration on Proxmox VE 8

For the VirtIo-GL/VirGL 3D acceleration to work on Proxmox VE 8 virtual machines, you must have the LibEGL and libGL libraries installed on your Proxmox VE 8 server. The LibEGL and libGL libraries are available in the official package repositories of Proxmox VE 8. So, they are very easy to install.

First, navigate to Datacenter > pve > Shell to access the Proxmox VE shell of your Proxmox VE 8 server and run the following command to update the Proxmox VE package database cache:

$ apt update

A computer screen shot of a computer screen Description automatically generated

To install the LibEGL and LibGL libraries on Proxmox VE 8 server, run the following command:

$ apt install -y libegl1 libgl1

The LibEGL and LibGL libraries should be installed. In our case, they are already installed.

A screenshot of a computer Description automatically generated

Enabling the VirtIO-GL/VirGL GPU 3D Acceleration on a Proxmox VE 8 Virtual Machine

To enable the VirtIO-GL/VirGL 3D acceleration on a Proxmox VE 8 virtual machine, navigate to the “Hardware” section of the virtual machine[1]. Double-click (LMB) on “Display”[2] and select “VirGL GPU” from the “Graphics card” dropdown menu[3].

By default, VirGL GPU uses only 256 MB of memory/VRAM (at max) from the installed GPU on your Proxmox VE server when the virtual machine is running. This is enough for most cases. If you want to allocate more memory/VRAM to the virtual machine, type it in the “Memory (MiB)” section[4].

Once you’re done, click on “OK”[5].

A screenshot of a computer Description automatically generated

VirtIO-GL/VirGL should be enabled for your desired Proxmox VE 8 virtual machine.

A screenshot of a computer Description automatically generated

Now, you can start the virtual machine as usual.

A screenshot of a computer Description automatically generated

If VirtIO-GL/VirGL is enabled on the Proxmox VE 8 virtual machine successfully, the virtual machine will start without any error and the screen of the virtual machine will be displayed on the Proxmox VE 8 web interface.

A computer screen shot of a jellyfish Description automatically generated

Testing If the VirtIO-GL/VirGL GPU 3D Acceleration Is Working on Proxmox VE Virtual Machines

You can navigate to Settings > About on the GNOME desktop environment to find the “Graphics” information of the virtual machine. As you can see, the virtual machine is using the NVIDIA RTX 4070 that we have on our Proxmox VE 8 server via VirIO-GL/VirGL. On other desktop environments, you will find a similar information on the “Settings” app.

A screenshot of a computer Description automatically generated

To test whether VirIO-GL/VirGL does any 3D improvements on Proxmox VE 8 virtual machines, we create two Ubuntu 22.04 LTS virtual machines on our Proxmox VE 8 server. We enable VirtIO-GL/VirGL on one of them and use the default display settings (3D acceleration disabled) on the other one. Then, we run the “glmark2” test and compare the results.

If you want to perform the same tests, you can install “glmark2” on your Ubuntu 22.04 LTS virtual machine with the following commands:

$ sudo apt update

$ sudo apt install glmark2 -y

While the “glmark2” benchmark is running, the Proxmox VE 8 virtual machine that has the VirtIO-GL/VirGL 3D acceleration enabled consumes less CPU resources (Figure 1) compared to the one which has the VirtIO-GL/VirGL 3D acceleration disabled (Figure 2). The VirtIO-GL/VirGL 3D acceleration that disables the Proxmox VE 8 virtual machines CPU usage is almost 100% as you can see in the following screenshot (figure 2). High CPU usage means that 3D is simulated via CPU instead of being accelerated via GPU. So, the VirtIO-GL/VirGL 3D acceleration improves the 3D performance of Proxmox VE 8 virtual machines and makes the user interface of the Linux graphical desktop environment more responsive.

A screenshot of a computer Description automatically generated

Figure 1: CPU usage while running the “glmark2” benchmark on the VirtIO-GL/VirGL 3D acceleration that is enabled on Proxmox VE 8 virtual machine

A screenshot of a computer Description automatically generated

Figure 2: CPU usage while running the “glmark2” benchmark on the VirtIO-GL/VirGL 3D acceleration that is disabled on Proxmox VE 8 virtual machine

The “glmark2” score proves that the VirIO-GL/VirGL 3D acceleration really improves the overall graphical user experience of the Proxmox VE 8 virtual machines. On the Proxmox VE 8 virtual machine with the VirtIO-GL/VirGL 3D acceleration enabled, the “glmark2” score is 2167 (figure 3) and only 163 on the one with the disabled VirtIO-GL/VirGL 3D acceleration (figure 4). That’s a huge difference.

A screenshot of a computer Description automatically generated

Figure 3: The “glmark2” score of the VirtIO-GL/VirGL 3D acceleration enabled on Promox VE 8 virtual machine when NVIDIA RTX 4070 GPU and AMD Ryzen 3900X CPU (4 cores allocated to the virtual machine) are used on the Promox VE 8 server

A screenshot of a computer Description automatically generated

Figure 4: The “glmark2” score of the VirtIO-GL/VirGL 3D acceleration disabled on Promox VE 8 virtual machine when AMD Ryzen 3900X CPU (4 cores allocated to the virtual machine) is used on the Promox VE 8 server

You can also verify that the Proxmox VE 8 virtual machine is using the GPU from your Proxmox VE 8 server for 3D acceleration via VirIO-GL/VirGL if you’re using an NVIDIA GPU on the Proxmox VE 8 server.

To find the programs that are using the NVIDIA GPU of your Proxmox VE 8 server, open the Proxmox VE shell and run the “nvidia-smi” command. As you can see, one of the Proxmox VE 8 virtual machine consumes about 194 MiB of VRAM from the NVIDIA RTX 4070 GPU of our Proxmox VE 8 server for 3D acceleration.

A screenshot of a computer Description automatically generated

Conclusion

In this article, we showed you how to install the required libraries on your Proxmox VE 8 server to get the VirtIO-GL/VirGL 3D acceleration working. We also showed you how to configure/enable the VirtIO-GL/VirGL 3D acceleration on a Proxmox VE 8 virtual machine. We showed you how to verify whether the VirtIO-GL/VirGL 3D acceleration is working on Proxmox VE 8 virtual machines as well. Finally, we benchmarked the VirtIO-GL/VirGL GPU of a Proxmox VE 8 virtual machine using “glmark2” to show you how it performs compared to a Proxmox VE 8 virtual machine with the VirtIO-GL/VirGL 3D acceleration disabled.

About the author

Shahriar Shovon

Freelancer & Linux System Administrator. Also loves Web API development with Node.js and JavaScript. I was born in Bangladesh. I am currently studying Electronics and Communication Engineering at Khulna University of Engineering & Technology (KUET), one of the demanding public engineering universities of Bangladesh.