qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] sdl: improve error message on fatal error
@ 2010-03-08 12:07 Bjørn Mork
  2010-03-08 19:50 ` Stefan Weil
  2010-03-17 15:59 ` Anthony Liguori
  0 siblings, 2 replies; 3+ messages in thread
From: Bjørn Mork @ 2010-03-08 12:07 UTC (permalink / raw)
  To: qemu-devel; +Cc: Bjørn Mork

The SDL_SetVideoMode() error condition is easily triggered by a user by
simply configure a guest with a host unsupported display resolution
and attempting to enable fullscreen.  Since the error is fatal, adding
a bit of debugging help can't harm.

Sample output with this change:

 (qemu) Could not open SDL display (1280x1024x32): No video mode large enough for 1280x1024

The width x height might seem redundant as SDL also provides it in
SDL_GetError(), but I believe there are situations where it is
useful.  I.e. if there is some other SDL error.  Anyway, redundant
information in fatal error messages has never harmed a single gerbil.

Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
 sdl.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/sdl.c b/sdl.c
index f26035c..34061c0 100644
--- a/sdl.c
+++ b/sdl.c
@@ -112,7 +112,8 @@ static void do_sdl_resize(int new_width, int new_height, int bpp)
     height = new_height;
     real_screen = SDL_SetVideoMode(width, height, bpp, flags);
     if (!real_screen) {
-        fprintf(stderr, "Could not open SDL display\n");
+	fprintf(stderr, "Could not open SDL display (%dx%dx%d): %s\n", width, 
+		height, bpp, SDL_GetError());
         exit(1);
     }
 }
-- 
1.5.6.5

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

* Re: [Qemu-devel] [PATCH] sdl: improve error message on fatal error
  2010-03-08 12:07 [Qemu-devel] [PATCH] sdl: improve error message on fatal error Bjørn Mork
@ 2010-03-08 19:50 ` Stefan Weil
  2010-03-17 15:59 ` Anthony Liguori
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Weil @ 2010-03-08 19:50 UTC (permalink / raw)
  To: Bjørn Mork; +Cc: qemu-devel

Bjørn Mork schrieb:
> The SDL_SetVideoMode() error condition is easily triggered by a user by
> simply configure a guest with a host unsupported display resolution
> and attempting to enable fullscreen. Since the error is fatal, adding
> a bit of debugging help can't harm.
>
> Sample output with this change:
>
> (qemu) Could not open SDL display (1280x1024x32): No video mode large
> enough for 1280x1024
>
> The width x height might seem redundant as SDL also provides it in
> SDL_GetError(), but I believe there are situations where it is
> useful. I.e. if there is some other SDL error. Anyway, redundant
> information in fatal error messages has never harmed a single gerbil.
>
> Signed-off-by: Bjørn Mork <bjorn@mork.no>
> ---
> sdl.c | 3 ++-
> 1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/sdl.c b/sdl.c
> index f26035c..34061c0 100644
> --- a/sdl.c
> +++ b/sdl.c
> @@ -112,7 +112,8 @@ static void do_sdl_resize(int new_width, int
> new_height, int bpp)
> height = new_height;
> real_screen = SDL_SetVideoMode(width, height, bpp, flags);
> if (!real_screen) {
> - fprintf(stderr, "Could not open SDL display\n");
> + fprintf(stderr, "Could not open SDL display (%dx%dx%d): %s\n", width,
> + height, bpp, SDL_GetError());
> exit(1);
> }
> }

Yesterday I stumbled across this problem, too:

QEMU was running a guest with 1024x768 resolution on a netbook
(which has a lower physical resolution).

Switching to fullscreen mode results in "Could not open SDL display\n"
and QEMU terminates which is not good.

The message is wrong because the SDL display was already opened:
"Could not set SDL video mode (%dx%dx%d): %s\n" would be better.

It would be even better if QEMU did not try to switch to an
unsupported video mode. It could either
(a) refuse an unsupported fullscreen mode (stay in window mode) or
(b) scale the display so it fits in the largest supported mode

Of course, as a first step an improved error message would help
a little, too.

Regards,
Stefan

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

* Re: [Qemu-devel] [PATCH] sdl: improve error message on fatal error
  2010-03-08 12:07 [Qemu-devel] [PATCH] sdl: improve error message on fatal error Bjørn Mork
  2010-03-08 19:50 ` Stefan Weil
@ 2010-03-17 15:59 ` Anthony Liguori
  1 sibling, 0 replies; 3+ messages in thread
From: Anthony Liguori @ 2010-03-17 15:59 UTC (permalink / raw)
  To: Bjørn Mork; +Cc: qemu-devel

On 03/08/2010 06:07 AM, Bjørn Mork wrote:
> The SDL_SetVideoMode() error condition is easily triggered by a user by
> simply configure a guest with a host unsupported display resolution
> and attempting to enable fullscreen.  Since the error is fatal, adding
> a bit of debugging help can't harm.
>
> Sample output with this change:
>
>   (qemu) Could not open SDL display (1280x1024x32): No video mode large enough for 1280x1024
>
> The width x height might seem redundant as SDL also provides it in
> SDL_GetError(), but I believe there are situations where it is
> useful.  I.e. if there is some other SDL error.  Anyway, redundant
> information in fatal error messages has never harmed a single gerbil.
>
> Signed-off-by: Bjørn Mork<bjorn@mork.no>
>    
Applied.  Thanks.

Regards,

Anthony Liguori
> ---
>   sdl.c |    3 ++-
>   1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/sdl.c b/sdl.c
> index f26035c..34061c0 100644
> --- a/sdl.c
> +++ b/sdl.c
> @@ -112,7 +112,8 @@ static void do_sdl_resize(int new_width, int new_height, int bpp)
>       height = new_height;
>       real_screen = SDL_SetVideoMode(width, height, bpp, flags);
>       if (!real_screen) {
> -        fprintf(stderr, "Could not open SDL display\n");
> +	fprintf(stderr, "Could not open SDL display (%dx%dx%d): %s\n", width,
> +		height, bpp, SDL_GetError());
>           exit(1);
>       }
>   }
>    

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

end of thread, other threads:[~2010-03-17 15:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-08 12:07 [Qemu-devel] [PATCH] sdl: improve error message on fatal error Bjørn Mork
2010-03-08 19:50 ` Stefan Weil
2010-03-17 15:59 ` Anthony Liguori

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).