summary refs log tree commit diff stats
path: root/vl.c
diff options
context:
space:
mode:
authorEduardo Habkost <ehabkost@redhat.com>2016-04-19 16:55:25 -0300
committerEduardo Habkost <ehabkost@redhat.com>2016-05-20 14:28:54 -0300
commitcfc58cf37362a931990efc75f3f580dfec49ac1e (patch)
tree86de8478715152ed258c1db3c100efc4d37158c2 /vl.c
parentcf3dc71eb5141761c3aed0d936e390aeaa73a88b (diff)
downloadfocaccia-qemu-cfc58cf37362a931990efc75f3f580dfec49ac1e.tar.gz
focaccia-qemu-cfc58cf37362a931990efc75f3f580dfec49ac1e.zip
vl: Replace DT_NOGRAPHIC with machine option
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>
Diffstat (limited to 'vl.c')
-rw-r--r--vl.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/vl.c b/vl.c
index 8576556f81..35ed954780 100644
--- a/vl.c
+++ b/vl.c
@@ -2962,6 +2962,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;
@@ -3206,7 +3207,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
@@ -4167,7 +4171,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");
@@ -4181,7 +4185,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;