From nobody Mon Feb 9 01:47:25 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=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 --- 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