Skip to contentSkip to conversation

Fixing Bug 1194: Fallback to SDL if GLX fails

PATCH New Stefano Stabellini 1 participant 1 message Mar 28, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fixing Bug 1194: Fallback to SDL if GLX fails

Hi all,
sorry for the delay fixing this bug.
I am attaching a simple patch that tries to fall back to SDL rendering when GLX fails. Regards,

Stefano Stabellini

tools/ioemu/sdl.c +22 -11
diff -r a819cf758b8c tools/ioemu/sdl.c
@@ -210,21 +210,32 @@ static void sdl_resize(DisplayState *ds,
 
  again:
     screen = SDL_SetVideoMode(w, h, 0, flags);
-#ifndef CONFIG_OPENGL
+
     if (!screen) {
         fprintf(stderr, "Could not open SDL display: %s\n", SDL_GetError());
+        if (opengl_enabled) {
+            /* Fallback to SDL */
+            opengl_enabled = 0;
+            ds->dpy_update = sdl_update;
+            ds->dpy_setdata = sdl_setdata;
+            sdl_resize(ds, w, h, linesize);
+            return;
+        }
         exit(1);
     }
-    if (!screen->pixels && (flags & SDL_HWSURFACE) && (flags & SDL_FULLSCREEN)) {
-        flags &= ~SDL_HWSURFACE;
-        goto again;
-    }
-
-    if (!screen->pixels) {
-        fprintf(stderr, "Could not open SDL display: %s\n", SDL_GetError());
-        exit(1);
-    }
-#endif
+
+    if (!opengl_enabled) {
+        if (!screen->pixels && (flags & SDL_HWSURFACE) && (flags & SDL_FULLSCREEN)) {
+            flags &= ~SDL_HWSURFACE;
+            goto again;
+        }
+
+        if (!screen->pixels) {
+            fprintf(stderr, "Could not open SDL display: %s\n", SDL_GetError());
+            exit(1);
+        }
+    }
+
     ds->width = w;
     ds->height = h;
     if (!ds->shared_buf) {

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel