From nobody Wed Feb 11 05:35:51 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 151758450126025.568740491799645; Fri, 2 Feb 2018 07:15:01 -0800 (PST) Received: from localhost ([::1]:36190 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ehd3M-0001ft-CK for importer@patchew.org; Fri, 02 Feb 2018 10:15:00 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44035) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ehcek-0005VR-7V for qemu-devel@nongnu.org; Fri, 02 Feb 2018 09:49:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ehcee-0005xj-4M for qemu-devel@nongnu.org; Fri, 02 Feb 2018 09:49:34 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35288) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ehced-0005x9-TN for qemu-devel@nongnu.org; Fri, 02 Feb 2018 09:49:28 -0500 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 mx1.redhat.com (Postfix) with ESMTPS id 151F4A0388 for ; Fri, 2 Feb 2018 11:10:28 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-227.ams2.redhat.com [10.36.116.227]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7355076603; Fri, 2 Feb 2018 11:10:27 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 347A54F29C; Fri, 2 Feb 2018 12:10:23 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 2 Feb 2018 12:10:22 +0100 Message-Id: <20180202111022.19269-13-kraxel@redhat.com> In-Reply-To: <20180202111022.19269-1-kraxel@redhat.com> References: <20180202111022.19269-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 02 Feb 2018 11:10:28 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 12/12] vl: drop display_type variable X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Markus Armbruster , Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Switch over all leftover users to qapi DisplayType. Then delete the unused display_type variable. Add 'default' DisplayType, which isn't an actual display type but a placeholder for "user didn't specify a display". It will be replaced by the DisplayType actually used, which in turn depends on the DisplayTypes availabel in the particular build. Signed-off-by: Gerd Hoffmann Reviewed-by: Eric Blake --- vl.c | 54 ++++++++++++++---------------------------------------- qapi/ui.json | 5 +++-- 2 files changed, 17 insertions(+), 42 deletions(-) diff --git a/vl.c b/vl.c index 4ef774e783..42867d60f8 100644 --- a/vl.c +++ b/vl.c @@ -2079,24 +2079,12 @@ static void select_vgahw(const char *p) } } =20 -typedef enum LegacyDisplayType { - DT_DEFAULT, - DT_CURSES, - DT_SDL, - DT_COCOA, - DT_GTK, - DT_EGL, - DT_NONE, -} LegacyDisplayType; - -static LegacyDisplayType select_display(const char *p) +static void parse_display(const char *p) { const char *opts; - LegacyDisplayType display =3D DT_DEFAULT; =20 if (strstart(p, "sdl", &opts)) { #ifdef CONFIG_SDL - display =3D DT_SDL; dpy.type =3D DISPLAY_TYPE_SDL; while (*opts) { const char *nextopt; @@ -2175,7 +2163,6 @@ static LegacyDisplayType select_display(const char *p) } else if (strstart(p, "egl-headless", &opts)) { #ifdef CONFIG_OPENGL_DMABUF display_opengl =3D 1; - display =3D DT_EGL; dpy.type =3D DISPLAY_TYPE_EGL_HEADLESS; #else fprintf(stderr, "egl support is disabled\n"); @@ -2183,7 +2170,6 @@ static LegacyDisplayType select_display(const char *p) #endif } else if (strstart(p, "curses", &opts)) { #ifdef CONFIG_CURSES - display =3D DT_CURSES; dpy.type =3D DISPLAY_TYPE_CURSES; #else error_report("curses support is disabled"); @@ -2191,7 +2177,6 @@ static LegacyDisplayType select_display(const char *p) #endif } else if (strstart(p, "gtk", &opts)) { #ifdef CONFIG_GTK - display =3D DT_GTK; dpy.type =3D DISPLAY_TYPE_GTK; while (*opts) { const char *nextopt; @@ -2228,14 +2213,11 @@ static LegacyDisplayType select_display(const char = *p) exit(1); #endif } else if (strstart(p, "none", &opts)) { - display =3D DT_NONE; dpy.type =3D DISPLAY_TYPE_NONE; } else { error_report("unknown display type"); exit(1); } - - return display; } =20 static int balloon_parse(const char *arg) @@ -3063,7 +3045,6 @@ int main(int argc, char **argv, char **envp) const char *incoming =3D NULL; bool userconfig =3D true; bool nographic =3D false; - LegacyDisplayType display_type =3D DT_DEFAULT; int display_remote =3D 0; const char *log_mask =3D NULL; const char *log_file =3D NULL; @@ -3257,18 +3238,16 @@ int main(int argc, char **argv, char **envp) } break; case QEMU_OPTION_display: - display_type =3D select_display(optarg); + parse_display(optarg); break; case QEMU_OPTION_nographic: olist =3D qemu_find_opts("machine"); qemu_opts_parse_noisily(olist, "graphics=3Doff", false); nographic =3D true; - display_type =3D DT_NONE; dpy.type =3D DISPLAY_TYPE_NONE; break; case QEMU_OPTION_curses: #ifdef CONFIG_CURSES - display_type =3D DT_CURSES; dpy.type =3D DISPLAY_TYPE_CURSES; #else error_report("curses support is disabled"); @@ -3676,7 +3655,6 @@ int main(int argc, char **argv, char **envp) break; case QEMU_OPTION_sdl: #ifdef CONFIG_SDL - display_type =3D DT_SDL; dpy.type =3D DISPLAY_TYPE_SDL; break; #else @@ -4292,7 +4270,7 @@ int main(int argc, char **argv, char **envp) exit(1); } #ifdef CONFIG_CURSES - if (display_type =3D=3D DT_CURSES) { + if (dpy.type =3D=3D DISPLAY_TYPE_CURSES) { error_report("curses display cannot be used with -daemonize"); exit(1); } @@ -4338,39 +4316,35 @@ int main(int argc, char **argv, char **envp) display_remote++; } #endif - if (display_type =3D=3D DT_DEFAULT && !display_remote) { + if (dpy.type =3D=3D DISPLAY_TYPE_DEFAULT && !display_remote) { #if defined(CONFIG_GTK) - display_type =3D DT_GTK; dpy.type =3D DISPLAY_TYPE_GTK; #elif defined(CONFIG_SDL) - display_type =3D DT_SDL; dpy.type =3D DISPLAY_TYPE_SDL; #elif defined(CONFIG_COCOA) - display_type =3D DT_COCOA; dpy.type =3D DISPLAY_TYPE_COCOA; #elif defined(CONFIG_VNC) vnc_parse("localhost:0,to=3D99,id=3Ddefault", &error_abort); #else - display_type =3D DT_NONE; dpy.type =3D DISPLAY_TYPE_NONE; #endif } =20 - if ((no_frame || alt_grab || ctrl_grab) && display_type !=3D DT_SDL) { + if ((no_frame || alt_grab || ctrl_grab) && dpy.type !=3D DISPLAY_TYPE_= SDL) { error_report("-no-frame, -alt-grab and -ctrl-grab are only valid " "for SDL, ignoring option"); } if (dpy.has_window_close && - (display_type !=3D DT_GTK && display_type !=3D DT_SDL)) { + (dpy.type !=3D DISPLAY_TYPE_GTK && dpy.type !=3D DISPLAY_TYPE_SDL)= ) { error_report("-no-quit is only valid for GTK and SDL, " "ignoring option"); } =20 - if (display_type =3D=3D DT_GTK) { + if (dpy.type =3D=3D DISPLAY_TYPE_GTK) { early_gtk_display_init(&dpy); } =20 - if (display_type =3D=3D DT_SDL) { + if (dpy.type =3D=3D DISPLAY_TYPE_SDL) { sdl_display_early_init(&dpy); } =20 @@ -4701,17 +4675,17 @@ int main(int argc, char **argv, char **envp) ds =3D init_displaystate(); =20 /* init local displays */ - switch (display_type) { - case DT_CURSES: + switch (dpy.type) { + case DISPLAY_TYPE_CURSES: curses_display_init(ds, &dpy); break; - case DT_SDL: + case DISPLAY_TYPE_SDL: sdl_display_init(ds, &dpy); break; - case DT_COCOA: + case DISPLAY_TYPE_COCOA: cocoa_display_init(ds, &dpy); break; - case DT_GTK: + case DISPLAY_TYPE_GTK: gtk_display_init(ds, &dpy); break; default: @@ -4732,7 +4706,7 @@ int main(int argc, char **argv, char **envp) } =20 #ifdef CONFIG_OPENGL_DMABUF - if (display_type =3D=3D DT_EGL) { + if (dpy.type =3D=3D DISPLAY_TYPE_EGL_HEADLESS) { egl_headless_init(&dpy); } #endif diff --git a/qapi/ui.json b/qapi/ui.json index aca5402746..08b89a01be 100644 --- a/qapi/ui.json +++ b/qapi/ui.json @@ -1017,7 +1017,7 @@ # ## { 'enum' : 'DisplayType', - 'data' : [ 'none', 'gtk', 'sdl', + 'data' : [ 'default', 'none', 'gtk', 'sdl', 'egl-headless', 'curses', 'cocoa' ] } =20 ## @@ -1039,7 +1039,8 @@ '*window-close' : 'bool', '*gl' : 'bool' }, 'discriminator' : 'type', - 'data' : { 'none' : 'DisplayNoOpts', + 'data' : { 'default' : 'DisplayNoOpts', + 'none' : 'DisplayNoOpts', 'gtk' : 'DisplayGTK', 'sdl' : 'DisplayNoOpts', 'egl-headless' : 'DisplayNoOpts', --=20 2.9.3