mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-28 19:41:16 +00:00
conf: Introduce virDomainGraphics-related helpers
A few simple helpers that allow us to determine whether a graphics can and will need to make use of a DRM render node. Signed-off-by: Erik Skultety <eskultet@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
394809694a
commit
255e073263
@ -30933,3 +30933,46 @@ virDomainGraphicsDefHasOpenGL(const virDomainDef *def)
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
virDomainGraphicsSupportsRenderNode(const virDomainGraphicsDef *graphics)
|
||||
{
|
||||
return graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE;
|
||||
}
|
||||
|
||||
|
||||
const char *
|
||||
virDomainGraphicsGetRenderNode(const virDomainGraphicsDef *graphics)
|
||||
{
|
||||
const char *ret = NULL;
|
||||
|
||||
switch (graphics->type) {
|
||||
case VIR_DOMAIN_GRAPHICS_TYPE_SPICE:
|
||||
if (graphics->data.spice.gl == VIR_TRISTATE_BOOL_YES)
|
||||
ret = graphics->data.spice.rendernode;
|
||||
break;
|
||||
case VIR_DOMAIN_GRAPHICS_TYPE_EGL_HEADLESS:
|
||||
case VIR_DOMAIN_GRAPHICS_TYPE_SDL:
|
||||
case VIR_DOMAIN_GRAPHICS_TYPE_VNC:
|
||||
case VIR_DOMAIN_GRAPHICS_TYPE_RDP:
|
||||
case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP:
|
||||
case VIR_DOMAIN_GRAPHICS_TYPE_LAST:
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
virDomainGraphicsNeedsAutoRenderNode(const virDomainGraphicsDef *graphics)
|
||||
{
|
||||
if (!virDomainGraphicsSupportsRenderNode(graphics))
|
||||
return false;
|
||||
|
||||
if (virDomainGraphicsGetRenderNode(graphics))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -3668,4 +3668,13 @@ virDomainDefHasManagedPR(const virDomainDef *def);
|
||||
bool
|
||||
virDomainGraphicsDefHasOpenGL(const virDomainDef *def);
|
||||
|
||||
bool
|
||||
virDomainGraphicsSupportsRenderNode(const virDomainGraphicsDef *graphics);
|
||||
|
||||
const char *
|
||||
virDomainGraphicsGetRenderNode(const virDomainGraphicsDef *graphics);
|
||||
|
||||
bool
|
||||
virDomainGraphicsNeedsAutoRenderNode(const virDomainGraphicsDef *graphics);
|
||||
|
||||
#endif /* __DOMAIN_CONF_H */
|
||||
|
@ -372,8 +372,10 @@ virDomainGraphicsAuthConnectedTypeToString;
|
||||
virDomainGraphicsDefFree;
|
||||
virDomainGraphicsDefHasOpenGL;
|
||||
virDomainGraphicsGetListen;
|
||||
virDomainGraphicsGetRenderNode;
|
||||
virDomainGraphicsListenAppendAddress;
|
||||
virDomainGraphicsListenAppendSocket;
|
||||
virDomainGraphicsNeedsAutoRenderNode;
|
||||
virDomainGraphicsSpiceChannelModeTypeFromString;
|
||||
virDomainGraphicsSpiceChannelModeTypeToString;
|
||||
virDomainGraphicsSpiceChannelNameTypeFromString;
|
||||
@ -388,6 +390,7 @@ virDomainGraphicsSpiceStreamingModeTypeFromString;
|
||||
virDomainGraphicsSpiceStreamingModeTypeToString;
|
||||
virDomainGraphicsSpiceZlibCompressionTypeFromString;
|
||||
virDomainGraphicsSpiceZlibCompressionTypeToString;
|
||||
virDomainGraphicsSupportsRenderNode;
|
||||
virDomainGraphicsTypeFromString;
|
||||
virDomainGraphicsTypeToString;
|
||||
virDomainGraphicsVNCSharePolicyTypeFromString;
|
||||
|
Loading…
Reference in New Issue
Block a user