All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Tokarev <mjt@tls.msk.ru>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] set $SDL_VIDEODRIVER=x11 on Linux to prevent sudo kvm from fighting for video card
Date: Thu, 12 May 2011 18:21:03 +0400	[thread overview]
Message-ID: <4DCBECCF.7010305@msgid.tls.msk.ru> (raw)

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

             reply	other threads:[~2011-05-12 14:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-12 14:21 Michael Tokarev [this message]
  -- strict thread matches above, loose matches on Subject: below --
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4DCBECCF.7010305@msgid.tls.msk.ru \
    --to=mjt@tls.msk.ru \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.