From nobody Fri Dec 19 20:16:37 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1543501242532198.5795469046534; Thu, 29 Nov 2018 06:20:42 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 61DC680F9C; Thu, 29 Nov 2018 14:20:39 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2848C18E44; Thu, 29 Nov 2018 14:20:39 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 92A26181B9E9; Thu, 29 Nov 2018 14:20:38 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wATEKXnD004504 for ; Thu, 29 Nov 2018 09:20:33 -0500 Received: by smtp.corp.redhat.com (Postfix) id 7669E61523; Thu, 29 Nov 2018 14:20:33 +0000 (UTC) Received: from beluga.usersys.redhat.com (unknown [10.43.2.166]) by smtp.corp.redhat.com (Postfix) with ESMTP id C95CB5D736; Thu, 29 Nov 2018 14:20:32 +0000 (UTC) From: Erik Skultety To: libvir-list@redhat.com Date: Thu, 29 Nov 2018 15:20:17 +0100 Message-Id: <94237eaf99751a018651d7d99b8a47a9f472b94a.1543500852.git.eskultet@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: Erik Skultety Subject: [libvirt] [PATCH v3 07/11] conf: gfx: egl-headless: Introduce a new subelement X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 29 Nov 2018 14:20:40 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Unlike with SPICE and SDL which use the subelement to enable OpenGL acceleration, specifying egl-headless graphics in the XML has essentially the same meaning, thus in case of egl-headless we don't have a need for the 'enable' element attribute and we'll only be interested in the 'rendernode' one further down the road. Signed-off-by: Erik Skultety Reviewed-by: J=C3=A1n Tomko --- docs/formatdomain.html.in | 11 +++-- docs/schemas/domaincommon.rng | 17 +++++-- src/conf/domain_conf.c | 45 ++++++++++++++++++- src/qemu/qemu_process.c | 16 +++++-- .../graphics-egl-headless-rendernode.xml | 33 ++++++++++++++ .../graphics-egl-headless-rendernode.xml | 41 +++++++++++++++++ tests/qemuxml2xmltest.c | 2 + 7 files changed, 155 insertions(+), 10 deletions(-) create mode 100644 tests/qemuxml2argvdata/graphics-egl-headless-rendernode= .xml create mode 100644 tests/qemuxml2xmloutdata/graphics-egl-headless-renderno= de.xml diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 84259c45e4..428b0e8bb5 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -6704,12 +6704,17 @@ qemu-kvm -net nic,model=3D? /dev/null the other types, for practical reasons it should be paired w= ith either vnc or spice graphics types. This display type is only supported by QEMU domains - (needs QEMU 2.10 or newer) and = doesn't - accept any attributes. + (needs QEMU 2.10 or newer). + 5.0.0 this element accepts a + <gl/> sub-element with an optional attrib= ute + rendernode which can be used to specify an abso= lute + path to a host's DRI device to be used for OpenGL rendering.

 <graphics type=3D'spice' autoport=3D'yes'/>
-<graphics type=3D'egl-headless'/>
+<graphics type=3D'egl-headless'>
+  <gl rendernode=3D'/dev/dri/renderD128'/>
+</graphics>
             
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index cb2ca5a20a..5a6c48f1aa 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -3418,9 +3418,20 @@ - - egl-headless - + + + egl-headless + + + + + + + + + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 6ae98435cc..86917596c5 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -14074,6 +14074,24 @@ virDomainGraphicsDefParseXMLSpice(virDomainGraphic= sDefPtr def, } =20 =20 +static int +virDomainGraphicsDefParseXMLEGLHeadless(virDomainGraphicsDefPtr def, + xmlNodePtr node, + xmlXPathContextPtr ctxt) +{ + xmlNodePtr save =3D ctxt->node; + xmlNodePtr glNode; + + ctxt->node =3D node; + + if ((glNode =3D virXPathNode("./gl", ctxt))) + def->data.egl_headless.rendernode =3D virXMLPropString(glNode, + "rendernode"); + ctxt->node =3D save; + return 0; +} + + /* Parse the XML definition for a graphics device */ static virDomainGraphicsDefPtr virDomainGraphicsDefParseXML(xmlNodePtr node, @@ -14123,6 +14141,9 @@ virDomainGraphicsDefParseXML(xmlNodePtr node, goto error; break; case VIR_DOMAIN_GRAPHICS_TYPE_EGL_HEADLESS: + if (virDomainGraphicsDefParseXMLEGLHeadless(def, node, ctxt) < 0) + goto error; + break; case VIR_DOMAIN_GRAPHICS_TYPE_LAST: break; } @@ -26852,6 +26873,20 @@ virDomainGraphicsDefFormat(virBufferPtr buf, break; =20 case VIR_DOMAIN_GRAPHICS_TYPE_EGL_HEADLESS: + if (!def->data.egl_headless.rendernode) + break; + + if (!children) { + virBufferAddLit(buf, ">\n"); + virBufferAdjustIndent(buf, 2); + children =3D true; + } + + virBufferAddLit(buf, "data.egl_headless.rendernode); + virBufferAddLit(buf, "/>\n"); + break; case VIR_DOMAIN_GRAPHICS_TYPE_LAST: break; } @@ -30938,7 +30973,13 @@ virDomainGraphicsDefHasOpenGL(const virDomainDef *= def) bool virDomainGraphicsSupportsRenderNode(const virDomainGraphicsDef *graphics) { - return graphics->type =3D=3D VIR_DOMAIN_GRAPHICS_TYPE_SPICE; + bool ret =3D false; + + if (graphics->type =3D=3D VIR_DOMAIN_GRAPHICS_TYPE_SPICE || + graphics->type =3D=3D VIR_DOMAIN_GRAPHICS_TYPE_EGL_HEADLESS) + ret =3D true; + + return ret; } =20 =20 @@ -30953,6 +30994,8 @@ virDomainGraphicsGetRenderNode(const virDomainGraph= icsDef *graphics) ret =3D graphics->data.spice.rendernode; break; case VIR_DOMAIN_GRAPHICS_TYPE_EGL_HEADLESS: + ret =3D graphics->data.egl_headless.rendernode; + break; case VIR_DOMAIN_GRAPHICS_TYPE_SDL: case VIR_DOMAIN_GRAPHICS_TYPE_VNC: case VIR_DOMAIN_GRAPHICS_TYPE_RDP: diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index feebdc7fdc..5e33c63c73 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -4788,11 +4788,21 @@ static int qemuProcessGraphicsSetupRenderNode(virDomainGraphicsDefPtr graphics, virQEMUCapsPtr qemuCaps) { + char **rendernode =3D NULL; /* Don't bother picking a DRM node if QEMU doesn't support it. */ - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SPICE_RENDERNODE)) - return 0; + if (graphics->type =3D=3D VIR_DOMAIN_GRAPHICS_TYPE_SPICE) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SPICE_RENDERNODE)) + return 0; =20 - if (!(graphics->data.spice.rendernode =3D virHostGetDRMRenderNode())) + rendernode =3D &graphics->data.spice.rendernode; + } else { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_EGL_HEADLESS_RENDERNODE)) + return 0; + + rendernode =3D &graphics->data.egl_headless.rendernode; + } + + if (!(*rendernode =3D virHostGetDRMRenderNode())) return -1; =20 return 0; diff --git a/tests/qemuxml2argvdata/graphics-egl-headless-rendernode.xml b/= tests/qemuxml2argvdata/graphics-egl-headless-rendernode.xml new file mode 100644 index 0000000000..a8d54e75da --- /dev/null +++ b/tests/qemuxml2argvdata/graphics-egl-headless-rendernode.xml @@ -0,0 +1,33 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-i686 + + + + +
+ + + + + + + + + + + + diff --git a/tests/qemuxml2xmloutdata/graphics-egl-headless-rendernode.xml = b/tests/qemuxml2xmloutdata/graphics-egl-headless-rendernode.xml new file mode 100644 index 0000000000..9b7ac89928 --- /dev/null +++ b/tests/qemuxml2xmloutdata/graphics-egl-headless-rendernode.xml @@ -0,0 +1,41 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-i686 + + + + +
+ + +
+ + +
+ + + + + + + +