mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-20 07:59:00 +00:00
conf: Introduce virDomainGraphicsDefHasOpenGL helper
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>
This commit is contained in:
parent
11c7bdac6d
commit
425329181f
@ -30274,3 +30274,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;
|
||||
}
|
||||
|
@ -3642,4 +3642,7 @@ virDomainDiskGetDetectZeroesMode(virDomainDiskDiscard discard,
|
||||
bool
|
||||
virDomainDefHasManagedPR(const virDomainDef *def);
|
||||
|
||||
bool
|
||||
virDomainGraphicsDefHasOpenGL(const virDomainDef *def);
|
||||
|
||||
#endif /* __DOMAIN_CONF_H */
|
||||
|
@ -359,6 +359,7 @@ virDomainGetFilesystemForTarget;
|
||||
virDomainGraphicsAuthConnectedTypeFromString;
|
||||
virDomainGraphicsAuthConnectedTypeToString;
|
||||
virDomainGraphicsDefFree;
|
||||
virDomainGraphicsDefHasOpenGL;
|
||||
virDomainGraphicsGetListen;
|
||||
virDomainGraphicsListenAppendAddress;
|
||||
virDomainGraphicsListenAppendSocket;
|
||||
|
Loading…
x
Reference in New Issue
Block a user