* [Qemu-devel] [PATCH for-2.7 v3 01/12] vl: Add DT_COCOA DisplayType value
2016-04-19 19:55 [Qemu-devel] [PATCH for-2.7 v3 00/12] vl: graphics stubs + #ifdef cleanup + DT_NOGRAPHIC cleanup Eduardo Habkost
@ 2016-04-19 19:55 ` Eduardo Habkost
2016-04-19 19:55 ` [Qemu-devel] [PATCH for-2.7 v3 02/12] vnc: Initialization stubs Eduardo Habkost
` (11 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Eduardo Habkost @ 2016-04-19 19:55 UTC (permalink / raw)
To: qemu-devel
Cc: Paolo Bonzini, Marcel Apfelbaum, Andreas Färber,
Peter Maydell
Instead of reusing DT_SDL for Cocoa, use DT_COCOA to indicate
that a Cocoa display was requested.
configure already ensures CONFIG_COCOA and CONFIG_SDL are never
set at the same time. The only case where DT_SDL is used outside
a #ifdef CONFIG_SDL block is in the no_frame/alt_grab/ctrl_grab
check. That means the only user-visible change is that we will
start printing a warning if the SDL-specific options are used in
Cocoa mode. This is a bugfix, because no_frame/alt_grab/ctrl_grab
are not used by Cocoa code.
Cc: Andreas Färber <andreas.faerber@web.de>
Cc: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
include/sysemu/sysemu.h | 1 +
vl.c | 6 ++++--
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
index 2033f8c..90766da 100644
--- a/include/sysemu/sysemu.h
+++ b/include/sysemu/sysemu.h
@@ -136,6 +136,7 @@ typedef enum DisplayType
DT_DEFAULT,
DT_CURSES,
DT_SDL,
+ DT_COCOA,
DT_GTK,
DT_NOGRAPHIC,
DT_NONE,
diff --git a/vl.c b/vl.c
index 36593c9..a920f16 100644
--- a/vl.c
+++ b/vl.c
@@ -4235,8 +4235,10 @@ int main(int argc, char **argv, char **envp)
if (display_type == DT_DEFAULT && !display_remote) {
#if defined(CONFIG_GTK)
display_type = DT_GTK;
-#elif defined(CONFIG_SDL) || defined(CONFIG_COCOA)
+#elif defined(CONFIG_SDL)
display_type = DT_SDL;
+#elif defined(CONFIG_COCOA)
+ display_type = DT_COCOA;
#elif defined(CONFIG_VNC)
vnc_parse("localhost:0,to=99,id=default", &error_abort);
show_vnc_port = 1;
@@ -4560,7 +4562,7 @@ int main(int argc, char **argv, char **envp)
sdl_display_init(ds, full_screen, no_frame);
break;
#elif defined(CONFIG_COCOA)
- case DT_SDL:
+ case DT_COCOA:
cocoa_display_init(ds, full_screen);
break;
#endif
--
2.1.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [Qemu-devel] [PATCH for-2.7 v3 02/12] vnc: Initialization stubs
2016-04-19 19:55 [Qemu-devel] [PATCH for-2.7 v3 00/12] vl: graphics stubs + #ifdef cleanup + DT_NOGRAPHIC cleanup Eduardo Habkost
2016-04-19 19:55 ` [Qemu-devel] [PATCH for-2.7 v3 01/12] vl: Add DT_COCOA DisplayType value Eduardo Habkost
@ 2016-04-19 19:55 ` Eduardo Habkost
2016-04-19 19:55 ` [Qemu-devel] [PATCH for-2.7 v3 03/12] curses: curses_display_init() stub Eduardo Habkost
` (10 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Eduardo Habkost @ 2016-04-19 19:55 UTC (permalink / raw)
To: qemu-devel; +Cc: Paolo Bonzini, Marcel Apfelbaum
This reduces the number of CONFIG_VNC #ifdefs in the vl.c code.
The only user-visible difference is that this will make QEMU
complain about syntax when using "-display vnc" ("VNC requires a
display argument vnc=<display>") even if CONFIG_VNC is disabled.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
Changes v1 -> v2:
* Move stub file to stubs/ui/
Changes v2 -> v3:
* Move stubs to header file
---
include/ui/console.h | 20 +++++++++++++++++++-
vl.c | 15 +--------------
2 files changed, 20 insertions(+), 15 deletions(-)
diff --git a/include/ui/console.h b/include/ui/console.h
index d5a88d9..6640348 100644
--- a/include/ui/console.h
+++ b/include/ui/console.h
@@ -6,6 +6,8 @@
#include "qapi/qmp/qdict.h"
#include "qemu/notify.h"
#include "qapi-types.h"
+#include "qemu/error-report.h"
+#include "qapi/error.h"
#ifdef CONFIG_OPENGL
# include <epoxy/gl.h>
@@ -430,10 +432,10 @@ void cocoa_display_init(DisplayState *ds, int full_screen);
void vnc_display_init(const char *id);
void vnc_display_open(const char *id, Error **errp);
void vnc_display_add_client(const char *id, int csock, bool skipauth);
-char *vnc_display_local_addr(const char *id);
#ifdef CONFIG_VNC
int vnc_display_password(const char *id, const char *password);
int vnc_display_pw_expire(const char *id, time_t expires);
+char *vnc_display_local_addr(const char *id);
QemuOpts *vnc_parse(const char *str, Error **errp);
int vnc_init_func(void *opaque, QemuOpts *opts, Error **errp);
#else
@@ -445,6 +447,22 @@ static inline int vnc_display_pw_expire(const char *id, time_t expires)
{
return -ENODEV;
};
+static inline QemuOpts *vnc_parse(const char *str, Error **errp)
+{
+ error_setg(errp, "VNC support is disabled");
+ return NULL;
+}
+static inline int vnc_init_func(void *opaque, QemuOpts *opts, Error **errp)
+{
+ error_setg(errp, "VNC support is disabled");
+ return -1;
+}
+static inline char *vnc_display_local_addr(const char *id)
+{
+ /* This must never be called if CONFIG_VNC is disabled */
+ error_report("VNC support is disabled");
+ abort();
+}
#endif
/* curses.c */
diff --git a/vl.c b/vl.c
index a920f16..cdb06dc 100644
--- a/vl.c
+++ b/vl.c
@@ -2146,7 +2146,6 @@ static DisplayType select_display(const char *p)
exit(1);
#endif
} else if (strstart(p, "vnc", &opts)) {
-#ifdef CONFIG_VNC
if (*opts == '=') {
Error *err = NULL;
if (vnc_parse(opts + 1, &err) == NULL) {
@@ -2157,10 +2156,6 @@ static DisplayType select_display(const char *p)
error_report("VNC requires a display argument vnc=<display>");
exit(1);
}
-#else
- error_report("VNC support is disabled");
- exit(1);
-#endif
} else if (strstart(p, "curses", &opts)) {
#ifdef CONFIG_CURSES
display = DT_CURSES;
@@ -2964,9 +2959,7 @@ int main(int argc, char **argv, char **envp)
const char *qtest_log = NULL;
const char *pid_file = NULL;
const char *incoming = NULL;
-#ifdef CONFIG_VNC
int show_vnc_port = 0;
-#endif
bool defconfig = true;
bool userconfig = true;
const char *log_mask = NULL;
@@ -3713,17 +3706,12 @@ int main(int argc, char **argv, char **envp)
break;
case QEMU_OPTION_vnc:
{
-#ifdef CONFIG_VNC
Error *local_err = NULL;
if (vnc_parse(optarg, &local_err) == NULL) {
error_report_err(local_err);
exit(1);
}
-#else
- error_report("VNC support is disabled");
- exit(1);
-#endif
break;
}
case QEMU_OPTION_no_acpi:
@@ -4578,7 +4566,6 @@ int main(int argc, char **argv, char **envp)
/* must be after terminal init, SDL library changes signal handlers */
os_setup_signal_handling();
-#ifdef CONFIG_VNC
/* init remote displays */
qemu_opts_foreach(qemu_find_opts("vnc"),
vnc_init_func, NULL, NULL);
@@ -4587,7 +4574,7 @@ int main(int argc, char **argv, char **envp)
printf("VNC server running on '%s'\n", ret);
g_free(ret);
}
-#endif
+
#ifdef CONFIG_SPICE
if (using_spice) {
qemu_spice_display_init();
--
2.1.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [Qemu-devel] [PATCH for-2.7 v3 03/12] curses: curses_display_init() stub
2016-04-19 19:55 [Qemu-devel] [PATCH for-2.7 v3 00/12] vl: graphics stubs + #ifdef cleanup + DT_NOGRAPHIC cleanup Eduardo Habkost
2016-04-19 19:55 ` [Qemu-devel] [PATCH for-2.7 v3 01/12] vl: Add DT_COCOA DisplayType value Eduardo Habkost
2016-04-19 19:55 ` [Qemu-devel] [PATCH for-2.7 v3 02/12] vnc: Initialization stubs Eduardo Habkost
@ 2016-04-19 19:55 ` Eduardo Habkost
2016-04-19 19:55 ` [Qemu-devel] [PATCH for-2.7 v3 04/12] sdl: Initialization stubs Eduardo Habkost
` (9 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Eduardo Habkost @ 2016-04-19 19:55 UTC (permalink / raw)
To: qemu-devel; +Cc: Paolo Bonzini, Marcel Apfelbaum
One less #ifdef in vl.c.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
Changes v1 -> v2:
* Move stub file to stubs/ui/
Changes v2 -> v3:
* Move stub to header file
---
include/ui/console.h | 9 +++++++++
vl.c | 2 --
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/include/ui/console.h b/include/ui/console.h
index 6640348..f5fa9cb 100644
--- a/include/ui/console.h
+++ b/include/ui/console.h
@@ -466,7 +466,16 @@ static inline char *vnc_display_local_addr(const char *id)
#endif
/* curses.c */
+#ifdef CONFIG_CURSES
void curses_display_init(DisplayState *ds, int full_screen);
+#else
+static inline void curses_display_init(DisplayState *ds, int full_screen)
+{
+ /* This must never be called if CONFIG_CURSES is disabled */
+ error_report("curses support is disabled");
+ abort();
+}
+#endif
/* input.c */
int index_from_key(const char *key, size_t key_length);
diff --git a/vl.c b/vl.c
index cdb06dc..6e2336e 100644
--- a/vl.c
+++ b/vl.c
@@ -4540,11 +4540,9 @@ int main(int argc, char **argv, char **envp)
case DT_NOGRAPHIC:
(void)ds; /* avoid warning if no display is configured */
break;
-#if defined(CONFIG_CURSES)
case DT_CURSES:
curses_display_init(ds, full_screen);
break;
-#endif
#if defined(CONFIG_SDL)
case DT_SDL:
sdl_display_init(ds, full_screen, no_frame);
--
2.1.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [Qemu-devel] [PATCH for-2.7 v3 04/12] sdl: Initialization stubs
2016-04-19 19:55 [Qemu-devel] [PATCH for-2.7 v3 00/12] vl: graphics stubs + #ifdef cleanup + DT_NOGRAPHIC cleanup Eduardo Habkost
` (2 preceding siblings ...)
2016-04-19 19:55 ` [Qemu-devel] [PATCH for-2.7 v3 03/12] curses: curses_display_init() stub Eduardo Habkost
@ 2016-04-19 19:55 ` Eduardo Habkost
2016-04-19 19:55 ` [Qemu-devel] [PATCH for-2.7 v3 05/12] cocoa: cocoa_display_init() stub Eduardo Habkost
` (8 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Eduardo Habkost @ 2016-04-19 19:55 UTC (permalink / raw)
To: qemu-devel; +Cc: Paolo Bonzini, Marcel Apfelbaum
This reduces the number of CONFIG_SDL #ifdefs in vl.c.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
Changes v1 -> v2:
* Move stub file to stubs/ui/
Changes v2 -> v3:
* Move stubs to header file
---
include/ui/console.h | 16 ++++++++++++++++
vl.c | 6 ++----
2 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/include/ui/console.h b/include/ui/console.h
index f5fa9cb..f3e749d 100644
--- a/include/ui/console.h
+++ b/include/ui/console.h
@@ -422,8 +422,24 @@ void surface_gl_setup_viewport(ConsoleGLState *gls,
#endif
/* sdl.c */
+#ifdef CONFIG_SDL
void sdl_display_early_init(int opengl);
void sdl_display_init(DisplayState *ds, int full_screen, int no_frame);
+#else
+static inline void sdl_display_early_init(int opengl)
+{
+ /* This must never be called if CONFIG_SDL is disabled */
+ error_report("SDL support is disabled");
+ abort();
+}
+static inline void sdl_display_init(DisplayState *ds, int full_screen,
+ int no_frame)
+{
+ /* This must never be called if CONFIG_SDL is disabled */
+ error_report("SDL support is disabled");
+ abort();
+}
+#endif
/* cocoa.m */
void cocoa_display_init(DisplayState *ds, int full_screen);
diff --git a/vl.c b/vl.c
index 6e2336e..51403c1 100644
--- a/vl.c
+++ b/vl.c
@@ -4249,11 +4249,10 @@ int main(int argc, char **argv, char **envp)
early_gtk_display_init(request_opengl);
}
#endif
-#if defined(CONFIG_SDL)
if (display_type == DT_SDL) {
sdl_display_early_init(request_opengl);
}
-#endif
+
if (request_opengl == 1 && display_opengl == 0) {
#if defined(CONFIG_OPENGL)
error_report("OpenGL is not supported by the display");
@@ -4543,11 +4542,10 @@ int main(int argc, char **argv, char **envp)
case DT_CURSES:
curses_display_init(ds, full_screen);
break;
-#if defined(CONFIG_SDL)
case DT_SDL:
sdl_display_init(ds, full_screen, no_frame);
break;
-#elif defined(CONFIG_COCOA)
+#if defined(CONFIG_COCOA)
case DT_COCOA:
cocoa_display_init(ds, full_screen);
break;
--
2.1.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [Qemu-devel] [PATCH for-2.7 v3 05/12] cocoa: cocoa_display_init() stub
2016-04-19 19:55 [Qemu-devel] [PATCH for-2.7 v3 00/12] vl: graphics stubs + #ifdef cleanup + DT_NOGRAPHIC cleanup Eduardo Habkost
` (3 preceding siblings ...)
2016-04-19 19:55 ` [Qemu-devel] [PATCH for-2.7 v3 04/12] sdl: Initialization stubs Eduardo Habkost
@ 2016-04-19 19:55 ` Eduardo Habkost
2016-04-19 19:55 ` [Qemu-devel] [PATCH for-2.7 v3 06/12] gtk: Initialization stubs Eduardo Habkost
` (7 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Eduardo Habkost @ 2016-04-19 19:55 UTC (permalink / raw)
To: qemu-devel; +Cc: Paolo Bonzini, Marcel Apfelbaum
One less #ifdef in vl.c.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
Changes v1 -> v2:
* Move stub file to stubs/ui/
Changes v2 -> v3:
* Fix typo (CONFIG_COCA) on comment
* Move stub to header file
---
include/ui/console.h | 9 +++++++++
vl.c | 2 --
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/include/ui/console.h b/include/ui/console.h
index f3e749d..7ac997f 100644
--- a/include/ui/console.h
+++ b/include/ui/console.h
@@ -442,7 +442,16 @@ static inline void sdl_display_init(DisplayState *ds, int full_screen,
#endif
/* cocoa.m */
+#ifdef CONFIG_COCOA
void cocoa_display_init(DisplayState *ds, int full_screen);
+#else
+static inline void cocoa_display_init(DisplayState *ds, int full_screen)
+{
+ /* This must never be called if CONFIG_COCOA is disabled */
+ error_report("Cocoa support is disabled");
+ abort();
+}
+#endif
/* vnc.c */
void vnc_display_init(const char *id);
diff --git a/vl.c b/vl.c
index 51403c1..41cdb68 100644
--- a/vl.c
+++ b/vl.c
@@ -4545,11 +4545,9 @@ int main(int argc, char **argv, char **envp)
case DT_SDL:
sdl_display_init(ds, full_screen, no_frame);
break;
-#if defined(CONFIG_COCOA)
case DT_COCOA:
cocoa_display_init(ds, full_screen);
break;
-#endif
#if defined(CONFIG_GTK)
case DT_GTK:
gtk_display_init(ds, full_screen, grab_on_hover);
--
2.1.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [Qemu-devel] [PATCH for-2.7 v3 06/12] gtk: Initialization stubs
2016-04-19 19:55 [Qemu-devel] [PATCH for-2.7 v3 00/12] vl: graphics stubs + #ifdef cleanup + DT_NOGRAPHIC cleanup Eduardo Habkost
` (4 preceding siblings ...)
2016-04-19 19:55 ` [Qemu-devel] [PATCH for-2.7 v3 05/12] cocoa: cocoa_display_init() stub Eduardo Habkost
@ 2016-04-19 19:55 ` Eduardo Habkost
2016-04-19 19:55 ` [Qemu-devel] [PATCH for-2.7 v3 07/12] spice: Initialization stubs on qemu-spice.h Eduardo Habkost
` (6 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Eduardo Habkost @ 2016-04-19 19:55 UTC (permalink / raw)
To: qemu-devel; +Cc: Paolo Bonzini, Marcel Apfelbaum
This reduces the number of CONFIG_GTK #ifdefs in vl.c.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
Changes v1 -> v2:
* Move stub file to stubs/ui/
Changes v2 -> v3:
* Add early_gtk_display_init() stub
* Move stubs to header file
---
include/ui/console.h | 17 +++++++++++++++++
vl.c | 7 +------
2 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/include/ui/console.h b/include/ui/console.h
index 7ac997f..52a5f65 100644
--- a/include/ui/console.h
+++ b/include/ui/console.h
@@ -506,7 +506,24 @@ static inline void curses_display_init(DisplayState *ds, int full_screen)
int index_from_key(const char *key, size_t key_length);
/* gtk.c */
+#ifdef CONFIG_GTK
void early_gtk_display_init(int opengl);
void gtk_display_init(DisplayState *ds, bool full_screen, bool grab_on_hover);
+#else
+static inline void gtk_display_init(DisplayState *ds, bool full_screen,
+ bool grab_on_hover)
+{
+ /* This must never be called if CONFIG_GTK is disabled */
+ error_report("GTK support is disabled");
+ abort();
+}
+
+static inline void early_gtk_display_init(int opengl)
+{
+ /* This must never be called if CONFIG_GTK is disabled */
+ error_report("GTK support is disabled");
+ abort();
+}
+#endif
#endif
diff --git a/vl.c b/vl.c
index 41cdb68..067d37e 100644
--- a/vl.c
+++ b/vl.c
@@ -146,9 +146,7 @@ int vga_interface_type = VGA_NONE;
static int full_screen = 0;
static int no_frame = 0;
int no_quit = 0;
-#ifdef CONFIG_GTK
static bool grab_on_hover;
-#endif
CharDriverState *serial_hds[MAX_SERIAL_PORTS];
CharDriverState *parallel_hds[MAX_PARALLEL_PORTS];
CharDriverState *virtcon_hds[MAX_VIRTIO_CONSOLES];
@@ -4244,11 +4242,10 @@ int main(int argc, char **argv, char **envp)
"ignoring option");
}
-#if defined(CONFIG_GTK)
if (display_type == DT_GTK) {
early_gtk_display_init(request_opengl);
}
-#endif
+
if (display_type == DT_SDL) {
sdl_display_early_init(request_opengl);
}
@@ -4548,11 +4545,9 @@ int main(int argc, char **argv, char **envp)
case DT_COCOA:
cocoa_display_init(ds, full_screen);
break;
-#if defined(CONFIG_GTK)
case DT_GTK:
gtk_display_init(ds, full_screen, grab_on_hover);
break;
-#endif
default:
break;
}
--
2.1.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [Qemu-devel] [PATCH for-2.7 v3 07/12] spice: Initialization stubs on qemu-spice.h
2016-04-19 19:55 [Qemu-devel] [PATCH for-2.7 v3 00/12] vl: graphics stubs + #ifdef cleanup + DT_NOGRAPHIC cleanup Eduardo Habkost
` (5 preceding siblings ...)
2016-04-19 19:55 ` [Qemu-devel] [PATCH for-2.7 v3 06/12] gtk: Initialization stubs Eduardo Habkost
@ 2016-04-19 19:55 ` Eduardo Habkost
2016-04-19 19:55 ` [Qemu-devel] [PATCH for-2.7 v3 08/12] milkymist: Move DT_NOGRAPHIC check outside milkymist_tmu2_create() Eduardo Habkost
` (5 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Eduardo Habkost @ 2016-04-19 19:55 UTC (permalink / raw)
To: qemu-devel; +Cc: Paolo Bonzini, Marcel Apfelbaum, Gerd Hoffmann
This reduces the number of CONFIG_SPICE #ifdefs in vl.c.
Cc: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
Changes v1 -> v2:
* Move stubs to qemu-spice.h, as the header file already
had a separate section for !CONFIG_SPICE
---
include/ui/qemu-spice.h | 13 +++++++++++++
vl.c | 4 ----
2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/include/ui/qemu-spice.h b/include/ui/qemu-spice.h
index aa24363..57ac91b 100644
--- a/include/ui/qemu-spice.h
+++ b/include/ui/qemu-spice.h
@@ -51,6 +51,8 @@ static inline CharDriverState *qemu_chr_open_spice_port(const char *name)
#else /* CONFIG_SPICE */
+#include "qemu/error-report.h"
+
#define using_spice 0
#define spice_displays 0
static inline int qemu_spice_set_passwd(const char *passwd,
@@ -75,6 +77,17 @@ static inline int qemu_spice_display_add_client(int csock, int skipauth,
return -1;
}
+static inline void qemu_spice_display_init(void)
+{
+ /* This must never be called if CONFIG_SPICE is disabled */
+ error_report("spice support is disabled");
+ abort();
+}
+
+static inline void qemu_spice_init(void)
+{
+}
+
#endif /* CONFIG_SPICE */
static inline bool qemu_using_spice(Error **errp)
diff --git a/vl.c b/vl.c
index 067d37e..732914b 100644
--- a/vl.c
+++ b/vl.c
@@ -4359,10 +4359,8 @@ int main(int argc, char **argv, char **envp)
os_set_line_buffering();
-#ifdef CONFIG_SPICE
/* spice needs the timers to be initialized by this point */
qemu_spice_init();
-#endif
cpu_ticks_init();
if (icount_opts) {
@@ -4564,11 +4562,9 @@ int main(int argc, char **argv, char **envp)
g_free(ret);
}
-#ifdef CONFIG_SPICE
if (using_spice) {
qemu_spice_display_init();
}
-#endif
if (foreach_device_config(DEV_GDB, gdbserver_start) < 0) {
exit(1);
--
2.1.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [Qemu-devel] [PATCH for-2.7 v3 08/12] milkymist: Move DT_NOGRAPHIC check outside milkymist_tmu2_create()
2016-04-19 19:55 [Qemu-devel] [PATCH for-2.7 v3 00/12] vl: graphics stubs + #ifdef cleanup + DT_NOGRAPHIC cleanup Eduardo Habkost
` (6 preceding siblings ...)
2016-04-19 19:55 ` [Qemu-devel] [PATCH for-2.7 v3 07/12] spice: Initialization stubs on qemu-spice.h Eduardo Habkost
@ 2016-04-19 19:55 ` Eduardo Habkost
2016-04-19 19:55 ` [Qemu-devel] [PATCH for-2.7 v3 09/12] vl: Replace DT_NOGRAPHIC with machine option Eduardo Habkost
` (4 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Eduardo Habkost @ 2016-04-19 19:55 UTC (permalink / raw)
To: qemu-devel; +Cc: Paolo Bonzini, Marcel Apfelbaum, Michael Walle
DT_NOGRAPHIC handling will be moved to a MachineState field, and
it will be easier to change milkymist_init() to check that field.
Cc: Michael Walle <michael@walle.cc>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
hw/lm32/milkymist-hw.h | 4 ----
hw/lm32/milkymist.c | 4 +++-
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/hw/lm32/milkymist-hw.h b/hw/lm32/milkymist-hw.h
index c8dfb4d..f857d28 100644
--- a/hw/lm32/milkymist-hw.h
+++ b/hw/lm32/milkymist-hw.h
@@ -108,10 +108,6 @@ static inline DeviceState *milkymist_tmu2_create(hwaddr base,
int nelements;
int ver_major, ver_minor;
- if (display_type == DT_NOGRAPHIC) {
- return NULL;
- }
-
/* check that GLX will work */
d = XOpenDisplay(NULL);
if (d == NULL) {
diff --git a/hw/lm32/milkymist.c b/hw/lm32/milkymist.c
index 96e6f4d..694dac3 100644
--- a/hw/lm32/milkymist.c
+++ b/hw/lm32/milkymist.c
@@ -167,7 +167,9 @@ milkymist_init(MachineState *machine)
milkymist_memcard_create(0x60004000);
milkymist_ac97_create(0x60005000, irq[4], irq[5], irq[6], irq[7]);
milkymist_pfpu_create(0x60006000, irq[8]);
- milkymist_tmu2_create(0x60007000, irq[9]);
+ if (display_type != DT_NOGRAPHIC) {
+ milkymist_tmu2_create(0x60007000, irq[9]);
+ }
milkymist_minimac2_create(0x60008000, 0x30000000, irq[10], irq[11]);
milkymist_softusb_create(0x6000f000, irq[15],
0x20000000, 0x1000, 0x20020000, 0x2000);
--
2.1.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [Qemu-devel] [PATCH for-2.7 v3 09/12] vl: Replace DT_NOGRAPHIC with machine option
2016-04-19 19:55 [Qemu-devel] [PATCH for-2.7 v3 00/12] vl: graphics stubs + #ifdef cleanup + DT_NOGRAPHIC cleanup Eduardo Habkost
` (7 preceding siblings ...)
2016-04-19 19:55 ` [Qemu-devel] [PATCH for-2.7 v3 08/12] milkymist: Move DT_NOGRAPHIC check outside milkymist_tmu2_create() Eduardo Habkost
@ 2016-04-19 19:55 ` Eduardo Habkost
2016-04-19 19:55 ` [Qemu-devel] [PATCH for-2.7 v3 10/12] vl: Make display_type a local variable Eduardo Habkost
` (3 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Eduardo Habkost @ 2016-04-19 19:55 UTC (permalink / raw)
To: qemu-devel
Cc: Paolo Bonzini, Marcel Apfelbaum, Michael Walle, Blue Swirl,
Mark Cave-Ayland
All DisplayType values are just UI options that don't affect any
hardware emulation code, except for DT_NOGRAPHIC. Replace
DT_NOGRAPHIC with DT_NONE plus a new "-machine graphics=on|off"
option, so hardware emulation code don't need to use the
display_type variable.
Cc: Michael Walle <michael@walle.cc>
Cc: Blue Swirl <blauwirbel@gmail.com>
Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
Changes v1 -> v2:
* (none, patch was removed in v2 of series)
Change v2 -> v3:
* Patch re-added in v3 of series
* Added "-machine graphics=on|off" option, rename
field to "enable_graphics" instead of "nographic"
---
hw/core/machine.c | 21 +++++++++++++++++++++
hw/lm32/milkymist.c | 2 +-
hw/nvram/fw_cfg.c | 6 ++++--
hw/sparc/sun4m.c | 2 +-
include/hw/boards.h | 1 +
include/sysemu/sysemu.h | 1 -
vl.c | 13 +++++++------
7 files changed, 35 insertions(+), 11 deletions(-)
diff --git a/hw/core/machine.c b/hw/core/machine.c
index 6dbbc85..0bb96ad 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -257,6 +257,20 @@ static void machine_set_usb(Object *obj, bool value, Error **errp)
ms->usb_disabled = !value;
}
+static bool machine_get_graphics(Object *obj, Error **errp)
+{
+ MachineState *ms = MACHINE(obj);
+
+ return ms->enable_graphics;
+}
+
+static void machine_set_graphics(Object *obj, bool value, Error **errp)
+{
+ MachineState *ms = MACHINE(obj);
+
+ ms->enable_graphics = value;
+}
+
static bool machine_get_igd_gfx_passthru(Object *obj, Error **errp)
{
MachineState *ms = MACHINE(obj);
@@ -382,6 +396,7 @@ static void machine_initfn(Object *obj)
ms->kvm_shadow_mem = -1;
ms->dump_guest_core = true;
ms->mem_merge = true;
+ ms->enable_graphics = true;
object_property_add_str(obj, "accel",
machine_get_accel, machine_set_accel, NULL);
@@ -460,6 +475,12 @@ static void machine_initfn(Object *obj)
object_property_set_description(obj, "usb",
"Set on/off to enable/disable usb",
NULL);
+ object_property_add_bool(obj, "graphics",
+ machine_get_graphics,
+ machine_set_graphics, NULL);
+ object_property_set_description(obj, "graphics",
+ "Set on/off to enable/disable graphics emulation",
+ NULL);
object_property_add_bool(obj, "igd-passthru",
machine_get_igd_gfx_passthru,
machine_set_igd_gfx_passthru, NULL);
diff --git a/hw/lm32/milkymist.c b/hw/lm32/milkymist.c
index 694dac3..1abdf6e 100644
--- a/hw/lm32/milkymist.c
+++ b/hw/lm32/milkymist.c
@@ -167,7 +167,7 @@ milkymist_init(MachineState *machine)
milkymist_memcard_create(0x60004000);
milkymist_ac97_create(0x60005000, irq[4], irq[5], irq[6], irq[7]);
milkymist_pfpu_create(0x60006000, irq[8]);
- if (display_type != DT_NOGRAPHIC) {
+ if (machine->enable_graphics) {
milkymist_tmu2_create(0x60007000, irq[9]);
}
milkymist_minimac2_create(0x60008000, 0x30000000, irq[10], irq[11]);
diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c
index 999f480..cdbdfb5 100644
--- a/hw/nvram/fw_cfg.c
+++ b/hw/nvram/fw_cfg.c
@@ -25,6 +25,7 @@
#include "hw/hw.h"
#include "sysemu/sysemu.h"
#include "sysemu/dma.h"
+#include "hw/boards.h"
#include "hw/isa/isa.h"
#include "hw/nvram/fw_cfg.h"
#include "hw/sysbus.h"
@@ -868,16 +869,17 @@ static void fw_cfg_machine_ready(struct Notifier *n, void *data)
static void fw_cfg_init1(DeviceState *dev)
{
FWCfgState *s = FW_CFG(dev);
+ MachineState *machine = MACHINE(qdev_get_machine());
assert(!object_resolve_path(FW_CFG_PATH, NULL));
- object_property_add_child(qdev_get_machine(), FW_CFG_NAME, OBJECT(s), NULL);
+ object_property_add_child(OBJECT(machine), FW_CFG_NAME, OBJECT(s), NULL);
qdev_init_nofail(dev);
fw_cfg_add_bytes(s, FW_CFG_SIGNATURE, (char *)"QEMU", 4);
fw_cfg_add_bytes(s, FW_CFG_UUID, qemu_uuid, 16);
- fw_cfg_add_i16(s, FW_CFG_NOGRAPHIC, (uint16_t)(display_type == DT_NOGRAPHIC));
+ fw_cfg_add_i16(s, FW_CFG_NOGRAPHIC, (uint16_t)!machine->enable_graphics);
fw_cfg_add_i16(s, FW_CFG_NB_CPUS, (uint16_t)smp_cpus);
fw_cfg_add_i16(s, FW_CFG_BOOT_MENU, (uint16_t)boot_menu);
fw_cfg_bootsplash(s);
diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c
index 7bfc00a..478fda8 100644
--- a/hw/sparc/sun4m.c
+++ b/hw/sparc/sun4m.c
@@ -1000,7 +1000,7 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef,
slavio_timer_init_all(hwdef->counter_base, slavio_irq[19], slavio_cpu_irq, smp_cpus);
slavio_serial_ms_kbd_init(hwdef->ms_kb_base, slavio_irq[14],
- display_type == DT_NOGRAPHIC, ESCC_CLOCK, 1);
+ !machine->enable_graphics, ESCC_CLOCK, 1);
/* Slavio TTYA (base+4, Linux ttyS0) is the first QEMU serial device
Slavio TTYB (base+0, Linux ttyS1) is the second QEMU serial device */
escc_init(hwdef->serial_base, slavio_irq[15], slavio_irq[15],
diff --git a/include/hw/boards.h b/include/hw/boards.h
index 8d4fe56..f968a25 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -154,6 +154,7 @@ struct MachineState {
bool iommu;
bool suppress_vmdesc;
bool enforce_config_section;
+ bool enable_graphics;
ram_addr_t ram_size;
ram_addr_t maxram_size;
diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
index 90766da..6076b80 100644
--- a/include/sysemu/sysemu.h
+++ b/include/sysemu/sysemu.h
@@ -138,7 +138,6 @@ typedef enum DisplayType
DT_SDL,
DT_COCOA,
DT_GTK,
- DT_NOGRAPHIC,
DT_NONE,
} DisplayType;
diff --git a/vl.c b/vl.c
index 732914b..c59cf0a 100644
--- a/vl.c
+++ b/vl.c
@@ -2960,6 +2960,7 @@ int main(int argc, char **argv, char **envp)
int show_vnc_port = 0;
bool defconfig = true;
bool userconfig = true;
+ bool nographic = false;
const char *log_mask = NULL;
const char *log_file = NULL;
char *trace_file = NULL;
@@ -3204,7 +3205,10 @@ int main(int argc, char **argv, char **envp)
display_type = select_display(optarg);
break;
case QEMU_OPTION_nographic:
- display_type = DT_NOGRAPHIC;
+ olist = qemu_find_opts("machine");
+ qemu_opts_parse_noisily(olist, "graphics=off", false);
+ nographic = true;
+ display_type = DT_NONE;
break;
case QEMU_OPTION_curses:
#ifdef CONFIG_CURSES
@@ -4165,7 +4169,7 @@ int main(int argc, char **argv, char **envp)
* -nographic _and_ redirects all ports explicitly - this is valid
* usage, -nographic is just a no-op in this case.
*/
- if (display_type == DT_NOGRAPHIC
+ if (nographic
&& (default_parallel || default_serial
|| default_monitor || default_virtcon)) {
error_report("-nographic cannot be used with -daemonize");
@@ -4179,7 +4183,7 @@ int main(int argc, char **argv, char **envp)
#endif
}
- if (display_type == DT_NOGRAPHIC) {
+ if (nographic) {
if (default_parallel)
add_device_config(DEV_PARALLEL, "null");
if (default_serial && default_monitor) {
@@ -4531,9 +4535,6 @@ int main(int argc, char **argv, char **envp)
/* init local displays */
switch (display_type) {
- case DT_NOGRAPHIC:
- (void)ds; /* avoid warning if no display is configured */
- break;
case DT_CURSES:
curses_display_init(ds, full_screen);
break;
--
2.1.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [Qemu-devel] [PATCH for-2.7 v3 10/12] vl: Make display_type a local variable
2016-04-19 19:55 [Qemu-devel] [PATCH for-2.7 v3 00/12] vl: graphics stubs + #ifdef cleanup + DT_NOGRAPHIC cleanup Eduardo Habkost
` (8 preceding siblings ...)
2016-04-19 19:55 ` [Qemu-devel] [PATCH for-2.7 v3 09/12] vl: Replace DT_NOGRAPHIC with machine option Eduardo Habkost
@ 2016-04-19 19:55 ` Eduardo Habkost
2016-04-19 19:55 ` [Qemu-devel] [PATCH for-2.7 v3 11/12] vl: Move DisplayType typedef to vl.c Eduardo Habkost
` (2 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Eduardo Habkost @ 2016-04-19 19:55 UTC (permalink / raw)
To: qemu-devel; +Cc: Paolo Bonzini, Marcel Apfelbaum
Now display_type is only used inside main(), and don't need to be a
global variable.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
include/sysemu/sysemu.h | 1 -
vl.c | 2 +-
2 files changed, 1 insertion(+), 2 deletions(-)
diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
index 6076b80..7e9f93e 100644
--- a/include/sysemu/sysemu.h
+++ b/include/sysemu/sysemu.h
@@ -155,7 +155,6 @@ extern int vga_interface_type;
extern int graphic_width;
extern int graphic_height;
extern int graphic_depth;
-extern DisplayType display_type;
extern int display_opengl;
extern const char *keyboard_layout;
extern int win2k_install_hack;
diff --git a/vl.c b/vl.c
index c59cf0a..5867c0f 100644
--- a/vl.c
+++ b/vl.c
@@ -127,7 +127,6 @@ static const char *data_dir[16];
static int data_dir_idx;
const char *bios_name = NULL;
enum vga_retrace_method vga_retrace_method = VGA_RETRACE_DUMB;
-DisplayType display_type = DT_DEFAULT;
int request_opengl = -1;
int display_opengl;
static int display_remote;
@@ -2961,6 +2960,7 @@ int main(int argc, char **argv, char **envp)
bool defconfig = true;
bool userconfig = true;
bool nographic = false;
+ DisplayType display_type = DT_DEFAULT;
const char *log_mask = NULL;
const char *log_file = NULL;
char *trace_file = NULL;
--
2.1.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [Qemu-devel] [PATCH for-2.7 v3 11/12] vl: Move DisplayType typedef to vl.c
2016-04-19 19:55 [Qemu-devel] [PATCH for-2.7 v3 00/12] vl: graphics stubs + #ifdef cleanup + DT_NOGRAPHIC cleanup Eduardo Habkost
` (9 preceding siblings ...)
2016-04-19 19:55 ` [Qemu-devel] [PATCH for-2.7 v3 10/12] vl: Make display_type a local variable Eduardo Habkost
@ 2016-04-19 19:55 ` Eduardo Habkost
2016-04-19 19:55 ` [Qemu-devel] [PATCH for-2.7 v3 12/12] vl: Make display_remote a local variable Eduardo Habkost
2016-05-10 13:55 ` [Qemu-devel] [PATCH for-2.7 v3 00/12] vl: graphics stubs + #ifdef cleanup + DT_NOGRAPHIC cleanup Paolo Bonzini
12 siblings, 0 replies; 15+ messages in thread
From: Eduardo Habkost @ 2016-04-19 19:55 UTC (permalink / raw)
To: qemu-devel; +Cc: Paolo Bonzini, Marcel Apfelbaum
Now the type is only used inside vl.c and doesn't need to be in a
header file.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
Change v1 -> v2:
* Coding style fix
(open brace '{' following enum go on the same line)
---
include/sysemu/sysemu.h | 10 ----------
vl.c | 9 +++++++++
2 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
index 7e9f93e..618169c 100644
--- a/include/sysemu/sysemu.h
+++ b/include/sysemu/sysemu.h
@@ -131,16 +131,6 @@ void qemu_savevm_send_postcopy_ram_discard(QEMUFile *f, const char *name,
int qemu_loadvm_state(QEMUFile *f);
-typedef enum DisplayType
-{
- DT_DEFAULT,
- DT_CURSES,
- DT_SDL,
- DT_COCOA,
- DT_GTK,
- DT_NONE,
-} DisplayType;
-
extern int autostart;
typedef enum {
diff --git a/vl.c b/vl.c
index 5867c0f..cc9cf65 100644
--- a/vl.c
+++ b/vl.c
@@ -2075,6 +2075,15 @@ static void select_vgahw(const char *p)
}
}
+typedef enum DisplayType {
+ DT_DEFAULT,
+ DT_CURSES,
+ DT_SDL,
+ DT_COCOA,
+ DT_GTK,
+ DT_NONE,
+} DisplayType;
+
static DisplayType select_display(const char *p)
{
const char *opts;
--
2.1.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [Qemu-devel] [PATCH for-2.7 v3 12/12] vl: Make display_remote a local variable
2016-04-19 19:55 [Qemu-devel] [PATCH for-2.7 v3 00/12] vl: graphics stubs + #ifdef cleanup + DT_NOGRAPHIC cleanup Eduardo Habkost
` (10 preceding siblings ...)
2016-04-19 19:55 ` [Qemu-devel] [PATCH for-2.7 v3 11/12] vl: Move DisplayType typedef to vl.c Eduardo Habkost
@ 2016-04-19 19:55 ` Eduardo Habkost
2016-05-10 13:55 ` [Qemu-devel] [PATCH for-2.7 v3 00/12] vl: graphics stubs + #ifdef cleanup + DT_NOGRAPHIC cleanup Paolo Bonzini
12 siblings, 0 replies; 15+ messages in thread
From: Eduardo Habkost @ 2016-04-19 19:55 UTC (permalink / raw)
To: qemu-devel; +Cc: Paolo Bonzini, Marcel Apfelbaum
The variable is used only inside main(), so it can be local.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
vl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/vl.c b/vl.c
index cc9cf65..d09b7fb 100644
--- a/vl.c
+++ b/vl.c
@@ -129,7 +129,6 @@ const char *bios_name = NULL;
enum vga_retrace_method vga_retrace_method = VGA_RETRACE_DUMB;
int request_opengl = -1;
int display_opengl;
-static int display_remote;
const char* keyboard_layout = NULL;
ram_addr_t ram_size;
const char *mem_path = NULL;
@@ -2970,6 +2969,7 @@ int main(int argc, char **argv, char **envp)
bool userconfig = true;
bool nographic = false;
DisplayType display_type = DT_DEFAULT;
+ int display_remote = 0;
const char *log_mask = NULL;
const char *log_file = NULL;
char *trace_file = NULL;
--
2.1.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [Qemu-devel] [PATCH for-2.7 v3 00/12] vl: graphics stubs + #ifdef cleanup + DT_NOGRAPHIC cleanup
2016-04-19 19:55 [Qemu-devel] [PATCH for-2.7 v3 00/12] vl: graphics stubs + #ifdef cleanup + DT_NOGRAPHIC cleanup Eduardo Habkost
` (11 preceding siblings ...)
2016-04-19 19:55 ` [Qemu-devel] [PATCH for-2.7 v3 12/12] vl: Make display_remote a local variable Eduardo Habkost
@ 2016-05-10 13:55 ` Paolo Bonzini
2016-05-10 15:17 ` Eduardo Habkost
12 siblings, 1 reply; 15+ messages in thread
From: Paolo Bonzini @ 2016-05-10 13:55 UTC (permalink / raw)
To: Eduardo Habkost, qemu-devel; +Cc: Marcel Apfelbaum
On 19/04/2016 21:55, Eduardo Habkost wrote:
> * Clean up the graphics initialization code to reduce the
> number of #ifdefs;
> * Remove the display_type == DT_NOGRAPHIC checks from hardware
> emulation code;
> * Make the display_type global variable a local variable on
> main();
> * Make the display_remote static variable a local variable on
> main().
>
> Changes v2 -> v3:
> * Include the DT_NOGRAPHIC patches again in the series, so all of
> them can be reviewed
> * Move the stub code to inline functions at console.h.
> This was done to simplify the series, as build dependencies get
> tricky when trying to build libqemustub.a with --disable-user
> --disable-system (it disables pixman build flags, and console.h
> won't build because qemu-pixman.h requires pixman headers)
> * Now the series is based on my 'machine-next' branch, available
> at:
> https://github.com/ehabkost/qemu.git machine-next
>
> Changes v1 -> v2:
> * Patches 2-6: Move stub files to stubs/ui/
> * Patch 7: Move stubs to qemu-spice.h, as the header file
> already had a separate section for !CONFIG_SPICE
> * Removed DT_NOGRAPHIC patches from the series (they will be sent
> as a separate series)
>
> Eduardo Habkost (12):
> vl: Add DT_COCOA DisplayType value
> vnc: Initialization stubs
> curses: curses_display_init() stub
> sdl: Initialization stubs
> cocoa: cocoa_display_init() stub
> gtk: Initialization stubs
> spice: Initialization stubs on qemu-spice.h
> milkymist: Move DT_NOGRAPHIC check outside milkymist_tmu2_create()
> vl: Replace DT_NOGRAPHIC with machine option
> vl: Make display_type a local variable
> vl: Move DisplayType typedef to vl.c
> vl: Make display_remote a local variable
>
> hw/core/machine.c | 21 +++++++++++++++
> hw/lm32/milkymist-hw.h | 4 ---
> hw/lm32/milkymist.c | 4 ++-
> hw/nvram/fw_cfg.c | 6 +++--
> hw/sparc/sun4m.c | 2 +-
> include/hw/boards.h | 1 +
> include/sysemu/sysemu.h | 11 --------
> include/ui/console.h | 71 ++++++++++++++++++++++++++++++++++++++++++++++++-
> include/ui/qemu-spice.h | 13 +++++++++
> vl.c | 66 +++++++++++++++++----------------------------
> 10 files changed, 138 insertions(+), 61 deletions(-)
Very nice, I suppose you'll be sending the pull request?
Paolo
^ permalink raw reply [flat|nested] 15+ messages in thread