From nobody Sun Feb 8 17:46:30 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1642771975; cv=none; d=zohomail.com; s=zohoarc; b=aYPOWaPqXGZ3FBJ/LOn5xDUZNtjdzTJL8i1HEfuhOJvxO8bbH3JEpoCyfwsOZ0piHe3nEJMToMTA1v/vsn4rkeXF1r7qYpraS9w20m4rlLjWUXYencnn1e8wWp3az18TqiaV5AZilpgT4Q8aURY8UQ6Im7VMUPeQewwvHPSJ1gw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642771975; 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=XKFiLVEnc/qFVMszEFq9mQvCGn4U0BCBdJPCOE1eEm0=; b=QUR1rZxhvTuCqKO5AKEwegWJiAT4hRKC4l1xzE5LzrxhxEFffimg1GtF309vYsr9V+CySI875Iggc5kGHFNgQSWFWZHKlVNMxWiIJjl0sNvtalKB2Q5uHcZEBjfCVLPa2RdDJp/0hUIzxqosa69Up01ky1qdjP4z3gxmUMr4Zs4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 1642771975277689.891533391982; Fri, 21 Jan 2022 05:32:55 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-359-peHyopmLOP-nWy9_7feyrw-1; Fri, 21 Jan 2022 08:32:51 -0500 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 DE9D1101F006; Fri, 21 Jan 2022 13:32:45 +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 9F3C0798A3; Fri, 21 Jan 2022 13:32:45 +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 5DC651832DBE; Fri, 21 Jan 2022 13:32:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 20LDSSsO011957 for ; Fri, 21 Jan 2022 08:28:28 -0500 Received: by smtp.corp.redhat.com (Postfix) id 1DD161090033; Fri, 21 Jan 2022 13:28:28 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.56]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9C83E108F850 for ; Fri, 21 Jan 2022 13:28:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1642771974; 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=XKFiLVEnc/qFVMszEFq9mQvCGn4U0BCBdJPCOE1eEm0=; b=XH/aigPthO2rmYGtZEe8FH1dZlTPUpKz80hKzweyuy+PJ276Ai/zEwzDdTIKVxYKtiFxHu Y8fHkgBLFMjaFv9+Ua24AC8TIfGNIra/+QH1D+9LRP6nbi5p8YbCZ1ZBLs6nql/ioNqUkm tCDgN9OZGAs0nkNwfbTD12I2TzuVepY= X-MC-Unique: peHyopmLOP-nWy9_7feyrw-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 04/12] qemu: Use virTristateBool instead of virTristateSwitch in a few places Date: Fri, 21 Jan 2022 14:28:11 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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) X-ZM-MESSAGEID: 1642771976032100001 Content-Type: text/plain; charset="utf-8" Both @accel2d and @accel3d are parsed as virTristateBool, but in a few places (qemuDeviceVideoGetModel() and qemuValidateDomainDeviceDefVideo()) they are compared to virTristateSwitch enum either directly or via a variable of that type. Clear this confusion by using the correct enum. Signed-off-by: Michal Privoznik --- src/qemu/qemu_command.c | 8 ++++---- src/qemu/qemu_validate.c | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 60b4f96e06..99ac44d7f1 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -695,7 +695,7 @@ qemuDeviceVideoGetModel(virQEMUCaps *qemuCaps, { const char *model =3D NULL; bool primaryVga =3D false; - virTristateSwitch accel3d =3D VIR_TRISTATE_SWITCH_ABSENT; + virTristateBool accel3d =3D VIR_TRISTATE_BOOL_ABSENT; =20 *virtio =3D false; *virtioBusSuffix =3D false; @@ -735,7 +735,7 @@ qemuDeviceVideoGetModel(virQEMUCaps *qemuCaps, break; case VIR_DOMAIN_VIDEO_TYPE_VIRTIO: if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_VGA_GL) && - accel3d =3D=3D VIR_TRISTATE_SWITCH_ON) + accel3d =3D=3D VIR_TRISTATE_BOOL_YES) model =3D "virtio-vga-gl"; else model =3D "virtio-vga"; @@ -765,7 +765,7 @@ qemuDeviceVideoGetModel(virQEMUCaps *qemuCaps, break; case VIR_DOMAIN_VIDEO_TYPE_VIRTIO: if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_GPU_GL_PCI) = && - accel3d =3D=3D VIR_TRISTATE_SWITCH_ON) + accel3d =3D=3D VIR_TRISTATE_BOOL_YES) model =3D "virtio-gpu-gl"; else model =3D "virtio-gpu"; @@ -4816,7 +4816,7 @@ qemuBuildDeviceVideoCmd(virCommand *cmd, virQEMUCaps *qemuCaps) { const char *model =3D NULL; - virTristateSwitch virgl =3D VIR_TRISTATE_SWITCH_ABSENT; + virTristateBool virgl =3D VIR_TRISTATE_BOOL_ABSENT; bool virtio =3D false; bool virtioBusSuffix =3D false; g_autoptr(virJSONValue) props =3D NULL; diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index 24e0866f8c..7eaad3614e 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -2489,7 +2489,7 @@ qemuValidateDomainDeviceDefVideo(const virDomainVideo= Def *video, } } =20 - if (video->accel && video->accel->accel2d =3D=3D VIR_TRISTATE_SWITCH_O= N) { + if (video->accel && video->accel->accel2d =3D=3D VIR_TRISTATE_BOOL_YES= ) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("qemu does not support the accel2d setting")); return -1; @@ -2553,7 +2553,7 @@ qemuValidateDomainDeviceDefVideo(const virDomainVideo= Def *video, return -1; } } else if (video->accel) { - if (video->accel->accel3d =3D=3D VIR_TRISTATE_SWITCH_ON && + if (video->accel->accel3d =3D=3D VIR_TRISTATE_BOOL_YES && (video->type !=3D VIR_DOMAIN_VIDEO_TYPE_VIRTIO || !(virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_GPU_VIRGL) || virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_GPU_GL_PCI) || --=20 2.34.1