From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46250) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VFKdw-0007p6-NM for qemu-devel@nongnu.org; Fri, 30 Aug 2013 05:05:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VFKdp-0004sl-2r for qemu-devel@nongnu.org; Fri, 30 Aug 2013 05:05:24 -0400 Received: from e28smtp06.in.ibm.com ([122.248.162.6]:49613) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VFKdo-0004s0-Bb for qemu-devel@nongnu.org; Fri, 30 Aug 2013 05:05:17 -0400 Received: from /spool/local by e28smtp06.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 30 Aug 2013 14:25:18 +0530 Received: from d28relay03.in.ibm.com (d28relay03.in.ibm.com [9.184.220.60]) by d28dlp02.in.ibm.com (Postfix) with ESMTP id 635E8394004E for ; Fri, 30 Aug 2013 14:34:55 +0530 (IST) Received: from d28av05.in.ibm.com (d28av05.in.ibm.com [9.184.220.67]) by d28relay03.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r7U96kx143515934 for ; Fri, 30 Aug 2013 14:36:46 +0530 Received: from d28av05.in.ibm.com (localhost [127.0.0.1]) by d28av05.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id r7U954Qe003789 for ; Fri, 30 Aug 2013 14:35:05 +0530 Message-ID: <52205FF2.2030605@linux.vnet.ibm.com> Date: Fri, 30 Aug 2013 17:03:46 +0800 From: Lei Li MIME-Version: 1.0 References: <1377600914-21259-1-git-send-email-lilei@linux.vnet.ibm.com> In-Reply-To: <1377600914-21259-1-git-send-email-lilei@linux.vnet.ibm.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] sdl: Reverse support for video mode setting List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: sascha@srlabs.de, Anthony Liguori , Lei Li Any comments? On 08/27/2013 06:55 PM, Lei Li wrote: > Currently, If the setting of video mode failed, qemu will exit. It > should go back to the previous setting if the new screen resolution > failed. This patch fixes LP#1216368, add support to revert to existing > surface for the failure of video mode setting. > > Reported-by: Sascha Krissler > Signed-off-by: Lei Li > --- > ui/sdl.c | 23 +++++++++++++++++++---- > 1 files changed, 19 insertions(+), 4 deletions(-) > > diff --git a/ui/sdl.c b/ui/sdl.c > index 39a42d6..9d8583c 100644 > --- a/ui/sdl.c > +++ b/ui/sdl.c > @@ -86,6 +86,7 @@ static void sdl_update(DisplayChangeListener *dcl, > static void do_sdl_resize(int width, int height, int bpp) > { > int flags; > + SDL_Surface *tmp_screen; > > // printf("resizing to %d %d\n", w, h); > > @@ -98,12 +99,26 @@ static void do_sdl_resize(int width, int height, int bpp) > if (gui_noframe) > flags |= SDL_NOFRAME; > > - real_screen = SDL_SetVideoMode(width, height, bpp, flags); > + tmp_screen = SDL_SetVideoMode(width, height, bpp, flags); > if (!real_screen) { > - fprintf(stderr, "Could not open SDL display (%dx%dx%d): %s\n", width, > - height, bpp, SDL_GetError()); > - exit(1); > + if (!tmp_screen) { > + fprintf(stderr, "Could not open SDL display (%dx%dx%d): %s\n", > + width, height, bpp, SDL_GetError()); > + exit(1); > + } > + } else { > + /* > + * Revert to the previous video mode if the change of resizing or > + * resolution failed. > + */ > + if (!tmp_screen) { > + fprintf(stderr, "Failed to set SDL display (%dx%dx%d): %s\n", > + width, height, bpp, SDL_GetError()); > + return; > + } > } > + > + real_screen = tmp_screen; > } > > static void sdl_switch(DisplayChangeListener *dcl, -- Lei