]> Git Repo - qemu.git/commitdiff
Merge remote-tracking branch 'remotes/kraxel/tags/ui-20180305-pull-request' into...
authorPeter Maydell <[email protected]>
Mon, 5 Mar 2018 15:16:30 +0000 (15:16 +0000)
committerPeter Maydell <[email protected]>
Mon, 5 Mar 2018 15:16:30 +0000 (15:16 +0000)
ui: build curses, gtk and sdl as modules.

# gpg: Signature made Mon 05 Mar 2018 08:48:24 GMT
# gpg:                using RSA key 4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <[email protected]>"
# gpg:                 aka "Gerd Hoffmann <[email protected]>"
# gpg:                 aka "Gerd Hoffmann (private) <[email protected]>"
# Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138

* remotes/kraxel/tags/ui-20180305-pull-request:
  ui/sdl: build as module
  audio: rename CONFIG_* to CONFIG_AUDIO_*
  ui/curses: build as module
  ui/gtk: build as module
  configure: opengl doesn't depend on x11
  configure: add X11 vars to config-host.mak
  console: add ui module loading support
  console: add and use qemu_display_find_default
  egl-headless: switch over to new display registry
  curses: switch over to new display registry
  cocoa: switch over to new display registry
  sdl: switch over to new display registry
  console: add qemu display registry, add gtk

Signed-off-by: Peter Maydell <[email protected]>
1  2 
Makefile.objs
configure
include/ui/console.h
ui/cocoa.m
ui/console.c
ui/gtk.c
vl.c

diff --combined Makefile.objs
index d741134cc77ff2eec207981b8ec68ba2fc21840f,57ca6d908bcd8153e17a50f446199416e6138a76..69413d33b175d3cba7540d94b6e1d92a151523a5
@@@ -2,60 -2,7 +2,60 @@@
  # Common libraries for tools and emulators
  stub-obj-y = stubs/ crypto/
  util-obj-y = util/ qobject/ qapi/
 -util-obj-y += qmp-introspect.o qapi-types.o qapi-visit.o qapi-event.o
 +util-obj-y += qapi/qapi-builtin-types.o
 +util-obj-y += qapi/qapi-types.o
 +util-obj-y += qapi/qapi-types-block-core.o
 +util-obj-y += qapi/qapi-types-block.o
 +util-obj-y += qapi/qapi-types-char.o
 +util-obj-y += qapi/qapi-types-common.o
 +util-obj-y += qapi/qapi-types-crypto.o
 +util-obj-y += qapi/qapi-types-introspect.o
 +util-obj-y += qapi/qapi-types-migration.o
 +util-obj-y += qapi/qapi-types-misc.o
 +util-obj-y += qapi/qapi-types-net.o
 +util-obj-y += qapi/qapi-types-rocker.o
 +util-obj-y += qapi/qapi-types-run-state.o
 +util-obj-y += qapi/qapi-types-sockets.o
 +util-obj-y += qapi/qapi-types-tpm.o
 +util-obj-y += qapi/qapi-types-trace.o
 +util-obj-y += qapi/qapi-types-transaction.o
 +util-obj-y += qapi/qapi-types-ui.o
 +util-obj-y += qapi/qapi-builtin-visit.o
 +util-obj-y += qapi/qapi-visit.o
 +util-obj-y += qapi/qapi-visit-block-core.o
 +util-obj-y += qapi/qapi-visit-block.o
 +util-obj-y += qapi/qapi-visit-char.o
 +util-obj-y += qapi/qapi-visit-common.o
 +util-obj-y += qapi/qapi-visit-crypto.o
 +util-obj-y += qapi/qapi-visit-introspect.o
 +util-obj-y += qapi/qapi-visit-migration.o
 +util-obj-y += qapi/qapi-visit-misc.o
 +util-obj-y += qapi/qapi-visit-net.o
 +util-obj-y += qapi/qapi-visit-rocker.o
 +util-obj-y += qapi/qapi-visit-run-state.o
 +util-obj-y += qapi/qapi-visit-sockets.o
 +util-obj-y += qapi/qapi-visit-tpm.o
 +util-obj-y += qapi/qapi-visit-trace.o
 +util-obj-y += qapi/qapi-visit-transaction.o
 +util-obj-y += qapi/qapi-visit-ui.o
 +util-obj-y += qapi/qapi-events.o
 +util-obj-y += qapi/qapi-events-block-core.o
 +util-obj-y += qapi/qapi-events-block.o
 +util-obj-y += qapi/qapi-events-char.o
 +util-obj-y += qapi/qapi-events-common.o
 +util-obj-y += qapi/qapi-events-crypto.o
 +util-obj-y += qapi/qapi-events-introspect.o
 +util-obj-y += qapi/qapi-events-migration.o
 +util-obj-y += qapi/qapi-events-misc.o
 +util-obj-y += qapi/qapi-events-net.o
 +util-obj-y += qapi/qapi-events-rocker.o
 +util-obj-y += qapi/qapi-events-run-state.o
 +util-obj-y += qapi/qapi-events-sockets.o
 +util-obj-y += qapi/qapi-events-tpm.o
 +util-obj-y += qapi/qapi-events-trace.o
 +util-obj-y += qapi/qapi-events-transaction.o
 +util-obj-y += qapi/qapi-events-ui.o
 +util-obj-y += qapi/qapi-introspect.o
  
  chardev-obj-y = chardev/
  
@@@ -109,6 -56,7 +109,7 @@@ common-obj-y += hw
  common-obj-y += replay/
  
  common-obj-y += ui/
+ common-obj-m += ui/
  common-obj-y += bt-host.o bt-vhci.o
  bt-host.o-cflags := $(BLUEZ_CFLAGS)
  
@@@ -131,24 -79,8 +132,24 @@@ common-obj-$(CONFIG_FDT) += device_tree
  ######################################################################
  # qapi
  
 -common-obj-y += qmp-marshal.o
 -common-obj-y += qmp-introspect.o
 +common-obj-y += qapi/qapi-commands.o
 +common-obj-y += qapi/qapi-commands-block-core.o
 +common-obj-y += qapi/qapi-commands-block.o
 +common-obj-y += qapi/qapi-commands-char.o
 +common-obj-y += qapi/qapi-commands-common.o
 +common-obj-y += qapi/qapi-commands-crypto.o
 +common-obj-y += qapi/qapi-commands-introspect.o
 +common-obj-y += qapi/qapi-commands-migration.o
 +common-obj-y += qapi/qapi-commands-misc.o
 +common-obj-y += qapi/qapi-commands-net.o
 +common-obj-y += qapi/qapi-commands-rocker.o
 +common-obj-y += qapi/qapi-commands-run-state.o
 +common-obj-y += qapi/qapi-commands-sockets.o
 +common-obj-y += qapi/qapi-commands-tpm.o
 +common-obj-y += qapi/qapi-commands-trace.o
 +common-obj-y += qapi/qapi-commands-transaction.o
 +common-obj-y += qapi/qapi-commands-ui.o
 +common-obj-y += qapi/qapi-introspect.o
  common-obj-y += qmp.o hmp.o
  endif
  
@@@ -171,9 -103,8 +172,9 @@@ target-obj-y += trace
  ######################################################################
  # guest agent
  
 -# FIXME: a few definitions from qapi-types.o/qapi-visit.o are needed
 -# by libqemuutil.a.  These should be moved to a separate .json schema.
 +# FIXME: a few definitions from qapi/qapi-types.o and
 +# qapi/qapi-visit.o are needed by libqemuutil.a.  These should be
 +# extracted into a QAPI schema module, or perhaps a separate schema.
  qga-obj-y = qga/
  qga-vss-dll-obj-y = qga/
  
diff --combined configure
index 2c1cb5852098cebd9ffea586e6933a90135d5170,cb4fdb3573496dbae5995259542679005ca79e00..27d3f66bd536363d247eeb1dfd9b3f53346fe11f
+++ b/configure
  
  ##########################################
  # X11 probe
- x11_cflags=
- x11_libs=-lX11
  if $pkg_config --exists "x11"; then
+     have_x11=yes
      x11_cflags=$($pkg_config --cflags x11)
      x11_libs=$($pkg_config --libs x11)
  fi
@@@ -2555,10 -2554,10 +2554,10 @@@ if test "$gtk" != "no"; the
          gtk_libs=$($pkg_config --libs $gtkpackage)
          gtk_version=$($pkg_config --modversion $gtkpackage)
          if $pkg_config --exists "$gtkx11package >= $gtkversion"; then
+             need_x11=yes
              gtk_cflags="$gtk_cflags $x11_cflags"
              gtk_libs="$gtk_libs $x11_libs"
          fi
-         libs_softmmu="$gtk_libs $libs_softmmu"
          gtk="yes"
      elif test "$gtk" = "yes"; then
          feature_not_found "gtk" "Install gtk3-devel"
@@@ -2808,7 -2807,6 +2807,6 @@@ if test "$vte" != "no"; the
          vte_cflags=$($pkg_config --cflags $vtepackage)
          vte_libs=$($pkg_config --libs $vtepackage)
          vteversion=$($pkg_config --modversion $vtepackage)
-         libs_softmmu="$vte_libs $libs_softmmu"
          vte="yes"
      elif test "$vte" = "yes"; then
          if test "$gtkabi" = "3.0"; then
@@@ -2923,6 -2921,7 +2921,7 @@@ if test "$sdl" = "yes" ; the
  int main(void) { return 0; }
  EOF
    if compile_prog "$sdl_cflags $x11_cflags" "$sdl_libs $x11_libs" ; then
+     need_x11=yes
      sdl_cflags="$sdl_cflags $x11_cflags"
      sdl_libs="$sdl_libs $x11_libs"
    fi
@@@ -3281,8 -3280,6 +3280,6 @@@ EO
        unset IFS
        if compile_prog "$curses_inc" "$curses_lib" ; then
          curses_found=yes
-         QEMU_CFLAGS="$curses_inc $QEMU_CFLAGS"
-         libs_softmmu="$curses_lib $libs_softmmu"
          break
        fi
      done
@@@ -3778,9 -3775,9 +3775,9 @@@ libs_softmmu="$libs_softmmu $fdt_libs
  
  if test "$opengl" != "no" ; then
    opengl_pkgs="epoxy libdrm gbm"
-   if $pkg_config $opengl_pkgs x11; then
-     opengl_cflags="$($pkg_config --cflags $opengl_pkgs) $x11_cflags"
-     opengl_libs="$($pkg_config --libs $opengl_pkgs) $x11_libs"
+   if $pkg_config $opengl_pkgs; then
+     opengl_cflags="$($pkg_config --cflags $opengl_pkgs)"
+     opengl_libs="$($pkg_config --libs $opengl_pkgs)"
      opengl=yes
      if test "$gtk" = "yes" && $pkg_config --exists "$gtkpackage >= 3.16"; then
          gtk_gl="yes"
@@@ -5984,7 -5981,7 +5981,7 @@@ if test "$cap_ng" = "yes" ; the
  fi
  echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
  for drv in $audio_drv_list; do
-     def=CONFIG_$(echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]')
+     def=CONFIG_AUDIO_$(echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]')
      echo "$def=y" >> $config_host_mak
  done
  echo "ALSA_LIBS=$alsa_libs" >> $config_host_mak
@@@ -6036,8 -6033,13 +6033,13 @@@ if test "$modules" = "yes"; the
    echo "CONFIG_STAMP=_$( (echo $qemu_version; echo $pkgversion; cat $0) | $shacmd - | cut -f1 -d\ )" >> $config_host_mak
    echo "CONFIG_MODULES=y" >> $config_host_mak
  fi
+ if test "$have_x11" = "yes" -a "$need_x11" = "yes"; then
+   echo "CONFIG_X11=y" >> $config_host_mak
+   echo "X11_CFLAGS=$x11_cflags" >> $config_host_mak
+   echo "X11_LIBS=$x11_libs" >> $config_host_mak
+ fi
  if test "$sdl" = "yes" ; then
-   echo "CONFIG_SDL=y" >> $config_host_mak
+   echo "CONFIG_SDL=m" >> $config_host_mak
    echo "CONFIG_SDLABI=$sdlabi" >> $config_host_mak
    echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
    echo "SDL_LIBS=$sdl_libs" >> $config_host_mak
@@@ -6046,7 -6048,9 +6048,9 @@@ if test "$cocoa" = "yes" ; the
    echo "CONFIG_COCOA=y" >> $config_host_mak
  fi
  if test "$curses" = "yes" ; then
-   echo "CONFIG_CURSES=y" >> $config_host_mak
+   echo "CONFIG_CURSES=m" >> $config_host_mak
+   echo "CURSES_CFLAGS=$curses_inc" >> $config_host_mak
+   echo "CURSES_LIBS=$curses_lib" >> $config_host_mak
  fi
  if test "$pipe2" = "yes" ; then
    echo "CONFIG_PIPE2=y" >> $config_host_mak
@@@ -6143,7 -6147,7 +6147,7 @@@ if test "$glib_subprocess" = "yes" ; th
    echo "CONFIG_HAS_GLIB_SUBPROCESS_TESTS=y" >> $config_host_mak
  fi
  if test "$gtk" = "yes" ; then
-   echo "CONFIG_GTK=y" >> $config_host_mak
+   echo "CONFIG_GTK=m" >> $config_host_mak
    echo "CONFIG_GTKABI=$gtkabi" >> $config_host_mak
    echo "GTK_CFLAGS=$gtk_cflags" >> $config_host_mak
    echo "GTK_LIBS=$gtk_libs" >> $config_host_mak
  if test "$vte" = "yes" ; then
    echo "CONFIG_VTE=y" >> $config_host_mak
    echo "VTE_CFLAGS=$vte_cflags" >> $config_host_mak
+   echo "VTE_LIBS=$vte_libs" >> $config_host_mak
  fi
  if test "$virglrenderer" = "yes" ; then
    echo "CONFIG_VIRGL=y" >> $config_host_mak
@@@ -7053,6 -7058,7 +7058,6 @@@ DIRS="tests tests/tcg tests/tcg/cris te
  DIRS="$DIRS docs docs/interop fsdev scsi"
  DIRS="$DIRS pc-bios/optionrom pc-bios/spapr-rtas pc-bios/s390-ccw"
  DIRS="$DIRS roms/seabios roms/vgabios"
 -DIRS="$DIRS qapi-generated"
  FILES="Makefile tests/tcg/Makefile qdict-test-data.txt"
  FILES="$FILES tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit"
  FILES="$FILES tests/tcg/lm32/Makefile tests/tcg/xtensa/Makefile po/Makefile"
diff --combined include/ui/console.h
index e0d81f1144b4119e113c2be28a54ff4a9d833961,3a53db9360140430c343fac76c7254237e5f3a4c..aae9e44cb3c0ddb0cddfecd052e9bc458896f2cc
@@@ -5,7 -5,6 +5,7 @@@
  #include "qom/object.h"
  #include "qemu/notify.h"
  #include "qemu/error-report.h"
 +#include "qapi/qapi-types-ui.h"
  
  #ifdef CONFIG_OPENGL
  # include <epoxy/gl.h>
@@@ -433,36 -432,18 +433,18 @@@ void surface_gl_setup_viewport(QemuGLSh
                                 int ww, int wh);
  #endif
  
- /* sdl.c */
- #ifdef CONFIG_SDL
- void sdl_display_early_init(DisplayOptions *opts);
- void sdl_display_init(DisplayState *ds, DisplayOptions *opts);
- #else
- static inline void sdl_display_early_init(DisplayOptions *opts)
- {
-     /* 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, DisplayOptions *opts)
- {
-     /* This must never be called if CONFIG_SDL is disabled */
-     error_report("SDL support is disabled");
-     abort();
- }
- #endif
+ typedef struct QemuDisplay QemuDisplay;
  
- /* cocoa.m */
- #ifdef CONFIG_COCOA
- void cocoa_display_init(DisplayState *ds, DisplayOptions *opts);
- #else
- static inline void cocoa_display_init(DisplayState *ds, DisplayOptions *opts)
- {
-     /* This must never be called if CONFIG_COCOA is disabled */
-     error_report("Cocoa support is disabled");
-     abort();
- }
- #endif
+ struct QemuDisplay {
+     DisplayType type;
+     void (*early_init)(DisplayOptions *opts);
+     void (*init)(DisplayState *ds, DisplayOptions *opts);
+ };
+ void qemu_display_register(QemuDisplay *ui);
+ bool qemu_display_find_default(DisplayOptions *opts);
+ void qemu_display_early_init(DisplayOptions *opts);
+ void qemu_display_init(DisplayState *ds, DisplayOptions *opts);
  
  /* vnc.c */
  void vnc_display_init(const char *id);
@@@ -473,42 -454,7 +455,7 @@@ int vnc_display_pw_expire(const char *i
  QemuOpts *vnc_parse(const char *str, Error **errp);
  int vnc_init_func(void *opaque, QemuOpts *opts, Error **errp);
  
- /* curses.c */
- #ifdef CONFIG_CURSES
- void curses_display_init(DisplayState *ds, DisplayOptions *opts);
- #else
- static inline void curses_display_init(DisplayState *ds, DisplayOptions *opts)
- {
-     /* 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);
  
- /* gtk.c */
- #ifdef CONFIG_GTK
- void early_gtk_display_init(DisplayOptions *opts);
- void gtk_display_init(DisplayState *ds, DisplayOptions *opts);
- #else
- static inline void gtk_display_init(DisplayState *ds, DisplayOptions *opts)
- {
-     /* This must never be called if CONFIG_GTK is disabled */
-     error_report("GTK support is disabled");
-     abort();
- }
- static inline void early_gtk_display_init(DisplayOptions *opts)
- {
-     /* This must never be called if CONFIG_GTK is disabled */
-     error_report("GTK support is disabled");
-     abort();
- }
- #endif
- /* egl-headless.c */
- void egl_headless_init(DisplayOptions *opts);
  #endif
diff --combined ui/cocoa.m
index 30888ca8fd6cbc8688e70c64fa17d2854d5b601f,8b0dce90cb64322275042338a34e9d47ffd2906d..18de0bb3eaa1debfd0610d22e8e58673941606ba
@@@ -32,7 -32,7 +32,7 @@@
  #include "ui/input.h"
  #include "sysemu/sysemu.h"
  #include "qapi/error.h"
 -#include "qmp-commands.h"
 +#include "qapi/qapi-commands.h"
  #include "sysemu/blockdev.h"
  #include "qemu-version.h"
  #include <Carbon/Carbon.h>
@@@ -1683,7 -1683,7 +1683,7 @@@ static void addRemovableDevicesMenuItem
      qapi_free_BlockInfoList(pointerToFree);
  }
  
- void cocoa_display_init(DisplayState *ds, DisplayOptions *opts)
static void cocoa_display_init(DisplayState *ds, DisplayOptions *opts)
  {
      COCOA_DEBUG("qemu_cocoa: cocoa_display_init\n");
  
       */
      addRemovableDevicesMenuItems();
  }
+ static QemuDisplay qemu_display_cocoa = {
+     .type       = DISPLAY_TYPE_COCOA,
+     .init       = cocoa_display_init,
+ };
+ static void register_cocoa(void)
+ {
+     qemu_display_register(&qemu_display_cocoa);
+ }
+ type_init(register_cocoa);
diff --combined ui/console.c
index 6a1f49916eebf5974ee7479d86bc77d1fc489d64,78efab269adfc7ae86d790b1716b50af2fecb37b..6ab4ff3bafb7afe619eac7199f38843d4622ad3a
@@@ -26,9 -26,9 +26,9 @@@
  #include "ui/console.h"
  #include "hw/qdev-core.h"
  #include "qapi/error.h"
 +#include "qapi/qapi-commands-ui.h"
  #include "qemu/option.h"
  #include "qemu/timer.h"
 -#include "qmp-commands.h"
  #include "chardev/char-fe.h"
  #include "trace.h"
  #include "exec/memory.h"
@@@ -2180,6 -2180,65 +2180,65 @@@ PixelFormat qemu_default_pixelformat(in
      return pf;
  }
  
+ static QemuDisplay *dpys[DISPLAY_TYPE__MAX];
+ void qemu_display_register(QemuDisplay *ui)
+ {
+     assert(ui->type < DISPLAY_TYPE__MAX);
+     dpys[ui->type] = ui;
+ }
+ bool qemu_display_find_default(DisplayOptions *opts)
+ {
+     static DisplayType prio[] = {
+         DISPLAY_TYPE_GTK,
+         DISPLAY_TYPE_SDL,
+         DISPLAY_TYPE_COCOA
+     };
+     int i;
+     for (i = 0; i < ARRAY_SIZE(prio); i++) {
+         if (dpys[prio[i]] == NULL) {
+             ui_module_load_one(DisplayType_lookup.array[prio[i]]);
+         }
+         if (dpys[prio[i]] == NULL) {
+             continue;
+         }
+         opts->type = prio[i];
+         return true;
+     }
+     return false;
+ }
+ void qemu_display_early_init(DisplayOptions *opts)
+ {
+     assert(opts->type < DISPLAY_TYPE__MAX);
+     if (opts->type == DISPLAY_TYPE_NONE) {
+         return;
+     }
+     if (dpys[opts->type] == NULL) {
+         ui_module_load_one(DisplayType_lookup.array[opts->type]);
+     }
+     if (dpys[opts->type] == NULL) {
+         error_report("Display '%s' is not available.",
+                      DisplayType_lookup.array[opts->type]);
+         exit(1);
+     }
+     if (dpys[opts->type]->early_init) {
+         dpys[opts->type]->early_init(opts);
+     }
+ }
+ void qemu_display_init(DisplayState *ds, DisplayOptions *opts)
+ {
+     assert(opts->type < DISPLAY_TYPE__MAX);
+     if (opts->type == DISPLAY_TYPE_NONE) {
+         return;
+     }
+     assert(dpys[opts->type] != NULL);
+     dpys[opts->type]->init(ds, opts);
+ }
  void qemu_chr_parse_vc(QemuOpts *opts, ChardevBackend *backend, Error **errp)
  {
      int val;
diff --combined ui/gtk.c
index 0750262ca8f6435301a951f54c59f6940aea12fa,c63408e036860639d0076ac4bcc2210b0a03296f..563cff32b89613f032a4df77c41d37ee1a2a853c
+++ b/ui/gtk.c
@@@ -37,7 -37,6 +37,7 @@@
  #include "qemu/osdep.h"
  #include "qemu-common.h"
  #include "qapi/error.h"
 +#include "qapi/qapi-commands-misc.h"
  #include "qemu/cutils.h"
  
  #include "ui/console.h"
@@@ -53,6 -52,7 +53,6 @@@
  #include "trace.h"
  #include "ui/input.h"
  #include "sysemu/sysemu.h"
 -#include "qmp-commands.h"
  #include "keymaps.h"
  #include "chardev/char.h"
  #include "qom/object.h"
@@@ -2297,7 -2297,7 +2297,7 @@@ static void gd_create_menus(GtkDisplayS
  
  static gboolean gtkinit;
  
- void gtk_display_init(DisplayState *ds, DisplayOptions *opts)
static void gtk_display_init(DisplayState *ds, DisplayOptions *opts)
  {
      VirtualConsole *vc;
  
      }
  }
  
- void early_gtk_display_init(DisplayOptions *opts)
static void early_gtk_display_init(DisplayOptions *opts)
  {
      /* The QEMU code relies on the assumption that it's always run in
       * the C locale. Therefore it is not prepared to deal with
      type_register(&char_gd_vc_type_info);
  #endif
  }
+ static QemuDisplay qemu_display_gtk = {
+     .type       = DISPLAY_TYPE_GTK,
+     .early_init = early_gtk_display_init,
+     .init       = gtk_display_init,
+ };
+ static void register_gtk(void)
+ {
+     qemu_display_register(&qemu_display_gtk);
+ }
+ type_init(register_gtk);
diff --combined vl.c
index f98ec983e846d2834d2ed59e52577ef078addda4,e5f6de1843489e37e6f8b3f6a52de506d8768dff..6120b889ed418eaccab5ca4942e1d2cb0d921357
--- 1/vl.c
--- 2/vl.c
+++ b/vl.c
@@@ -97,9 -97,11 +97,9 @@@ int main(int argc, char **argv
  #include "sysemu/kvm.h"
  #include "sysemu/hax.h"
  #include "qapi/qobject-input-visitor.h"
 -#include "qapi-visit.h"
  #include "qemu/option.h"
  #include "qemu/config-file.h"
  #include "qemu-options.h"
 -#include "qmp-commands.h"
  #include "qemu/main-loop.h"
  #ifdef CONFIG_VIRTFS
  #include "fsdev/qemu-fsdev.h"
  #include "qapi/string-input-visitor.h"
  #include "qapi/opts-visitor.h"
  #include "qom/object_interfaces.h"
 -#include "qapi-event.h"
  #include "exec/semihost.h"
  #include "crypto/init.h"
  #include "sysemu/replay.h"
 +#include "qapi/qapi-events-run-state.h"
 +#include "qapi/qapi-visit-block-core.h"
 +#include "qapi/qapi-commands-block-core.h"
 +#include "qapi/qapi-commands-misc.h"
 +#include "qapi/qapi-commands-run-state.h"
  #include "qapi/qmp/qerror.h"
  #include "sysemu/iothread.h"
  
@@@ -2094,7 -2092,6 +2094,6 @@@ static void parse_display(const char *p
      const char *opts;
  
      if (strstart(p, "sdl", &opts)) {
- #ifdef CONFIG_SDL
          dpy.type = DISPLAY_TYPE_SDL;
          while (*opts) {
              const char *nextopt;
              }
              opts = nextopt;
          }
- #else
-         error_report("SDL support is disabled");
-         exit(1);
- #endif
      } else if (strstart(p, "vnc", &opts)) {
          if (*opts == '=') {
              vnc_parse(opts + 1, &error_fatal);
              exit(1);
          }
      } else if (strstart(p, "egl-headless", &opts)) {
- #ifdef CONFIG_OPENGL_DMABUF
-         display_opengl = 1;
          dpy.type = DISPLAY_TYPE_EGL_HEADLESS;
- #else
-         error_report("egl support is disabled");
-         exit(1);
- #endif
      } else if (strstart(p, "curses", &opts)) {
- #ifdef CONFIG_CURSES
          dpy.type = DISPLAY_TYPE_CURSES;
- #else
-         error_report("curses support is disabled");
-         exit(1);
- #endif
      } else if (strstart(p, "gtk", &opts)) {
- #ifdef CONFIG_GTK
          dpy.type = DISPLAY_TYPE_GTK;
          while (*opts) {
              const char *nextopt;
              }
              opts = nextopt;
          }
- #else
-         error_report("GTK support is disabled");
-         exit(1);
- #endif
      } else if (strstart(p, "none", &opts)) {
          dpy.type = DISPLAY_TYPE_NONE;
      } else {
@@@ -3093,7 -3070,6 +3072,7 @@@ int main(int argc, char **argv, char **
      qemu_add_opts(&qemu_chardev_opts);
      qemu_add_opts(&qemu_device_opts);
      qemu_add_opts(&qemu_netdev_opts);
 +    qemu_add_opts(&qemu_nic_opts);
      qemu_add_opts(&qemu_net_opts);
      qemu_add_opts(&qemu_rtc_opts);
      qemu_add_opts(&qemu_global_opts);
                      exit(1);
                  }
                  break;
 +            case QEMU_OPTION_nic:
 +                default_net = 0;
 +                if (net_client_parse(qemu_find_opts("nic"), optarg) == -1) {
 +                    exit(1);
 +                }
 +                break;
              case QEMU_OPTION_net:
                  default_net = 0;
                  if (net_client_parse(qemu_find_opts("net"), optarg) == -1) {
      }
  #endif
      if (dpy.type == DISPLAY_TYPE_DEFAULT && !display_remote) {
- #if defined(CONFIG_GTK)
-         dpy.type = DISPLAY_TYPE_GTK;
- #elif defined(CONFIG_SDL)
-         dpy.type = DISPLAY_TYPE_SDL;
- #elif defined(CONFIG_COCOA)
-         dpy.type = DISPLAY_TYPE_COCOA;
- #elif defined(CONFIG_VNC)
-         vnc_parse("localhost:0,to=99,id=default", &error_abort);
- #else
-         dpy.type = DISPLAY_TYPE_NONE;
+         if (!qemu_display_find_default(&dpy)) {
+             dpy.type = DISPLAY_TYPE_NONE;
+ #if defined(CONFIG_VNC)
+             vnc_parse("localhost:0,to=99,id=default", &error_abort);
  #endif
+         }
+     }
+     if (dpy.type == DISPLAY_TYPE_DEFAULT) {
+         dpy.type = DISPLAY_TYPE_NONE;
      }
  
      if ((no_frame || alt_grab || ctrl_grab) && dpy.type != DISPLAY_TYPE_SDL) {
                       "ignoring option");
      }
  
-     if (dpy.type == DISPLAY_TYPE_GTK) {
-         early_gtk_display_init(&dpy);
-     }
-     if (dpy.type == DISPLAY_TYPE_SDL) {
-         sdl_display_early_init(&dpy);
-     }
+     qemu_display_early_init(&dpy);
      qemu_console_early_init();
  
      if (dpy.has_gl && dpy.gl && display_opengl == 0) {
  
      colo_info_init();
  
 -    if (net_init_clients() < 0) {
 +    if (net_init_clients(&err) < 0) {
 +        error_report_err(err);
          exit(1);
      }
  
          qemu_register_reset(restore_boot_order, g_strdup(boot_order));
      }
  
-     ds = init_displaystate();
      /* init local displays */
-     switch (dpy.type) {
-     case DISPLAY_TYPE_CURSES:
-         curses_display_init(ds, &dpy);
-         break;
-     case DISPLAY_TYPE_SDL:
-         sdl_display_init(ds, &dpy);
-         break;
-     case DISPLAY_TYPE_COCOA:
-         cocoa_display_init(ds, &dpy);
-         break;
-     case DISPLAY_TYPE_GTK:
-         gtk_display_init(ds, &dpy);
-         break;
-     default:
-         break;
-     }
+     ds = init_displaystate();
+     qemu_display_init(ds, &dpy);
  
      /* must be after terminal init, SDL library changes signal handlers */
      os_setup_signal_handling();
          qemu_spice_display_init();
      }
  
- #ifdef CONFIG_OPENGL_DMABUF
-     if (dpy.type == DISPLAY_TYPE_EGL_HEADLESS) {
-         egl_headless_init(&dpy);
-     }
- #endif
      if (foreach_device_config(DEV_GDB, gdbserver_start) < 0) {
          exit(1);
      }
This page took 0.06045 seconds and 4 git commands to generate.