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

Erik Skultety posted 7 patches 6 years, 11 months ago
[libvirt] [RFC PATCH 3/7] conf: Introduce virDomainDefHasSpiceGL helper
Posted by Erik Skultety 6 years, 11 months ago
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@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

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [RFC PATCH 3/7] conf: Introduce virDomainDefHasSpiceGL helper
Posted by John Ferlan 6 years, 11 months ago

On 05/30/2018 09:42 AM, Erik Skultety wrote:
> 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@redhat.com>
> ---
>  src/conf/domain_conf.c   | 24 ++++++++++++++++++++++++
>  src/conf/domain_conf.h   |  3 +++
>  src/libvirt_private.syms |  1 +
>  3 files changed, 28 insertions(+)
> 

Although this could move to the patch before it used (e.g. patch 7).

Reviewed-by: John Ferlan <jferlan@redhat.com>

John

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list