From nobody Tue Apr 30 17:50:23 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=1623232992; cv=none; d=zohomail.com; s=zohoarc; b=P0kdI9vZrcfzFeEbrEVUXHCYLec9hxXuojXr9EdVoS5VyedxjNeZFZQqfgpZfE4Jl5QDZ0ukZXnrVHKtx0QPSoI0Y48Hrw/lQ/JIn4WEQEAJLCbrK6nt2AzRPb6HeZUjNwbdzi8tDD4Y6s4C4dWI1eTcsVAjWfCUfLY7gi/QaD8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623232992; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=dvyq+AGfaRJfN8wStTM/sk6Lsjm/iy5X2JuXOEtzfAY=; b=TOfxlX+cG1AeZwqtNrDhCzIlfwAY+C3jf1WNAMi9hwWeIwZUMgKXHtmlAJA37BLQBxWHfSy3BoYMeJR4iTHsBkF3B1GS6Lf7Rgpj+ppakwPDIVopNp/vcx7e7PsNxHKUecWPd7CgJBJgUlc18dMjzCkX4YHVCN7pNPirTxHXRuo= 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) header.from= 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 1623232992724655.0040997761565; Wed, 9 Jun 2021 03:03:12 -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-264-oaQJgaGcNbyInxGtJHt9OQ-1; Wed, 09 Jun 2021 06:03:09 -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 C8094801B13; Wed, 9 Jun 2021 10:03:03 +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 223955D9E3; Wed, 9 Jun 2021 10:03:02 +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 391281809CAE; Wed, 9 Jun 2021 10:02:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 159A2u0u032682 for ; Wed, 9 Jun 2021 06:02:57 -0400 Received: by smtp.corp.redhat.com (Postfix) id EB2FC5C1D1; Wed, 9 Jun 2021 10:02:56 +0000 (UTC) Received: from thuth.com (ovpn-112-47.ams2.redhat.com [10.36.112.47]) by smtp.corp.redhat.com (Postfix) with ESMTP id D62B25C23E; Wed, 9 Jun 2021 10:02:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623232991; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=dvyq+AGfaRJfN8wStTM/sk6Lsjm/iy5X2JuXOEtzfAY=; b=Y34qiB59JwNhqXUJDrNuzktJoqg56k+/Kko44A789it3VMwzmRDYyszhWbpWLbhlBaJMyd K856DHc2DGPd2tZkBUkbCprxIDnl3uMwyeUj+9Q0KSoPEBUO+rMz+eQ/jPvCLkHVhcGAh9 fev7xiXDUpwcO/EfKg7UAjlI/oXY6oA= X-MC-Unique: oaQJgaGcNbyInxGtJHt9OQ-1 From: Thomas Huth To: Gerd Hoffmann , qemu-devel@nongnu.org Subject: [RFC QEMU PATCH] ui: Make the DisplayType enum entries conditional Date: Wed, 9 Jun 2021 12:02:40 +0200 Message-Id: <20210609100240.1285032-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: libvir-list@redhat.com, smitterl@redhat.com, Eric Blake 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" Libvirt's "domcapabilities" command has a way to state whether certain graphic frontends are available in QEMU or not. Originally, libvirt looked at the "--help" output of the QEMU binary to determine whether SDL was available or not (by looking for the "-sdl" parameter in the help text), but since libvirt stopped doing this analysis of the help text, the detection of SDL is currently broken, see: https://bugzilla.redhat.com/show_bug.cgi?id=3D1790902 QEMU should provide a way via the QMP interface instead. The simplest way, without introducing additional commands, is to make the DisplayType enum entries conditional, so that the enum only contains the entries if the corresponding CONFIG_xxx switches have been set. Unfortunately, this only works for sdl, cocoa and spice, since gtk, egl-headless and curses are hard-wired in the "data" section of the DisplayOptions, and thus unfortunately always have to be defined. Signed-off-by: Thomas Huth --- qapi/ui.json | 12 +++++++++--- ui/console.c | 4 ++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/qapi/ui.json b/qapi/ui.json index 1052ca9c38..c4f44cfe50 100644 --- a/qapi/ui.json +++ b/qapi/ui.json @@ -1126,9 +1126,15 @@ # ## { 'enum' : 'DisplayType', - 'data' : [ 'default', 'none', 'gtk', 'sdl', - 'egl-headless', 'curses', 'cocoa', - 'spice-app'] } + 'data' : [ + { 'name': 'default' }, + { 'name': 'none' }, + { 'name': 'gtk' }, + { 'name': 'sdl', 'if': 'defined(CONFIG_SDL)' }, + { 'name': 'egl-headless' }, + { 'name': 'curses' }, + { 'name': 'cocoa', 'if': 'defined(CONFIG_COCOA)' }, + { 'name': 'spice-app', 'if': 'defined(CONFIG_SPICE)'} ] } =20 ## # @DisplayOptions: diff --git a/ui/console.c b/ui/console.c index 2de5f4105b..954f7162c3 100644 --- a/ui/console.c +++ b/ui/console.c @@ -2371,8 +2371,12 @@ bool qemu_display_find_default(DisplayOptions *opts) { static DisplayType prio[] =3D { DISPLAY_TYPE_GTK, +#if defined(CONFIG_SDL) DISPLAY_TYPE_SDL, +#endif +#if defined(CONFIG_COCOA) DISPLAY_TYPE_COCOA +#endif }; int i; =20 --=20 2.27.0