All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH resend] sdl: Reverse support for video mode setting
@ 2013-09-04  9:07 Lei Li
  2013-10-24 12:21 ` Lei Li
  0 siblings, 1 reply; 5+ messages in thread
From: Lei Li @ 2013-09-04  9:07 UTC (permalink / raw)
  To: qemu-devel; +Cc: Lei Li, anthony

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 <sascha@srlabs.de>
Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com>
---
 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,
-- 
1.7.7.6

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH resend] sdl: Reverse support for video mode setting
  2013-09-04  9:07 [Qemu-devel] [PATCH resend] sdl: Reverse support for video mode setting Lei Li
@ 2013-10-24 12:21 ` Lei Li
  2013-11-06 13:31   ` Lei Li
  0 siblings, 1 reply; 5+ messages in thread
From: Lei Li @ 2013-10-24 12:21 UTC (permalink / raw)
  To: qemu-devel; +Cc: sascha, Anthony Liguori, 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...

On 09/04/2013 05:07 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 <sascha@srlabs.de>
> Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com>
> ---
>   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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH resend] sdl: Reverse support for video mode setting
  2013-10-24 12:21 ` Lei Li
@ 2013-11-06 13:31   ` Lei Li
  2013-11-06 14:16     ` [Qemu-devel] [PATCH resend 1.7] " Paolo Bonzini
  0 siblings, 1 reply; 5+ messages in thread
From: Lei Li @ 2013-11-06 13:31 UTC (permalink / raw)
  To: qemu-devel; +Cc: sascha, Anthony Liguori, Lei Li

Ping^2

On 10/24/2013 08:21 PM, Lei Li wrote:
> 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...
>
> On 09/04/2013 05:07 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 <sascha@srlabs.de>
>> Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com>
>> ---
>>   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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH resend 1.7] sdl: Reverse support for video mode setting
  2013-11-06 13:31   ` Lei Li
@ 2013-11-06 14:16     ` Paolo Bonzini
  0 siblings, 0 replies; 5+ messages in thread
From: Paolo Bonzini @ 2013-11-06 14:16 UTC (permalink / raw)
  To: Lei Li; +Cc: qemu-devel, Anthony Liguori, sascha

Il 06/11/2013 14:31, Lei Li ha scritto:
> Ping^2
> 
> On 10/24/2013 08:21 PM, Lei Li wrote:
>> 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...
>>
>> On 09/04/2013 05:07 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 <sascha@srlabs.de>
>>> Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com>
>>> ---
>>>   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,
>>
>>
> 
> 

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Qemu-devel] [PATCH resend] sdl: Reverse support for video mode setting
@ 2013-09-25 14:40 Lei Li
  0 siblings, 0 replies; 5+ messages in thread
From: Lei Li @ 2013-09-25 14:40 UTC (permalink / raw)
  To: qemu-devel; +Cc: Lei Li, anthony

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 <sascha@srlabs.de>
Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com>
---
 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,
-- 
1.7.7.6

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-11-06 14:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-04  9:07 [Qemu-devel] [PATCH resend] sdl: Reverse support for video mode setting Lei Li
2013-10-24 12:21 ` Lei Li
2013-11-06 13:31   ` Lei Li
2013-11-06 14:16     ` [Qemu-devel] [PATCH resend 1.7] " Paolo Bonzini
2013-09-25 14:40 [Qemu-devel] [PATCH resend] " Lei Li

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.