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

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

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

edecca
+            

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

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

edecca
             

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

edecca
           
edecca
+          
egl-headlessSince 4.6.0
edecca
+          
edecca
+            

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

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