From nobody Wed May 14 09:53:58 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=fail(p=none dis=none) header.from=codethink.co.uk Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1525949723346847.6166077898183; Thu, 10 May 2018 03:55:23 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BDB423002FE4; Thu, 10 May 2018 10:55:21 +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 85B0A2010CCD; Thu, 10 May 2018 10:55:21 +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 3DF7E180B5AA; Thu, 10 May 2018 10:55:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w4AAtJaB020809 for ; Thu, 10 May 2018 06:55:19 -0400 Received: by smtp.corp.redhat.com (Postfix) id 41DE42010CCD; Thu, 10 May 2018 10:55:19 +0000 (UTC) Received: from mx1.redhat.com (ext-mx08.extmail.prod.ext.phx2.redhat.com [10.5.110.32]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 39FDC2010CBA for ; Thu, 10 May 2018 10:55:16 +0000 (UTC) Received: from imap1.codethink.co.uk (imap1.codethink.co.uk [176.9.8.82]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F0205C0587C1 for ; Thu, 10 May 2018 10:55:14 +0000 (UTC) Received: from [88.97.110.231] (helo=ct-lt-931.lan) by imap1.codethink.co.uk with esmtpsa (Exim 4.84_2 #1 (Debian)) id 1fGjE9-00018g-G6; Thu, 10 May 2018 11:55:13 +0100 From: Maciej Wolny To: libvir-list@redhat.com Date: Thu, 10 May 2018 11:53:59 +0100 Message-Id: <20180510105359.24803-6-maciej.wolny@codethink.co.uk> In-Reply-To: <20180510105359.24803-1-maciej.wolny@codethink.co.uk> References: <20180510105359.24803-1-maciej.wolny@codethink.co.uk> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 10 May 2018 10:55:15 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 10 May 2018 10:55:15 +0000 (UTC) for IP:'176.9.8.82' DOMAIN:'imap1.codethink.co.uk' HELO:'imap1.codethink.co.uk' FROM:'maciej.wolny@codethink.co.uk' RCPT:'' X-RedHat-Spam-Score: -0.011 (RCVD_IN_DNSWL_NONE, SPF_PASS) 176.9.8.82 imap1.codethink.co.uk 176.9.8.82 imap1.codethink.co.uk X-Scanned-By: MIMEDefang 2.78 on 10.5.110.32 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.25 X-loop: libvir-list@redhat.com Cc: Maciej Wolny Subject: [libvirt] [PATCH v2 5/5] qemu: Add gl option to SDL graphics command line 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: , MIME-Version: 1.0 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.25 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Thu, 10 May 2018 10:55:22 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Support OpenGL when using SDL backend via -sdl,gl=3Don. Add associated tests. Signed-off-by: Maciej Wolny Reviewed-by: John Ferlan --- src/qemu/qemu_command.c | 25 ++++++++++++++++++- .../qemuxml2argvdata/video-virtio-gpu-sdl-gl.args | 28 ++++++++++++++++++= ++++ tests/qemuxml2argvtest.c | 5 ++++ 3 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 tests/qemuxml2argvdata/video-virtio-gpu-sdl-gl.args diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 690be51e0..9e7a0f26d 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -7573,6 +7573,10 @@ qemuBuildGraphicsSDLCommandLine(virQEMUDriverConfigP= tr cfg ATTRIBUTE_UNUSED, virQEMUCapsPtr qemuCaps ATTRIBUTE_UNUSED, virDomainGraphicsDefPtr graphics) { + int ret =3D -1; + virBuffer opt =3D VIR_BUFFER_INITIALIZER; + const char *optContent; + if (graphics->data.sdl.xauth) virCommandAddEnvPair(cmd, "XAUTHORITY", graphics->data.sdl.xauth); if (graphics->data.sdl.display) @@ -7588,7 +7592,26 @@ qemuBuildGraphicsSDLCommandLine(virQEMUDriverConfigP= tr cfg ATTRIBUTE_UNUSED, virCommandAddEnvPassBlockSUID(cmd, "SDL_AUDIODRIVER", NULL); =20 virCommandAddArg(cmd, "-sdl"); - return 0; + + if (graphics->data.sdl.gl =3D=3D VIR_TRISTATE_BOOL_YES) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SDL_GL)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("This QEMU doesn't support SDL OpenGL")); + goto cleanup; + } + + virBufferAsprintf(&opt, "gl=3D%s", + virTristateSwitchTypeToString(graphics->data.sdl= .gl)); + } + + optContent =3D virBufferCurrentContent(&opt); + if (optContent && STRNEQ(optContent, "")) + virCommandAddArgBuffer(cmd, &opt); + + ret =3D 0; + cleanup: + virBufferFreeAndReset(&opt); + return ret; } =20 =20 diff --git a/tests/qemuxml2argvdata/video-virtio-gpu-sdl-gl.args b/tests/qe= muxml2argvdata/video-virtio-gpu-sdl-gl.args new file mode 100644 index 000000000..4172320ed --- /dev/null +++ b/tests/qemuxml2argvdata/video-virtio-gpu-sdl-gl.args @@ -0,0 +1,28 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/home/test \ +USER=3Dtest \ +LOGNAME=3Dtest \ +/usr/bin/qemu-system-i686 \ +-name QEMUGuest1 \ +-S \ +-machine pc,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \ +-m 1024 \ +-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 \ +-boot c \ +-usb \ +-drive file=3D/var/lib/libvirt/images/QEMUGuest1,format=3Dqcow2,if=3Dnone,\ +id=3Ddrive-ide0-0-0,cache=3Dnone \ +-device ide-drive,bus=3Dide.0,unit=3D0,drive=3Ddrive-ide0-0-0,id=3Dide0-0-= 0 \ +-sdl gl=3Don \ +-device virtio-gpu-pci,id=3Dvideo0,virgl=3Don,bus=3Dpci.0,addr=3D0x2 \ +-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x3 diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index ddf567b62..5d8dd9d04 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1908,6 +1908,11 @@ mymain(void) QEMU_CAPS_SPICE_GL, QEMU_CAPS_SPICE_RENDERNODE, QEMU_CAPS_DEVICE_VIDEO_PRIMARY); + DO_TEST("video-virtio-gpu-sdl-gl", + QEMU_CAPS_DEVICE_VIRTIO_GPU, + QEMU_CAPS_VIRTIO_GPU_VIRGL, + QEMU_CAPS_SDL_GL, + QEMU_CAPS_DEVICE_VIDEO_PRIMARY); DO_TEST("video-virtio-gpu-secondary", QEMU_CAPS_DEVICE_VIRTIO_GPU, QEMU_CAPS_DEVICE_VIDEO_PRIMARY); --=20 2.11.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list