qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] set $SDL_VIDEODRIVER=x11 on Linux to prevent sudo kvm from fighting for video card
@ 2011-05-07 21:18 Michael Tokarev
  2011-05-07 21:23 ` Alexander Graf
  2011-05-14 23:05 ` Aurelien Jarno
  0 siblings, 2 replies; 4+ messages in thread
From: Michael Tokarev @ 2011-05-07 21:18 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 ui/sdl.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/ui/sdl.c b/ui/sdl.c
index dc5c3a1..14a62d9 100644
--- a/ui/sdl.c
+++ b/ui/sdl.c
@@ -831,6 +831,18 @@ void sdl_display_init(DisplayState *ds, int full_screen, int no_frame)
     if (!full_screen) {
         setenv("SDL_VIDEO_ALLOW_SCREENSAVER", "1", 0);
     }
+#ifdef __linux__
+    /* on Linux, SDL may use fbcon|directfb|svgalib when run without
+     * accessible $DISPLAY to open X11 window.  This is often the case
+     * when qemu is run using sudo.  But in this case, and when actually
+     * run in X11 environment, SDL fights with X11 for the video card,
+     * making current display unavailable, often until reboot.
+     * So make x11 the default SDL video driver if this variable is unset.
+     * This is a bit hackish but saves us from bigger problem.
+     * Maybe it's a good idea to fix this in SDL instead.
+     */
+    setenv("SDL_VIDEODRIVER", "x11", 0);
+#endif
 
     /* Enable normal up/down events for Caps-Lock and Num-Lock keys.
      * This requires SDL >= 1.2.14. */
-- 
1.7.2.5

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

* Re: [Qemu-devel] [PATCH] set $SDL_VIDEODRIVER=x11 on Linux to prevent sudo kvm from fighting for video card
  2011-05-07 21:18 [Qemu-devel] [PATCH] set $SDL_VIDEODRIVER=x11 on Linux to prevent sudo kvm from fighting for video card Michael Tokarev
@ 2011-05-07 21:23 ` Alexander Graf
  2011-05-14 23:05 ` Aurelien Jarno
  1 sibling, 0 replies; 4+ messages in thread
From: Alexander Graf @ 2011-05-07 21:23 UTC (permalink / raw)
  To: Michael Tokarev; +Cc: qemu-devel


On 07.05.2011, at 23:18, Michael Tokarev wrote:

> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>

This has been haunting users ever since I know of qemu. Thanks a lot for writing up the patch!

Acked-by: Alexander Graf <agraf@suse.de>


Alex

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

* [Qemu-devel] [PATCH] set $SDL_VIDEODRIVER=x11 on Linux to prevent sudo kvm from fighting for video card
@ 2011-05-12 14:21 Michael Tokarev
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Tokarev @ 2011-05-12 14:21 UTC (permalink / raw)
  To: qemu-devel

This is a resend of email sent 08.05.2011 01:18.

On Linux, SDL may use fbcon|directfb|svgalib when run without
accessible $DISPLAY to open X11 window.  This is often the case
when qemu is run using sudo.  But in this case, and when actually
run in X11 environment, SDL fights with X11 for the video card,
making current display unavailable, often until reboot.
So make x11 the default SDL video driver if this variable is unset.
This is a bit hackish but saves us from bigger problem.
Maybe it's a good idea to fix this in SDL instead.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Acked-by: Alexander Graf <agraf@suse.de>
---
 ui/sdl.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/ui/sdl.c b/ui/sdl.c
index dc5c3a1..14a62d9 100644
--- a/ui/sdl.c
+++ b/ui/sdl.c
@@ -831,6 +831,18 @@ void sdl_display_init(DisplayState *ds, int full_screen, int no_frame)
     if (!full_screen) {
         setenv("SDL_VIDEO_ALLOW_SCREENSAVER", "1", 0);
     }
+#ifdef __linux__
+    /* on Linux, SDL may use fbcon|directfb|svgalib when run without
+     * accessible $DISPLAY to open X11 window.  This is often the case
+     * when qemu is run using sudo.  But in this case, and when actually
+     * run in X11 environment, SDL fights with X11 for the video card,
+     * making current display unavailable, often until reboot.
+     * So make x11 the default SDL video driver if this variable is unset.
+     * This is a bit hackish but saves us from bigger problem.
+     * Maybe it's a good idea to fix this in SDL instead.
+     */
+    setenv("SDL_VIDEODRIVER", "x11", 0);
+#endif
      /* Enable normal up/down events for Caps-Lock and Num-Lock keys.
      * This requires SDL >= 1.2.14. */
-- 
1.7.2.5

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

* Re: [Qemu-devel] [PATCH] set $SDL_VIDEODRIVER=x11 on Linux to prevent sudo kvm from fighting for video card
  2011-05-07 21:18 [Qemu-devel] [PATCH] set $SDL_VIDEODRIVER=x11 on Linux to prevent sudo kvm from fighting for video card Michael Tokarev
  2011-05-07 21:23 ` Alexander Graf
@ 2011-05-14 23:05 ` Aurelien Jarno
  1 sibling, 0 replies; 4+ messages in thread
From: Aurelien Jarno @ 2011-05-14 23:05 UTC (permalink / raw)
  To: Michael Tokarev; +Cc: qemu-devel

On Sun, May 08, 2011 at 01:18:30AM +0400, Michael Tokarev wrote:
> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
> ---
>  ui/sdl.c |   12 ++++++++++++
>  1 files changed, 12 insertions(+), 0 deletions(-)

Thanks, applied.

> diff --git a/ui/sdl.c b/ui/sdl.c
> index dc5c3a1..14a62d9 100644
> --- a/ui/sdl.c
> +++ b/ui/sdl.c
> @@ -831,6 +831,18 @@ void sdl_display_init(DisplayState *ds, int full_screen, int no_frame)
>      if (!full_screen) {
>          setenv("SDL_VIDEO_ALLOW_SCREENSAVER", "1", 0);
>      }
> +#ifdef __linux__
> +    /* on Linux, SDL may use fbcon|directfb|svgalib when run without
> +     * accessible $DISPLAY to open X11 window.  This is often the case
> +     * when qemu is run using sudo.  But in this case, and when actually
> +     * run in X11 environment, SDL fights with X11 for the video card,
> +     * making current display unavailable, often until reboot.
> +     * So make x11 the default SDL video driver if this variable is unset.
> +     * This is a bit hackish but saves us from bigger problem.
> +     * Maybe it's a good idea to fix this in SDL instead.
> +     */
> +    setenv("SDL_VIDEODRIVER", "x11", 0);
> +#endif
>  
>      /* Enable normal up/down events for Caps-Lock and Num-Lock keys.
>       * This requires SDL >= 1.2.14. */
> -- 
> 1.7.2.5
> 
> 
> 

-- 
Aurelien Jarno                          GPG: 1024D/F1BCDB73
aurelien@aurel32.net                 http://www.aurel32.net

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

end of thread, other threads:[~2011-05-14 23:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-07 21:18 [Qemu-devel] [PATCH] set $SDL_VIDEODRIVER=x11 on Linux to prevent sudo kvm from fighting for video card Michael Tokarev
2011-05-07 21:23 ` Alexander Graf
2011-05-14 23:05 ` Aurelien Jarno
  -- strict thread matches above, loose matches on Subject: below --
2011-05-12 14:21 Michael Tokarev

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).