* [Qemu-devel] [PATCH v2 0/7] vl: graphics stubs + #ifdef cleanup
@ 2015-11-12 19:02 Eduardo Habkost
2015-11-12 19:02 ` [Qemu-devel] [PATCH v2 1/7] vl: Add DT_COCOA DisplayType value Eduardo Habkost
` (7 more replies)
0 siblings, 8 replies; 15+ messages in thread
From: Eduardo Habkost @ 2015-11-12 19:02 UTC (permalink / raw)
To: qemu-devel; +Cc: Paolo Bonzini
Clean up the graphics initialization code to reduce the number of
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 (7):
vl: Add DT_COCOA DisplayType value
stubs: VNC initialization stubs
stubs: curses_display_init() stub
stubs: SDL initialization stubs
stubs: cocoa_display_init() stub
stubs: gtk_display_init() stub
spice: Initialization stubs on qemu-spice.h
include/sysemu/sysemu.h | 1 +
include/ui/console.h | 4 ++--
include/ui/qemu-spice.h | 13 +++++++++++++
stubs/Makefile.objs | 1 +
stubs/ui/Makefile.objs | 5 +++++
stubs/ui/cocoa.c | 10 ++++++++++
stubs/ui/curses.c | 10 ++++++++++
stubs/ui/gtk.c | 10 ++++++++++
stubs/ui/sdl.c | 17 +++++++++++++++++
stubs/ui/vnc.c | 22 ++++++++++++++++++++++
vl.c | 37 ++++++-------------------------------
11 files changed, 97 insertions(+), 33 deletions(-)
create mode 100644 stubs/ui/Makefile.objs
create mode 100644 stubs/ui/cocoa.c
create mode 100644 stubs/ui/curses.c
create mode 100644 stubs/ui/gtk.c
create mode 100644 stubs/ui/sdl.c
create mode 100644 stubs/ui/vnc.c
--
2.1.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Qemu-devel] [PATCH v2 1/7] vl: Add DT_COCOA DisplayType value
2015-11-12 19:02 [Qemu-devel] [PATCH v2 0/7] vl: graphics stubs + #ifdef cleanup Eduardo Habkost
@ 2015-11-12 19:02 ` Eduardo Habkost
2015-11-13 15:49 ` Andreas Färber
2015-11-12 19:02 ` [Qemu-devel] [PATCH v2 2/7] stubs: VNC initialization stubs Eduardo Habkost
` (6 subsequent siblings)
7 siblings, 1 reply; 15+ messages in thread
From: Eduardo Habkost @ 2015-11-12 19:02 UTC (permalink / raw)
To: qemu-devel; +Cc: Paolo Bonzini, 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>
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 f992494..0f4e520 100644
--- a/include/sysemu/sysemu.h
+++ b/include/sysemu/sysemu.h
@@ -137,6 +137,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 7d993a5..bba1b0a 100644
--- a/vl.c
+++ b/vl.c
@@ -4247,8 +4247,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;
@@ -4588,7 +4590,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 v2 2/7] stubs: VNC initialization stubs
2015-11-12 19:02 [Qemu-devel] [PATCH v2 0/7] vl: graphics stubs + #ifdef cleanup Eduardo Habkost
2015-11-12 19:02 ` [Qemu-devel] [PATCH v2 1/7] vl: Add DT_COCOA DisplayType value Eduardo Habkost
@ 2015-11-12 19:02 ` Eduardo Habkost
2015-11-12 19:02 ` [Qemu-devel] [PATCH v2 3/7] stubs: curses_display_init() stub Eduardo Habkost
` (5 subsequent siblings)
7 siblings, 0 replies; 15+ messages in thread
From: Eduardo Habkost @ 2015-11-12 19:02 UTC (permalink / raw)
To: qemu-devel; +Cc: Paolo Bonzini
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/
---
include/ui/console.h | 4 ++--
stubs/Makefile.objs | 1 +
stubs/ui/Makefile.objs | 1 +
stubs/ui/vnc.c | 22 ++++++++++++++++++++++
vl.c | 15 +--------------
5 files changed, 27 insertions(+), 16 deletions(-)
create mode 100644 stubs/ui/Makefile.objs
create mode 100644 stubs/ui/vnc.c
diff --git a/include/ui/console.h b/include/ui/console.h
index c249db4..30e5305 100644
--- a/include/ui/console.h
+++ b/include/ui/console.h
@@ -413,11 +413,11 @@ 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);
+QemuOpts *vnc_parse(const char *str, Error **errp);
+int vnc_init_func(void *opaque, QemuOpts *opts, Error **errp);
#ifdef CONFIG_VNC
int vnc_display_password(const char *id, const char *password);
int vnc_display_pw_expire(const char *id, time_t expires);
-QemuOpts *vnc_parse(const char *str, Error **errp);
-int vnc_init_func(void *opaque, QemuOpts *opts, Error **errp);
#else
static inline int vnc_display_password(const char *id, const char *password)
{
diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs
index d7898a0..ecf06ae 100644
--- a/stubs/Makefile.objs
+++ b/stubs/Makefile.objs
@@ -38,3 +38,4 @@ stub-obj-y += qmp_pc_dimm_device_list.o
stub-obj-y += target-monitor-defs.o
stub-obj-y += target-get-monitor-def.o
stub-obj-y += vhost.o
+stub-obj-y += ui/
diff --git a/stubs/ui/Makefile.objs b/stubs/ui/Makefile.objs
new file mode 100644
index 0000000..16ea29a
--- /dev/null
+++ b/stubs/ui/Makefile.objs
@@ -0,0 +1 @@
+stub-obj-y += vnc.o
diff --git a/stubs/ui/vnc.c b/stubs/ui/vnc.c
new file mode 100644
index 0000000..de89858
--- /dev/null
+++ b/stubs/ui/vnc.c
@@ -0,0 +1,22 @@
+#include "qemu-common.h"
+#include "ui/console.h"
+#include "qemu/error-report.h"
+
+QemuOpts *vnc_parse(const char *str, Error **errp)
+{
+ error_setg(errp, "VNC support is disabled");
+ return NULL;
+}
+
+int vnc_init_func(void *opaque, QemuOpts *opts, Error **errp)
+{
+ error_setg(errp, "VNC support is disabled");
+ return -1;
+}
+
+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();
+}
diff --git a/vl.c b/vl.c
index bba1b0a..0558e87 100644
--- a/vl.c
+++ b/vl.c
@@ -2145,7 +2145,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) {
@@ -2156,10 +2155,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;
@@ -2984,9 +2979,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;
@@ -3726,17 +3719,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:
@@ -4606,7 +4594,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);
@@ -4615,7 +4602,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 v2 3/7] stubs: curses_display_init() stub
2015-11-12 19:02 [Qemu-devel] [PATCH v2 0/7] vl: graphics stubs + #ifdef cleanup Eduardo Habkost
2015-11-12 19:02 ` [Qemu-devel] [PATCH v2 1/7] vl: Add DT_COCOA DisplayType value Eduardo Habkost
2015-11-12 19:02 ` [Qemu-devel] [PATCH v2 2/7] stubs: VNC initialization stubs Eduardo Habkost
@ 2015-11-12 19:02 ` Eduardo Habkost
2015-11-12 19:02 ` [Qemu-devel] [PATCH v2 4/7] stubs: SDL initialization stubs Eduardo Habkost
` (4 subsequent siblings)
7 siblings, 0 replies; 15+ messages in thread
From: Eduardo Habkost @ 2015-11-12 19:02 UTC (permalink / raw)
To: qemu-devel; +Cc: Paolo Bonzini
One less #ifdef in vl.c.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
Changes v1 -> v2:
* Move stub file to stubs/ui/
---
stubs/ui/Makefile.objs | 1 +
stubs/ui/curses.c | 10 ++++++++++
vl.c | 2 --
3 files changed, 11 insertions(+), 2 deletions(-)
create mode 100644 stubs/ui/curses.c
diff --git a/stubs/ui/Makefile.objs b/stubs/ui/Makefile.objs
index 16ea29a..2f63c58 100644
--- a/stubs/ui/Makefile.objs
+++ b/stubs/ui/Makefile.objs
@@ -1 +1,2 @@
stub-obj-y += vnc.o
+stub-obj-y += curses.o
diff --git a/stubs/ui/curses.c b/stubs/ui/curses.c
new file mode 100644
index 0000000..2115c77
--- /dev/null
+++ b/stubs/ui/curses.c
@@ -0,0 +1,10 @@
+#include "qemu-common.h"
+#include "ui/console.h"
+#include "qemu/error-report.h"
+
+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();
+}
diff --git a/vl.c b/vl.c
index 0558e87..3ca1c11 100644
--- a/vl.c
+++ b/vl.c
@@ -4568,11 +4568,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 v2 4/7] stubs: SDL initialization stubs
2015-11-12 19:02 [Qemu-devel] [PATCH v2 0/7] vl: graphics stubs + #ifdef cleanup Eduardo Habkost
` (2 preceding siblings ...)
2015-11-12 19:02 ` [Qemu-devel] [PATCH v2 3/7] stubs: curses_display_init() stub Eduardo Habkost
@ 2015-11-12 19:02 ` Eduardo Habkost
2015-11-12 19:02 ` [Qemu-devel] [PATCH v2 5/7] stubs: cocoa_display_init() stub Eduardo Habkost
` (3 subsequent siblings)
7 siblings, 0 replies; 15+ messages in thread
From: Eduardo Habkost @ 2015-11-12 19:02 UTC (permalink / raw)
To: qemu-devel; +Cc: Paolo Bonzini
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/
---
stubs/ui/Makefile.objs | 1 +
stubs/ui/sdl.c | 17 +++++++++++++++++
vl.c | 6 ++----
3 files changed, 20 insertions(+), 4 deletions(-)
create mode 100644 stubs/ui/sdl.c
diff --git a/stubs/ui/Makefile.objs b/stubs/ui/Makefile.objs
index 2f63c58..2e4c924 100644
--- a/stubs/ui/Makefile.objs
+++ b/stubs/ui/Makefile.objs
@@ -1,2 +1,3 @@
stub-obj-y += vnc.o
stub-obj-y += curses.o
+stub-obj-y += sdl.o
diff --git a/stubs/ui/sdl.c b/stubs/ui/sdl.c
new file mode 100644
index 0000000..f5ab668
--- /dev/null
+++ b/stubs/ui/sdl.c
@@ -0,0 +1,17 @@
+#include "qemu-common.h"
+#include "ui/console.h"
+#include "qemu/error-report.h"
+
+void sdl_display_early_init(int opengl)
+{
+ /* This must never be called if CONFIG_SDL is disabled */
+ error_report("SDL support is disabled");
+ abort();
+}
+
+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();
+}
diff --git a/vl.c b/vl.c
index 3ca1c11..5292648 100644
--- a/vl.c
+++ b/vl.c
@@ -4261,11 +4261,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");
@@ -4571,11 +4570,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 v2 5/7] stubs: cocoa_display_init() stub
2015-11-12 19:02 [Qemu-devel] [PATCH v2 0/7] vl: graphics stubs + #ifdef cleanup Eduardo Habkost
` (3 preceding siblings ...)
2015-11-12 19:02 ` [Qemu-devel] [PATCH v2 4/7] stubs: SDL initialization stubs Eduardo Habkost
@ 2015-11-12 19:02 ` Eduardo Habkost
2015-11-17 14:45 ` Peter Maydell
2015-11-12 19:02 ` [Qemu-devel] [PATCH v2 6/7] stubs: gtk_display_init() stub Eduardo Habkost
` (2 subsequent siblings)
7 siblings, 1 reply; 15+ messages in thread
From: Eduardo Habkost @ 2015-11-12 19:02 UTC (permalink / raw)
To: qemu-devel; +Cc: Paolo Bonzini
One less #ifdef in vl.c.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
Changes v1 -> v2:
* Move stub file to stubs/ui/
---
stubs/ui/Makefile.objs | 1 +
stubs/ui/cocoa.c | 10 ++++++++++
vl.c | 2 --
3 files changed, 11 insertions(+), 2 deletions(-)
create mode 100644 stubs/ui/cocoa.c
diff --git a/stubs/ui/Makefile.objs b/stubs/ui/Makefile.objs
index 2e4c924..ce9a0ce 100644
--- a/stubs/ui/Makefile.objs
+++ b/stubs/ui/Makefile.objs
@@ -1,3 +1,4 @@
stub-obj-y += vnc.o
stub-obj-y += curses.o
stub-obj-y += sdl.o
+stub-obj-y += cocoa.o
diff --git a/stubs/ui/cocoa.c b/stubs/ui/cocoa.c
new file mode 100644
index 0000000..ef07a8a
--- /dev/null
+++ b/stubs/ui/cocoa.c
@@ -0,0 +1,10 @@
+#include "qemu-common.h"
+#include "ui/console.h"
+#include "qemu/error-report.h"
+
+void cocoa_display_init(DisplayState *ds, int full_screen)
+{
+ /* This must never be called if CONFIG_COCA is disabled */
+ error_report("Cocoa support is disabled");
+ abort();
+}
diff --git a/vl.c b/vl.c
index 5292648..ea83e17 100644
--- a/vl.c
+++ b/vl.c
@@ -4573,11 +4573,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 v2 6/7] stubs: gtk_display_init() stub
2015-11-12 19:02 [Qemu-devel] [PATCH v2 0/7] vl: graphics stubs + #ifdef cleanup Eduardo Habkost
` (4 preceding siblings ...)
2015-11-12 19:02 ` [Qemu-devel] [PATCH v2 5/7] stubs: cocoa_display_init() stub Eduardo Habkost
@ 2015-11-12 19:02 ` Eduardo Habkost
2015-11-12 19:02 ` [Qemu-devel] [PATCH v2 7/7] spice: Initialization stubs on qemu-spice.h Eduardo Habkost
2015-11-12 21:17 ` [Qemu-devel] [PATCH v2 0/7] vl: graphics stubs + #ifdef cleanup Eric Blake
7 siblings, 0 replies; 15+ messages in thread
From: Eduardo Habkost @ 2015-11-12 19:02 UTC (permalink / raw)
To: qemu-devel; +Cc: Paolo Bonzini
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/
---
stubs/ui/Makefile.objs | 1 +
stubs/ui/gtk.c | 10 ++++++++++
vl.c | 4 ----
3 files changed, 11 insertions(+), 4 deletions(-)
create mode 100644 stubs/ui/gtk.c
diff --git a/stubs/ui/Makefile.objs b/stubs/ui/Makefile.objs
index ce9a0ce..cdf87fe 100644
--- a/stubs/ui/Makefile.objs
+++ b/stubs/ui/Makefile.objs
@@ -2,3 +2,4 @@ stub-obj-y += vnc.o
stub-obj-y += curses.o
stub-obj-y += sdl.o
stub-obj-y += cocoa.o
+stub-obj-y += gtk.o
diff --git a/stubs/ui/gtk.c b/stubs/ui/gtk.c
new file mode 100644
index 0000000..a46ef0c
--- /dev/null
+++ b/stubs/ui/gtk.c
@@ -0,0 +1,10 @@
+#include "qemu-common.h"
+#include "ui/console.h"
+#include "qemu/error-report.h"
+
+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();
+}
diff --git a/vl.c b/vl.c
index ea83e17..d4191d6 100644
--- a/vl.c
+++ b/vl.c
@@ -151,9 +151,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];
@@ -4576,11 +4574,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 v2 7/7] spice: Initialization stubs on qemu-spice.h
2015-11-12 19:02 [Qemu-devel] [PATCH v2 0/7] vl: graphics stubs + #ifdef cleanup Eduardo Habkost
` (5 preceding siblings ...)
2015-11-12 19:02 ` [Qemu-devel] [PATCH v2 6/7] stubs: gtk_display_init() stub Eduardo Habkost
@ 2015-11-12 19:02 ` Eduardo Habkost
2015-11-13 7:27 ` Gerd Hoffmann
2015-11-12 21:17 ` [Qemu-devel] [PATCH v2 0/7] vl: graphics stubs + #ifdef cleanup Eric Blake
7 siblings, 1 reply; 15+ messages in thread
From: Eduardo Habkost @ 2015-11-12 19:02 UTC (permalink / raw)
To: qemu-devel; +Cc: Paolo Bonzini, Gerd Hoffmann
This reduces the number of CONFIG_SPICE #ifdefs in vl.c.
Cc: 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 f9ce357..da01273 100644
--- a/include/ui/qemu-spice.h
+++ b/include/ui/qemu-spice.h
@@ -52,6 +52,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,
@@ -76,6 +78,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 d4191d6..57064ea 100644
--- a/vl.c
+++ b/vl.c
@@ -4386,10 +4386,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) {
@@ -4593,11 +4591,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
* Re: [Qemu-devel] [PATCH v2 0/7] vl: graphics stubs + #ifdef cleanup
2015-11-12 19:02 [Qemu-devel] [PATCH v2 0/7] vl: graphics stubs + #ifdef cleanup Eduardo Habkost
` (6 preceding siblings ...)
2015-11-12 19:02 ` [Qemu-devel] [PATCH v2 7/7] spice: Initialization stubs on qemu-spice.h Eduardo Habkost
@ 2015-11-12 21:17 ` Eric Blake
2015-11-12 21:49 ` Eduardo Habkost
7 siblings, 1 reply; 15+ messages in thread
From: Eric Blake @ 2015-11-12 21:17 UTC (permalink / raw)
To: Eduardo Habkost, qemu-devel; +Cc: Paolo Bonzini
[-- Attachment #1: Type: text/plain, Size: 1738 bytes --]
On 11/12/2015 12:02 PM, Eduardo Habkost wrote:
> Clean up the graphics initialization code to reduce the number of
>
Lame of git for eating lines that start with #ifdef. But at least it
doesn't matter on the cover letter :)
> 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 (7):
> vl: Add DT_COCOA DisplayType value
> stubs: VNC initialization stubs
> stubs: curses_display_init() stub
> stubs: SDL initialization stubs
> stubs: cocoa_display_init() stub
> stubs: gtk_display_init() stub
> spice: Initialization stubs on qemu-spice.h
>
> include/sysemu/sysemu.h | 1 +
> include/ui/console.h | 4 ++--
> include/ui/qemu-spice.h | 13 +++++++++++++
> stubs/Makefile.objs | 1 +
> stubs/ui/Makefile.objs | 5 +++++
> stubs/ui/cocoa.c | 10 ++++++++++
> stubs/ui/curses.c | 10 ++++++++++
> stubs/ui/gtk.c | 10 ++++++++++
> stubs/ui/sdl.c | 17 +++++++++++++++++
> stubs/ui/vnc.c | 22 ++++++++++++++++++++++
> vl.c | 37 ++++++-------------------------------
> 11 files changed, 97 insertions(+), 33 deletions(-)
> create mode 100644 stubs/ui/Makefile.objs
> create mode 100644 stubs/ui/cocoa.c
> create mode 100644 stubs/ui/curses.c
> create mode 100644 stubs/ui/gtk.c
> create mode 100644 stubs/ui/sdl.c
> create mode 100644 stubs/ui/vnc.c
>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Qemu-devel] [PATCH v2 0/7] vl: graphics stubs + #ifdef cleanup
2015-11-12 21:17 ` [Qemu-devel] [PATCH v2 0/7] vl: graphics stubs + #ifdef cleanup Eric Blake
@ 2015-11-12 21:49 ` Eduardo Habkost
2015-11-13 18:28 ` Eduardo Habkost
0 siblings, 1 reply; 15+ messages in thread
From: Eduardo Habkost @ 2015-11-12 21:49 UTC (permalink / raw)
To: Eric Blake; +Cc: Paolo Bonzini, qemu-devel, Stefan Hajnoczi
On Thu, Nov 12, 2015 at 02:17:53PM -0700, Eric Blake wrote:
> On 11/12/2015 12:02 PM, Eduardo Habkost wrote:
> > Clean up the graphics initialization code to reduce the number of
> >
>
> Lame of git for eating lines that start with #ifdef. But at least it
> doesn't matter on the cover letter :)
Maybe it's a git-publish bug, I will check. Thanks for noting! :)
--
Eduardo
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Qemu-devel] [PATCH v2 7/7] spice: Initialization stubs on qemu-spice.h
2015-11-12 19:02 ` [Qemu-devel] [PATCH v2 7/7] spice: Initialization stubs on qemu-spice.h Eduardo Habkost
@ 2015-11-13 7:27 ` Gerd Hoffmann
0 siblings, 0 replies; 15+ messages in thread
From: Gerd Hoffmann @ 2015-11-13 7:27 UTC (permalink / raw)
To: Eduardo Habkost; +Cc: Paolo Bonzini, qemu-devel
On Do, 2015-11-12 at 17:02 -0200, Eduardo Habkost wrote:
> This reduces the number of CONFIG_SPICE #ifdefs in vl.c.
>
> Cc: 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
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
cheers,
Gerd
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Qemu-devel] [PATCH v2 1/7] vl: Add DT_COCOA DisplayType value
2015-11-12 19:02 ` [Qemu-devel] [PATCH v2 1/7] vl: Add DT_COCOA DisplayType value Eduardo Habkost
@ 2015-11-13 15:49 ` Andreas Färber
0 siblings, 0 replies; 15+ messages in thread
From: Andreas Färber @ 2015-11-13 15:49 UTC (permalink / raw)
To: Eduardo Habkost, qemu-devel; +Cc: Paolo Bonzini, Peter Maydell
Am 12.11.2015 um 20:02 schrieb Eduardo Habkost:
> 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>
> 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 f992494..0f4e520 100644
> --- a/include/sysemu/sysemu.h
> +++ b/include/sysemu/sysemu.h
> @@ -137,6 +137,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 7d993a5..bba1b0a 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -4247,8 +4247,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;
> @@ -4588,7 +4590,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
Sounds like a good idea, but haven't reviewed those extra DT_SDL uses,
Acked-by: Andreas Färber <andreas.faerber@web.de>
Regards,
Andreas
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Qemu-devel] [PATCH v2 0/7] vl: graphics stubs + #ifdef cleanup
2015-11-12 21:49 ` Eduardo Habkost
@ 2015-11-13 18:28 ` Eduardo Habkost
0 siblings, 0 replies; 15+ messages in thread
From: Eduardo Habkost @ 2015-11-13 18:28 UTC (permalink / raw)
To: Eric Blake; +Cc: Paolo Bonzini, qemu-devel, Stefan Hajnoczi
On Thu, Nov 12, 2015 at 07:49:51PM -0200, Eduardo Habkost wrote:
> On Thu, Nov 12, 2015 at 02:17:53PM -0700, Eric Blake wrote:
> > On 11/12/2015 12:02 PM, Eduardo Habkost wrote:
> > > Clean up the graphics initialization code to reduce the number of
> > >
> >
> > Lame of git for eating lines that start with #ifdef. But at least it
> > doesn't matter on the cover letter :)
>
> Maybe it's a git-publish bug, I will check. Thanks for noting! :)
I've confirmed it's a "git tag -F" bug/feature, it's not
git-publish's fault.
--
Eduardo
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Qemu-devel] [PATCH v2 5/7] stubs: cocoa_display_init() stub
2015-11-12 19:02 ` [Qemu-devel] [PATCH v2 5/7] stubs: cocoa_display_init() stub Eduardo Habkost
@ 2015-11-17 14:45 ` Peter Maydell
2015-11-17 15:09 ` Eduardo Habkost
0 siblings, 1 reply; 15+ messages in thread
From: Peter Maydell @ 2015-11-17 14:45 UTC (permalink / raw)
To: Eduardo Habkost; +Cc: Paolo Bonzini, QEMU Developers
On 12 November 2015 at 19:02, Eduardo Habkost <ehabkost@redhat.com> wrote:
> One less #ifdef in vl.c.
>
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
> Changes v1 -> v2:
> * Move stub file to stubs/ui/
> ---
> stubs/ui/Makefile.objs | 1 +
> stubs/ui/cocoa.c | 10 ++++++++++
> vl.c | 2 --
> 3 files changed, 11 insertions(+), 2 deletions(-)
> create mode 100644 stubs/ui/cocoa.c
>
> diff --git a/stubs/ui/Makefile.objs b/stubs/ui/Makefile.objs
> index 2e4c924..ce9a0ce 100644
> --- a/stubs/ui/Makefile.objs
> +++ b/stubs/ui/Makefile.objs
> @@ -1,3 +1,4 @@
> stub-obj-y += vnc.o
> stub-obj-y += curses.o
> stub-obj-y += sdl.o
> +stub-obj-y += cocoa.o
> diff --git a/stubs/ui/cocoa.c b/stubs/ui/cocoa.c
> new file mode 100644
> index 0000000..ef07a8a
> --- /dev/null
> +++ b/stubs/ui/cocoa.c
> @@ -0,0 +1,10 @@
> +#include "qemu-common.h"
> +#include "ui/console.h"
> +#include "qemu/error-report.h"
> +
> +void cocoa_display_init(DisplayState *ds, int full_screen)
> +{
> + /* This must never be called if CONFIG_COCA is disabled */
"CONFIG_COCOA".
thanks
-- PMM
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Qemu-devel] [PATCH v2 5/7] stubs: cocoa_display_init() stub
2015-11-17 14:45 ` Peter Maydell
@ 2015-11-17 15:09 ` Eduardo Habkost
0 siblings, 0 replies; 15+ messages in thread
From: Eduardo Habkost @ 2015-11-17 15:09 UTC (permalink / raw)
To: Peter Maydell; +Cc: Paolo Bonzini, QEMU Developers
On Tue, Nov 17, 2015 at 02:45:17PM +0000, Peter Maydell wrote:
> On 12 November 2015 at 19:02, Eduardo Habkost <ehabkost@redhat.com> wrote:
[...]
> > +void cocoa_display_init(DisplayState *ds, int full_screen)
> > +{
> > + /* This must never be called if CONFIG_COCA is disabled */
>
> "CONFIG_COCOA".
Will be fixed in next version. Thanks!
--
Eduardo
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2015-11-17 15:10 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-12 19:02 [Qemu-devel] [PATCH v2 0/7] vl: graphics stubs + #ifdef cleanup Eduardo Habkost
2015-11-12 19:02 ` [Qemu-devel] [PATCH v2 1/7] vl: Add DT_COCOA DisplayType value Eduardo Habkost
2015-11-13 15:49 ` Andreas Färber
2015-11-12 19:02 ` [Qemu-devel] [PATCH v2 2/7] stubs: VNC initialization stubs Eduardo Habkost
2015-11-12 19:02 ` [Qemu-devel] [PATCH v2 3/7] stubs: curses_display_init() stub Eduardo Habkost
2015-11-12 19:02 ` [Qemu-devel] [PATCH v2 4/7] stubs: SDL initialization stubs Eduardo Habkost
2015-11-12 19:02 ` [Qemu-devel] [PATCH v2 5/7] stubs: cocoa_display_init() stub Eduardo Habkost
2015-11-17 14:45 ` Peter Maydell
2015-11-17 15:09 ` Eduardo Habkost
2015-11-12 19:02 ` [Qemu-devel] [PATCH v2 6/7] stubs: gtk_display_init() stub Eduardo Habkost
2015-11-12 19:02 ` [Qemu-devel] [PATCH v2 7/7] spice: Initialization stubs on qemu-spice.h Eduardo Habkost
2015-11-13 7:27 ` Gerd Hoffmann
2015-11-12 21:17 ` [Qemu-devel] [PATCH v2 0/7] vl: graphics stubs + #ifdef cleanup Eric Blake
2015-11-12 21:49 ` Eduardo Habkost
2015-11-13 18:28 ` Eduardo Habkost
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.