sdl: Reverse support for video mode setting
PATCH RESEND 1/1 sdl: Reverse support for video mode setting
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.
--- ui/sdl.c | 23 +++++++++++++++++++---- 1 files changed, 19 insertions(+), 4 deletions(-)
ui/sdl.c +19 -4
@@ -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,
Signature · 1 line
1.7.7.6
This patch has been confirmed by the reporter himself as link below,
https://bugs.launchpad.net/qemu/+bug/1216368
It has been on the mailing list for a while, could it be merged? PING...
Quoted 54 lines · Lei Li
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 <[email protected]>Signed-off-by Lei Li <[email protected]>--- ui/sdl.c | 23 +++++++++++++++++++---- 1 files changed, 19 insertions(+), 4 deletions(-)ui/sdl.c +19
-4@@ -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,
Signature · 1 line
Lei
Ping^2
Quoted 69 lines · Lei Li
This patch has been confirmed by the reporter himself as link below,
https://bugs.launchpad.net/qemu/+bug/1216368
It has been on the mailing list for a while, could it be merged? PING...
Quoted 59 lines · Lei Li
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 <[email protected]>Signed-off-by Lei Li <[email protected]>--- ui/sdl.c | 23 +++++++++++++++++++---- 1 files changed, 19 insertions(+), 4 deletions(-)ui/sdl.c +10
-4@@ -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
ui/sdl.c +4
-0+* resolution failed. +*/ +if (!tmp_screen) { + fprintf(stderr, "Failed to set SDL display (%dx%dx%d):%s\n",
ui/sdl.c +5
-0+ width, height, bpp, SDL_GetError()); +return ; + } } + + real_screen = tmp_screen; } static void sdl_switch(DisplayChangeListener *dcl,
Signature · 1 line
Lei
Paolo Bonzini
Reviewed-byIl 06/11/2013 14:31, Lei Li ha scritto:
Quoted 74 lines
Ping^2
Quoted 69 lines · Lei Li
This patch has been confirmed by the reporter himself as link below,
https://bugs.launchpad.net/qemu/+bug/1216368
It has been on the mailing list for a while, could it be merged? PING...
Quoted 59 lines · Lei Li
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 <[email protected]>Signed-off-by Lei Li <[email protected]>--- ui/sdl.c | 23 +++++++++++++++++++---- 1 files changed, 19 insertions(+), 4 deletions(-)ui/sdl.c +10
-4@@ -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
ui/sdl.c +4
-0+* resolution failed. +*/ +if (!tmp_screen) { + fprintf(stderr, "Failed to set SDL display (%dx%dx%d):%s\n",
ui/sdl.c +5
-0+ width, height, bpp, SDL_GetError()); +return ; + } } + + real_screen = tmp_screen; } static void sdl_switch(DisplayChangeListener *dcl,