From nobody Sun Feb 8 22:43:26 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=1623423927; cv=none; d=zohomail.com; s=zohoarc; b=dY774kTK72Yjr+cUEzaYDHXVQi35ANOlay1DtyLef3pbj6gnBJPFYxbkgYgmbFPDkct0jYNPl3BGVg4zXiOFijgHjv5AfERUfPhPLZxoiUJgN/Wnqt5nyNs8ZtBXPzu/0BIlMImvhl816i65fQKuQg5+OX+H4e0VUAJImRWlkEg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623423927; 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=2OLmsWGy/xNlRFNN5XQ2mz17G1gaL1MZZjSpG4webEM=; b=KHTiJklKtXVVWtG32TR6oCTk2ihcCnwEBGfyXd6CDZ9LmR0xmr6btallVnP5R8B6YQmWiLTYgzWR3UtDt0vV27jwlixjh0Hf7MgQeCHf3NoLTE0u8IwXgghG7gcxm5vCNweyIDQx+NOhLC63sZWdpmP5drZAuy1wdmChde3AEeI= 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 1623423927020479.8479227942952; Fri, 11 Jun 2021 08:05:27 -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-133-J5YqEPooMSW4CAWKcF6kAg-1; Fri, 11 Jun 2021 11:05:22 -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 70DD81850606; Fri, 11 Jun 2021 15:05:14 +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 503AA5D9C6; Fri, 11 Jun 2021 15:05:14 +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 163A946F5C; Fri, 11 Jun 2021 15:05:14 +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 15BF5C2D009900 for ; Fri, 11 Jun 2021 11:05:12 -0400 Received: by smtp.corp.redhat.com (Postfix) id 91B235D9D7; Fri, 11 Jun 2021 15:05:12 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.194.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id 160D25D9F0 for ; Fri, 11 Jun 2021 15:05:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623423925; 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=2OLmsWGy/xNlRFNN5XQ2mz17G1gaL1MZZjSpG4webEM=; b=GCV1S2GxG9nW7rKTXDU4Za+pUwsTatMcYkAiCOcS16vgNLjvo9qcCVwfN8qAvuvefbNEmS 6Ae/qxDHyCdz4hJzs8amw58KcPHXOZlu31obTkZyIUOlLJhnzgVs0FFySup/a6TqGZnXiK Twck5gxLn9kltoGYOaX/4qMs7rEBDl8= X-MC-Unique: J5YqEPooMSW4CAWKcF6kAg-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 2/7] qemuBuildDeviceVideoStr: Separate out video module selection Date: Fri, 11 Jun 2021 17:04:55 +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" The code that decides video card model is going to be reworked and expanded. Separate it out into a function. Signed-off-by: Michal Privoznik --- src/qemu/qemu_command.c | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 4b676fe8fc..7ca099bb39 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -4195,18 +4195,11 @@ qemuBuildSoundCommandLine(virCommand *cmd, } =20 =20 - -static char * -qemuBuildDeviceVideoStr(const virDomainDef *def, - virDomainVideoDef *video, - virQEMUCaps *qemuCaps) +static const char * +qemuDeviceVideoGetModel(virQEMUCaps *qemuCaps, + const virDomainVideoDef *video) { - g_auto(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; const char *model =3D NULL; - virTristateSwitch accel3d =3D VIR_TRISTATE_SWITCH_ABSENT; - - if (video->accel) - accel3d =3D video->accel->accel3d; =20 /* We try to chose the best model for primary video device by preferri= ng * model with VGA compatibility mode. For some video devices on some @@ -4231,6 +4224,25 @@ qemuBuildDeviceVideoStr(const virDomainDef *def, return NULL; } =20 + return model; +} + + +static char * +qemuBuildDeviceVideoStr(const virDomainDef *def, + virDomainVideoDef *video, + virQEMUCaps *qemuCaps) +{ + g_auto(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; + const char *model =3D NULL; + virTristateSwitch accel3d =3D VIR_TRISTATE_SWITCH_ABSENT; + + if (video->accel) + accel3d =3D video->accel->accel3d; + + if (!(model =3D qemuDeviceVideoGetModel(qemuCaps, video))) + return NULL; + if (STREQ(model, "virtio-gpu") || STREQ(model, "vhost-user-gpu")) { if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_GPU_GL_PCI) && accel3d =3D=3D VIR_TRISTATE_SWITCH_ON && --=20 2.31.1