982648
From 11219f42da3b15bd76b9215fda9d23d5435a1d3b Mon Sep 17 00:00:00 2001
982648
Message-Id: <11219f42da3b15bd76b9215fda9d23d5435a1d3b@dist-git>
982648
From: Erik Skultety <eskultet@redhat.com>
982648
Date: Thu, 19 Jul 2018 15:03:58 +0200
982648
Subject: [PATCH] qemu: Introduce a new graphics display type 'headless'
982648
MIME-Version: 1.0
982648
Content-Type: text/plain; charset=UTF-8
982648
Content-Transfer-Encoding: 8bit
982648
982648
Since 2.10 QEMU supports a new display type egl-headless which uses the
982648
drm nodes for OpenGL rendering copying back the rendered bits back to
982648
QEMU into a dma-buf which can be accessed by standard "display" apps
982648
like VNC or SPICE. Although this display type can be used on its own,
982648
for any practical use case it makes sense to pair it with either VNC or
982648
SPICE display. The clear benefit of this display is that VNC gains
982648
OpenGL support, which it natively doesn't have, and SPICE gains remote
982648
OpenGL support (native OpenGL support only works locally through a UNIX
982648
socket, i.e. listen type=socket/none).
982648
982648
Reviewed-by: Ján Tomko <jtomko@redhat.com>
982648
Signed-off-by: Erik Skultety <eskultet@redhat.com>
982648
(cherry picked from commit d8266ebe1615c4b043db6b8d486465722cdd0ef8)
982648
982648
https://bugzilla.redhat.com/show_bug.cgi?id=1475770
982648
Signed-off-by: Erik Skultety <eskultet@redhat.com>
982648
Reviewed-by: Ján Tomko <jtomko@redhat.com>
982648
---
982648
 docs/formatdomain.html.in                     | 33 +++++++++-
982648
 docs/schemas/domaincommon.rng                 |  3 +
982648
 src/conf/domain_conf.c                        |  6 +-
982648
 src/conf/domain_conf.h                        |  1 +
982648
 src/libxl/libxl_conf.c                        |  1 +
982648
 src/qemu/qemu_command.c                       | 14 ++++-
982648
 src/qemu/qemu_domain.c                        | 60 ++++++++++++++++++-
982648
 src/qemu/qemu_driver.c                        |  2 +
982648
 src/qemu/qemu_hotplug.c                       |  1 +
982648
 src/qemu/qemu_process.c                       |  4 ++
982648
 src/vmx/vmx.c                                 |  1 +
982648
 tests/domaincapsschemadata/full.xml           |  1 +
982648
 .../graphics-egl-headless.args                | 26 ++++++++
982648
 .../graphics-egl-headless.xml                 | 31 ++++++++++
982648
 .../graphics-sdl-egl-headless.xml             | 35 +++++++++++
982648
 .../graphics-spice-egl-headless.args          | 31 ++++++++++
982648
 .../graphics-spice-egl-headless.xml           | 36 +++++++++++
982648
 .../graphics-spice-invalid-egl-headless.xml   | 37 ++++++++++++
982648
 .../graphics-vnc-egl-headless.args            | 28 +++++++++
982648
 .../graphics-vnc-egl-headless.xml             | 37 ++++++++++++
982648
 tests/qemuxml2argvtest.c                      | 17 ++++++
982648
 .../graphics-spice-egl-headless.xml           | 44 ++++++++++++++
982648
 .../graphics-vnc-egl-headless.xml             | 42 +++++++++++++
982648
 tests/qemuxml2xmltest.c                       |  2 +
982648
 24 files changed, 488 insertions(+), 5 deletions(-)
982648
 create mode 100644 tests/qemuxml2argvdata/graphics-egl-headless.args
982648
 create mode 100644 tests/qemuxml2argvdata/graphics-egl-headless.xml
982648
 create mode 100644 tests/qemuxml2argvdata/graphics-sdl-egl-headless.xml
982648
 create mode 100644 tests/qemuxml2argvdata/graphics-spice-egl-headless.args
982648
 create mode 100644 tests/qemuxml2argvdata/graphics-spice-egl-headless.xml
982648
 create mode 100644 tests/qemuxml2argvdata/graphics-spice-invalid-egl-headless.xml
982648
 create mode 100644 tests/qemuxml2argvdata/graphics-vnc-egl-headless.args
982648
 create mode 100644 tests/qemuxml2argvdata/graphics-vnc-egl-headless.xml
982648
 create mode 100644 tests/qemuxml2xmloutdata/graphics-spice-egl-headless.xml
982648
 create mode 100644 tests/qemuxml2xmloutdata/graphics-vnc-egl-headless.xml
982648
982648
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
982648
index a3afe137bf..9dd22554ad 100644
982648
--- a/docs/formatdomain.html.in
982648
+++ b/docs/formatdomain.html.in
982648
@@ -6299,7 +6299,8 @@ qemu-kvm -net nic,model=? /dev/null
982648
         

982648
           The graphics element has a mandatory type
982648
           attribute which takes the value sdl, vnc,
982648
-          spice, rdp or desktop:
982648
+          spice, rdp, desktop or
982648
+          egl-headless:
982648
         

982648
         
982648
           
sdl
982648
@@ -6358,6 +6359,11 @@ qemu-kvm -net nic,model=? /dev/null
982648
               auto-allocation and autoport having no effect due to
982648
               security reasons) Since 1.0.6.
982648
             

982648
+            

982648
+              Although VNC doesn't support OpenGL natively, it can be paired
982648
+              with graphics type egl-headless (see below) which
982648
+              will instruct QEMU to open and use drm nodes for OpenGL rendering.
982648
+            

982648
           
982648
           
spice Since 0.8.6
982648
           
982648
@@ -6463,6 +6469,12 @@ qemu-kvm -net nic,model=? /dev/null
982648
               You can enable or disable OpenGL support explicitly with
982648
               the gl element, by setting the enable
982648
               property. (QEMU only, since 1.3.3).
982648
+              Note that this only works locally, since this requires usage of
982648
+              UNIX sockets, i.e. using listen types 'socket' or
982648
+              'none'. For accelerated OpenGL with remote support, consider
982648
+              pairing this element with type egl-headless
982648
+              (see below). However, this will deliver weaker performance
982648
+              compared to native Spice OpenGL support.
982648
             

982648
             

982648
               By default, QEMU will pick the first available GPU DRM render node.
982648
@@ -6498,6 +6510,25 @@ qemu-kvm -net nic,model=? /dev/null
982648
               fullscreen.
982648
             

982648
           
982648
+          
egl-headlessSince 4.6.0
982648
+          
982648
+            

982648
+              This display type provides support for an OpenGL accelerated
982648
+              display accessible both locally and remotely (for comparison,
982648
+              Spice's native OpenGL support only works locally using UNIX
982648
+              sockets at the moment, but has better performance). Since this
982648
+              display type doesn't provide any window or graphical console like
982648
+              the other types, for practical reasons it should be paired with
982648
+              either vnc or spice graphics types.
982648
+              This display type is only supported by QEMU domains
982648
+              (needs QEMU 2.10 or newer) and doesn't
982648
+              accept any attributes.
982648
+            

982648
+            
982648
+<graphics type='spice' autoport='yes'/>
982648
+<graphics type='egl-headless'/>
982648
+            
982648
+          
982648
         
982648
       
982648
     
982648
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
982648
index f24a56392a..157726752c 100644
982648
--- a/docs/schemas/domaincommon.rng
982648
+++ b/docs/schemas/domaincommon.rng
982648
@@ -3366,6 +3366,9 @@
982648
             </attribute>
982648
           </optional>
982648
         </group>
982648
+        <attribute name="type">
982648
+          <value>egl-headless</value>
982648
+        </attribute>
982648
       </choice>
982648
     </element>
982648
   </define>
982648
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
982648
index db8e17dac4..fa4dfafcff 100644
982648
--- a/src/conf/domain_conf.c
982648
+++ b/src/conf/domain_conf.c
982648
@@ -615,7 +615,8 @@ VIR_ENUM_IMPL(virDomainGraphics, VIR_DOMAIN_GRAPHICS_TYPE_LAST,
982648
               "vnc",
982648
               "rdp",
982648
               "desktop",
982648
-              "spice")
982648
+              "spice",
982648
+              "egl-headless")
982648
 
982648
 VIR_ENUM_IMPL(virDomainGraphicsListen, VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_LAST,
982648
               "none",
982648
@@ -1426,6 +1427,7 @@ void virDomainGraphicsDefFree(virDomainGraphicsDefPtr def)
982648
         virDomainGraphicsAuthDefClear(&def->data.spice.auth);
982648
         break;
982648
 
982648
+    case VIR_DOMAIN_GRAPHICS_TYPE_EGL_HEADLESS:
982648
     case VIR_DOMAIN_GRAPHICS_TYPE_LAST:
982648
         break;
982648
     }
982648
@@ -14172,6 +14174,7 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
982648
         if (virDomainGraphicsDefParseXMLSpice(def, node, ctxt, flags) < 0)
982648
             goto error;
982648
         break;
982648
+    case VIR_DOMAIN_GRAPHICS_TYPE_EGL_HEADLESS:
982648
     case VIR_DOMAIN_GRAPHICS_TYPE_LAST:
982648
         break;
982648
     }
982648
@@ -26404,6 +26407,7 @@ virDomainGraphicsDefFormat(virBufferPtr buf,
982648
         virDomainGraphicsAuthDefFormatAttr(buf, &def->data.spice.auth, flags);
982648
         break;
982648
 
982648
+    case VIR_DOMAIN_GRAPHICS_TYPE_EGL_HEADLESS:
982648
     case VIR_DOMAIN_GRAPHICS_TYPE_LAST:
982648
         break;
982648
     }
982648
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
982648
index 0f10e242fd..26f75b15d0 100644
982648
--- a/src/conf/domain_conf.h
982648
+++ b/src/conf/domain_conf.h
982648
@@ -1473,6 +1473,7 @@ typedef enum {
982648
     VIR_DOMAIN_GRAPHICS_TYPE_RDP,
982648
     VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP,
982648
     VIR_DOMAIN_GRAPHICS_TYPE_SPICE,
982648
+    VIR_DOMAIN_GRAPHICS_TYPE_EGL_HEADLESS,
982648
 
982648
     VIR_DOMAIN_GRAPHICS_TYPE_LAST
982648
 } virDomainGraphicsType;
982648
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
982648
index 452a77f3b8..cda4eb9d31 100644
982648
--- a/src/libxl/libxl_conf.c
982648
+++ b/src/libxl/libxl_conf.c
982648
@@ -1441,6 +1441,7 @@ libxlMakeVfb(virPortAllocatorRangePtr graphicsports,
982648
         case VIR_DOMAIN_GRAPHICS_TYPE_RDP:
982648
         case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP:
982648
         case VIR_DOMAIN_GRAPHICS_TYPE_SPICE:
982648
+        case VIR_DOMAIN_GRAPHICS_TYPE_EGL_HEADLESS:
982648
         case VIR_DOMAIN_GRAPHICS_TYPE_LAST:
982648
             break;
982648
     }
982648
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
982648
index fed4f8faf9..8915040c6a 100644
982648
--- a/src/qemu/qemu_command.c
982648
+++ b/src/qemu/qemu_command.c
982648
@@ -8212,6 +8212,7 @@ qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfigPtr cfg,
982648
     return -1;
982648
 }
982648
 
982648
+
982648
 static int
982648
 qemuBuildGraphicsCommandLine(virQEMUDriverConfigPtr cfg,
982648
                              virCommandPtr cmd,
982648
@@ -8241,6 +8242,11 @@ qemuBuildGraphicsCommandLine(virQEMUDriverConfigPtr cfg,
982648
                                                   qemuCaps, graphics) < 0)
982648
                 return -1;
982648
 
982648
+            break;
982648
+        case VIR_DOMAIN_GRAPHICS_TYPE_EGL_HEADLESS:
982648
+            virCommandAddArg(cmd, "-display");
982648
+            virCommandAddArg(cmd, "egl-headless");
982648
+
982648
             break;
982648
         case VIR_DOMAIN_GRAPHICS_TYPE_RDP:
982648
         case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP:
982648
@@ -10068,6 +10074,7 @@ qemuBuildCommandLineValidate(virQEMUDriverPtr driver,
982648
     int sdl = 0;
982648
     int vnc = 0;
982648
     int spice = 0;
982648
+    int egl_headless = 0;
982648
 
982648
     if (!virQEMUDriverIsPrivileged(driver)) {
982648
         /* If we have no cgroups then we can have no tunings that
982648
@@ -10109,6 +10116,9 @@ qemuBuildCommandLineValidate(virQEMUDriverPtr driver,
982648
         case VIR_DOMAIN_GRAPHICS_TYPE_SPICE:
982648
             ++spice;
982648
             break;
982648
+        case VIR_DOMAIN_GRAPHICS_TYPE_EGL_HEADLESS:
982648
+            ++egl_headless;
982648
+            break;
982648
         case VIR_DOMAIN_GRAPHICS_TYPE_RDP:
982648
         case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP:
982648
         case VIR_DOMAIN_GRAPHICS_TYPE_LAST:
982648
@@ -10116,10 +10126,10 @@ qemuBuildCommandLineValidate(virQEMUDriverPtr driver,
982648
         }
982648
     }
982648
 
982648
-    if (sdl > 1 || vnc > 1 || spice > 1) {
982648
+    if (sdl > 1 || vnc > 1 || spice > 1 || egl_headless > 1) {
982648
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
982648
                        _("only 1 graphics device of each type "
982648
-                         "(sdl, vnc, spice) is supported"));
982648
+                         "(sdl, vnc, spice, headless) is supported"));
982648
         return -1;
982648
     }
982648
 
982648
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
982648
index a42a6df91b..9498594857 100644
982648
--- a/src/qemu/qemu_domain.c
982648
+++ b/src/qemu/qemu_domain.c
982648
@@ -5502,6 +5502,60 @@ qemuDomainDeviceDefValidateTPM(virDomainTPMDef *tpm,
982648
 }
982648
 
982648
 
982648
+static int
982648
+qemuDomainDeviceDefValidateGraphics(const virDomainGraphicsDef *graphics,
982648
+                                    const virDomainDef *def,
982648
+                                    virQEMUCapsPtr qemuCaps)
982648
+{
982648
+    bool have_egl_headless = false;
982648
+    size_t i;
982648
+
982648
+    for (i = 0; i < def->ngraphics; i++) {
982648
+        graphics = def->graphics[i];
982648
+
982648
+        if (graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_EGL_HEADLESS) {
982648
+            have_egl_headless = true;
982648
+            break;
982648
+        }
982648
+    }
982648
+
982648
+    /* Only VNC and SPICE can be paired with egl-headless, the other types
982648
+     * either don't make sense to pair with egl-headless or aren't even
982648
+     * supported by QEMU.
982648
+     */
982648
+    if (have_egl_headless) {
982648
+        if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_EGL_HEADLESS)) {
982648
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
982648
+                           _("egl-headless display is not supported with this "
982648
+                             "QEMU binary"));
982648
+            return -1;
982648
+        }
982648
+
982648
+        if (graphics->type != VIR_DOMAIN_GRAPHICS_TYPE_EGL_HEADLESS &&
982648
+            graphics->type != VIR_DOMAIN_GRAPHICS_TYPE_VNC &&
982648
+            graphics->type != VIR_DOMAIN_GRAPHICS_TYPE_SPICE) {
982648
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
982648
+                           _("graphics type 'egl-headless' is only supported "
982648
+                             "with one of: 'vnc', 'spice' graphics types"));
982648
+            return -1;
982648
+        }
982648
+
982648
+        /* '-spice gl=on' and '-display egl-headless' are mutually
982648
+         * exclusive
982648
+         */
982648
+        if (graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE &&
982648
+            graphics->data.spice.gl == VIR_TRISTATE_BOOL_YES) {
982648
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
982648
+                           _("multiple OpenGL displays are not supported "
982648
+                             "by QEMU"));
982648
+            return -1;
982648
+        }
982648
+    }
982648
+
982648
+    return 0;
982648
+}
982648
+
982648
+
982648
 static int
982648
 qemuDomainDeviceDefValidate(const virDomainDeviceDef *dev,
982648
                             const virDomainDef *def,
982648
@@ -5569,11 +5623,15 @@ qemuDomainDeviceDefValidate(const virDomainDeviceDef *dev,
982648
         ret = qemuDomainDeviceDefValidateTPM(dev->data.tpm, def);
982648
         break;
982648
 
982648
+    case VIR_DOMAIN_DEVICE_GRAPHICS:
982648
+        ret = qemuDomainDeviceDefValidateGraphics(dev->data.graphics, def,
982648
+                                                  qemuCaps);
982648
+        break;
982648
+
982648
     case VIR_DOMAIN_DEVICE_LEASE:
982648
     case VIR_DOMAIN_DEVICE_FS:
982648
     case VIR_DOMAIN_DEVICE_INPUT:
982648
     case VIR_DOMAIN_DEVICE_SOUND:
982648
-    case VIR_DOMAIN_DEVICE_GRAPHICS:
982648
     case VIR_DOMAIN_DEVICE_HUB:
982648
     case VIR_DOMAIN_DEVICE_MEMBALLOON:
982648
     case VIR_DOMAIN_DEVICE_NVRAM:
982648
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
982648
index 7094c80498..62deae4b98 100644
982648
--- a/src/qemu/qemu_driver.c
982648
+++ b/src/qemu/qemu_driver.c
982648
@@ -18116,6 +18116,7 @@ qemuDomainOpenGraphics(virDomainPtr dom,
982648
     case VIR_DOMAIN_GRAPHICS_TYPE_SDL:
982648
     case VIR_DOMAIN_GRAPHICS_TYPE_RDP:
982648
     case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP:
982648
+    case VIR_DOMAIN_GRAPHICS_TYPE_EGL_HEADLESS:
982648
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
982648
                        _("Can only open VNC or SPICE graphics backends, not %s"),
982648
                        virDomainGraphicsTypeToString(vm->def->graphics[idx]->type));
982648
@@ -18184,6 +18185,7 @@ qemuDomainOpenGraphicsFD(virDomainPtr dom,
982648
     case VIR_DOMAIN_GRAPHICS_TYPE_SDL:
982648
     case VIR_DOMAIN_GRAPHICS_TYPE_RDP:
982648
     case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP:
982648
+    case VIR_DOMAIN_GRAPHICS_TYPE_EGL_HEADLESS:
982648
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
982648
                        _("Can only open VNC or SPICE graphics backends, not %s"),
982648
                        virDomainGraphicsTypeToString(vm->def->graphics[idx]->type));
982648
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
982648
index 91a751a2fe..053ddb14ec 100644
982648
--- a/src/qemu/qemu_hotplug.c
982648
+++ b/src/qemu/qemu_hotplug.c
982648
@@ -3699,6 +3699,7 @@ qemuDomainChangeGraphics(virQEMUDriverPtr driver,
982648
     case VIR_DOMAIN_GRAPHICS_TYPE_SDL:
982648
     case VIR_DOMAIN_GRAPHICS_TYPE_RDP:
982648
     case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP:
982648
+    case VIR_DOMAIN_GRAPHICS_TYPE_EGL_HEADLESS:
982648
         virReportError(VIR_ERR_INTERNAL_ERROR,
982648
                        _("unable to change config on '%s' graphics type"), type);
982648
         break;
982648
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
982648
index c903a8e5c8..a4b1f97df5 100644
982648
--- a/src/qemu/qemu_process.c
982648
+++ b/src/qemu/qemu_process.c
982648
@@ -4467,6 +4467,7 @@ qemuProcessGraphicsReservePorts(virDomainGraphicsDefPtr graphics,
982648
     case VIR_DOMAIN_GRAPHICS_TYPE_SDL:
982648
     case VIR_DOMAIN_GRAPHICS_TYPE_RDP:
982648
     case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP:
982648
+    case VIR_DOMAIN_GRAPHICS_TYPE_EGL_HEADLESS:
982648
     case VIR_DOMAIN_GRAPHICS_TYPE_LAST:
982648
         break;
982648
     }
982648
@@ -4505,6 +4506,7 @@ qemuProcessGraphicsAllocatePorts(virQEMUDriverPtr driver,
982648
     case VIR_DOMAIN_GRAPHICS_TYPE_SDL:
982648
     case VIR_DOMAIN_GRAPHICS_TYPE_RDP:
982648
     case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP:
982648
+    case VIR_DOMAIN_GRAPHICS_TYPE_EGL_HEADLESS:
982648
     case VIR_DOMAIN_GRAPHICS_TYPE_LAST:
982648
         break;
982648
     }
982648
@@ -4657,6 +4659,7 @@ qemuProcessGraphicsSetupListen(virQEMUDriverPtr driver,
982648
     case VIR_DOMAIN_GRAPHICS_TYPE_SDL:
982648
     case VIR_DOMAIN_GRAPHICS_TYPE_RDP:
982648
     case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP:
982648
+    case VIR_DOMAIN_GRAPHICS_TYPE_EGL_HEADLESS:
982648
     case VIR_DOMAIN_GRAPHICS_TYPE_LAST:
982648
         break;
982648
     }
982648
@@ -4944,6 +4947,7 @@ qemuProcessStartValidateGraphics(virDomainObjPtr vm)
982648
         case VIR_DOMAIN_GRAPHICS_TYPE_SDL:
982648
         case VIR_DOMAIN_GRAPHICS_TYPE_RDP:
982648
         case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP:
982648
+        case VIR_DOMAIN_GRAPHICS_TYPE_EGL_HEADLESS:
982648
         case VIR_DOMAIN_GRAPHICS_TYPE_LAST:
982648
             break;
982648
         }
982648
diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c
982648
index fe24b060d7..937bf0c96b 100644
982648
--- a/src/vmx/vmx.c
982648
+++ b/src/vmx/vmx.c
982648
@@ -3282,6 +3282,7 @@ virVMXFormatConfig(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virDomainDe
982648
           case VIR_DOMAIN_GRAPHICS_TYPE_RDP:
982648
           case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP:
982648
           case VIR_DOMAIN_GRAPHICS_TYPE_SPICE:
982648
+          case VIR_DOMAIN_GRAPHICS_TYPE_EGL_HEADLESS:
982648
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
982648
                            _("Unsupported graphics type '%s'"),
982648
                            virDomainGraphicsTypeToString(def->graphics[i]->type));
982648
diff --git a/tests/domaincapsschemadata/full.xml b/tests/domaincapsschemadata/full.xml
982648
index d3faf38da0..154c4a6fe9 100644
982648
--- a/tests/domaincapsschemadata/full.xml
982648
+++ b/tests/domaincapsschemadata/full.xml
982648
@@ -59,6 +59,7 @@
982648
         <value>rdp</value>
982648
         <value>desktop</value>
982648
         <value>spice</value>
982648
+        <value>egl-headless</value>
982648
       </enum>
982648
     </graphics>
982648
     <video supported='yes'>
982648
diff --git a/tests/qemuxml2argvdata/graphics-egl-headless.args b/tests/qemuxml2argvdata/graphics-egl-headless.args
982648
new file mode 100644
982648
index 0000000000..fdf540ddfc
982648
--- /dev/null
982648
+++ b/tests/qemuxml2argvdata/graphics-egl-headless.args
982648
@@ -0,0 +1,26 @@
982648
+LC_ALL=C \
982648
+PATH=/bin \
982648
+HOME=/home/test \
982648
+USER=test \
982648
+LOGNAME=test \
982648
+/usr/bin/qemu-system-i686 \
982648
+-name QEMUGuest1 \
982648
+-S \
982648
+-machine pc,accel=tcg,usb=off,dump-guest-core=off \
982648
+-m 214 \
982648
+-smp 1,sockets=1,cores=1,threads=1 \
982648
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
982648
+-no-user-config \
982648
+-nodefaults \
982648
+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\
982648
+server,nowait \
982648
+-mon chardev=charmonitor,id=monitor,mode=control \
982648
+-rtc base=utc \
982648
+-no-shutdown \
982648
+-no-acpi \
982648
+-boot c \
982648
+-usb \
982648
+-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
982648
+-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
982648
+-display egl-headless \
982648
+-vga cirrus
982648
diff --git a/tests/qemuxml2argvdata/graphics-egl-headless.xml b/tests/qemuxml2argvdata/graphics-egl-headless.xml
982648
new file mode 100644
982648
index 0000000000..7b001cd2eb
982648
--- /dev/null
982648
+++ b/tests/qemuxml2argvdata/graphics-egl-headless.xml
982648
@@ -0,0 +1,31 @@
982648
+<domain type='qemu'>
982648
+  <name>QEMUGuest1</name>
982648
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
982648
+  <memory unit='KiB'>219100</memory>
982648
+  <currentMemory unit='KiB'>219100</currentMemory>
982648
+  <vcpu placement='static'>1</vcpu>
982648
+  <os>
982648
+    <type arch='i686' machine='pc'>hvm</type>
982648
+    <boot dev='hd'/>
982648
+  </os>
982648
+  <clock offset='utc'/>
982648
+  <on_poweroff>destroy</on_poweroff>
982648
+  <on_reboot>restart</on_reboot>
982648
+  <on_crash>destroy</on_crash>
982648
+  <devices>
982648
+    <emulator>/usr/bin/qemu-system-i686</emulator>
982648
+    <disk type='block' device='disk'>
982648
+      <driver name='qemu' type='raw'/>
982648
+      <source dev='/dev/HostVG/QEMUGuest1'/>
982648
+      <target dev='hda' bus='ide'/>
982648
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
982648
+    </disk>
982648
+    <controller type='usb' index='0'/>
982648
+    <controller type='ide' index='0'/>
982648
+    <controller type='pci' index='0' model='pci-root'/>
982648
+    <input type='mouse' bus='ps2'/>
982648
+    <input type='keyboard' bus='ps2'/>
982648
+    <graphics type='egl-headless'/>
982648
+    <memballoon model='none'/>
982648
+  </devices>
982648
+</domain>
982648
diff --git a/tests/qemuxml2argvdata/graphics-sdl-egl-headless.xml b/tests/qemuxml2argvdata/graphics-sdl-egl-headless.xml
982648
new file mode 100644
982648
index 0000000000..955dfeb3c2
982648
--- /dev/null
982648
+++ b/tests/qemuxml2argvdata/graphics-sdl-egl-headless.xml
982648
@@ -0,0 +1,35 @@
982648
+<domain type='qemu'>
982648
+  <name>QEMUGuest1</name>
982648
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
982648
+  <memory unit='KiB'>219136</memory>
982648
+  <currentMemory unit='KiB'>219136</currentMemory>
982648
+  <vcpu placement='static'>1</vcpu>
982648
+  <os>
982648
+    <type arch='i686' machine='pc'>hvm</type>
982648
+    <boot dev='hd'/>
982648
+  </os>
982648
+  <clock offset='utc'/>
982648
+  <on_poweroff>destroy</on_poweroff>
982648
+  <on_reboot>restart</on_reboot>
982648
+  <on_crash>destroy</on_crash>
982648
+  <devices>
982648
+    <emulator>/usr/bin/qemu-system-i686</emulator>
982648
+    <disk type='block' device='disk'>
982648
+      <driver name='qemu' type='raw'/>
982648
+      <source dev='/dev/HostVG/QEMUGuest1'/>
982648
+      <target dev='hda' bus='ide'/>
982648
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
982648
+    </disk>
982648
+    <controller type='usb' index='0'/>
982648
+    <controller type='ide' index='0'/>
982648
+    <controller type='pci' index='0' model='pci-root'/>
982648
+    <input type='mouse' bus='ps2'/>
982648
+    <input type='keyboard' bus='ps2'/>
982648
+    <graphics type='sdl' display=':0.1' xauth='/root/.Xauthority'/>
982648
+    <graphics type='egl-headless'/>
982648
+    <video>
982648
+      <model type='vga' vram='16384' heads='1'/>
982648
+    </video>
982648
+    <memballoon model='none'/>
982648
+  </devices>
982648
+</domain>
982648
diff --git a/tests/qemuxml2argvdata/graphics-spice-egl-headless.args b/tests/qemuxml2argvdata/graphics-spice-egl-headless.args
982648
new file mode 100644
982648
index 0000000000..4886ee05f6
982648
--- /dev/null
982648
+++ b/tests/qemuxml2argvdata/graphics-spice-egl-headless.args
982648
@@ -0,0 +1,31 @@
982648
+LC_ALL=C \
982648
+PATH=/bin \
982648
+HOME=/home/test \
982648
+USER=test \
982648
+LOGNAME=test \
982648
+QEMU_AUDIO_DRV=spice \
982648
+/usr/bin/qemu-system-i686 \
982648
+-name QEMUGuest1 \
982648
+-S \
982648
+-machine pc,accel=tcg,usb=off,dump-guest-core=off \
982648
+-m 214 \
982648
+-smp 1,sockets=1,cores=1,threads=1 \
982648
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
982648
+-no-user-config \
982648
+-nodefaults \
982648
+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\
982648
+server,nowait \
982648
+-mon chardev=charmonitor,id=monitor,mode=control \
982648
+-rtc base=utc \
982648
+-no-shutdown \
982648
+-no-acpi \
982648
+-boot c \
982648
+-usb \
982648
+-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
982648
+-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
982648
+-spice port=5903,addr=127.0.0.1 \
982648
+-display egl-headless \
982648
+-vga qxl \
982648
+-global qxl-vga.ram_size=67108864 \
982648
+-global qxl-vga.vram_size=33554432 \
982648
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
982648
diff --git a/tests/qemuxml2argvdata/graphics-spice-egl-headless.xml b/tests/qemuxml2argvdata/graphics-spice-egl-headless.xml
982648
new file mode 100644
982648
index 0000000000..fafae13a0f
982648
--- /dev/null
982648
+++ b/tests/qemuxml2argvdata/graphics-spice-egl-headless.xml
982648
@@ -0,0 +1,36 @@
982648
+<domain type='qemu'>
982648
+  <name>QEMUGuest1</name>
982648
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
982648
+  <memory unit='KiB'>219136</memory>
982648
+  <currentMemory unit='KiB'>219136</currentMemory>
982648
+  <vcpu placement='static'>1</vcpu>
982648
+  <os>
982648
+    <type arch='i686' machine='pc'>hvm</type>
982648
+    <boot dev='hd'/>
982648
+  </os>
982648
+  <clock offset='utc'/>
982648
+  <on_poweroff>destroy</on_poweroff>
982648
+  <on_reboot>restart</on_reboot>
982648
+  <on_crash>destroy</on_crash>
982648
+  <devices>
982648
+    <emulator>/usr/bin/qemu-system-i686</emulator>
982648
+    <disk type='block' device='disk'>
982648
+      <source dev='/dev/HostVG/QEMUGuest1'/>
982648
+      <target dev='hda' bus='ide'/>
982648
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
982648
+    </disk>
982648
+    <controller type='usb' index='0'/>
982648
+    <controller type='ide' index='0'/>
982648
+    <controller type='pci' index='0' model='pci-root'/>
982648
+    <input type='mouse' bus='ps2'/>
982648
+    <input type='keyboard' bus='ps2'/>
982648
+    <graphics type='spice' port='5903' autoport='no' listen='127.0.0.1'>
982648
+      <listen type='address' address='127.0.0.1'/>
982648
+    </graphics>
982648
+    <graphics type='egl-headless'/>
982648
+    <video>
982648
+      <model type='qxl' ram='65536' vram='32768' vgamem='8192' heads='1'/>
982648
+    </video>
982648
+    <memballoon model='virtio'/>
982648
+  </devices>
982648
+</domain>
982648
diff --git a/tests/qemuxml2argvdata/graphics-spice-invalid-egl-headless.xml b/tests/qemuxml2argvdata/graphics-spice-invalid-egl-headless.xml
982648
new file mode 100644
982648
index 0000000000..25ae61cef6
982648
--- /dev/null
982648
+++ b/tests/qemuxml2argvdata/graphics-spice-invalid-egl-headless.xml
982648
@@ -0,0 +1,37 @@
982648
+<domain type='qemu'>
982648
+  <name>QEMUGuest1</name>
982648
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
982648
+  <memory unit='KiB'>219136</memory>
982648
+  <currentMemory unit='KiB'>219136</currentMemory>
982648
+  <vcpu placement='static'>1</vcpu>
982648
+  <os>
982648
+    <type arch='i686' machine='pc'>hvm</type>
982648
+    <boot dev='hd'/>
982648
+  </os>
982648
+  <clock offset='utc'/>
982648
+  <on_poweroff>destroy</on_poweroff>
982648
+  <on_reboot>restart</on_reboot>
982648
+  <on_crash>destroy</on_crash>
982648
+  <devices>
982648
+    <emulator>/usr/bin/qemu-system-i686</emulator>
982648
+    <disk type='block' device='disk'>
982648
+      <source dev='/dev/HostVG/QEMUGuest1'/>
982648
+      <target dev='hda' bus='ide'/>
982648
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
982648
+    </disk>
982648
+    <controller type='usb' index='0'/>
982648
+    <controller type='ide' index='0'/>
982648
+    <controller type='pci' index='0' model='pci-root'/>
982648
+    <input type='mouse' bus='ps2'/>
982648
+    <input type='keyboard' bus='ps2'/>
982648
+    <graphics type='spice'>
982648
+      <listen type='none'/>
982648
+      <gl enable='yes'/>
982648
+    </graphics>
982648
+    <graphics type='egl-headless'/>
982648
+    <video>
982648
+      <model type='qxl' ram='65536' vram='32768' vgamem='8192' heads='1'/>
982648
+    </video>
982648
+    <memballoon model='virtio'/>
982648
+  </devices>
982648
+</domain>
982648
diff --git a/tests/qemuxml2argvdata/graphics-vnc-egl-headless.args b/tests/qemuxml2argvdata/graphics-vnc-egl-headless.args
982648
new file mode 100644
982648
index 0000000000..2d2b3cf0fb
982648
--- /dev/null
982648
+++ b/tests/qemuxml2argvdata/graphics-vnc-egl-headless.args
982648
@@ -0,0 +1,28 @@
982648
+LC_ALL=C \
982648
+PATH=/bin \
982648
+HOME=/home/test \
982648
+USER=test \
982648
+LOGNAME=test \
982648
+QEMU_AUDIO_DRV=none \
982648
+/usr/bin/qemu-system-i686 \
982648
+-name QEMUGuest1 \
982648
+-S \
982648
+-machine pc,accel=tcg,usb=off,dump-guest-core=off \
982648
+-m 214 \
982648
+-smp 1,sockets=1,cores=1,threads=1 \
982648
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
982648
+-no-user-config \
982648
+-nodefaults \
982648
+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\
982648
+server,nowait \
982648
+-mon chardev=charmonitor,id=monitor,mode=control \
982648
+-rtc base=utc \
982648
+-no-shutdown \
982648
+-no-acpi \
982648
+-boot c \
982648
+-usb \
982648
+-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
982648
+-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
982648
+-vnc '[2001:1:2:3:4:5:1234:1234]:3' \
982648
+-display egl-headless \
982648
+-vga cirrus
982648
diff --git a/tests/qemuxml2argvdata/graphics-vnc-egl-headless.xml b/tests/qemuxml2argvdata/graphics-vnc-egl-headless.xml
982648
new file mode 100644
982648
index 0000000000..570cf2e50f
982648
--- /dev/null
982648
+++ b/tests/qemuxml2argvdata/graphics-vnc-egl-headless.xml
982648
@@ -0,0 +1,37 @@
982648
+<domain type='qemu'>
982648
+  <name>QEMUGuest1</name>
982648
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
982648
+  <memory unit='KiB'>219100</memory>
982648
+  <currentMemory unit='KiB'>219100</currentMemory>
982648
+  <vcpu placement='static'>1</vcpu>
982648
+  <os>
982648
+    <type arch='i686' machine='pc'>hvm</type>
982648
+    <boot dev='hd'/>
982648
+  </os>
982648
+  <clock offset='utc'/>
982648
+  <on_poweroff>destroy</on_poweroff>
982648
+  <on_reboot>restart</on_reboot>
982648
+  <on_crash>destroy</on_crash>
982648
+  <devices>
982648
+    <emulator>/usr/bin/qemu-system-i686</emulator>
982648
+    <disk type='block' device='disk'>
982648
+      <driver name='qemu' type='raw'/>
982648
+      <source dev='/dev/HostVG/QEMUGuest1'/>
982648
+      <target dev='hda' bus='ide'/>
982648
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
982648
+    </disk>
982648
+    <controller type='usb' index='0'/>
982648
+    <controller type='ide' index='0'/>
982648
+    <controller type='pci' index='0' model='pci-root'/>
982648
+    <input type='mouse' bus='ps2'/>
982648
+    <input type='keyboard' bus='ps2'/>
982648
+    <graphics type='vnc' port='5903' autoport='no' listen='2001:1:2:3:4:5:1234:1234'>
982648
+      <listen type='address' address='2001:1:2:3:4:5:1234:1234'/>
982648
+    </graphics>
982648
+    <graphics type='egl-headless'/>
982648
+    <video>
982648
+      <model type='cirrus' vram='16384' heads='1'/>
982648
+    </video>
982648
+    <memballoon model='none'/>
982648
+  </devices>
982648
+</domain>
982648
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
982648
index 3be5af03aa..848e40440a 100644
982648
--- a/tests/qemuxml2argvtest.c
982648
+++ b/tests/qemuxml2argvtest.c
982648
@@ -1167,6 +1167,10 @@ mymain(void)
982648
     DO_TEST_PARSE_ERROR("disk-scsi-incompatible-address",
982648
                         QEMU_CAPS_VIRTIO_SCSI);
982648
 
982648
+    DO_TEST("graphics-egl-headless",
982648
+            QEMU_CAPS_EGL_HEADLESS,
982648
+            QEMU_CAPS_DEVICE_CIRRUS_VGA);
982648
+
982648
     DO_TEST("graphics-vnc", QEMU_CAPS_VNC, QEMU_CAPS_DEVICE_CIRRUS_VGA);
982648
     DO_TEST("graphics-vnc-socket", QEMU_CAPS_VNC, QEMU_CAPS_DEVICE_CIRRUS_VGA);
982648
     DO_TEST("graphics-vnc-websocket", QEMU_CAPS_VNC, QEMU_CAPS_VNC_WEBSOCKET,
982648
@@ -1198,9 +1202,14 @@ mymain(void)
982648
     driver.config->vncSASL = driver.config->vncTLSx509verify = driver.config->vncTLS = 0;
982648
     VIR_FREE(driver.config->vncSASLdir);
982648
     VIR_FREE(driver.config->vncTLSx509certdir);
982648
+    DO_TEST("graphics-vnc-egl-headless",
982648
+            QEMU_CAPS_VNC,
982648
+            QEMU_CAPS_EGL_HEADLESS,
982648
+            QEMU_CAPS_DEVICE_CIRRUS_VGA);
982648
 
982648
     DO_TEST("graphics-sdl",
982648
             QEMU_CAPS_DEVICE_VGA);
982648
+    DO_TEST_FAILURE("graphics-sdl-egl-headless", NONE);
982648
     DO_TEST("graphics-sdl-fullscreen",
982648
             QEMU_CAPS_DEVICE_CIRRUS_VGA);
982648
     DO_TEST("graphics-spice",
982648
@@ -1255,6 +1264,14 @@ mymain(void)
982648
             QEMU_CAPS_SPICE_UNIX,
982648
             QEMU_CAPS_DEVICE_CIRRUS_VGA);
982648
     driver.config->spiceAutoUnixSocket = false;
982648
+    DO_TEST("graphics-spice-egl-headless",
982648
+            QEMU_CAPS_SPICE,
982648
+            QEMU_CAPS_EGL_HEADLESS,
982648
+            QEMU_CAPS_DEVICE_QXL);
982648
+    DO_TEST_FAILURE("graphics-spice-invalid-egl-headless",
982648
+                    QEMU_CAPS_SPICE,
982648
+                    QEMU_CAPS_EGL_HEADLESS,
982648
+                    QEMU_CAPS_DEVICE_QXL);
982648
 
982648
     DO_TEST("input-usbmouse", NONE);
982648
     DO_TEST("input-usbtablet", NONE);
982648
diff --git a/tests/qemuxml2xmloutdata/graphics-spice-egl-headless.xml b/tests/qemuxml2xmloutdata/graphics-spice-egl-headless.xml
982648
new file mode 100644
982648
index 0000000000..6d96264914
982648
--- /dev/null
982648
+++ b/tests/qemuxml2xmloutdata/graphics-spice-egl-headless.xml
982648
@@ -0,0 +1,44 @@
982648
+<domain type='qemu'>
982648
+  <name>QEMUGuest1</name>
982648
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
982648
+  <memory unit='KiB'>219136</memory>
982648
+  <currentMemory unit='KiB'>219136</currentMemory>
982648
+  <vcpu placement='static'>1</vcpu>
982648
+  <os>
982648
+    <type arch='i686' machine='pc'>hvm</type>
982648
+    <boot dev='hd'/>
982648
+  </os>
982648
+  <clock offset='utc'/>
982648
+  <on_poweroff>destroy</on_poweroff>
982648
+  <on_reboot>restart</on_reboot>
982648
+  <on_crash>destroy</on_crash>
982648
+  <devices>
982648
+    <emulator>/usr/bin/qemu-system-i686</emulator>
982648
+    <disk type='block' device='disk'>
982648
+      <driver name='qemu' type='raw'/>
982648
+      <source dev='/dev/HostVG/QEMUGuest1'/>
982648
+      <target dev='hda' bus='ide'/>
982648
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
982648
+    </disk>
982648
+    <controller type='usb' index='0'>
982648
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
982648
+    </controller>
982648
+    <controller type='ide' index='0'>
982648
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
982648
+    </controller>
982648
+    <controller type='pci' index='0' model='pci-root'/>
982648
+    <input type='mouse' bus='ps2'/>
982648
+    <input type='keyboard' bus='ps2'/>
982648
+    <graphics type='spice' port='5903' autoport='no' listen='127.0.0.1'>
982648
+      <listen type='address' address='127.0.0.1'/>
982648
+    </graphics>
982648
+    <graphics type='egl-headless'/>
982648
+    <video>
982648
+      <model type='qxl' ram='65536' vram='32768' vgamem='8192' heads='1' primary='yes'/>
982648
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
982648
+    </video>
982648
+    <memballoon model='virtio'>
982648
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
982648
+    </memballoon>
982648
+  </devices>
982648
+</domain>
982648
diff --git a/tests/qemuxml2xmloutdata/graphics-vnc-egl-headless.xml b/tests/qemuxml2xmloutdata/graphics-vnc-egl-headless.xml
982648
new file mode 100644
982648
index 0000000000..4155c10397
982648
--- /dev/null
982648
+++ b/tests/qemuxml2xmloutdata/graphics-vnc-egl-headless.xml
982648
@@ -0,0 +1,42 @@
982648
+<domain type='qemu'>
982648
+  <name>QEMUGuest1</name>
982648
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
982648
+  <memory unit='KiB'>219100</memory>
982648
+  <currentMemory unit='KiB'>219100</currentMemory>
982648
+  <vcpu placement='static'>1</vcpu>
982648
+  <os>
982648
+    <type arch='i686' machine='pc'>hvm</type>
982648
+    <boot dev='hd'/>
982648
+  </os>
982648
+  <clock offset='utc'/>
982648
+  <on_poweroff>destroy</on_poweroff>
982648
+  <on_reboot>restart</on_reboot>
982648
+  <on_crash>destroy</on_crash>
982648
+  <devices>
982648
+    <emulator>/usr/bin/qemu-system-i686</emulator>
982648
+    <disk type='block' device='disk'>
982648
+      <driver name='qemu' type='raw'/>
982648
+      <source dev='/dev/HostVG/QEMUGuest1'/>
982648
+      <target dev='hda' bus='ide'/>
982648
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
982648
+    </disk>
982648
+    <controller type='usb' index='0'>
982648
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
982648
+    </controller>
982648
+    <controller type='ide' index='0'>
982648
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
982648
+    </controller>
982648
+    <controller type='pci' index='0' model='pci-root'/>
982648
+    <input type='mouse' bus='ps2'/>
982648
+    <input type='keyboard' bus='ps2'/>
982648
+    <graphics type='vnc' port='5903' autoport='no' listen='2001:1:2:3:4:5:1234:1234'>
982648
+      <listen type='address' address='2001:1:2:3:4:5:1234:1234'/>
982648
+    </graphics>
982648
+    <graphics type='egl-headless'/>
982648
+    <video>
982648
+      <model type='cirrus' vram='16384' heads='1' primary='yes'/>
982648
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
982648
+    </video>
982648
+    <memballoon model='none'/>
982648
+  </devices>
982648
+</domain>
982648
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
982648
index bbb995656e..fa57221d62 100644
982648
--- a/tests/qemuxml2xmltest.c
982648
+++ b/tests/qemuxml2xmltest.c
982648
@@ -417,6 +417,7 @@ mymain(void)
982648
     cfg->vncAutoUnixSocket = false;
982648
     DO_TEST("graphics-vnc-socket", NONE);
982648
     DO_TEST("graphics-vnc-auto-socket", NONE);
982648
+    DO_TEST("graphics-vnc-egl-headless", NONE);
982648
 
982648
     DO_TEST("graphics-sdl", NONE);
982648
     DO_TEST("graphics-sdl-fullscreen", NONE);
982648
@@ -428,6 +429,7 @@ mymain(void)
982648
     cfg->spiceAutoUnixSocket = true;
982648
     DO_TEST("graphics-spice-auto-socket-cfg", NONE);
982648
     cfg->spiceAutoUnixSocket = false;
982648
+    DO_TEST("graphics-spice-egl-headless", NONE);
982648
 
982648
     DO_TEST("input-usbmouse", NONE);
982648
     DO_TEST("input-usbtablet", NONE);
982648
-- 
982648
2.18.0
982648