From nobody Tue Apr 23 07:08:12 2024
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 154350123166344.55435908904667;
Thu, 29 Nov 2018 06:20:31 -0800 (PST)
Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com
[10.5.11.22])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id 52B0B308FBB1;
Thu, 29 Nov 2018 14:20:29 +0000 (UTC)
Received: from colo-mx.corp.redhat.com
(colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21])
by smtp.corp.redhat.com (Postfix) with ESMTPS id 169EF1019637;
Thu, 29 Nov 2018 14:20:29 +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 BFD2B3F604;
Thu, 29 Nov 2018 14:20:28 +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 wATEKRU0004450 for ;
Thu, 29 Nov 2018 09:20:27 -0500
Received: by smtp.corp.redhat.com (Postfix)
id 8B8B56153B; Thu, 29 Nov 2018 14:20:27 +0000 (UTC)
Received: from beluga.usersys.redhat.com (unknown [10.43.2.166])
by smtp.corp.redhat.com (Postfix) with ESMTP id DBFE85D777;
Thu, 29 Nov 2018 14:20:26 +0000 (UTC)
From: Erik Skultety
To: libvir-list@redhat.com
Date: Thu, 29 Nov 2018 15:20:11 +0100
Message-Id:
<4f4845892391512a55b2aafd8caf18b3fa634f1f.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 01/11] util: Introduce virHostGetDRMRenderNode
helper
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.84 on 10.5.11.22
X-Greylist: Sender IP whitelisted,
not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]);
Thu, 29 Nov 2018 14:20:30 +0000 (UTC)
Content-Type: text/plain; charset="utf-8"
This is the first step towards libvirt picking the first available
render node instead of QEMU. It also makes sense for us to be able to do
that, since we allow specifying the node directly for SPICE, so if
there's no render node specified by the user, we should pick the first
available one. The algorithm used for that is essentially the same as
the one QEMU uses.
Signed-off-by: Erik Skultety
Reviewed-by: J=C3=A1n Tomko
---
src/libvirt_private.syms | 1 +
src/util/virutil.c | 53 ++++++++++++++++++++++++++++++++++++++++
src/util/virutil.h | 2 ++
3 files changed, 56 insertions(+)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 5018a13e9c..c7f08f9620 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -3151,6 +3151,7 @@ virGetUserName;
virGetUserRuntimeDirectory;
virGetUserShell;
virHexToBin;
+virHostGetDRMRenderNode;
virHostHasIOMMU;
virIndexToDiskName;
virIsDevMapperDevice;
diff --git a/src/util/virutil.c b/src/util/virutil.c
index 974cffc2ee..da12a11e04 100644
--- a/src/util/virutil.c
+++ b/src/util/virutil.c
@@ -2145,3 +2145,56 @@ virHostHasIOMMU(void)
VIR_DIR_CLOSE(iommuDir);
return ret;
}
+
+
+/**
+ * virHostGetDRMRenderNode:
+ *
+ * Picks the first DRM render node available. Missing DRI or missing DRM r=
ender
+ * nodes in the system results in an error.
+ *
+ * Returns an absolute path to the first render node available or NULL in =
case
+ * of an error with the error being reported.
+ * Caller is responsible for freeing the result string.
+ *
+ */
+char *
+virHostGetDRMRenderNode(void)
+{
+ char *ret =3D NULL;
+ DIR *driDir =3D NULL;
+ const char *driPath =3D "/dev/dri";
+ struct dirent *ent =3D NULL;
+ int dirErr =3D 0;
+ bool have_rendernode =3D false;
+
+ if (virDirOpen(&driDir, driPath) < 0)
+ return NULL;
+
+ while ((dirErr =3D virDirRead(driDir, &ent, driPath)) > 0) {
+ if (ent->d_type !=3D DT_CHR)
+ continue;
+
+ if (STRPREFIX(ent->d_name, "renderD")) {
+ have_rendernode =3D true;
+ break;
+ }
+ }
+
+ if (dirErr < 0)
+ goto cleanup;
+
+ /* even if /dev/dri exists, there might be no renderDX nodes available=
*/
+ if (!have_rendernode) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("No DRM render nodes available"));
+ goto cleanup;
+ }
+
+ if (virAsprintf(&ret, "%s/%s", driPath, ent->d_name) < 0)
+ goto cleanup;
+
+ cleanup:
+ VIR_DIR_CLOSE(driDir);
+ return ret;
+}
diff --git a/src/util/virutil.h b/src/util/virutil.h
index e0ab0da0f2..89bd21b148 100644
--- a/src/util/virutil.h
+++ b/src/util/virutil.h
@@ -222,6 +222,8 @@ unsigned long long virMemoryMaxValue(bool ulong) ATTRIB=
UTE_NOINLINE;
=20
bool virHostHasIOMMU(void);
=20
+char *virHostGetDRMRenderNode(void);
+
/**
* VIR_ASSIGN_IS_OVERFLOW:
* @rvalue: value that is checked (evaluated twice)
--=20
2.19.1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Tue Apr 23 07:08:12 2024
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 1543501235864377.31959016117844;
Thu, 29 Nov 2018 06:20:35 -0800 (PST)
Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com
[10.5.11.12])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id 9766E308402C;
Thu, 29 Nov 2018 14:20:33 +0000 (UTC)
Received: from colo-mx.corp.redhat.com
(colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21])
by smtp.corp.redhat.com (Postfix) with ESMTPS id 4BD1D19063;
Thu, 29 Nov 2018 14:20:33 +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 DB2323F606;
Thu, 29 Nov 2018 14:20:32 +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 wATEKSHI004463 for ;
Thu, 29 Nov 2018 09:20:28 -0500
Received: by smtp.corp.redhat.com (Postfix)
id 8507F5D777; Thu, 29 Nov 2018 14:20:28 +0000 (UTC)
Received: from beluga.usersys.redhat.com (unknown [10.43.2.166])
by smtp.corp.redhat.com (Postfix) with ESMTP id D8F9261520;
Thu, 29 Nov 2018 14:20:27 +0000 (UTC)
From: Erik Skultety
To: libvir-list@redhat.com
Date: Thu, 29 Nov 2018 15:20:12 +0100
Message-Id:
<26711e8ab348428e999737b10e20470f53b24993.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 02/11] conf: Introduce
virDomainGraphics-related helpers
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.12
X-Greylist: Sender IP whitelisted,
not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]);
Thu, 29 Nov 2018 14:20:34 +0000 (UTC)
Content-Type: text/plain; charset="utf-8"
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
Reviewed-by: J=C3=A1n Tomko
---
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)
=20
return false;
}
+
+
+bool
+virDomainGraphicsSupportsRenderNode(const virDomainGraphicsDef *graphics)
+{
+ return graphics->type =3D=3D VIR_DOMAIN_GRAPHICS_TYPE_SPICE;
+}
+
+
+const char *
+virDomainGraphicsGetRenderNode(const virDomainGraphicsDef *graphics)
+{
+ const char *ret =3D NULL;
+
+ switch (graphics->type) {
+ case VIR_DOMAIN_GRAPHICS_TYPE_SPICE:
+ if (graphics->data.spice.gl =3D=3D VIR_TRISTATE_BOOL_YES)
+ ret =3D 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);
=20
+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;
--=20
2.19.1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Tue Apr 23 07:08:12 2024
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 1543501242252908.3072083284841;
Thu, 29 Nov 2018 06:20:42 -0800 (PST)
Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com
[10.5.11.22])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id A4D667E9CB;
Thu, 29 Nov 2018 14:20:37 +0000 (UTC)
Received: from colo-mx.corp.redhat.com
(colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21])
by smtp.corp.redhat.com (Postfix) with ESMTPS id 71AD3105705A;
Thu, 29 Nov 2018 14:20:37 +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 0E3E73F606;
Thu, 29 Nov 2018 14:20:37 +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 wATEKTCS004471 for ;
Thu, 29 Nov 2018 09:20:29 -0500
Received: by smtp.corp.redhat.com (Postfix)
id 80CE561520; Thu, 29 Nov 2018 14:20:29 +0000 (UTC)
Received: from beluga.usersys.redhat.com (unknown [10.43.2.166])
by smtp.corp.redhat.com (Postfix) with ESMTP id D4C255D777;
Thu, 29 Nov 2018 14:20:28 +0000 (UTC)
From: Erik Skultety
To: libvir-list@redhat.com
Date: Thu, 29 Nov 2018 15:20:13 +0100
Message-Id:
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 03/11] qemu: process: spice: Pick the first
available DRM render node
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.84 on 10.5.11.22
X-Greylist: Sender IP whitelisted,
not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]);
Thu, 29 Nov 2018 14:20:40 +0000 (UTC)
Content-Type: text/plain; charset="utf-8"
Up until now, we formatted 'rendernode=3D' onto QEMU cmdline only if the
user specified it in the XML, otherwise we let QEMU do it for us. This
causes permission issues because by default the /dev/dri/renderDX
permissions are as follows:
crw-rw----. 1 root video
There's literally no reason why it shouldn't be libvirt picking the DRM
render node instead of QEMU, that way (and because we're using
namespaces by default), we can safely relabel the device within the
namespace.
Signed-off-by: Erik Skultety
Reviewed-by: J=C3=A1n Tomko
---
src/qemu/qemu_process.c | 22 +++++++++++++++-
src/util/virutil.h | 2 +-
.../graphics-spice-gl-no-rendernode.args | 25 +++++++++++++++++++
.../graphics-spice-gl-no-rendernode.xml | 24 ++++++++++++++++++
tests/qemuxml2argvmock.c | 9 +++++++
5 files changed, 80 insertions(+), 2 deletions(-)
create mode 100644 tests/qemuxml2argvdata/graphics-spice-gl-no-rendernode.=
args
create mode 100644 tests/qemuxml2argvdata/graphics-spice-gl-no-rendernode.=
xml
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 12d1fca0d4..feebdc7fdc 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -4784,9 +4784,25 @@ qemuProcessGraphicsSetupListen(virQEMUDriverPtr driv=
er,
}
=20
=20
+static int
+qemuProcessGraphicsSetupRenderNode(virDomainGraphicsDefPtr graphics,
+ virQEMUCapsPtr qemuCaps)
+{
+ /* Don't bother picking a DRM node if QEMU doesn't support it. */
+ if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SPICE_RENDERNODE))
+ return 0;
+
+ if (!(graphics->data.spice.rendernode =3D virHostGetDRMRenderNode()))
+ return -1;
+
+ return 0;
+}
+
+
static int
qemuProcessSetupGraphics(virQEMUDriverPtr driver,
virDomainObjPtr vm,
+ virQEMUCapsPtr qemuCaps,
unsigned int flags)
{
virDomainGraphicsDefPtr graphics;
@@ -4797,6 +4813,10 @@ qemuProcessSetupGraphics(virQEMUDriverPtr driver,
for (i =3D 0; i < vm->def->ngraphics; i++) {
graphics =3D vm->def->graphics[i];
=20
+ if (virDomainGraphicsNeedsRenderNode(graphics) &&
+ qemuProcessGraphicsSetupRenderNode(graphics, qemuCaps) < 0)
+ goto cleanup;
+
if (qemuProcessGraphicsSetupListen(driver, graphics, vm) < 0)
goto cleanup;
}
@@ -5953,7 +5973,7 @@ qemuProcessPrepareDomain(virQEMUDriverPtr driver,
goto cleanup;
=20
VIR_DEBUG("Setting graphics devices");
- if (qemuProcessSetupGraphics(driver, vm, flags) < 0)
+ if (qemuProcessSetupGraphics(driver, vm, priv->qemuCaps, flags) < 0)
goto cleanup;
=20
VIR_DEBUG("Create domain masterKey");
diff --git a/src/util/virutil.h b/src/util/virutil.h
index 89bd21b148..588d779d10 100644
--- a/src/util/virutil.h
+++ b/src/util/virutil.h
@@ -222,7 +222,7 @@ unsigned long long virMemoryMaxValue(bool ulong) ATTRIB=
UTE_NOINLINE;
=20
bool virHostHasIOMMU(void);
=20
-char *virHostGetDRMRenderNode(void);
+char *virHostGetDRMRenderNode(void) ATTRIBUTE_NOINLINE;
=20
/**
* VIR_ASSIGN_IS_OVERFLOW:
diff --git a/tests/qemuxml2argvdata/graphics-spice-gl-no-rendernode.args b/=
tests/qemuxml2argvdata/graphics-spice-gl-no-rendernode.args
new file mode 100644
index 0000000000..1b08811692
--- /dev/null
+++ b/tests/qemuxml2argvdata/graphics-spice-gl-no-rendernode.args
@@ -0,0 +1,25 @@
+LC_ALL=3DC \
+PATH=3D/bin \
+HOME=3D/home/test \
+USER=3Dtest \
+LOGNAME=3Dtest \
+QEMU_AUDIO_DRV=3Dspice \
+/usr/bin/qemu-system-i686 \
+-name QEMUGuest1 \
+-S \
+-machine pc,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \
+-m 214 \
+-smp 1,sockets=3D1,cores=3D1,threads=3D1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-QEMUGuest1/moni=
tor.sock,\
+server,nowait \
+-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \
+-rtc base=3Dutc \
+-no-shutdown \
+-no-acpi \
+-usb \
+-spice port=3D0,gl=3Don,rendernode=3D/dev/dri/foo \
+-vga cirrus \
+-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x3
diff --git a/tests/qemuxml2argvdata/graphics-spice-gl-no-rendernode.xml b/t=
ests/qemuxml2argvdata/graphics-spice-gl-no-rendernode.xml
new file mode 100644
index 0000000000..b48e7bc94e
--- /dev/null
+++ b/tests/qemuxml2argvdata/graphics-spice-gl-no-rendernode.xml
@@ -0,0 +1,24 @@
+
+ QEMUGuest1
+ c7a5fdbd-edaf-9455-926a-d65c16db1809
+ 219136
+ 219136
+ 1
+
+ hvm
+
+
+
+ destroy
+ restart
+ destroy
+
+ /usr/bin/qemu-system-i686
+
+
+
+
+
+
+
+
diff --git a/tests/qemuxml2argvmock.c b/tests/qemuxml2argvmock.c
index 79152d928e..a64cd955c4 100644
--- a/tests/qemuxml2argvmock.c
+++ b/tests/qemuxml2argvmock.c
@@ -184,6 +184,15 @@ virNetDevRunEthernetScript(const char *ifname ATTRIBUT=
E_UNUSED,
return 0;
}
=20
+char *
+virHostGetDRMRenderNode(void)
+{
+ char *dst =3D NULL;
+
+ ignore_value(VIR_STRDUP(dst, "/dev/dri/foo"));
+ return dst;
+}
+
static void (*real_virCommandPassFD)(virCommandPtr cmd, int fd, unsigned i=
nt flags);
=20
static const int testCommandPassSafeFDs[] =3D { 1730, 1731 };
--=20
2.19.1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Tue Apr 23 07:08:12 2024
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 1543501246935978.6607243417382;
Thu, 29 Nov 2018 06:20:46 -0800 (PST)
Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com
[10.5.11.11])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id 5F85980E7B;
Thu, 29 Nov 2018 14:20:42 +0000 (UTC)
Received: from colo-mx.corp.redhat.com
(colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21])
by smtp.corp.redhat.com (Postfix) with ESMTPS id 01A4F6E714;
Thu, 29 Nov 2018 14:20:42 +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 A95473F609;
Thu, 29 Nov 2018 14:20:41 +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 wATEKUpc004478 for ;
Thu, 29 Nov 2018 09:20:30 -0500
Received: by smtp.corp.redhat.com (Postfix)
id 7BC395EDE4; Thu, 29 Nov 2018 14:20:30 +0000 (UTC)
Received: from beluga.usersys.redhat.com (unknown [10.43.2.166])
by smtp.corp.redhat.com (Postfix) with ESMTP id CF3965D736;
Thu, 29 Nov 2018 14:20:29 +0000 (UTC)
From: Erik Skultety
To: libvir-list@redhat.com
Date: Thu, 29 Nov 2018 15:20:14 +0100
Message-Id:
<1af1a2510826b9fac69f03d6c93e946854e60ec8.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 04/11] qemu: command: Introduce
qemuBuildGraphicsEGLHeadlessCommandLine helper
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.11
X-Greylist: Sender IP whitelisted,
not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]);
Thu, 29 Nov 2018 14:20:45 +0000 (UTC)
Content-Type: text/plain; charset="utf-8"
We're going to need a bit more logic for egl-headless down the road so
prepare a helper just like for the other display types.
Signed-off-by: Erik Skultety
Reviewed-by: J=C3=A1n Tomko
---
src/qemu/qemu_command.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 315419c71b..34c8ad751b 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -8307,6 +8307,19 @@ qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfi=
gPtr cfg,
}
=20
=20
+static int
+qemuBuildGraphicsEGLHeadlessCommandLine(virQEMUDriverConfigPtr cfg ATTRIBU=
TE_UNUSED,
+ virCommandPtr cmd,
+ virQEMUCapsPtr qemuCaps ATTRIBUTE_=
UNUSED,
+ virDomainGraphicsDefPtr graphics A=
TTRIBUTE_UNUSED)
+{
+ virCommandAddArg(cmd, "-display");
+ virCommandAddArg(cmd, "egl-headless");
+
+ return 0;
+}
+
+
static int
qemuBuildGraphicsCommandLine(virQEMUDriverConfigPtr cfg,
virCommandPtr cmd,
@@ -8338,8 +8351,9 @@ qemuBuildGraphicsCommandLine(virQEMUDriverConfigPtr c=
fg,
=20
break;
case VIR_DOMAIN_GRAPHICS_TYPE_EGL_HEADLESS:
- virCommandAddArg(cmd, "-display");
- virCommandAddArg(cmd, "egl-headless");
+ if (qemuBuildGraphicsEGLHeadlessCommandLine(cfg, cmd,
+ qemuCaps, graphics=
) < 0)
+ return -1;
=20
break;
case VIR_DOMAIN_GRAPHICS_TYPE_RDP:
--=20
2.19.1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Tue Apr 23 07:08:12 2024
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 154350123732845.55284944614118;
Thu, 29 Nov 2018 06:20:37 -0800 (PST)
Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com
[10.5.11.11])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id D601630821EE;
Thu, 29 Nov 2018 14:20:34 +0000 (UTC)
Received: from colo-mx.corp.redhat.com
(colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21])
by smtp.corp.redhat.com (Postfix) with ESMTPS id 890756911C;
Thu, 29 Nov 2018 14:20:34 +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 345413F604;
Thu, 29 Nov 2018 14:20:34 +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 wATEKVB2004487 for ;
Thu, 29 Nov 2018 09:20:31 -0500
Received: by smtp.corp.redhat.com (Postfix)
id 7D82E6152D; Thu, 29 Nov 2018 14:20:31 +0000 (UTC)
Received: from beluga.usersys.redhat.com (unknown [10.43.2.166])
by smtp.corp.redhat.com (Postfix) with ESMTP id CB6E661524;
Thu, 29 Nov 2018 14:20:30 +0000 (UTC)
From: Erik Skultety
To: libvir-list@redhat.com
Date: Thu, 29 Nov 2018 15:20:15 +0100
Message-Id:
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 05/11] qemu: caps: Introduce
QEMU_EGL_HEADLESS_RENDERNODE capability
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.11
X-Greylist: Sender IP whitelisted,
not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]);
Thu, 29 Nov 2018 14:20:35 +0000 (UTC)
Content-Type: text/plain; charset="utf-8"
Now that we have QAPI introspection of display types in QEMU upstream,
we can check whether the 'rendernode' option is supported with
egl-headless display type.
Signed-off-by: Erik Skultety
Reviewed-by: J=C3=A1n Tomko
---
src/qemu/qemu_capabilities.c | 2 ++
src/qemu/qemu_capabilities.h | 1 +
tests/qemucapabilitiesdata/caps_3.1.0.x86_64.xml | 1 +
3 files changed, 4 insertions(+)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 20a1a0c201..820cddfe04 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -516,6 +516,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
"memory-backend-memfd.hugetlb",
"iothread.poll-max-ns",
"machine.pseries.cap-nested-hv",
+ "egl-headless.rendernode"
);
=20
=20
@@ -1249,6 +1250,7 @@ static struct virQEMUCapsStringFlags virQEMUCapsQMPSc=
hemaQueries[] =3D {
{ "screendump/arg-type/device", QEMU_CAPS_SCREENDUMP_DEVICE },
{ "block-commit/arg-type/*top", QEMU_CAPS_ACTIVE_COMMIT },
{ "query-iothreads/ret-type/poll-max-ns", QEMU_CAPS_IOTHREAD_POLLING },
+ { "query-display-options/ret-type/+egl-headless/rendernode", QEMU_CAPS=
_EGL_HEADLESS_RENDERNODE },
};
=20
typedef struct _virQEMUCapsObjectTypeProps virQEMUCapsObjectTypeProps;
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index b1990b6bb8..c109887c0c 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -500,6 +500,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for =
syntax-check */
QEMU_CAPS_OBJECT_MEMORY_MEMFD_HUGETLB, /* -object memory-backend-memfd=
.hugetlb */
QEMU_CAPS_IOTHREAD_POLLING, /* -object iothread.poll-max-ns */
QEMU_CAPS_MACHINE_PSERIES_CAP_NESTED_HV, /* -machine pseries.cap-neste=
d-hv */
+ QEMU_CAPS_EGL_HEADLESS_RENDERNODE, /* -display egl-headless,rendernode=
=3D */
=20
QEMU_CAPS_LAST /* this must always be the last item */
} virQEMUCapsFlags;
diff --git a/tests/qemucapabilitiesdata/caps_3.1.0.x86_64.xml b/tests/qemuc=
apabilitiesdata/caps_3.1.0.x86_64.xml
index cbebc095bd..6c9c0c6612 100644
--- a/tests/qemucapabilitiesdata/caps_3.1.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_3.1.0.x86_64.xml
@@ -208,6 +208,7 @@
+
3000092
0
440395
--=20
2.19.1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Tue Apr 23 07:08:12 2024
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 1543501239181880.0484854863597;
Thu, 29 Nov 2018 06:20:39 -0800 (PST)
Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com
[10.5.11.13])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id E427F3082E71;
Thu, 29 Nov 2018 14:20:35 +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 958407D8CA;
Thu, 29 Nov 2018 14:20:35 +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 49124181B9EA;
Thu, 29 Nov 2018 14:20:35 +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 wATEKWY3004497 for ;
Thu, 29 Nov 2018 09:20:32 -0500
Received: by smtp.corp.redhat.com (Postfix)
id 7C4185D736; Thu, 29 Nov 2018 14:20:32 +0000 (UTC)
Received: from beluga.usersys.redhat.com (unknown [10.43.2.166])
by smtp.corp.redhat.com (Postfix) with ESMTP id CECCE61532;
Thu, 29 Nov 2018 14:20:31 +0000 (UTC)
From: Erik Skultety
To: libvir-list@redhat.com
Date: Thu, 29 Nov 2018 15:20:16 +0100
Message-Id:
<5ce0eecd43b66ce7e8586a3cda8751ec1b2c1f69.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 06/11] conf: gfx: Add egl-headless as a member
to virDomainGraphicsDef struct
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.13
X-Greylist: Sender IP whitelisted,
not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]);
Thu, 29 Nov 2018 14:20:37 +0000 (UTC)
Content-Type: text/plain; charset="utf-8"
Since we need to specify the rendernode option onto QEMU cmdline, we
need this union member to retain consistency in how we build the
cmdline.
Signed-off-by: Erik Skultety
Reviewed-by: J=C3=A1n Tomko
---
src/conf/domain_conf.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 39dc33db8f..9ddfef478b 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1659,6 +1659,9 @@ struct _virDomainGraphicsDef {
virTristateBool gl;
char *rendernode;
} spice;
+ struct {
+ char *rendernode;
+ } egl_headless;
} data;
/* nListens, listens, and *port are only useful if type is vnc,
* rdp, or spice. They've been extracted from the union only to
--=20
2.19.1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Tue Apr 23 07:08:12 2024
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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 2527497675..25ab990a4b 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -413,6 +413,8 @@ mymain(void)
cfg->spiceAutoUnixSocket =3D false;
DO_TEST("graphics-spice-egl-headless", NONE);
=20
+ DO_TEST("graphics-egl-headless-rendernode", NONE);
+
DO_TEST("input-usbmouse", NONE);
DO_TEST("input-usbtablet", NONE);
DO_TEST("misc-acpi", NONE);
--=20
2.19.1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Tue Apr 23 07:08:12 2024
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 1543501247345801.0862744677175;
Thu, 29 Nov 2018 06:20:47 -0800 (PST)
Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com
[10.5.11.13])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id 4EEBA30C4B7E;
Thu, 29 Nov 2018 14:20:43 +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 0B2677D937;
Thu, 29 Nov 2018 14:20:43 +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 B1D72181B9EA;
Thu, 29 Nov 2018 14:20:42 +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 wATEKYDn004515 for ;
Thu, 29 Nov 2018 09:20:34 -0500
Received: by smtp.corp.redhat.com (Postfix)
id 70CBA61524; Thu, 29 Nov 2018 14:20:34 +0000 (UTC)
Received: from beluga.usersys.redhat.com (unknown [10.43.2.166])
by smtp.corp.redhat.com (Postfix) with ESMTP id C470E5EDE4;
Thu, 29 Nov 2018 14:20:33 +0000 (UTC)
From: Erik Skultety
To: libvir-list@redhat.com
Date: Thu, 29 Nov 2018 15:20:18 +0100
Message-Id:
<6283c82c128f78cae9ecea8543fd82aa90fdaa69.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 08/11] qemu: domain: egl-headless: Add the DRI
device into the namespace
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.13
X-Greylist: Sender IP whitelisted,
not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]);
Thu, 29 Nov 2018 14:20:45 +0000 (UTC)
Content-Type: text/plain; charset="utf-8"
Just like for SPICE, we need to put the DRI device into the namespace,
otherwise it will be left out from the DAC relabeling process.
Signed-off-by: Erik Skultety
Reviewed-by: J=C3=A1n Tomko
---
src/qemu/qemu_domain.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index ee61caa823..dd4f77193a 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -11866,14 +11866,9 @@ qemuDomainSetupGraphics(virQEMUDriverConfigPtr cfg=
ATTRIBUTE_UNUSED,
virDomainGraphicsDefPtr gfx,
const struct qemuDomainCreateDeviceData *data)
{
- const char *rendernode =3D gfx->data.spice.rendernode;
+ const char *rendernode =3D virDomainGraphicsGetRenderNode(gfx);
=20
- if (gfx->type !=3D VIR_DOMAIN_GRAPHICS_TYPE_SPICE ||
- gfx->data.spice.gl !=3D VIR_TRISTATE_BOOL_YES ||
- !rendernode)
- return 0;
-
- return qemuDomainCreateDevice(rendernode, data, false);
+ return !rendernode ? 0 : qemuDomainCreateDevice(rendernode, data, fals=
e);
}
=20
=20
--=20
2.19.1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Tue Apr 23 07:08:12 2024
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 1543501249964489.25104592579726;
Thu, 29 Nov 2018 06:20:49 -0800 (PST)
Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com
[10.5.11.12])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id 4B626307D840;
Thu, 29 Nov 2018 14:20:46 +0000 (UTC)
Received: from colo-mx.corp.redhat.com
(colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21])
by smtp.corp.redhat.com (Postfix) with ESMTPS id 196E660C5C;
Thu, 29 Nov 2018 14:20:46 +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 C33903F60D;
Thu, 29 Nov 2018 14:20:45 +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 wATEKZd3004531 for ;
Thu, 29 Nov 2018 09:20:35 -0500
Received: by smtp.corp.redhat.com (Postfix)
id 6BA815D777; Thu, 29 Nov 2018 14:20:35 +0000 (UTC)
Received: from beluga.usersys.redhat.com (unknown [10.43.2.166])
by smtp.corp.redhat.com (Postfix) with ESMTP id BF06261524;
Thu, 29 Nov 2018 14:20:34 +0000 (UTC)
From: Erik Skultety
To: libvir-list@redhat.com
Date: Thu, 29 Nov 2018 15:20:19 +0100
Message-Id:
<5b128a406fc2782d5dbf21bd52243bb19d1bb41f.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 09/11] qemu: cgroup: gfx: egl-headless: Add the
DRI device into the cgroup list
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.12
X-Greylist: Sender IP whitelisted,
not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]);
Thu, 29 Nov 2018 14:20:48 +0000 (UTC)
Content-Type: text/plain; charset="utf-8"
Just like for SPICE, we need to put the render node DRI device into the
device cgroup list so that users don't need to add it manually via
qemu.conf file.
Signed-off-by: Erik Skultety
Reviewed-by: J=C3=A1n Tomko
---
src/qemu/qemu_cgroup.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index 43e17d786e..3a6efdc4f1 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -491,15 +491,11 @@ qemuSetupGraphicsCgroup(virDomainObjPtr vm,
virDomainGraphicsDefPtr gfx)
{
qemuDomainObjPrivatePtr priv =3D vm->privateData;
- const char *rendernode =3D gfx->data.spice.rendernode;
+ const char *rendernode =3D virDomainGraphicsGetRenderNode(gfx);
int ret;
=20
- if (!virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_DEVICE=
S))
- return 0;
-
- if (gfx->type !=3D VIR_DOMAIN_GRAPHICS_TYPE_SPICE ||
- gfx->data.spice.gl !=3D VIR_TRISTATE_BOOL_YES ||
- !rendernode)
+ if (!rendernode ||
+ !virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_DEVICE=
S))
return 0;
=20
ret =3D virCgroupAllowDevicePath(priv->cgroup, rendernode,
--=20
2.19.1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Tue Apr 23 07:08:12 2024
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 1543501243298863.994582325229;
Thu, 29 Nov 2018 06:20:43 -0800 (PST)
Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com
[10.5.11.23])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id AA7AE87633;
Thu, 29 Nov 2018 14:20:40 +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 545B9194A8;
Thu, 29 Nov 2018 14:20:40 +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 0C28E181B9E7;
Thu, 29 Nov 2018 14:20:40 +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 wATEKaHd004542 for ;
Thu, 29 Nov 2018 09:20:36 -0500
Received: by smtp.corp.redhat.com (Postfix)
id 650065D777; Thu, 29 Nov 2018 14:20:36 +0000 (UTC)
Received: from beluga.usersys.redhat.com (unknown [10.43.2.166])
by smtp.corp.redhat.com (Postfix) with ESMTP id B97325EDE4;
Thu, 29 Nov 2018 14:20:35 +0000 (UTC)
From: Erik Skultety
To: libvir-list@redhat.com
Date: Thu, 29 Nov 2018 15:20:20 +0100
Message-Id:
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 10/11] security: dac: gfx: egl-headless:
Relabel the DRI device
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.84 on 10.5.11.23
X-Greylist: Sender IP whitelisted,
not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]);
Thu, 29 Nov 2018 14:20:41 +0000 (UTC)
Content-Type: text/plain; charset="utf-8"
Just like for SPICE, we need to change the permissions on the DRI device
used as the @rendernode for egl-headless graphics type.
Signed-off-by: Erik Skultety
Reviewed-by: J=C3=A1n Tomko
---
src/security/security_dac.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/src/security/security_dac.c b/src/security/security_dac.c
index 6b64d2c07a..4bdc6ed213 100644
--- a/src/security/security_dac.c
+++ b/src/security/security_dac.c
@@ -1492,11 +1492,16 @@ virSecurityDACSetGraphicsLabel(virSecurityManagerPt=
r mgr,
virDomainGraphicsDefPtr gfx)
=20
{
+ const char *rendernode =3D virDomainGraphicsGetRenderNode(gfx);
virSecurityDACDataPtr priv =3D virSecurityManagerGetPrivateData(mgr);
virSecurityLabelDefPtr seclabel;
uid_t user;
gid_t group;
=20
+ /* There's nothing to relabel */
+ if (!rendernode)
+ return 0;
+
/* Skip chowning the shared render file if namespaces are disabled */
if (!priv->mountNamespace)
return 0;
@@ -1508,14 +1513,8 @@ virSecurityDACSetGraphicsLabel(virSecurityManagerPtr=
mgr,
if (virSecurityDACGetIds(seclabel, priv, &user, &group, NULL, NULL) < =
0)
return -1;
=20
- if (gfx->type =3D=3D VIR_DOMAIN_GRAPHICS_TYPE_SPICE &&
- gfx->data.spice.gl =3D=3D VIR_TRISTATE_BOOL_YES &&
- gfx->data.spice.rendernode) {
- if (virSecurityDACSetOwnership(mgr, NULL,
- gfx->data.spice.rendernode,
- user, group) < 0)
- return -1;
- }
+ if (virSecurityDACSetOwnership(mgr, NULL, rendernode, user, group) < 0)
+ return -1;
=20
return 0;
}
--=20
2.19.1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Tue Apr 23 07:08:12 2024
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 1543501268980691.1116410127856;
Thu, 29 Nov 2018 06:21:08 -0800 (PST)
Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com
[10.5.11.13])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id 0D3FF29158;
Thu, 29 Nov 2018 14:21:07 +0000 (UTC)
Received: from colo-mx.corp.redhat.com
(colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21])
by smtp.corp.redhat.com (Postfix) with ESMTPS id 2F4417D936;
Thu, 29 Nov 2018 14:21:04 +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 E25213F610;
Thu, 29 Nov 2018 14:20:49 +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 wATEKbsF004549 for ;
Thu, 29 Nov 2018 09:20:37 -0500
Received: by smtp.corp.redhat.com (Postfix)
id 62BF36152D; Thu, 29 Nov 2018 14:20:37 +0000 (UTC)
Received: from beluga.usersys.redhat.com (unknown [10.43.2.166])
by smtp.corp.redhat.com (Postfix) with ESMTP id B31A25D777;
Thu, 29 Nov 2018 14:20:36 +0000 (UTC)
From: Erik Skultety
To: libvir-list@redhat.com
Date: Thu, 29 Nov 2018 15:20:21 +0100
Message-Id:
<340af0c36d39a690035b0a9af84ff02bbfd6b126.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 11/11] qemu: command: gfx: egl-headless: Add
'rendernode' option to the cmdline
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.13
X-Greylist: Sender IP whitelisted,
not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]);
Thu, 29 Nov 2018 14:21:07 +0000 (UTC)
Content-Type: text/plain; charset="utf-8"
Depending on whether QEMU actually supports the option, we can put the
'rendernode' on the '-display egl-headless' cmdline.
Signed-off-by: Erik Skultety
Reviewed-by: J=C3=A1n Tomko
---
src/qemu/qemu_command.c | 32 ++++++++++++++++---
...egl-headless-rendernode.x86_64-latest.args | 31 ++++++++++++++++++
.../graphics-egl-headless.x86_64-latest.args | 31 ++++++++++++++++++
...play-spice-egl-headless.x86_64-latest.args | 2 +-
...isplay-vnc-egl-headless.x86_64-latest.args | 2 +-
tests/qemuxml2argvtest.c | 2 ++
6 files changed, 94 insertions(+), 6 deletions(-)
create mode 100644 tests/qemuxml2argvdata/graphics-egl-headless-rendernode=
.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/graphics-egl-headless.x86_64-lat=
est.args
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 34c8ad751b..07b7082df8 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -8310,13 +8310,37 @@ qemuBuildGraphicsSPICECommandLine(virQEMUDriverConf=
igPtr cfg,
static int
qemuBuildGraphicsEGLHeadlessCommandLine(virQEMUDriverConfigPtr cfg ATTRIBU=
TE_UNUSED,
virCommandPtr cmd,
- virQEMUCapsPtr qemuCaps ATTRIBUTE_=
UNUSED,
- virDomainGraphicsDefPtr graphics A=
TTRIBUTE_UNUSED)
+ virQEMUCapsPtr qemuCaps,
+ virDomainGraphicsDefPtr graphics)
{
+ int ret =3D -1;
+ virBuffer opt =3D VIR_BUFFER_INITIALIZER;
+
+ virBufferAddLit(&opt, "egl-headless");
+
+ if (graphics->data.egl_headless.rendernode) {
+ if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_EGL_HEADLESS_RENDERNODE)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("This QEMU doesn't support OpenGL rendernode "
+ "with egl-headless graphics type"));
+ goto cleanup;
+ }
+
+ virBufferAddLit(&opt, ",rendernode=3D");
+ virQEMUBuildBufferEscapeComma(&opt,
+ graphics->data.egl_headless.renderno=
de);
+ }
+
+ if (virBufferCheckError(&opt) < 0)
+ goto cleanup;
+
virCommandAddArg(cmd, "-display");
- virCommandAddArg(cmd, "egl-headless");
+ virCommandAddArgBuffer(cmd, &opt);
=20
- return 0;
+ ret =3D 0;
+ cleanup:
+ virBufferFreeAndReset(&opt);
+ return ret;
}
=20
=20
diff --git a/tests/qemuxml2argvdata/graphics-egl-headless-rendernode.x86_64=
-latest.args b/tests/qemuxml2argvdata/graphics-egl-headless-rendernode.x86_=
64-latest.args
new file mode 100644
index 0000000000..ad9079d912
--- /dev/null
+++ b/tests/qemuxml2argvdata/graphics-egl-headless-rendernode.x86_64-latest=
.args
@@ -0,0 +1,31 @@
+LC_ALL=3DC \
+PATH=3D/bin \
+HOME=3D/home/test \
+USER=3Dtest \
+LOGNAME=3Dtest \
+/usr/bin/qemu-system-i686 \
+-name guest=3DQEMUGuest1,debug-threads=3Don \
+-S \
+-object secret,id=3DmasterKey0,format=3Draw,\
+file=3D/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
+-machine pc,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \
+-m 214 \
+-realtime mlock=3Doff \
+-smp 1,sockets=3D1,cores=3D1,threads=3D1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=3Dcharmonitor,fd=3D1729,server,nowait \
+-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \
+-rtc base=3Dutc \
+-no-shutdown \
+-no-acpi \
+-boot strict=3Don \
+-device piix3-usb-uhci,id=3Dusb,bus=3Dpci.0,addr=3D0x1.0x2 \
+-drive file=3D/dev/HostVG/QEMUGuest1,format=3Draw,if=3Dnone,id=3Ddrive-ide=
0-0-0 \
+-device ide-hd,bus=3Dide.0,unit=3D0,drive=3Ddrive-ide0-0-0,id=3Dide0-0-0,b=
ootindex=3D1 \
+-display egl-headless,rendernode=3D/dev/dri/foo \
+-device cirrus-vga,id=3Dvideo0,bus=3Dpci.0,addr=3D0x2 \
+-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\
+resourcecontrol=3Ddeny \
+-msg timestamp=3Don
diff --git a/tests/qemuxml2argvdata/graphics-egl-headless.x86_64-latest.arg=
s b/tests/qemuxml2argvdata/graphics-egl-headless.x86_64-latest.args
new file mode 100644
index 0000000000..ad9079d912
--- /dev/null
+++ b/tests/qemuxml2argvdata/graphics-egl-headless.x86_64-latest.args
@@ -0,0 +1,31 @@
+LC_ALL=3DC \
+PATH=3D/bin \
+HOME=3D/home/test \
+USER=3Dtest \
+LOGNAME=3Dtest \
+/usr/bin/qemu-system-i686 \
+-name guest=3DQEMUGuest1,debug-threads=3Don \
+-S \
+-object secret,id=3DmasterKey0,format=3Draw,\
+file=3D/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
+-machine pc,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \
+-m 214 \
+-realtime mlock=3Doff \
+-smp 1,sockets=3D1,cores=3D1,threads=3D1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=3Dcharmonitor,fd=3D1729,server,nowait \
+-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \
+-rtc base=3Dutc \
+-no-shutdown \
+-no-acpi \
+-boot strict=3Don \
+-device piix3-usb-uhci,id=3Dusb,bus=3Dpci.0,addr=3D0x1.0x2 \
+-drive file=3D/dev/HostVG/QEMUGuest1,format=3Draw,if=3Dnone,id=3Ddrive-ide=
0-0-0 \
+-device ide-hd,bus=3Dide.0,unit=3D0,drive=3Ddrive-ide0-0-0,id=3Dide0-0-0,b=
ootindex=3D1 \
+-display egl-headless,rendernode=3D/dev/dri/foo \
+-device cirrus-vga,id=3Dvideo0,bus=3Dpci.0,addr=3D0x2 \
+-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\
+resourcecontrol=3Ddeny \
+-msg timestamp=3Don
diff --git a/tests/qemuxml2argvdata/hostdev-mdev-display-spice-egl-headless=
.x86_64-latest.args b/tests/qemuxml2argvdata/hostdev-mdev-display-spice-egl=
-headless.x86_64-latest.args
index b84869264e..f5229936fc 100644
--- a/tests/qemuxml2argvdata/hostdev-mdev-display-spice-egl-headless.x86_64=
-latest.args
+++ b/tests/qemuxml2argvdata/hostdev-mdev-display-spice-egl-headless.x86_64=
-latest.args
@@ -24,7 +24,7 @@ file=3D/tmp/lib/domain--1-QEMUGuest2/master-key.aes \
-boot strict=3Don \
-device piix3-usb-uhci,id=3Dusb,bus=3Dpci.0,addr=3D0x1.0x2 \
-spice port=3D0,seamless-migration=3Don \
--display egl-headless \
+-display egl-headless,rendernode=3D/dev/dri/foo \
-device qxl-vga,id=3Dvideo0,ram_size=3D67108864,vram_size=3D67108864,\
vram64_size_mb=3D0,vgamem_mb=3D16,max_outputs=3D1,bus=3Dpci.0,addr=3D0x2 \
-device vfio-pci,id=3Dhostdev0,\
diff --git a/tests/qemuxml2argvdata/hostdev-mdev-display-vnc-egl-headless.x=
86_64-latest.args b/tests/qemuxml2argvdata/hostdev-mdev-display-vnc-egl-hea=
dless.x86_64-latest.args
index 91708d7663..9eaaf89eef 100644
--- a/tests/qemuxml2argvdata/hostdev-mdev-display-vnc-egl-headless.x86_64-l=
atest.args
+++ b/tests/qemuxml2argvdata/hostdev-mdev-display-vnc-egl-headless.x86_64-l=
atest.args
@@ -24,7 +24,7 @@ file=3D/tmp/lib/domain--1-QEMUGuest2/master-key.aes \
-boot strict=3Don \
-device piix3-usb-uhci,id=3Dusb,bus=3Dpci.0,addr=3D0x1.0x2 \
-vnc 127.0.0.1:0 \
--display egl-headless \
+-display egl-headless,rendernode=3D/dev/dri/foo \
-device qxl-vga,id=3Dvideo0,ram_size=3D67108864,vram_size=3D67108864,\
vram64_size_mb=3D0,vgamem_mb=3D16,max_outputs=3D1,bus=3Dpci.0,addr=3D0x2 \
-device vfio-pci,id=3Dhostdev0,\
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index eae2b7edf7..5601b356e2 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1246,6 +1246,8 @@ mymain(void)
DO_TEST("graphics-egl-headless",
QEMU_CAPS_EGL_HEADLESS,
QEMU_CAPS_DEVICE_CIRRUS_VGA);
+ DO_TEST_CAPS_LATEST("graphics-egl-headless");
+ DO_TEST_CAPS_LATEST("graphics-egl-headless-rendernode");
=20
DO_TEST("graphics-vnc", QEMU_CAPS_VNC, QEMU_CAPS_DEVICE_CIRRUS_VGA);
DO_TEST("graphics-vnc-socket", QEMU_CAPS_VNC, QEMU_CAPS_DEVICE_CIRRUS_=
VGA);
--=20
2.19.1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list