WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] Fixing Bug 1194: Fallback to SDL if GLX fails

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] Fixing Bug 1194: Fallback to SDL if GLX fails
From: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Date: Fri, 28 Mar 2008 10:33:49 +0000
Delivery-date: Fri, 28 Mar 2008 03:35:03 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 2.0.0.6 (X11/20071022)
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
diff -r a819cf758b8c tools/ioemu/sdl.c
--- a/tools/ioemu/sdl.c Thu Mar 27 16:20:25 2008 +0000
+++ b/tools/ioemu/sdl.c Thu Mar 27 18:35:35 2008 +0000
@@ -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
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] Fixing Bug 1194: Fallback to SDL if GLX fails, Stefano Stabellini <=