s/conf/qemu/ in the commit summary, since you chose to group the XML parser and the QEMU driver changes in one commit. On Wed, Jul 11, 2018 at 03:58:22PM +0200, Erik Skultety wrote:
Since 2.10 QEMU supports a new display type egl-headless which uses the drm nodes for OpenGL rendering copying back the rendered bits back to QEMU into a dma-buf which can be accessed by standard "display" apps like VNC or SPICE. Although this display type can be used on its own, for any practical use case it makes sense to pair it with either VNC or SPICE display. The clear benefit of this display is that VNC gains OpenGL support, which it natively doesn't have, and SPICE gains remote OpenGL support (native OpenGL support only works locally through a UNIX socket, i.e. listen type=socket/none) Signed-off-by: Erik Skultety <eskultet@xxxxxxxxxx> --- docs/formatdomain.html.in | 33 +++++++++++++- docs/schemas/domaincommon.rng | 3 ++ src/conf/domain_conf.c | 6 ++- src/conf/domain_conf.h | 1 + src/libxl/libxl_conf.c | 1 + src/qemu/qemu_command.c | 35 ++++++++++++++- src/qemu/qemu_domain.c | 52 +++++++++++++++++++++- src/qemu/qemu_driver.c | 2 + src/qemu/qemu_hotplug.c | 1 + src/qemu/qemu_process.c | 4 ++ src/vmx/vmx.c | 1 + tests/domaincapsschemadata/full.xml | 1 + tests/qemuxml2argvdata/graphics-egl-headless.args | 26 +++++++++++ tests/qemuxml2argvdata/graphics-egl-headless.xml | 31 +++++++++++++ .../qemuxml2argvdata/graphics-sdl-egl-headless.xml | 35 +++++++++++++++ .../graphics-spice-egl-headless.args | 31 +++++++++++++ .../graphics-spice-egl-headless.xml | 36 +++++++++++++++ .../graphics-spice-invalid-egl-headless.xml | 37 +++++++++++++++ .../graphics-vnc-egl-headless.args | 28 ++++++++++++ .../qemuxml2argvdata/graphics-vnc-egl-headless.xml | 37 +++++++++++++++ tests/qemuxml2argvtest.c | 17 +++++++ .../graphics-spice-egl-headless.xml | 44 ++++++++++++++++++ .../graphics-vnc-egl-headless.xml | 42 +++++++++++++++++ tests/qemuxml2xmltest.c | 2 + 24 files changed, 501 insertions(+), 5 deletions(-) create mode 100644 tests/qemuxml2argvdata/graphics-egl-headless.args create mode 100644 tests/qemuxml2argvdata/graphics-egl-headless.xml create mode 100644 tests/qemuxml2argvdata/graphics-sdl-egl-headless.xml create mode 100644 tests/qemuxml2argvdata/graphics-spice-egl-headless.args create mode 100644 tests/qemuxml2argvdata/graphics-spice-egl-headless.xml create mode 100644 tests/qemuxml2argvdata/graphics-spice-invalid-egl-headless.xml create mode 100644 tests/qemuxml2argvdata/graphics-vnc-egl-headless.args create mode 100644 tests/qemuxml2argvdata/graphics-vnc-egl-headless.xml create mode 100644 tests/qemuxml2xmloutdata/graphics-spice-egl-headless.xml create mode 100644 tests/qemuxml2xmloutdata/graphics-vnc-egl-headless.xml
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 44ae8dcef7..48e224cabc 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -8213,6 +8213,27 @@ qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfigPtr cfg, return -1; } + +static int +qemuBuildGraphicsHeadlessCommandLine(virQEMUDriverConfigPtr cfg ATTRIBUTE_UNUSED, + virCommandPtr cmd, + virQEMUCapsPtr qemuCaps, + virDomainGraphicsDefPtr def ATTRIBUTE_UNUSED)
These arguments are unused now as well as at the end of the series and can be dropped.
+{ + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_EGL_HEADLESS)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("egl-headless display is not supported with this " + "QEMU binary")); + return -1; + } +
This belongs in qemu.*Validate.
+ virCommandAddArg(cmd, "-display"); + virCommandAddArg(cmd, "egl-headless"); + + return 0; +} + + static int qemuBuildGraphicsCommandLine(virQEMUDriverConfigPtr cfg, virCommandPtr cmd, diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index ed76495309..5da8c8bfcc 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -5528,6 +5528,53 @@ qemuDomainDeviceDefValidateTPM(virDomainTPMDef *tpm, } +static int +qemuDomainDeviceDefValidateGraphics(const virDomainGraphicsDef *graphics, + const virDomainDef *def) +{ + bool have_egl_headless = false; + size_t i; + + /* are we running with egl-headless? */
The variable name is self-explanatory, no need to explain the for cycle here.
+ for (i = 0; i < def->ngraphics; i++) { + graphics = def->graphics[i]; + + if (graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_EGL_HEADLESS) { + have_egl_headless = true; + break; + } + } + + /* Only VNC and SPICE can be paired with egl-headless, the other types + * either don't make sense to pair with egl-headless or aren't even + * supported by QEMU. + */ + if (have_egl_headless) { + if (graphics->type != VIR_DOMAIN_GRAPHICS_TYPE_EGL_HEADLESS && + graphics->type != VIR_DOMAIN_GRAPHICS_TYPE_VNC && + graphics->type != VIR_DOMAIN_GRAPHICS_TYPE_SPICE) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("graphics type 'egl-headless' is only supported " + "with one of: 'vnc', 'spice' graphics types")); + return -1; + } + + /* '-spice gl=on' and '-display egl-headless' are mutually + * exclusive + */ + if (graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE && + graphics->data.spice.gl == VIR_TRISTATE_BOOL_YES) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("multiple OpenGL displays are not supported " + "by QEMU")); + return -1; + } + } + + return 0; +} + + static int qemuDomainDeviceDefValidate(const virDomainDeviceDef *dev, const virDomainDef *def,
Reviewed-by: Ján Tomko <jtomko@xxxxxxxxxx> Jano
Attachment:
signature.asc
Description: Digital signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list