106 lines
3.4 KiB
Diff
106 lines
3.4 KiB
Diff
From e6b37b93dd6e7ec133378aec04dd9c96e0ab57cb Mon Sep 17 00:00:00 2001
|
|
Message-Id: <e6b37b93dd6e7ec133378aec04dd9c96e0ab57cb@dist-git>
|
|
From: Erik Skultety <eskultet@redhat.com>
|
|
Date: Thu, 19 Jul 2018 15:04:00 +0200
|
|
Subject: [PATCH] conf: Introduce virDomainGraphicsDefHasOpenGL helper
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
A simple helper which will loop through all the graphics elements and
|
|
checks whether at least one of them enables OpenGL support, either by
|
|
containing <gl enable='yes'/> or being of type 'egl-headless'.
|
|
|
|
Signed-off-by: Erik Skultety <eskultet@redhat.com>
|
|
Acked-by: Michal Privoznik <mprivozn@redhat.com>
|
|
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
(cherry picked from commit 425329181f1db19f34a8ffffc1da9afa7f323f13)
|
|
|
|
https://bugzilla.redhat.com/show_bug.cgi?id=1475770
|
|
Signed-off-by: Erik Skultety <eskultet@redhat.com>
|
|
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
---
|
|
src/conf/domain_conf.c | 43 ++++++++++++++++++++++++++++++++++++++++
|
|
src/conf/domain_conf.h | 3 +++
|
|
src/libvirt_private.syms | 1 +
|
|
3 files changed, 47 insertions(+)
|
|
|
|
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
|
index fa4dfafcff..08654ab41d 100644
|
|
--- a/src/conf/domain_conf.c
|
|
+++ b/src/conf/domain_conf.c
|
|
@@ -30284,3 +30284,46 @@ virDomainDefHasManagedPR(const virDomainDef *def)
|
|
|
|
return false;
|
|
}
|
|
+
|
|
+
|
|
+/**
|
|
+ * virDomainGraphicsDefHasOpenGL:
|
|
+ * @def: domain definition
|
|
+ *
|
|
+ * Returns true if a domain config contains at least one <graphics> element
|
|
+ * with OpenGL support enabled, false otherwise.
|
|
+ */
|
|
+bool
|
|
+virDomainGraphicsDefHasOpenGL(const virDomainDef *def)
|
|
+{
|
|
+ size_t i;
|
|
+
|
|
+ for (i = 0; i < def->ngraphics; i++) {
|
|
+ virDomainGraphicsDefPtr graphics = def->graphics[i];
|
|
+
|
|
+ /* we only care about OpenGL support for a given type here */
|
|
+ switch (graphics->type) {
|
|
+ case VIR_DOMAIN_GRAPHICS_TYPE_VNC:
|
|
+ case VIR_DOMAIN_GRAPHICS_TYPE_RDP:
|
|
+ case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP:
|
|
+ continue;
|
|
+ case VIR_DOMAIN_GRAPHICS_TYPE_SDL:
|
|
+ if (graphics->data.sdl.gl == VIR_TRISTATE_BOOL_YES)
|
|
+ return true;
|
|
+
|
|
+ continue;
|
|
+ case VIR_DOMAIN_GRAPHICS_TYPE_SPICE:
|
|
+ if (graphics->data.spice.gl == VIR_TRISTATE_BOOL_YES)
|
|
+ return true;
|
|
+
|
|
+ continue;
|
|
+ case VIR_DOMAIN_GRAPHICS_TYPE_EGL_HEADLESS:
|
|
+ return true;
|
|
+
|
|
+ case VIR_DOMAIN_GRAPHICS_TYPE_LAST:
|
|
+ break;
|
|
+ }
|
|
+ }
|
|
+
|
|
+ return false;
|
|
+}
|
|
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
|
|
index 26f75b15d0..3deda1d978 100644
|
|
--- a/src/conf/domain_conf.h
|
|
+++ b/src/conf/domain_conf.h
|
|
@@ -3642,4 +3642,7 @@ virDomainDiskGetDetectZeroesMode(virDomainDiskDiscard discard,
|
|
bool
|
|
virDomainDefHasManagedPR(const virDomainDef *def);
|
|
|
|
+bool
|
|
+virDomainGraphicsDefHasOpenGL(const virDomainDef *def);
|
|
+
|
|
#endif /* __DOMAIN_CONF_H */
|
|
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
|
|
index 5bd08d3f67..86846f3b08 100644
|
|
--- a/src/libvirt_private.syms
|
|
+++ b/src/libvirt_private.syms
|
|
@@ -368,6 +368,7 @@ virDomainGetFilesystemForTarget;
|
|
virDomainGraphicsAuthConnectedTypeFromString;
|
|
virDomainGraphicsAuthConnectedTypeToString;
|
|
virDomainGraphicsDefFree;
|
|
+virDomainGraphicsDefHasOpenGL;
|
|
virDomainGraphicsGetListen;
|
|
virDomainGraphicsListenAppendAddress;
|
|
virDomainGraphicsListenAppendSocket;
|
|
--
|
|
2.18.0
|
|
|