From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1M6qIl-0003RP-Pr for qemu-devel@nongnu.org; Wed, 20 May 2009 14:14:03 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1M6qIg-0003Qw-JW for qemu-devel@nongnu.org; Wed, 20 May 2009 14:14:02 -0400 Received: from [199.232.76.173] (port=37213 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M6qIg-0003Qs-GK for qemu-devel@nongnu.org; Wed, 20 May 2009 14:13:58 -0400 Received: from e8.ny.us.ibm.com ([32.97.182.138]:56926) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1M6qIg-0002K4-6P for qemu-devel@nongnu.org; Wed, 20 May 2009 14:13:58 -0400 Received: from d01relay02.pok.ibm.com (d01relay02.pok.ibm.com [9.56.227.234]) by e8.ny.us.ibm.com (8.13.1/8.13.1) with ESMTP id n4KI3pod018629 for ; Wed, 20 May 2009 14:03:51 -0400 Received: from d01av03.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) by d01relay02.pok.ibm.com (8.13.8/8.13.8/NCO v9.2) with ESMTP id n4KIDuQL234800 for ; Wed, 20 May 2009 14:13:56 -0400 Received: from d01av03.pok.ibm.com (loopback [127.0.0.1]) by d01av03.pok.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id n4KIDul2014023 for ; Wed, 20 May 2009 14:13:56 -0400 From: Anthony Liguori Date: Wed, 20 May 2009 13:13:54 -0500 Message-Id: <1242843234-9694-1-git-send-email-aliguori@us.ibm.com> Subject: [Qemu-devel] [PATCH] Eliminate --disable-gfx-check and make VNC default when SDL not available List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Anthony Liguori --disable-gfx-check predates VNC server support. It made sense back then because the only thing you could do without SDL was use -nographic mode or similar tricks. Since this is a very advanced mode of operation, gfx-check provided a good safety net for casual users. A casual user is very likely to use VNC to interact with a guest. In fact, it's often frustrating to install QEMU on a server and have to specify disable-gfx-check when you only want to use VNC. This patch eliminates disable-gfx-check and makes SDL behave like every other optional dependency. If SDL is not available, instead of failing ungracefully if no special options are specified, we default to -vnc localhost:0,to=99. When we do default to VNC, we also print a message to tell the user that we've done this include which port we're currently listening on. Any objections? Signed-off-by: Anthony Liguori --- configure | 19 ++----------------- console.h | 1 + vl.c | 41 ++++++++++++++++++++++++++--------------- vnc.c | 8 +++++++- 4 files changed, 36 insertions(+), 33 deletions(-) diff --git a/configure b/configure index 8fdbc1c..186e535 100755 --- a/configure +++ b/configure @@ -172,7 +172,6 @@ solaris="no" kqemu="no" profiler="no" cocoa="no" -check_gfx="yes" softmmu="yes" linux_user="no" darwin_user="no" @@ -191,6 +190,7 @@ kerneldir="" aix="no" blobs="yes" fdt="yes" +sdl="yes" sdl_x11="no" xen="yes" pkgversion="" @@ -438,8 +438,6 @@ for opt do sdl="no" ; audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`" ;; - --disable-gfx-check) check_gfx="no" - ;; --disable-system) softmmu="no" ;; --enable-system) softmmu="yes" @@ -835,7 +833,7 @@ fi sdl_too_old=no -if test -z "$sdl" ; then +if test "$sdl" = "yes" ; then sdl_config="sdl-config" sdl=no sdl_static=no @@ -1346,10 +1344,6 @@ echo "preadv support $preadv" if test $sdl_too_old = "yes"; then echo "-> Your SDL version is too old - please upgrade to have SDL support" fi -if [ -s $TMPSDLLOG ]; then - echo "The error log from compiling the libSDL test is: " - cat $TMPSDLLOG -fi #if test "$sdl_static" = "no"; then # echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output" #fi @@ -1772,15 +1766,6 @@ case "$target" in ;; esac -if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \ - -a "$sdl" = "no" -a "$cocoa" = "no" ; then - echo "ERROR: QEMU requires SDL or Cocoa for graphical output" - echo "To build QEMU without graphical output configure with --disable-gfx-check" - echo "Note that this will disable all output from the virtual graphics card" - echo "except through VNC or curses." - exit 1; -fi - #echo "Creating $config_mak, $config_h and $target_dir/Makefile" test -f $config_h && mv $config_h ${config_h}~ diff --git a/console.h b/console.h index 953b784..4172175 100644 --- a/console.h +++ b/console.h @@ -320,6 +320,7 @@ void vnc_display_close(DisplayState *ds); int vnc_display_open(DisplayState *ds, const char *display); int vnc_display_password(DisplayState *ds, const char *password); void do_info_vnc(Monitor *mon); +char *vnc_display_local_addr(DisplayState *ds); /* curses.c */ void curses_display_init(DisplayState *ds, int full_screen); diff --git a/vl.c b/vl.c index 9f25cd4..e28da7e 100644 --- a/vl.c +++ b/vl.c @@ -203,7 +203,7 @@ enum vga_retrace_method vga_retrace_method = VGA_RETRACE_DUMB; static DisplayState *display_state; int nographic; static int curses; -static int sdl; +static int sdl = 1; const char* keyboard_layout = NULL; int64_t ticks_per_sec; ram_addr_t ram_size; @@ -5952,25 +5952,36 @@ int main(int argc, char **argv, char **envp) } } else { #if defined(CONFIG_CURSES) - if (curses) { - /* At the moment curses cannot be used with other displays */ - curses_display_init(ds, full_screen); - } else + if (curses) { + /* At the moment curses cannot be used with other displays */ + curses_display_init(ds, full_screen); + } else #endif - { - if (vnc_display != NULL) { - vnc_display_init(ds); - if (vnc_display_open(ds, vnc_display) < 0) - exit(1); - } +#if defined(CONFIG_SDL) || defined(CONFIG_COCOA) + if (sdl) { #if defined(CONFIG_SDL) - if (sdl || !vnc_display) - sdl_display_init(ds, full_screen, no_frame); + sdl_display_init(ds, full_screen, no_frame); #elif defined(CONFIG_COCOA) - if (sdl || !vnc_display) - cocoa_display_init(ds, full_screen); + cocoa_display_init(ds, full_screen); +#endif + } else #endif + { + int print_port = 0; + + if (vnc_display == NULL) { + vnc_display = "localhost:0,to=99"; + print_port = 1; } + + vnc_display_init(ds); + if (vnc_display_open(ds, vnc_display) < 0) + exit(1); + + if (print_port) { + printf("VNC server running on `%s'\n", vnc_display_local_addr(ds)); + } + } } dpy_resize(ds); diff --git a/vnc.c b/vnc.c index ad3c1ce..3f5d622 100644 --- a/vnc.c +++ b/vnc.c @@ -86,7 +86,6 @@ char *vnc_socket_local_addr(const char *format, int fd) { return addr_to_string(format, &sa, salen); } - char *vnc_socket_remote_addr(const char *format, int fd) { struct sockaddr_storage sa; socklen_t salen; @@ -2101,6 +2100,13 @@ int vnc_display_password(DisplayState *ds, const char *password) return 0; } +char *vnc_display_local_addr(DisplayState *ds) +{ + VncDisplay *vs = ds ? (VncDisplay *)ds->opaque : vnc_display; + + return vnc_socket_local_addr("%s:%s", vs->lsock); +} + int vnc_display_open(DisplayState *ds, const char *display) { VncDisplay *vs = ds ? (VncDisplay *)ds->opaque : vnc_display; -- 1.6.2.5