From patchwork Sat May 7 21:18:30 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 94514 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 6DAFFB7160 for ; Sun, 8 May 2011 07:20:27 +1000 (EST) Received: from localhost ([::1]:42960 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QIovH-0002oM-E8 for incoming@patchwork.ozlabs.org; Sat, 07 May 2011 17:20:23 -0400 Received: from eggs.gnu.org ([140.186.70.92]:39130) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QIovA-0002o1-83 for qemu-devel@nongnu.org; Sat, 07 May 2011 17:20:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QIov9-0003J0-4m for qemu-devel@nongnu.org; Sat, 07 May 2011 17:20:16 -0400 Received: from isrv.corpit.ru ([86.62.121.231]:41120) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QIov8-0003Et-TX for qemu-devel@nongnu.org; Sat, 07 May 2011 17:20:15 -0400 Received: from gandalf.tls.msk.ru (mjt.vpn.tls.msk.ru [192.168.177.99]) by isrv.corpit.ru (Postfix) with ESMTP id 00799A08A6; Sun, 8 May 2011 01:17:14 +0400 (MSD) Received: by gandalf.tls.msk.ru (Postfix, from userid 1000) id 7708913393; Sun, 8 May 2011 01:20:02 +0400 (MSD) From: Michael Tokarev Date: Sun, 8 May 2011 01:18:30 +0400 To: qemu-devel@nongnu.org Message-Id: <20110507212002.7708913393@gandalf.tls.msk.ru> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 86.62.121.231 Subject: [Qemu-devel] [PATCH] set $SDL_VIDEODRIVER=x11 on Linux to prevent sudo kvm from fighting for video card X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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. */