From nobody Fri Dec 19 20:17:12 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 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