From nobody Thu Apr 25 06:50:42 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 ARC-Seal: i=1; a=rsa-sha256; t=1570533392; cv=none; d=zoho.com; s=zohoarc; b=QCvi3cUxCtL8LI6f9/0jRYhsgcwEYt5Wktdpw8ih87eCWGogLcUc6ZHoX/Uys94Y5V1I2avyvXxqKJ0dsYwsDdadE6iOhI6pCGm0usxB1HkvXRjPgp8BcUqXJgM0uZI57ZufSv548RHMrgfMBg5qi7qPiojEfE73yG08BZ6BJmQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1570533392; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=q+q32yivwIm8Zl+x84UUawKf5StrZZDmXKG1SEQqi3Y=; b=H5dJyXTe8vVWacBhIRcnYcVEvkj0ccsIfAKAVG1juY7UQz0ie399FMsrCAT+whQKEca6xMNb38Rkycz6pIqcHi4fhPnuQa0weOr7LH2MbPgJR8Mi2dyl0JlhoieO0XMROfr4oVinRfVE5pC1q7z8g6+ITULUTRUq1l+hf11UoI8= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1570533392975593.3680684342951; Tue, 8 Oct 2019 04:16:32 -0700 (PDT) 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 AAC3B308449D; Tue, 8 Oct 2019 11:16:30 +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 7EAD160A35; Tue, 8 Oct 2019 11:16:30 +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 36F411803B4B; Tue, 8 Oct 2019 11:16:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x98BGCMH021984 for ; Tue, 8 Oct 2019 07:16:12 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7D6C85D9D6; Tue, 8 Oct 2019 11:16:12 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.43.2.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id D3D5C5D9C9; Tue, 8 Oct 2019 11:16:11 +0000 (UTC) From: Pavel Mores To: libvir-list@redhat.com Date: Tue, 8 Oct 2019 13:16:03 +0200 Message-Id: <20191008111603.17081-2-pmores@redhat.com> In-Reply-To: <20191008111603.17081-1-pmores@redhat.com> References: <20191008111603.17081-1-pmores@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Pavel Mores Subject: [libvirt] [PATCH 1/1] qemu: fix type of default video 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.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.40]); Tue, 08 Oct 2019 11:16:31 +0000 (UTC) Content-Type: text/plain; charset="utf-8" If a graphics device is added to XML that has no video device, libvirt automatically adds a video device which is always of type 'cirrus', even if the underlying qemu doesn't support cirrus. This patch refines a bit the decision about the type of the video device. Based on QEMU capabilities, cirrus is still preferred but only added if QEMU supports it, otherwise QXL is preferred for SPICE and Bochs for UEFI guests. VGA is used as a fallback. (For some info about QEMU display devices see e.g. https://www.kraxel.org/blog/2019/09/display-devices-in-qemu/ .) https://bugzilla.redhat.com/show_bug.cgi?id=3D1668141 Signed-off-by: Pavel Mores --- src/qemu/qemu_domain.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index b4175a846e..a37ff1d384 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -7821,7 +7821,8 @@ qemuDomainDeviceNetDefPostParse(virDomainNetDefPtr ne= t, =20 static int qemuDomainDeviceVideoDefPostParse(virDomainVideoDefPtr video, - const virDomainDef *def) + const virDomainDef *def, + virQEMUCapsPtr qemuCaps) { if (video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_DEFAULT) { if (ARCH_IS_PPC64(def->os.arch)) @@ -7830,8 +7831,20 @@ qemuDomainDeviceVideoDefPostParse(virDomainVideoDefP= tr video, qemuDomainIsRISCVVirt(def) || ARCH_IS_S390(def->os.arch)) video->type =3D VIR_DOMAIN_VIDEO_TYPE_VIRTIO; - else - video->type =3D VIR_DOMAIN_VIDEO_TYPE_CIRRUS; + else { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_CIRRUS_VGA)) { + video->type =3D VIR_DOMAIN_VIDEO_TYPE_CIRRUS; + } else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_SPICE) + && virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_QXL)) { + video->type =3D VIR_DOMAIN_VIDEO_TYPE_QXL; + video->vgamem =3D QEMU_QXL_VGAMEM_DEFAULT; + } else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_BOCHS_DIS= PLAY) + && def->os.firmware =3D=3D VIR_DOMAIN_OS_DEF_FIRMWARE_= EFI) { + video->type =3D VIR_DOMAIN_VIDEO_TYPE_BOCHS; + } else { + video->type =3D VIR_DOMAIN_VIDEO_TYPE_VGA; + } + } } =20 if (video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_QXL && @@ -7926,7 +7939,7 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr de= v, break; =20 case VIR_DOMAIN_DEVICE_VIDEO: - ret =3D qemuDomainDeviceVideoDefPostParse(dev->data.video, def); + ret =3D qemuDomainDeviceVideoDefPostParse(dev->data.video, def, qe= muCaps); break; =20 case VIR_DOMAIN_DEVICE_PANIC: --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list