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@xxxxxxxxxx> --- src/conf/domain_conf.c | 41 ++++++++++++++++++++++++++++++++++++++++ src/conf/domain_conf.h | 9 +++++++++ src/libvirt_private.syms | 3 +++ 3 files changed, 53 insertions(+) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index a7ab3e26f1..6ae98435cc 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -30933,3 +30933,44 @@ 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 +virDomainGraphicsNeedsRenderNode(const virDomainGraphicsDef *graphics) +{ + if (!virDomainGraphicsSupportsRenderNode(graphics) || + virDomainGraphicsGetRenderNode(graphics)) + return false; + + return true; +} diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 7a724fbc6f..39dc33db8f 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -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 +virDomainGraphicsNeedsRenderNode(const virDomainGraphicsDef *graphics); + #endif /* __DOMAIN_CONF_H */ diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index c7f08f9620..d34a387485 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -372,8 +372,10 @@ virDomainGraphicsAuthConnectedTypeToString; virDomainGraphicsDefFree; virDomainGraphicsDefHasOpenGL; virDomainGraphicsGetListen; +virDomainGraphicsGetRenderNode; virDomainGraphicsListenAppendAddress; virDomainGraphicsListenAppendSocket; +virDomainGraphicsNeedsRenderNode; virDomainGraphicsSpiceChannelModeTypeFromString; virDomainGraphicsSpiceChannelModeTypeToString; virDomainGraphicsSpiceChannelNameTypeFromString; @@ -388,6 +390,7 @@ virDomainGraphicsSpiceStreamingModeTypeFromString; virDomainGraphicsSpiceStreamingModeTypeToString; virDomainGraphicsSpiceZlibCompressionTypeFromString; virDomainGraphicsSpiceZlibCompressionTypeToString; +virDomainGraphicsSupportsRenderNode; virDomainGraphicsTypeFromString; virDomainGraphicsTypeToString; virDomainGraphicsVNCSharePolicyTypeFromString; -- 2.19.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list