[libvirt] [RFC PATCH 3/7] conf: Introduce virDomainDefHasSpiceGL helper

Erik Skultety eskultet at redhat.com
Wed May 30 13:42:57 UTC 2018


This helper will later help us to make corresponding changes when
building QEMU cmdline, depending on what implementation of vfio-pci
display should be used - dmabuf (requires OpenGL) vs vfio region mapping
(doesn't need OpenGL).

Signed-off-by: Erik Skultety <eskultet at redhat.com>
---
 src/conf/domain_conf.c   | 24 ++++++++++++++++++++++++
 src/conf/domain_conf.h   |  3 +++
 src/libvirt_private.syms |  1 +
 3 files changed, 28 insertions(+)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 62bd17739c..c868d8de08 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -29927,3 +29927,27 @@ virDomainDefHasManagedPR(const virDomainDef *def)
 
     return false;
 }
+
+
+/**
+ * virDomainDefHasSpiceGL:
+ * @def: domain definition
+ *
+ * Returns true if we have a SPICE graphic frame buffer with OpenGL enabled,
+ * false otherwise
+ */
+bool
+virDomainDefHasSpiceGL(const virDomainDef *def)
+{
+    size_t i;
+
+    for (i = 0; i < def->ngraphics; i++) {
+        virDomainGraphicsDefPtr gfx = def->graphics[i];
+
+        if (gfx->type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE &&
+            gfx->data.spice.gl == VIR_TRISTATE_BOOL_YES)
+            return true;
+    }
+
+    return false;
+}
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 6cc8f8a29b..8493dfdd76 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -3592,4 +3592,7 @@ virDomainDiskGetDetectZeroesMode(virDomainDiskDiscard discard,
 bool
 virDomainDefHasManagedPR(const virDomainDef *def);
 
+bool
+virDomainDefHasSpiceGL(const virDomainDef *def);
+
 #endif /* __DOMAIN_CONF_H */
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 6001635916..b18f2fd5ea 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -278,6 +278,7 @@ virDomainDefHasDeviceAddress;
 virDomainDefHasManagedPR;
 virDomainDefHasMemballoon;
 virDomainDefHasMemoryHotplug;
+virDomainDefHasSpiceGL;
 virDomainDefHasUSB;
 virDomainDefHasVcpusOffline;
 virDomainDefLifecycleActionAllowed;
-- 
2.14.3




More information about the libvir-list mailing list