From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Markus Armbruster <armbru@redhat.com>,
Gerd Hoffmann <kraxel@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>
Subject: [Qemu-devel] [PATCH 12/24] vl: drop display_type variable
Date: Fri, 17 Nov 2017 11:30:34 +0100 [thread overview]
Message-ID: <20171117103046.15943-13-kraxel@redhat.com> (raw)
In-Reply-To: <20171117103046.15943-1-kraxel@redhat.com>
Switch over all leftover users to qapi DisplayType.
The delete the unused display_type variable.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
vl.c | 52 +++++++++++++---------------------------------------
1 file changed, 13 insertions(+), 39 deletions(-)
diff --git a/vl.c b/vl.c
index 85c41953b3..36eec0d1e0 100644
--- a/vl.c
+++ b/vl.c
@@ -2137,24 +2137,12 @@ static void select_vgahw(const char *p)
}
}
-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 = DT_DEFAULT;
if (strstart(p, "sdl", &opts)) {
#ifdef CONFIG_SDL
- display = DT_SDL;
dpy.type = DISPLAY_TYPE_SDL;
while (*opts) {
const char *nextopt;
@@ -2212,7 +2200,6 @@ static LegacyDisplayType select_display(const char *p)
#ifdef CONFIG_OPENGL_DMABUF
request_opengl = 1;
display_opengl = 1;
- display = DT_EGL;
dpy.type = DISPLAY_TYPE_EGL_HEADLESS;
#else
fprintf(stderr, "egl support is disabled\n");
@@ -2220,7 +2207,6 @@ static LegacyDisplayType select_display(const char *p)
#endif
} else if (strstart(p, "curses", &opts)) {
#ifdef CONFIG_CURSES
- display = DT_CURSES;
dpy.type = DISPLAY_TYPE_CURSES;
#else
error_report("curses support is disabled");
@@ -2228,7 +2214,6 @@ static LegacyDisplayType select_display(const char *p)
#endif
} else if (strstart(p, "gtk", &opts)) {
#ifdef CONFIG_GTK
- display = DT_GTK;
dpy.type = DISPLAY_TYPE_GTK;
while (*opts) {
const char *nextopt;
@@ -2267,14 +2252,11 @@ static LegacyDisplayType select_display(const char *p)
exit(1);
#endif
} else if (strstart(p, "none", &opts)) {
- display = DT_NONE;
dpy.type = DISPLAY_TYPE_NONE;
} else {
error_report("unknown display type");
exit(1);
}
-
- return display;
}
static int balloon_parse(const char *arg)
@@ -3103,7 +3085,6 @@ int main(int argc, char **argv, char **envp)
const char *incoming = NULL;
bool userconfig = true;
bool nographic = false;
- LegacyDisplayType display_type = DT_DEFAULT;
int display_remote = 0;
const char *log_mask = NULL;
const char *log_file = NULL;
@@ -3378,18 +3359,16 @@ int main(int argc, char **argv, char **envp)
}
break;
case QEMU_OPTION_display:
- display_type = select_display(optarg);
+ parse_display(optarg);
break;
case QEMU_OPTION_nographic:
olist = qemu_find_opts("machine");
qemu_opts_parse_noisily(olist, "graphics=off", false);
nographic = true;
- display_type = DT_NONE;
dpy.type = DISPLAY_TYPE_NONE;
break;
case QEMU_OPTION_curses:
#ifdef CONFIG_CURSES
- display_type = DT_CURSES;
dpy.type = DISPLAY_TYPE_CURSES;
#else
error_report("curses support is disabled");
@@ -3791,7 +3770,6 @@ int main(int argc, char **argv, char **envp)
break;
case QEMU_OPTION_sdl:
#ifdef CONFIG_SDL
- display_type = DT_SDL;
dpy.type = DISPLAY_TYPE_SDL;
break;
#else
@@ -4408,7 +4386,7 @@ int main(int argc, char **argv, char **envp)
exit(1);
}
#ifdef CONFIG_CURSES
- if (display_type == DT_CURSES) {
+ if (dpy.type == DISPLAY_TYPE_CURSES) {
error_report("curses display cannot be used with -daemonize");
exit(1);
}
@@ -4454,35 +4432,31 @@ int main(int argc, char **argv, char **envp)
display_remote++;
}
#endif
- if (display_type == DT_DEFAULT && !display_remote) {
+ if (dpy.type == DISPLAY_TYPE_DEFAULT && !display_remote) {
#if defined(CONFIG_GTK)
- display_type = DT_GTK;
dpy.type = DISPLAY_TYPE_GTK;
#elif defined(CONFIG_SDL)
- display_type = DT_SDL;
dpy.type = DISPLAY_TYPE_SDL;
#elif defined(CONFIG_COCOA)
- display_type = DT_COCOA;
dpy.type = DISPLAY_TYPE_COCOA;
#elif defined(CONFIG_VNC)
vnc_parse("localhost:0,to=99,id=default", &error_abort);
#else
- display_type = DT_NONE;
dpy.type = DISPLAY_TYPE_NONE;
#endif
}
if (dpy.has_window_close &&
- (display_type != DT_GTK && display_type != DT_SDL)) {
+ (dpy.type != DISPLAY_TYPE_GTK && dpy.type != DISPLAY_TYPE_SDL)) {
error_report("-no-quit is only valid for GTK and SDL, "
"ignoring option");
}
- if (display_type == DT_GTK) {
+ if (dpy.type == DISPLAY_TYPE_GTK) {
early_gtk_display_init(&dpy);
}
- if (display_type == DT_SDL) {
+ if (dpy.type == DISPLAY_TYPE_SDL) {
sdl_display_early_init(&dpy);
}
@@ -4815,17 +4789,17 @@ int main(int argc, char **argv, char **envp)
ds = init_displaystate();
/* 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:
@@ -4846,7 +4820,7 @@ int main(int argc, char **argv, char **envp)
}
#ifdef CONFIG_OPENGL_DMABUF
- if (display_type == DT_EGL) {
+ if (dpy.type == DISPLAY_TYPE_EGL_HEADLESS) {
egl_headless_init(&dpy);
}
#endif
--
2.9.3
next prev parent reply other threads:[~2017-11-17 10:31 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-17 10:30 [Qemu-devel] [PATCH 00/24] RfC: rework display initialization Gerd Hoffmann
2017-11-17 10:30 ` [Qemu-devel] [PATCH 01/24] sdl: remove -no-frame support Gerd Hoffmann
2017-11-17 14:21 ` Daniel P. Berrange
2017-11-17 14:49 ` Gerd Hoffmann
2017-11-17 14:59 ` Daniel P. Berrange
2017-11-17 15:06 ` Daniel P. Berrange
2017-11-17 10:30 ` [Qemu-devel] [PATCH 02/24] sdl: remove -alt-grab and -ctrl-grab support Gerd Hoffmann
2017-11-17 14:22 ` Daniel P. Berrange
2017-11-17 14:51 ` Gerd Hoffmann
2017-11-17 10:30 ` [Qemu-devel] [PATCH 03/24] sdl: use ctrl-alt-g as grab hotkey Gerd Hoffmann
2017-11-17 10:30 ` [Qemu-devel] [PATCH 04/24] vl: rename DisplayType to LegacyDisplayType Gerd Hoffmann
2017-11-17 10:30 ` [Qemu-devel] [PATCH 05/24] gtk: add and use DisplayOptions + DisplayGTK Gerd Hoffmann
2017-11-17 10:30 ` [Qemu-devel] [PATCH 06/24] sdl: use DisplayOptions Gerd Hoffmann
2017-11-17 10:30 ` [Qemu-devel] [PATCH 07/24] vl: drop no_quit variable Gerd Hoffmann
2017-11-17 10:30 ` [Qemu-devel] [PATCH 08/24] egl-headless: use DisplayOptions Gerd Hoffmann
2017-11-17 10:30 ` [Qemu-devel] [PATCH 09/24] curses: " Gerd Hoffmann
2017-11-17 10:30 ` [Qemu-devel] [PATCH 10/24] cocoa: " Gerd Hoffmann
2017-11-17 10:30 ` [Qemu-devel] [PATCH 11/24] vl: drop full_screen variable Gerd Hoffmann
2017-11-17 10:30 ` Gerd Hoffmann [this message]
2017-11-17 10:30 ` [Qemu-devel] [PATCH 13/24] vl: drop request_opengl variable Gerd Hoffmann
2017-11-17 10:30 ` [Qemu-devel] [PATCH 14/24] console: add qemu display registry, add gtk Gerd Hoffmann
2017-11-17 10:30 ` [Qemu-devel] [PATCH 15/24] sdl: hook up to display registry Gerd Hoffmann
2017-11-17 10:30 ` [Qemu-devel] [PATCH 16/24] cocoa: " Gerd Hoffmann
2017-11-17 10:30 ` [Qemu-devel] [PATCH 17/24] curses: " Gerd Hoffmann
2017-11-17 10:30 ` [Qemu-devel] [PATCH 18/24] egl-headless: " Gerd Hoffmann
2017-11-17 10:30 ` [Qemu-devel] [PATCH 19/24] console: add and use qemu_display_find_default Gerd Hoffmann
2017-11-17 12:55 ` Darren Kenny
2017-11-17 13:24 ` Gerd Hoffmann
2017-11-17 14:16 ` Darren Kenny
2017-11-17 15:03 ` Gerd Hoffmann
2017-11-17 15:55 ` Darren Kenny
2017-11-17 10:30 ` [Qemu-devel] [PATCH 20/24] console: add ui module loading support Gerd Hoffmann
2017-11-17 10:30 ` [Qemu-devel] [PATCH 21/24] sdl: build as module Gerd Hoffmann
2017-11-17 10:30 ` [Qemu-devel] [PATCH 22/24] gtk: " Gerd Hoffmann
2017-11-17 10:30 ` [Qemu-devel] [PATCH 23/24] curses: " Gerd Hoffmann
2017-11-17 10:30 ` [Qemu-devel] [PATCH 24/24] build: opengl should not need X11 Gerd Hoffmann
2017-11-17 10:58 ` [Qemu-devel] [PATCH 00/24] RfC: rework display initialization no-reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171117103046.15943-13-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=armbru@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).