edecca
From 4628d3e178430d418703f39e86d63e22a6af209f Mon Sep 17 00:00:00 2001
edecca
Message-Id: <4628d3e178430d418703f39e86d63e22a6af209f@dist-git>
edecca
From: Erik Skultety <eskultet@redhat.com>
edecca
Date: Thu, 19 Jul 2018 15:03:57 +0200
edecca
Subject: [PATCH] qemu: caps: Introduce a capability for egl-headless
edecca
MIME-Version: 1.0
edecca
Content-Type: text/plain; charset=UTF-8
edecca
Content-Transfer-Encoding: 8bit
edecca
edecca
Since QEMU 2.10, it's possible to use a new type of display -
edecca
egl-headless which uses drm nodes to provide OpenGL support. This patch
edecca
adds a capability for that. However, since QEMU doesn't provide a QMP
edecca
command to probe it, we have to base the capability on specific QEMU
edecca
version.
edecca
edecca
Acked-by: Michal Privoznik <mprivozn@redhat.com>
edecca
Reviewed-by: Ján Tomko <jtomko@redhat.com>
edecca
Signed-off-by: Erik Skultety <eskultet@redhat.com>
edecca
(cherry picked from commit 7ab7d0ed49d8501198b33c655cc646667d333f8c)
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
 src/qemu/qemu_capabilities.c                       | 6 ++++++
edecca
 src/qemu/qemu_capabilities.h                       | 1 +
edecca
 tests/qemucapabilitiesdata/caps_2.10.0.aarch64.xml | 1 +
edecca
 tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml   | 1 +
edecca
 tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml   | 1 +
edecca
 tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml  | 1 +
edecca
 tests/qemucapabilitiesdata/caps_2.11.0.s390x.xml   | 1 +
edecca
 tests/qemucapabilitiesdata/caps_2.11.0.x86_64.xml  | 1 +
edecca
 tests/qemucapabilitiesdata/caps_2.12.0.aarch64.xml | 1 +
edecca
 tests/qemucapabilitiesdata/caps_2.12.0.ppc64.xml   | 1 +
edecca
 tests/qemucapabilitiesdata/caps_2.12.0.s390x.xml   | 1 +
edecca
 tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml  | 1 +
edecca
 tests/qemucapabilitiesdata/caps_3.0.0.ppc64.xml    | 1 +
edecca
 tests/qemucapabilitiesdata/caps_3.0.0.x86_64.xml   | 1 +
edecca
 14 files changed, 19 insertions(+)
edecca
edecca
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
edecca
index 23b483349f..df358f8967 100644
edecca
--- a/src/qemu/qemu_capabilities.c
edecca
+++ b/src/qemu/qemu_capabilities.c
edecca
@@ -503,6 +503,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
edecca
               "machine.pseries.cap-hpt-max-page-size",
edecca
               "machine.pseries.cap-htm",
edecca
               "usb-storage.werror",
edecca
+              "egl-headless",
edecca
     );
edecca
 
edecca
 
edecca
@@ -4030,6 +4031,11 @@ virQEMUCapsInitQMPMonitor(virQEMUCapsPtr qemuCaps,
edecca
         virQEMUCapsSet(qemuCaps, QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT);
edecca
     }
edecca
 
edecca
+    /* '-display egl-headless' cmdline option is supported since QEMU 2.10, but
edecca
+     * there's no way to probe it */
edecca
+    if (qemuCaps->version >= 2010000)
edecca
+        virQEMUCapsSet(qemuCaps, QEMU_CAPS_EGL_HEADLESS);
edecca
+
edecca
     /* no way to query for -numa dist */
edecca
     if (qemuCaps->version >= 2010000)
edecca
         virQEMUCapsSet(qemuCaps, QEMU_CAPS_NUMA_DIST);
edecca
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
edecca
index 1fa0ebfea3..55221e7e57 100644
edecca
--- a/src/qemu/qemu_capabilities.h
edecca
+++ b/src/qemu/qemu_capabilities.h
edecca
@@ -487,6 +487,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */
edecca
     QEMU_CAPS_MACHINE_PSERIES_CAP_HPT_MAX_PAGE_SIZE, /* -machine pseries.cap-hpt-max-page-size */
edecca
     QEMU_CAPS_MACHINE_PSERIES_CAP_HTM, /* -machine pseries.cap-htm */
edecca
     QEMU_CAPS_USB_STORAGE_WERROR, /* -device usb-storage,werror=..,rerror=.. */
edecca
+    QEMU_CAPS_EGL_HEADLESS, /* -display egl-headless */
edecca
 
edecca
     QEMU_CAPS_LAST /* this must always be the last item */
edecca
 } virQEMUCapsFlags;
edecca
diff --git a/tests/qemucapabilitiesdata/caps_2.10.0.aarch64.xml b/tests/qemucapabilitiesdata/caps_2.10.0.aarch64.xml
edecca
index 169641063c..a70e050765 100644
edecca
--- a/tests/qemucapabilitiesdata/caps_2.10.0.aarch64.xml
edecca
+++ b/tests/qemucapabilitiesdata/caps_2.10.0.aarch64.xml
edecca
@@ -159,6 +159,7 @@
edecca
   <flag name='hda-output'/>
edecca
   <flag name='blockdev-del'/>
edecca
   <flag name='vhost-vsock'/>
edecca
+  <flag name='egl-headless'/>
edecca
   <version>2010000</version>
edecca
   <kvmVersion>0</kvmVersion>
edecca
   <microcodeVersion>307647</microcodeVersion>
edecca
diff --git a/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml
edecca
index 92c095abd2..72709905d8 100644
edecca
--- a/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml
edecca
+++ b/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml
edecca
@@ -158,6 +158,7 @@
edecca
   <flag name='hda-output'/>
edecca
   <flag name='blockdev-del'/>
edecca
   <flag name='vhost-vsock'/>
edecca
+  <flag name='egl-headless'/>
edecca
   <version>2010000</version>
edecca
   <kvmVersion>0</kvmVersion>
edecca
   <microcodeVersion>386992</microcodeVersion>
edecca
diff --git a/tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml b/tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml
edecca
index 5e22e21224..7347f5683f 100644
edecca
--- a/tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml
edecca
+++ b/tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml
edecca
@@ -119,6 +119,7 @@
edecca
   <flag name='sdl-gl'/>
edecca
   <flag name='blockdev-del'/>
edecca
   <flag name='vhost-vsock'/>
edecca
+  <flag name='egl-headless'/>
edecca
   <version>2010000</version>
edecca
   <kvmVersion>0</kvmVersion>
edecca
   <microcodeVersion>307899</microcodeVersion>
edecca
diff --git a/tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml
edecca
index 10b066bff1..d69a148cd2 100644
edecca
--- a/tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml
edecca
+++ b/tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml
edecca
@@ -203,6 +203,7 @@
edecca
   <flag name='vmgenid'/>
edecca
   <flag name='vhost-vsock'/>
edecca
   <flag name='mch'/>
edecca
+  <flag name='egl-headless'/>
edecca
   <version>2010000</version>
edecca
   <kvmVersion>0</kvmVersion>
edecca
   <microcodeVersion>367995</microcodeVersion>
edecca
diff --git a/tests/qemucapabilitiesdata/caps_2.11.0.s390x.xml b/tests/qemucapabilitiesdata/caps_2.11.0.s390x.xml
edecca
index 6ca2e57ef8..b359f9a049 100644
edecca
--- a/tests/qemucapabilitiesdata/caps_2.11.0.s390x.xml
edecca
+++ b/tests/qemucapabilitiesdata/caps_2.11.0.s390x.xml
edecca
@@ -126,6 +126,7 @@
edecca
   <flag name='blockdev-del'/>
edecca
   <flag name='vhost-vsock'/>
edecca
   <flag name='tpm-emulator'/>
edecca
+  <flag name='egl-headless'/>
edecca
   <version>2011000</version>
edecca
   <kvmVersion>0</kvmVersion>
edecca
   <microcodeVersion>346751</microcodeVersion>
edecca
diff --git a/tests/qemucapabilitiesdata/caps_2.11.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.11.0.x86_64.xml
edecca
index c52e44a498..210f774c4e 100644
edecca
--- a/tests/qemucapabilitiesdata/caps_2.11.0.x86_64.xml
edecca
+++ b/tests/qemucapabilitiesdata/caps_2.11.0.x86_64.xml
edecca
@@ -207,6 +207,7 @@
edecca
   <flag name='tpm-emulator'/>
edecca
   <flag name='mch'/>
edecca
   <flag name='mch.extended-tseg-mbytes'/>
edecca
+  <flag name='egl-headless'/>
edecca
   <version>2011000</version>
edecca
   <kvmVersion>0</kvmVersion>
edecca
   <microcodeVersion>371455</microcodeVersion>
edecca
diff --git a/tests/qemucapabilitiesdata/caps_2.12.0.aarch64.xml b/tests/qemucapabilitiesdata/caps_2.12.0.aarch64.xml
edecca
index ecc029f403..80e7afec04 100644
edecca
--- a/tests/qemucapabilitiesdata/caps_2.12.0.aarch64.xml
edecca
+++ b/tests/qemucapabilitiesdata/caps_2.12.0.aarch64.xml
edecca
@@ -169,6 +169,7 @@
edecca
   <flag name='vhost-vsock'/>
edecca
   <flag name='chardev-fd-pass'/>
edecca
   <flag name='tpm-emulator'/>
edecca
+  <flag name='egl-headless'/>
edecca
   <version>2011090</version>
edecca
   <kvmVersion>0</kvmVersion>
edecca
   <microcodeVersion>347550</microcodeVersion>
edecca
diff --git a/tests/qemucapabilitiesdata/caps_2.12.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_2.12.0.ppc64.xml
edecca
index 7139179304..c4b09c0003 100644
edecca
--- a/tests/qemucapabilitiesdata/caps_2.12.0.ppc64.xml
edecca
+++ b/tests/qemucapabilitiesdata/caps_2.12.0.ppc64.xml
edecca
@@ -167,6 +167,7 @@
edecca
   <flag name='chardev-fd-pass'/>
edecca
   <flag name='tpm-emulator'/>
edecca
   <flag name='machine.pseries.cap-htm'/>
edecca
+  <flag name='egl-headless'/>
edecca
   <version>2011090</version>
edecca
   <kvmVersion>0</kvmVersion>
edecca
   <microcodeVersion>428334</microcodeVersion>
edecca
diff --git a/tests/qemucapabilitiesdata/caps_2.12.0.s390x.xml b/tests/qemucapabilitiesdata/caps_2.12.0.s390x.xml
edecca
index 87d189e58d..1ff2fe45e1 100644
edecca
--- a/tests/qemucapabilitiesdata/caps_2.12.0.s390x.xml
edecca
+++ b/tests/qemucapabilitiesdata/caps_2.12.0.s390x.xml
edecca
@@ -133,6 +133,7 @@
edecca
   <flag name='vhost-vsock'/>
edecca
   <flag name='chardev-fd-pass'/>
edecca
   <flag name='tpm-emulator'/>
edecca
+  <flag name='egl-headless'/>
edecca
   <version>2012000</version>
edecca
   <kvmVersion>0</kvmVersion>
edecca
   <microcodeVersion>375999</microcodeVersion>
edecca
diff --git a/tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml
edecca
index 9c1f6c327c..37d17786cf 100644
edecca
--- a/tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml
edecca
+++ b/tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml
edecca
@@ -211,6 +211,7 @@
edecca
   <flag name='mch'/>
edecca
   <flag name='mch.extended-tseg-mbytes'/>
edecca
   <flag name='sev-guest'/>
edecca
+  <flag name='egl-headless'/>
edecca
   <version>2011090</version>
edecca
   <kvmVersion>0</kvmVersion>
edecca
   <microcodeVersion>416196</microcodeVersion>
edecca
diff --git a/tests/qemucapabilitiesdata/caps_3.0.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_3.0.0.ppc64.xml
edecca
index 33cd00e613..57bf5dba11 100644
edecca
--- a/tests/qemucapabilitiesdata/caps_3.0.0.ppc64.xml
edecca
+++ b/tests/qemucapabilitiesdata/caps_3.0.0.ppc64.xml
edecca
@@ -167,6 +167,7 @@
edecca
   <flag name='tpm-emulator'/>
edecca
   <flag name='machine.pseries.cap-hpt-max-page-size'/>
edecca
   <flag name='machine.pseries.cap-htm'/>
edecca
+  <flag name='egl-headless'/>
edecca
   <version>2012050</version>
edecca
   <kvmVersion>0</kvmVersion>
edecca
   <microcodeVersion>446771</microcodeVersion>
edecca
diff --git a/tests/qemucapabilitiesdata/caps_3.0.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_3.0.0.x86_64.xml
edecca
index cd036d9323..431910a9e3 100644
edecca
--- a/tests/qemucapabilitiesdata/caps_3.0.0.x86_64.xml
edecca
+++ b/tests/qemucapabilitiesdata/caps_3.0.0.x86_64.xml
edecca
@@ -214,6 +214,7 @@
edecca
   <flag name='mch.extended-tseg-mbytes'/>
edecca
   <flag name='sev-guest'/>
edecca
   <flag name='usb-storage.werror'/>
edecca
+  <flag name='egl-headless'/>
edecca
   <version>2012090</version>
edecca
   <kvmVersion>0</kvmVersion>
edecca
   <microcodeVersion>438109</microcodeVersion>
edecca
-- 
edecca
2.18.0
edecca