From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefano Stabellini Subject: [PATCH] Fixing Bug 1194: Fallback to SDL if GLX fails Date: Fri, 28 Mar 2008 10:33:49 +0000 Message-ID: <47ECC98D.4060508@eu.citrix.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------010100040700070801070600" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org This is a multi-part message in MIME format. --------------010100040700070801070600 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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 --------------010100040700070801070600 Content-Type: text/x-diff; name="opengl-disable.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="opengl-disable.patch" 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) { --------------010100040700070801070600 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --------------010100040700070801070600--