ia64/xen-unstable

changeset 17346:abae878a65f4

ioemu: Fall back to SDL rendering when GLX fails.

From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Fri Mar 28 11:15:43 2008 +0000 (2008-03-28)
parents 50efc4b3ffdb
children d686808b3169
files tools/ioemu/sdl.c
line diff
     1.1 --- a/tools/ioemu/sdl.c	Fri Mar 28 09:50:50 2008 +0000
     1.2 +++ b/tools/ioemu/sdl.c	Fri Mar 28 11:15:43 2008 +0000
     1.3 @@ -210,21 +210,32 @@ static void sdl_resize(DisplayState *ds,
     1.4  
     1.5   again:
     1.6      screen = SDL_SetVideoMode(w, h, 0, flags);
     1.7 -#ifndef CONFIG_OPENGL
     1.8 +
     1.9      if (!screen) {
    1.10          fprintf(stderr, "Could not open SDL display: %s\n", SDL_GetError());
    1.11 +        if (opengl_enabled) {
    1.12 +            /* Fallback to SDL */
    1.13 +            opengl_enabled = 0;
    1.14 +            ds->dpy_update = sdl_update;
    1.15 +            ds->dpy_setdata = sdl_setdata;
    1.16 +            sdl_resize(ds, w, h, linesize);
    1.17 +            return;
    1.18 +        }
    1.19          exit(1);
    1.20      }
    1.21 -    if (!screen->pixels && (flags & SDL_HWSURFACE) && (flags & SDL_FULLSCREEN)) {
    1.22 -        flags &= ~SDL_HWSURFACE;
    1.23 -        goto again;
    1.24 +
    1.25 +    if (!opengl_enabled) {
    1.26 +        if (!screen->pixels && (flags & SDL_HWSURFACE) && (flags & SDL_FULLSCREEN)) {
    1.27 +            flags &= ~SDL_HWSURFACE;
    1.28 +            goto again;
    1.29 +        }
    1.30 +
    1.31 +        if (!screen->pixels) {
    1.32 +            fprintf(stderr, "Could not open SDL display: %s\n", SDL_GetError());
    1.33 +            exit(1);
    1.34 +        }
    1.35      }
    1.36  
    1.37 -    if (!screen->pixels) {
    1.38 -        fprintf(stderr, "Could not open SDL display: %s\n", SDL_GetError());
    1.39 -        exit(1);
    1.40 -    }
    1.41 -#endif
    1.42      ds->width = w;
    1.43      ds->height = h;
    1.44      if (!ds->shared_buf) {