Commit f92f8afebe038a4eae9ad90a140c9529f94919a6

Authored by Anthony Liguori
1 parent eb0b64f7

Eliminate --disable-gfx-check and make VNC default when SDL not available

 --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.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
configure
... ... @@ -172,7 +172,6 @@ solaris=&quot;no&quot;
172 172 kqemu="no"
173 173 profiler="no"
174 174 cocoa="no"
175   -check_gfx="yes"
176 175 softmmu="yes"
177 176 linux_user="no"
178 177 darwin_user="no"
... ... @@ -191,6 +190,7 @@ kerneldir=&quot;&quot;
191 190 aix="no"
192 191 blobs="yes"
193 192 fdt="yes"
  193 +sdl="yes"
194 194 sdl_x11="no"
195 195 xen="yes"
196 196 pkgversion=""
... ... @@ -438,8 +438,6 @@ for opt do
438 438 sdl="no" ;
439 439 audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
440 440 ;;
441   - --disable-gfx-check) check_gfx="no"
442   - ;;
443 441 --disable-system) softmmu="no"
444 442 ;;
445 443 --enable-system) softmmu="yes"
... ... @@ -835,7 +833,7 @@ fi
835 833  
836 834 sdl_too_old=no
837 835  
838   -if test -z "$sdl" ; then
  836 +if test "$sdl" = "yes" ; then
839 837 sdl_config="sdl-config"
840 838 sdl=no
841 839 sdl_static=no
... ... @@ -1346,10 +1344,6 @@ echo &quot;preadv support $preadv&quot;
1346 1344 if test $sdl_too_old = "yes"; then
1347 1345 echo "-> Your SDL version is too old - please upgrade to have SDL support"
1348 1346 fi
1349   -if [ -s $TMPSDLLOG ]; then
1350   - echo "The error log from compiling the libSDL test is: "
1351   - cat $TMPSDLLOG
1352   -fi
1353 1347 #if test "$sdl_static" = "no"; then
1354 1348 # echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
1355 1349 #fi
... ... @@ -1772,15 +1766,6 @@ case &quot;$target&quot; in
1772 1766 ;;
1773 1767 esac
1774 1768  
1775   -if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
1776   - -a "$sdl" = "no" -a "$cocoa" = "no" ; then
1777   - echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
1778   - echo "To build QEMU without graphical output configure with --disable-gfx-check"
1779   - echo "Note that this will disable all output from the virtual graphics card"
1780   - echo "except through VNC or curses."
1781   - exit 1;
1782   -fi
1783   -
1784 1769 #echo "Creating $config_mak, $config_h and $target_dir/Makefile"
1785 1770  
1786 1771 test -f $config_h && mv $config_h ${config_h}~
... ...
console.h
... ... @@ -320,6 +320,7 @@ void vnc_display_close(DisplayState *ds);
320 320 int vnc_display_open(DisplayState *ds, const char *display);
321 321 int vnc_display_password(DisplayState *ds, const char *password);
322 322 void do_info_vnc(Monitor *mon);
  323 +char *vnc_display_local_addr(DisplayState *ds);
323 324  
324 325 /* curses.c */
325 326 void curses_display_init(DisplayState *ds, int full_screen);
... ...
... ... @@ -203,7 +203,7 @@ enum vga_retrace_method vga_retrace_method = VGA_RETRACE_DUMB;
203 203 static DisplayState *display_state;
204 204 int nographic;
205 205 static int curses;
206   -static int sdl;
  206 +static int sdl = 1;
207 207 const char* keyboard_layout = NULL;
208 208 int64_t ticks_per_sec;
209 209 ram_addr_t ram_size;
... ... @@ -5952,25 +5952,36 @@ int main(int argc, char **argv, char **envp)
5952 5952 }
5953 5953 } else {
5954 5954 #if defined(CONFIG_CURSES)
5955   - if (curses) {
5956   - /* At the moment curses cannot be used with other displays */
5957   - curses_display_init(ds, full_screen);
5958   - } else
  5955 + if (curses) {
  5956 + /* At the moment curses cannot be used with other displays */
  5957 + curses_display_init(ds, full_screen);
  5958 + } else
5959 5959 #endif
5960   - {
5961   - if (vnc_display != NULL) {
5962   - vnc_display_init(ds);
5963   - if (vnc_display_open(ds, vnc_display) < 0)
5964   - exit(1);
5965   - }
  5960 +#if defined(CONFIG_SDL) || defined(CONFIG_COCOA)
  5961 + if (sdl) {
5966 5962 #if defined(CONFIG_SDL)
5967   - if (sdl || !vnc_display)
5968   - sdl_display_init(ds, full_screen, no_frame);
  5963 + sdl_display_init(ds, full_screen, no_frame);
5969 5964 #elif defined(CONFIG_COCOA)
5970   - if (sdl || !vnc_display)
5971   - cocoa_display_init(ds, full_screen);
  5965 + cocoa_display_init(ds, full_screen);
  5966 +#endif
  5967 + } else
5972 5968 #endif
  5969 + {
  5970 + int print_port = 0;
  5971 +
  5972 + if (vnc_display == NULL) {
  5973 + vnc_display = "localhost:0,to=99";
  5974 + print_port = 1;
5973 5975 }
  5976 +
  5977 + vnc_display_init(ds);
  5978 + if (vnc_display_open(ds, vnc_display) < 0)
  5979 + exit(1);
  5980 +
  5981 + if (print_port) {
  5982 + printf("VNC server running on `%s'\n", vnc_display_local_addr(ds));
  5983 + }
  5984 + }
5974 5985 }
5975 5986 dpy_resize(ds);
5976 5987  
... ...
... ... @@ -86,7 +86,6 @@ char *vnc_socket_local_addr(const char *format, int fd) {
86 86 return addr_to_string(format, &sa, salen);
87 87 }
88 88  
89   -
90 89 char *vnc_socket_remote_addr(const char *format, int fd) {
91 90 struct sockaddr_storage sa;
92 91 socklen_t salen;
... ... @@ -2101,6 +2100,13 @@ int vnc_display_password(DisplayState *ds, const char *password)
2101 2100 return 0;
2102 2101 }
2103 2102  
  2103 +char *vnc_display_local_addr(DisplayState *ds)
  2104 +{
  2105 + VncDisplay *vs = ds ? (VncDisplay *)ds->opaque : vnc_display;
  2106 +
  2107 + return vnc_socket_local_addr("%s:%s", vs->lsock);
  2108 +}
  2109 +
2104 2110 int vnc_display_open(DisplayState *ds, const char *display)
2105 2111 {
2106 2112 VncDisplay *vs = ds ? (VncDisplay *)ds->opaque : vnc_display;
... ...