From nobody Sun Feb 8 22:08:32 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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=1623423948; cv=none; d=zohomail.com; s=zohoarc; b=KCFUXDyK/ulmp3rcAprhSuAdMEQqV3tg5e7xsYTc2pI86nKkQuKTyc58lUYFPNqU3SPN32PUjSorhX8GZiF/TZ8mgLybgtDunQilCEaF6BMtu35gGgb1mhhiYyUeZuSN11zpXfpHOCL7kGZHJ1HXgQgEdmqFXSZChGGlIH8M8sc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623423948; h=Content-Type:Content-Transfer-Encoding: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; bh=ehwPcwauR44XIrQg3CTVoaaJ+2sdqIogqOelH/WLS0s=; b=MPzpOzlvqm7TwhK/gRwXactPS/Jz512bMQ9mZyWwH0ARd9rIdP2DIlW1cN/PZ5zWiK9CqzhMgsOaNhJYwuAcBRV4RRPsbcd73kfysvKJa1vNbJl+rCTMgMNETwG/etl8JitmPafXvsOxnQagyo+z2z6kY1jpAYy9vxhwsAtmbis= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1623423948892274.28228482504494; Fri, 11 Jun 2021 08:05:48 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-595-cRRygwVuO2yL8s0eZsKyRw-1; Fri, 11 Jun 2021 11:05:46 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9676391272; Fri, 11 Jun 2021 15:05: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 6E7825E7AA; Fri, 11 Jun 2021 15:05: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 2D5A21832D5E; Fri, 11 Jun 2021 15:05:40 +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 15BF5dAN010089 for ; Fri, 11 Jun 2021 11:05:39 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7F34E18E2E; Fri, 11 Jun 2021 15:05:39 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.194.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id 033BF18E31 for ; Fri, 11 Jun 2021 15:05:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623423947; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=ehwPcwauR44XIrQg3CTVoaaJ+2sdqIogqOelH/WLS0s=; b=TWaY9Hx/zBB/TlrPnoskkYQLI0J8K20Idko13VLAncVWPSPFBBuJTSlMvm8pI1EJaWroOK ukT3Obt1zF8KeJY5u+KHjGUL0sTee8tIFvXsm5P3dKL8Tky8bn5olA7pQmyR4j2s3VAApe cCsn+VxoArOcooEaAesf0tg0sktPDkk= X-MC-Unique: cRRygwVuO2yL8s0eZsKyRw-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 7/7] qemuBuildDeviceVideoStr: Don't overwrite @model Date: Fri, 11 Jun 2021 17:05:00 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Now we have everything prepared so that @model doesn't have to be rewritten. The correct model can be chosen right from the beginning. Signed-off-by: Michal Privoznik --- src/qemu/qemu_command.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index c9e152324d..22cc383f33 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -4164,6 +4164,12 @@ qemuDeviceVideoGetModel(virQEMUCaps *qemuCaps, { const char *model =3D NULL; bool primaryVga =3D false; + virTristateSwitch accel3d =3D VIR_TRISTATE_SWITCH_ABSENT; + + *virtio =3D false; + + if (video->accel) + accel3d =3D video->accel->accel3d; =20 *virtio =3D false; =20 @@ -4197,7 +4203,11 @@ qemuDeviceVideoGetModel(virQEMUCaps *qemuCaps, model =3D "qxl-vga"; break; case VIR_DOMAIN_VIDEO_TYPE_VIRTIO: - model =3D "virtio-vga"; + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_VGA_GL) && + accel3d =3D=3D VIR_TRISTATE_SWITCH_ON) + model =3D "virtio-vga-gl"; + else + model =3D "virtio-vga"; break; case VIR_DOMAIN_VIDEO_TYPE_BOCHS: model =3D "bochs-display"; @@ -4220,7 +4230,11 @@ qemuDeviceVideoGetModel(virQEMUCaps *qemuCaps, model =3D "qxl"; break; case VIR_DOMAIN_VIDEO_TYPE_VIRTIO: - model =3D "virtio-gpu"; + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_GPU_GL_PCI) = && + accel3d =3D=3D VIR_TRISTATE_SWITCH_ON) + model =3D "virtio-gpu-gl"; + else + model =3D "virtio-gpu"; *virtio =3D true; break; case VIR_DOMAIN_VIDEO_TYPE_DEFAULT: @@ -4268,21 +4282,12 @@ qemuBuildDeviceVideoStr(const virDomainDef *def, return NULL; =20 if (virtio) { - if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_GPU_GL_PCI) && - accel3d =3D=3D VIR_TRISTATE_SWITCH_ON && - STREQ(model, "virtio-gpu")) - model =3D "virtio-gpu-gl"; - if (qemuBuildVirtioDevStr(&buf, model, qemuCaps, VIR_DOMAIN_DEVICE_VIDEO, video) < 0) { return NULL; } } else { virBufferAsprintf(&buf, "%s", model); - if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_VGA_GL) && - accel3d =3D=3D VIR_TRISTATE_SWITCH_ON && - STREQ(model, "virtio-vga")) - virBufferAddLit(&buf, "-gl"); } =20 virBufferAsprintf(&buf, ",id=3D%s", video->info.alias); --=20 2.31.1