From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:43127) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QKWlK-0002Ge-A6 for qemu-devel@nongnu.org; Thu, 12 May 2011 10:21:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QKWlF-0006gg-WC for qemu-devel@nongnu.org; Thu, 12 May 2011 10:21:10 -0400 Received: from isrv.corpit.ru ([86.62.121.231]:41534) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QKWlF-0006gc-Ob for qemu-devel@nongnu.org; Thu, 12 May 2011 10:21:05 -0400 Message-ID: <4DCBECCF.7010305@msgid.tls.msk.ru> Date: Thu, 12 May 2011 18:21:03 +0400 From: Michael Tokarev MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [PATCH] set $SDL_VIDEODRIVER=x11 on Linux to prevent sudo kvm from fighting for video card List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 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 Acked-by: Alexander Graf --- 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