# 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/
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)
######################################################################
# 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
######################################################################
# 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/
##########################################
# 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
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"
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
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
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
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"
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
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
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
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
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"
#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>
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);
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
#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>
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);
#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"
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;
#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"
#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"
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);
#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"
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 {
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);
}