From nobody Wed May 1 15:02:04 2024 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=1623423966; cv=none; d=zohomail.com; s=zohoarc; b=MkEn5RFeS3XtOJgnGYvdpSpvZGsFWYQVEn+wmtSBn4hxUnYy3PvkuEG/B4neBkNmoggiyng6r4YLe8W06EXuJhFw2BoYRZm3tjFgvcE3vocwJnupV/vKuWQ7ZFNNm8SgS4eQ9fPCGEZfrDjiKPRLoGxbUXb9ztfsXPSvY65D0hQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623423966; 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=p/wFrzEf9y4VO821gCkiFXGnRtC6tOmE3rySz/v57GQ=; b=NIDgzHFpTCAzWziIOtI4vsVt2QuM633jVI/2AvWQu068D5nZN8KgDjHhGezAa+7PGz/htFPlqPCb3YRxICJ6mt4tojcAinCugiXlOei68ARxQJ3Bmz2WNoInbI0X+up0i0gFtvvIdp2fffQm5I45/lCHNeojE3WPjy9PNI2aUkg= 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 1623423966620527.2147924253761; Fri, 11 Jun 2021 08:06:06 -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-410-kl9zev5UOqeIKEu2fTp1lA-1; Fri, 11 Jun 2021 11:05:33 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1990E100C619; Fri, 11 Jun 2021 15:05:29 +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 EC33B5C26D; Fri, 11 Jun 2021 15:05:28 +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 B69D046F65; Fri, 11 Jun 2021 15:05:28 +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 15BF57W5009881 for ; Fri, 11 Jun 2021 11:05:07 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2AF2D5D9E2; Fri, 11 Jun 2021 15:05:07 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.194.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id A328C5D9D7 for ; Fri, 11 Jun 2021 15:05:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623423965; 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=p/wFrzEf9y4VO821gCkiFXGnRtC6tOmE3rySz/v57GQ=; b=LshzxZcnWkAI8gvWX4kgbjMBwOP2ODE/wwEH1bWz0Ipdmu60jvjxP3CYjAtBySGibObO0X VG3rzCX5HNtipACj3EgDu7SwSTFKn6eY+puz1fni+hs3yS3uDC/1ahimk5YmKIhX+ZKWy+ 84GoIvn24c1tLLpVm3c8HuPTQxeG7wo= X-MC-Unique: kl9zev5UOqeIKEu2fTp1lA-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 1/7] qemuDomainSupportsVideoVga: Fix const correctness Date: Fri, 11 Jun 2021 17:04:54 +0200 Message-Id: <2d591cc371c97e16dd357a89ff2dcb30131ab38e.1623423850.git.mprivozn@redhat.com> 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.16 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" This function doesn't modify passed video definition. Make the argument const. Signed-off-by: Michal Privoznik Reviewed-by: Peter Krempa --- src/qemu/qemu_domain.c | 2 +- src/qemu/qemu_domain.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 7f57cae00e..6bcd67611e 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -10163,7 +10163,7 @@ qemuDomainCheckMonitor(virQEMUDriver *driver, =20 =20 bool -qemuDomainSupportsVideoVga(virDomainVideoDef *video, +qemuDomainSupportsVideoVga(const virDomainVideoDef *video, virQEMUCaps *qemuCaps) { if (video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_VIRTIO) { diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 9cebf9e426..0394eb45a6 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -914,7 +914,7 @@ int qemuDomainCheckMonitor(virQEMUDriver *driver, virDomainObj *vm, qemuDomainAsyncJob asyncJob); =20 -bool qemuDomainSupportsVideoVga(virDomainVideoDef *video, +bool qemuDomainSupportsVideoVga(const virDomainVideoDef *video, virQEMUCaps *qemuCaps); =20 bool qemuDomainNeedsVFIO(const virDomainDef *def); --=20 2.31.1 From nobody Wed May 1 15:02:04 2024 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 Reviewed-by: Peter Krempa --- 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 From nobody Wed May 1 15:02:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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 170.10.133.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=1623423923; cv=none; d=zohomail.com; s=zohoarc; b=m24NwV3VHaIiIPEyNjD+YuHiY//6gb0ReQ7I9y0nfllrZtxfJUzRbLL2cBguDS/3nrPSb5S9MLteoA9N8eodpYO/4xEtYa7RRF8yKY93bkbxGXbJHQScIXUQE0ljTqDkQ6wxJzOJPO2eI7Yz9OVYWPgxSbBkv3DOt2JdiO+JCHk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623423923; 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=I1sdNbaFM2Fy2Hg3TBRHAHPS+sdImV1anETDFQ98SV4=; b=QCMuBZL5/S7e5o9j2oNT06Jf18WiuHtIN8HkkFKIh9+2s/NwV6nERN9bJcCTEZFmx+3KBhm8C2I7x+tqo7NtZdxf3rdDyiMDMWc5s+nQdYNoFmehScAGNazG3r2sYpwiK4XOFfBUi2dKD0LXSCY8pNd/w0CLNcUwNzme/2XCFEA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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 [170.10.133.124]) by mx.zohomail.com with SMTPS id 1623423923199718.4740750956997; Fri, 11 Jun 2021 08:05:23 -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-556-7TQohDPSMeWdSXB0VJSsaw-1; Fri, 11 Jun 2021 11:05:20 -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 79981100B3B2; Fri, 11 Jun 2021 15:05:16 +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 53C5E5D9C6; Fri, 11 Jun 2021 15:05:16 +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 EA52A46F5E; Fri, 11 Jun 2021 15:05:15 +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 15BF5DSF009905 for ; Fri, 11 Jun 2021 11:05:13 -0400 Received: by smtp.corp.redhat.com (Postfix) id 690A75D9C6; Fri, 11 Jun 2021 15:05:13 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.194.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id E10FD5D9D7 for ; Fri, 11 Jun 2021 15:05:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623423922; 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=I1sdNbaFM2Fy2Hg3TBRHAHPS+sdImV1anETDFQ98SV4=; b=HX7i3a06bRbBqtyLpkVpq4RC4q+2gLAQZ6XZI73uKx71Uvk9PgsmzZJgIci4VevOoJIvCj qeANUSQ8+1Pnqb2ZYCpPVilAo9W0OiILEEOytjofufIBOu1m6PtNZVn3i6o21/9ner/9MB 2myrTlIsymKeL8bQgTvraW+xkDtkBfs= X-MC-Unique: 7TQohDPSMeWdSXB0VJSsaw-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 3/7] qemuDeviceVideoGetModel: Deduplicate a check Date: Fri, 11 Jun 2021 17:04:56 +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" There is the same check written twice (whether given video card is primary one and whether it supports VGA mode). Write it just once and store it in a boolean variable. Signed-off-by: Michal Privoznik Reviewed-by: Peter Krempa --- src/qemu/qemu_command.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 7ca099bb39..9d8e41f4cd 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -4200,18 +4200,22 @@ qemuDeviceVideoGetModel(virQEMUCaps *qemuCaps, const virDomainVideoDef *video) { const char *model =3D NULL; + bool primaryVga =3D false; + + if (video->primary && qemuDomainSupportsVideoVga(video, qemuCaps)) + primaryVga =3D true; =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 * architectures there might not be such model so fallback to one * without VGA compatibility mode. */ if (video->backend =3D=3D VIR_DOMAIN_VIDEO_BACKEND_TYPE_VHOSTUSER) { - if (video->primary && qemuDomainSupportsVideoVga(video, qemuCaps)) + if (primaryVga) model =3D "vhost-user-vga"; else model =3D "vhost-user-gpu"; } else { - if (video->primary && qemuDomainSupportsVideoVga(video, qemuCaps)) + if (primaryVga) model =3D qemuDeviceVideoTypeToString(video->type); else model =3D qemuDeviceVideoSecondaryTypeToString(video->type); --=20 2.31.1 From nobody Wed May 1 15:02:04 2024 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=1623423928; cv=none; d=zohomail.com; s=zohoarc; b=OSNfNvFfok01ZwUvYwLYnPj8ffqgXpoBgVbY4CoSe58b4Hao65mkgtc8/R9YYzAb2XISYruBk3fQqOkoajYB/2mcxePrXm3Fcm+9bbVpQAHnZmNELMl/dC6s7dsswd+lrALEkydUDxRRzrLG5D8qZoZh8jkR+DPhBTDcBi31C1M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623423928; 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=eQO9vmj/OGB32CleWf3DLpo5jYZohfnmlvGxLEMGj+A=; b=CXbbMFTSxbCJBCEXOGVxM0lrbBpGudJ31/EEVcusprwr2YjkjnnjAewj7MYkjdRQeF5MitEjxkc/HAtH80xhtcP6oY5u4O3PJgEakCi2zEN/F9Mmonaj/CwM6GgzjOSqhoAUg8YMcI3nErh4tLgoS+OPnpswhS10NyKWGz0YVYw= 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 16234239281236.600915928511768; Fri, 11 Jun 2021 08:05:28 -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-97-ipqroVtMPRG5yqIEhVwJ5g-1; Fri, 11 Jun 2021 11:05:24 -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 A8993101C8AE; Fri, 11 Jun 2021 15:05:18 +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 7EC175D9C6; Fri, 11 Jun 2021 15:05:18 +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 412E71826D2A; Fri, 11 Jun 2021 15:05:18 +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 15BF5HOs009925 for ; Fri, 11 Jun 2021 11:05:17 -0400 Received: by smtp.corp.redhat.com (Postfix) id 02E565DAA5; Fri, 11 Jun 2021 15:05:17 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.194.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7AFEF5D9F0 for ; Fri, 11 Jun 2021 15:05:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623423927; 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=eQO9vmj/OGB32CleWf3DLpo5jYZohfnmlvGxLEMGj+A=; b=LByTNSQmvR0+ercSbjecBL/oMGd1C8x5VEnlasUUwi31mc/y/WvagVLekxIND6yfOLMj+f e/s4nUMqol4521uvQYqsU5mTDTu5kSXHcmofHNEFTfG81KuemmUWYxWahP7VRhJ85m1L5q aZvC3SLkV6izoOIT6hlaCyiUFi9Jlug= X-MC-Unique: ipqroVtMPRG5yqIEhVwJ5g-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 4/7] qemu_command: Switch from VIR_ENUM_IMPL(qemuDeviceVideo) to explicit switch() Date: Fri, 11 Jun 2021 17:04:57 +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" This may look like a step backwards, but it isn't. The point is that in near future the chosen model will depend on more than just video type. Signed-off-by: Michal Privoznik Reviewed-by: Peter Krempa --- src/qemu/qemu_command.c | 56 +++++++++++++++++++++++++---------------- 1 file changed, 34 insertions(+), 22 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 9d8e41f4cd..0a22036002 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -104,25 +104,6 @@ VIR_ENUM_IMPL(qemuVideo, "", /* ramfb can't be used with -vga */ ); =20 -VIR_ENUM_DECL(qemuDeviceVideo); - -VIR_ENUM_IMPL(qemuDeviceVideo, - VIR_DOMAIN_VIDEO_TYPE_LAST, - "", /* default value, we shouldn't see this */ - "VGA", - "cirrus-vga", - "vmware-svga", - "", /* don't support xen */ - "", /* don't support vbox */ - "qxl-vga", - "", /* don't support parallels */ - "virtio-vga", - "" /* don't support gop */, - "" /* 'none' doesn't make sense here */, - "bochs-display", - "ramfb", -); - VIR_ENUM_DECL(qemuDeviceVideoSecondary); =20 VIR_ENUM_IMPL(qemuDeviceVideoSecondary, @@ -4215,10 +4196,41 @@ qemuDeviceVideoGetModel(virQEMUCaps *qemuCaps, else model =3D "vhost-user-gpu"; } else { - if (primaryVga) - model =3D qemuDeviceVideoTypeToString(video->type); - else + if (primaryVga) { + switch (video->type) { + case VIR_DOMAIN_VIDEO_TYPE_VGA: + model =3D "VGA"; + break; + case VIR_DOMAIN_VIDEO_TYPE_CIRRUS: + model =3D "cirrus-vga"; + break; + case VIR_DOMAIN_VIDEO_TYPE_VMVGA: + model =3D "vmware-svga"; + break; + case VIR_DOMAIN_VIDEO_TYPE_QXL: + model =3D "qxl-vga"; + break; + case VIR_DOMAIN_VIDEO_TYPE_VIRTIO: + model =3D "virtio-vga"; + break; + case VIR_DOMAIN_VIDEO_TYPE_BOCHS: + model =3D "bochs-display"; + break; + case VIR_DOMAIN_VIDEO_TYPE_RAMFB: + model =3D "ramfb"; + break; + case VIR_DOMAIN_VIDEO_TYPE_DEFAULT: + case VIR_DOMAIN_VIDEO_TYPE_XEN: + case VIR_DOMAIN_VIDEO_TYPE_VBOX: + case VIR_DOMAIN_VIDEO_TYPE_PARALLELS: + case VIR_DOMAIN_VIDEO_TYPE_GOP: + case VIR_DOMAIN_VIDEO_TYPE_NONE: + case VIR_DOMAIN_VIDEO_TYPE_LAST: + break; + } + } else { model =3D qemuDeviceVideoSecondaryTypeToString(video->type); + } } =20 if (!model || STREQ(model, "")) { --=20 2.31.1 From nobody Wed May 1 15:02:04 2024 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=1623423932; cv=none; d=zohomail.com; s=zohoarc; b=V3IJC79eb9otV93o+zhzwfy+Szl359HI02XRbE7ll2y6P+b7JIxTy4jzbgjHPfE0UOWR/u1G0DxRyJY3ad0d2nFG7QUEwuF9fIHY9H1FVVLG0fsHhgybLDvYDj9zyKFnsnQZVDCGC71fUAJRlKUlLsQ1kHwmkiU3aK1mcySjArQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623423932; 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=nselbtx31EF6RRcYDEFPH9OHc4xl5Ha6uG4ZUIolB+E=; b=PHZiPTnuQW7q6cGKkXNW5pwBUIuqY5sC0/1RvBJAGZVpKtoVFin4aMLnwrLoxGN5kiXERMeJBncv6LqwTonIje6H48fsXQIW8C4BG8xMGM3PwsEdMMk4Zw3QgLAWpmBpf4TwVaD6gp7sAowDJXLVpadAb5S4fxaa3lqeNUC9BUc= 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 1623423932001371.03912110754106; Fri, 11 Jun 2021 08:05:32 -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-575-Je8CgwDhMc2wPNezHtU8Tg-1; Fri, 11 Jun 2021 11:05:29 -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 F1506100B3AE; Fri, 11 Jun 2021 15:05:22 +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 CBA855D9C6; Fri, 11 Jun 2021 15:05:22 +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 903681826D2C; Fri, 11 Jun 2021 15:05:22 +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 15BF5Kp6009937 for ; Fri, 11 Jun 2021 11:05:20 -0400 Received: by smtp.corp.redhat.com (Postfix) id 80FC65D9C6; Fri, 11 Jun 2021 15:05:20 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.194.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id 057255D9F0 for ; Fri, 11 Jun 2021 15:05:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623423931; 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=nselbtx31EF6RRcYDEFPH9OHc4xl5Ha6uG4ZUIolB+E=; b=gUmKD9DcDHmtJNr9PViXITee2Brpuj1iuouXwpRK1E+d1wOcRF3ccPZeL6hLJ0CS/P5u5J 69DzJthDFRlJhpuB1nNknwDRxwrzNM/GzOK2QfWMNoAwDjRlG6Lp64I2mniJkjiWYCAZxv sTukQRVDolksx3wkiu1ZPmmt2sQlc5w= X-MC-Unique: Je8CgwDhMc2wPNezHtU8Tg-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 5/7] qemu_command: Switch from VIR_ENUM_IMPL(qemuDeviceVideoSecondary) to explicit switch() Date: Fri, 11 Jun 2021 17:04:58 +0200 Message-Id: <1fecdb2d6cfb5c1acb1a22aeb4e06bc130231431.1623423850.git.mprivozn@redhat.com> 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" This may look like a step backwards, but it isn't. The point is that in near future the chosen model will depend on more than just video type. Signed-off-by: Michal Privoznik Reviewed-by: Peter Krempa --- src/qemu/qemu_command.c | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 0a22036002..71f0b498c1 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -104,25 +104,6 @@ VIR_ENUM_IMPL(qemuVideo, "", /* ramfb can't be used with -vga */ ); =20 -VIR_ENUM_DECL(qemuDeviceVideoSecondary); - -VIR_ENUM_IMPL(qemuDeviceVideoSecondary, - VIR_DOMAIN_VIDEO_TYPE_LAST, - "", /* default value, we shouldn't see this */ - "", /* no secondary device for VGA */ - "", /* no secondary device for cirrus-vga */ - "", /* no secondary device for vmware-svga */ - "", /* don't support xen */ - "", /* don't support vbox */ - "qxl", - "", /* don't support parallels */ - "virtio-gpu", - "" /* don't support gop */, - "" /* 'none' doesn't make sense here */, - "" /* no secondary device for bochs */, - "" /* no secondary device for ramfb */, -); - VIR_ENUM_IMPL(qemuSoundCodec, VIR_DOMAIN_SOUND_CODEC_TYPE_LAST, "hda-duplex", @@ -4229,7 +4210,27 @@ qemuDeviceVideoGetModel(virQEMUCaps *qemuCaps, break; } } else { - model =3D qemuDeviceVideoSecondaryTypeToString(video->type); + switch (video->type) { + case VIR_DOMAIN_VIDEO_TYPE_QXL: + model =3D "qxl"; + break; + case VIR_DOMAIN_VIDEO_TYPE_VIRTIO: + model =3D "virtio-gpu"; + break; + case VIR_DOMAIN_VIDEO_TYPE_DEFAULT: + case VIR_DOMAIN_VIDEO_TYPE_VGA: + case VIR_DOMAIN_VIDEO_TYPE_CIRRUS: + case VIR_DOMAIN_VIDEO_TYPE_VMVGA: + case VIR_DOMAIN_VIDEO_TYPE_XEN: + case VIR_DOMAIN_VIDEO_TYPE_VBOX: + case VIR_DOMAIN_VIDEO_TYPE_PARALLELS: + case VIR_DOMAIN_VIDEO_TYPE_GOP: + case VIR_DOMAIN_VIDEO_TYPE_NONE: + case VIR_DOMAIN_VIDEO_TYPE_BOCHS: + case VIR_DOMAIN_VIDEO_TYPE_RAMFB: + case VIR_DOMAIN_VIDEO_TYPE_LAST: + break; + } } } =20 --=20 2.31.1 From nobody Wed May 1 15:02:04 2024 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=1623423939; cv=none; d=zohomail.com; s=zohoarc; b=elzaxYmDw4IVgx57jFAKCR6FDULFquD1Nq4VMB0zhDqftAb3xICsA0UcmCWlKybZ+W98SNukDQxAULMO9HfXN0KW4VJPzoouGS1jiiQQAIgqA5Er1bCN1FMSdM8ea8W+PQtO7srylZ6IqW2U0l+DJBiCtfAM2qLrmp/8Xfnbpoo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623423939; 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=+ysh21cYXLOcTt4mVFg1OVLrtXCw3lw4BP7pWVQZ2ng=; b=dsxdgm09JEfBD/xGj/tIsrom5kXzOBNfwp5Uqn8STNyC2wdq0uabR81O+T5U4m0fA39PuIFgMkPe7YGdkRbJZKmyDSn5lAXmIvLMBXr7IkNBnY122oyUDtDT3W6swobpP3HtK59RfZkckCBJ7al/bVfQUd8TjJ4VUbRCRFKOVmQ= 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 1623423939275232.11940487689094; Fri, 11 Jun 2021 08:05:39 -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-321-o0swZnG5MzGhupDYLgCaWw-1; Fri, 11 Jun 2021 11:05:36 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BF2C5100C631; Fri, 11 Jun 2021 15:05:30 +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 9DA135C3E5; Fri, 11 Jun 2021 15:05: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 65FC946F69; Fri, 11 Jun 2021 15:05: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 15BF5SZH009994 for ; Fri, 11 Jun 2021 11:05:28 -0400 Received: by smtp.corp.redhat.com (Postfix) id B25C51383B; Fri, 11 Jun 2021 15:05:28 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.194.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id 36A5E5DDAD for ; Fri, 11 Jun 2021 15:05:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623423938; 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=+ysh21cYXLOcTt4mVFg1OVLrtXCw3lw4BP7pWVQZ2ng=; b=ZBBeuzVWfR7ycroo8ZlV+CwOUjGP622El/fHYvpUWue9100jXJKxi0HXC9oH06rBC36wcJ iajS27x3BY30TOWwMUymdTWZo+iliwuDRNIYGHuK3BwlMzZFRyl+fyhivyJHJ0YFDJ1Lo2 rJZEX4KYQjt1cm7quLC6EDj26jx2210= X-MC-Unique: o0swZnG5MzGhupDYLgCaWw-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 6/7] qemuBuildDeviceVideoStr: Move logic wrapping qemuBuildVirtioDevStr() into qemuDeviceVideoGetModel() Date: Fri, 11 Jun 2021 17:04:59 +0200 Message-Id: <6f2d27c7093161f0998988584e9424eea3907bdd.1623423850.git.mprivozn@redhat.com> 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.16 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" We want to call qemuBuildVirtioDevStr() from qemuBuildDeviceVideoStr() but only for some models (currently "virtio-gpu" and "vhost-user-gpu"), not all of them. Move this logic into qemuDeviceVideoGetModel() because this logic will be refined. Signed-off-by: Michal Privoznik Reviewed-by: Peter Krempa --- src/qemu/qemu_command.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 71f0b498c1..c9e152324d 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -4159,11 +4159,14 @@ qemuBuildSoundCommandLine(virCommand *cmd, =20 static const char * qemuDeviceVideoGetModel(virQEMUCaps *qemuCaps, - const virDomainVideoDef *video) + const virDomainVideoDef *video, + bool *virtio) { const char *model =3D NULL; bool primaryVga =3D false; =20 + *virtio =3D false; + if (video->primary && qemuDomainSupportsVideoVga(video, qemuCaps)) primaryVga =3D true; =20 @@ -4172,10 +4175,12 @@ qemuDeviceVideoGetModel(virQEMUCaps *qemuCaps, * architectures there might not be such model so fallback to one * without VGA compatibility mode. */ if (video->backend =3D=3D VIR_DOMAIN_VIDEO_BACKEND_TYPE_VHOSTUSER) { - if (primaryVga) + if (primaryVga) { model =3D "vhost-user-vga"; - else + } else { model =3D "vhost-user-gpu"; + *virtio =3D true; + } } else { if (primaryVga) { switch (video->type) { @@ -4216,6 +4221,7 @@ qemuDeviceVideoGetModel(virQEMUCaps *qemuCaps, break; case VIR_DOMAIN_VIDEO_TYPE_VIRTIO: model =3D "virtio-gpu"; + *virtio =3D true; break; case VIR_DOMAIN_VIDEO_TYPE_DEFAULT: case VIR_DOMAIN_VIDEO_TYPE_VGA: @@ -4253,14 +4259,15 @@ qemuBuildDeviceVideoStr(const virDomainDef *def, g_auto(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; const char *model =3D NULL; virTristateSwitch accel3d =3D VIR_TRISTATE_SWITCH_ABSENT; + bool virtio =3D false; =20 if (video->accel) accel3d =3D video->accel->accel3d; =20 - if (!(model =3D qemuDeviceVideoGetModel(qemuCaps, video))) + if (!(model =3D qemuDeviceVideoGetModel(qemuCaps, video, &virtio))) return NULL; =20 - if (STREQ(model, "virtio-gpu") || STREQ(model, "vhost-user-gpu")) { + if (virtio) { if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_GPU_GL_PCI) && accel3d =3D=3D VIR_TRISTATE_SWITCH_ON && STREQ(model, "virtio-gpu")) --=20 2.31.1 From nobody Wed May 1 15:02:04 2024 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 Reviewed-by: Peter Krempa --- 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