Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/kraxel/tags/ui-20180305-pull-re…
Browse files Browse the repository at this point in the history
…quest' into staging

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) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"
# 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 <peter.maydell@linaro.org>
  • Loading branch information
pm215 committed Mar 5, 2018
2 parents 41dfc0d + 96400a1 commit 4ee02f5
Show file tree
Hide file tree
Showing 16 changed files with 220 additions and 176 deletions.
1 change: 1 addition & 0 deletions Makefile.objs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +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)

Expand Down
12 changes: 6 additions & 6 deletions audio/Makefile.objs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
common-obj-y = audio.o noaudio.o wavaudio.o mixeng.o
common-obj-$(CONFIG_SDL) += sdlaudio.o
common-obj-$(CONFIG_OSS) += ossaudio.o
common-obj-$(CONFIG_AUDIO_SDL) += sdlaudio.o
common-obj-$(CONFIG_AUDIO_OSS) += ossaudio.o
common-obj-$(CONFIG_SPICE) += spiceaudio.o
common-obj-$(CONFIG_COREAUDIO) += coreaudio.o
common-obj-$(CONFIG_ALSA) += alsaaudio.o
common-obj-$(CONFIG_DSOUND) += dsoundaudio.o
common-obj-$(CONFIG_PA) += paaudio.o
common-obj-$(CONFIG_AUDIO_COREAUDIO) += coreaudio.o
common-obj-$(CONFIG_AUDIO_ALSA) += alsaaudio.o
common-obj-$(CONFIG_AUDIO_DSOUND) += dsoundaudio.o
common-obj-$(CONFIG_AUDIO_PA) += paaudio.o
common-obj-$(CONFIG_AUDIO_PT_INT) += audio_pt_int.o
common-obj-$(CONFIG_AUDIO_WIN_INT) += audio_win_int.o
common-obj-y += wavcapture.o
Expand Down
2 changes: 1 addition & 1 deletion audio/audio_int.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#ifndef QEMU_AUDIO_INT_H
#define QEMU_AUDIO_INT_H

#ifdef CONFIG_COREAUDIO
#ifdef CONFIG_AUDIO_COREAUDIO
#define FLOAT_MIXENG
/* #define RECIPROCAL */
#endif
Expand Down
31 changes: 18 additions & 13 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -2520,9 +2520,8 @@ fi

##########################################
# 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
Expand Down Expand Up @@ -2555,10 +2554,10 @@ if test "$gtk" != "no"; then
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"
Expand Down Expand Up @@ -2808,7 +2807,6 @@ if test "$vte" != "no"; then
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
Expand Down Expand Up @@ -2923,6 +2921,7 @@ if test "$sdl" = "yes" ; 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
Expand Down Expand Up @@ -3281,8 +3280,6 @@ EOF
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
Expand Down Expand Up @@ -3778,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"
Expand Down Expand Up @@ -5984,7 +5981,7 @@ if test "$cap_ng" = "yes" ; then
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
Expand Down Expand Up @@ -6036,8 +6033,13 @@ if test "$modules" = "yes"; then
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
Expand All @@ -6046,7 +6048,9 @@ if test "$cocoa" = "yes" ; then
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
Expand Down Expand Up @@ -6143,7 +6147,7 @@ if test "$glib_subprocess" = "yes" ; then
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
Expand Down Expand Up @@ -6194,6 +6198,7 @@ fi
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
Expand Down
1 change: 1 addition & 0 deletions include/qemu/module.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ typedef enum {
#define trace_init(function) module_init(function, MODULE_INIT_TRACE)

#define block_module_load_one(lib) module_load_one("block-", lib)
#define ui_module_load_one(lib) module_load_one("ui-", lib)

void register_module_init(void (*fn)(void), module_init_type type);
void register_dso_module_init(void (*fn)(void), module_init_type type);
Expand Down
75 changes: 11 additions & 64 deletions include/ui/console.h
Original file line number Diff line number Diff line change
Expand Up @@ -433,36 +433,18 @@ void surface_gl_setup_viewport(QemuGLShader *gls,
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);
Expand All @@ -473,42 +455,7 @@ 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);

/* 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
4 changes: 4 additions & 0 deletions target/unicore32/Makefile.objs
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@ obj-y += translate.o op_helper.o helper.o cpu.o
obj-y += ucf64_helper.o

obj-$(CONFIG_SOFTMMU) += softmmu.o

# Huh? Uses curses directly instead of using ui/console.h interfaces ...
helper.o-cflags := $(CURSES_CFLAGS)
helper.o-libs := $(CURSES_LIBS)
31 changes: 20 additions & 11 deletions ui/Makefile.objs
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,16 @@ common-obj-y += keymaps.o console.o cursor.o qemu-pixman.o
common-obj-y += input.o input-keymap.o input-legacy.o
common-obj-$(CONFIG_LINUX) += input-linux.o
common-obj-$(CONFIG_SPICE) += spice-core.o spice-input.o spice-display.o
common-obj-$(CONFIG_SDL) += sdl.mo
common-obj-$(CONFIG_COCOA) += cocoa.o
common-obj-$(CONFIG_CURSES) += curses.o
common-obj-$(CONFIG_VNC) += $(vnc-obj-y)
common-obj-$(call lnot,$(CONFIG_VNC)) += vnc-stubs.o
common-obj-$(CONFIG_GTK) += gtk.o
common-obj-$(if $(CONFIG_WIN32),n,$(if $(CONFIG_SDL),y,$(CONFIG_GTK))) += x_keymap.o

common-obj-$(CONFIG_X11) += x_keymap.o
x_keymap.o-cflags := $(X11_CFLAGS)
x_keymap.o-libs := $(X11_LIBS)

# ui-sdl module
common-obj-$(CONFIG_SDL) += sdl.mo
ifeq ($(CONFIG_SDLABI),1.2)
sdl.mo-objs := sdl.o sdl_zoom.o
endif
Expand All @@ -31,24 +33,31 @@ endif
sdl.mo-cflags := $(SDL_CFLAGS)
sdl.mo-libs := $(SDL_LIBS)

# ui-gtk module
common-obj-$(CONFIG_GTK) += gtk.mo
gtk.mo-objs := gtk.o
gtk.mo-cflags := $(GTK_CFLAGS) $(VTE_CFLAGS)
gtk.mo-libs := $(GTK_LIBS) $(VTE_LIBS)

common-obj-$(CONFIG_CURSES) += curses.mo
curses.mo-objs := curses.o
curses.mo-cflags := $(CURSES_CFLAGS)
curses.mo-libs := $(CURSES_LIBS)

ifeq ($(CONFIG_OPENGL),y)
common-obj-y += shader.o
common-obj-y += console-gl.o
common-obj-y += egl-helpers.o
common-obj-y += egl-context.o
common-obj-$(CONFIG_OPENGL_DMABUF) += egl-headless.o
ifeq ($(CONFIG_GTK_GL),y)
common-obj-$(CONFIG_GTK) += gtk-gl-area.o
gtk.mo-objs += gtk-gl-area.o
else
common-obj-$(CONFIG_GTK) += gtk-egl.o
gtk.mo-objs += gtk-egl.o
gtk.mo-libs += $(OPENGL_LIBS)
endif
endif

gtk.o-cflags := $(GTK_CFLAGS) $(VTE_CFLAGS)
gtk-egl.o-cflags := $(GTK_CFLAGS) $(VTE_CFLAGS)
gtk-gl-area.o-cflags := $(GTK_CFLAGS) $(VTE_CFLAGS)

gtk-egl.o-libs += $(OPENGL_LIBS)
shader.o-libs += $(OPENGL_LIBS)
console-gl.o-libs += $(OPENGL_LIBS)
egl-helpers.o-libs += $(OPENGL_LIBS)
14 changes: 13 additions & 1 deletion ui/cocoa.m
Original file line number Diff line number Diff line change
Expand Up @@ -1683,7 +1683,7 @@ static void addRemovableDevicesMenuItems(void)
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");

Expand Down Expand Up @@ -1713,3 +1713,15 @@ void cocoa_display_init(DisplayState *ds, DisplayOptions *opts)
*/
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);
Loading

0 comments on commit 4ee02f5

Please sign in to comment.