Making gnome boxes work with 3d acceleration

What to do

Gnome-boxes xml for a VM needs to be edited:

Add graphics node

<graphics type='egl-headless'>
    <gl rendernode='/dev/dri/renderD128'/>
</graphics>

Add iommu driver under video and set accel3d to “yes”

<video>
    <driver iommu="on" ats="on" packed="on"/>
    <model type="virtio" heads="1" primary="yes">
        <acceleration accel3d="yes"/>
    </model>
    <address type="pci" domain="0x0000" bus="0x00" slot="0x01" function="0x0"/>
</video>

Source

https://wiki.tnonline.net/w/Blog/OpenGL_acceleration_with_KVM_and_VirGL#Enabling_VirGL