summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@intel.com>2013-09-18 17:48:45 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-09-18 17:52:04 +0100
commitdd2b2f93a99206e2b33b9a971b107dee0ffe4f54 (patch)
treed0d0df5ee972232283239d3bbf67271a8e85b756
parent63cd03b80c3eb5b4b88774e44a4ed2cf0905f094 (diff)
downloadpoky-dd2b2f93a99206e2b33b9a971b107dee0ffe4f54.tar.gz
qemu: add option to disable X grabs
When the mouse pointer enters the qemu window it takes a pointer grab. This doesn't sound too dangerous at first but it turns out that SDL will infinitely busy-loop if it can't get the grab (e.g. if the screen is locked) and the average autobuilder setup's X server will have locked the screen a few minutes after boot. The result is that on many autobuilders apparently random qemu instances (the top-most one under the pointer) will hang during boot. To resolve this add an option (via an environment variable) to never attempt a grab. The default behaviour remains to grab so that everyone else doesn't see any change. (From OE-Core rev: a60b1ebbb8f81245f3ccf25b3f9d63677de75b85) Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-devtools/qemu/files/disable-grabs.patch69
-rw-r--r--meta/recipes-devtools/qemu/qemu.inc1
2 files changed, 70 insertions, 0 deletions
diff --git a/meta/recipes-devtools/qemu/files/disable-grabs.patch b/meta/recipes-devtools/qemu/files/disable-grabs.patch
new file mode 100644
index 0000000000..0e82cc8688
--- /dev/null
+++ b/meta/recipes-devtools/qemu/files/disable-grabs.patch
@@ -0,0 +1,69 @@
1When the pointer enters the Qemu window it calls SDL_WM_GrabInput, which calls
2XGrabPointer in a busyloop until it returns GrabSuccess. However if there's already
3a pointer grab (screen is locked, a menu is open) then qemu will hang until the
4grab can be taken. In the specific case of a headless X server on an autobuilder, once
5the screensaver has kicked in any qemu instance that appears underneath the
6pointer will hang.
7
8I'm not entirely sure why pointer grabs are required (the documentation
9explicitly says it doesn't do grabs when using a tablet, which we are) so wrap
10them in a conditional that can be set by the autobuilder environment, preserving
11the current grabbing behaviour for everyone else.
12
13Upstream-Status: Pending
14Signed-off-by: Ross Burton <ross.burton@intel.com>
15
16
17From 4b1988ecb01a178269ec0513a75f2ec620c7ef6a Mon Sep 17 00:00:00 2001
18From: Ross Burton <ross.burton@intel.com>
19Date: Wed, 18 Sep 2013 14:04:54 +0100
20Subject: [PATCH] sdl.c: allow user to disable pointer grabs
21
22Signed-off-by: Ross Burton <ross.burton@intel.com>
23---
24 ui/sdl.c | 9 +++++++--
25 1 file changed, 7 insertions(+), 2 deletions(-)
26
27diff --git a/ui/sdl.c b/ui/sdl.c
28index 39a42d6..6095aa6 100644
29--- a/ui/sdl.c
30+++ b/ui/sdl.c
31@@ -59,6 +59,7 @@ static SDL_Cursor *guest_sprite = NULL;
32 static SDL_PixelFormat host_format;
33 static int scaling_active = 0;
34 static Notifier mouse_mode_notifier;
35+static doing_grabs = True;
36
37 static void sdl_update(DisplayChangeListener *dcl,
38 int x, int y, int w, int h)
39@@ -384,14 +385,16 @@ static void sdl_grab_start(void)
40 SDL_WarpMouse(guest_x, guest_y);
41 } else
42 sdl_hide_cursor();
43- SDL_WM_GrabInput(SDL_GRAB_ON);
44+ if (doing_grabs)
45+ SDL_WM_GrabInput(SDL_GRAB_ON);
46 gui_grab = 1;
47 sdl_update_caption();
48 }
49
50 static void sdl_grab_end(void)
51 {
52- SDL_WM_GrabInput(SDL_GRAB_OFF);
53+ if (doing_grabs)
54+ SDL_WM_GrabInput(SDL_GRAB_OFF);
55 gui_grab = 0;
56 sdl_show_cursor();
57 sdl_update_caption();
58@@ -909,7 +912,8 @@ void sdl_display_init(DisplayState *ds, int full_screen, int no_frame)
59 * This requires SDL >= 1.2.14. */
60 setenv("SDL_DISABLE_LOCK_KEYS", "1", 1);
61
62+ doing_grabs = (getenv("QEMU_DONT_GRAB") == NULL);
63+
64 flags = SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE;
65 if (SDL_Init (flags)) {
66 fprintf(stderr, "Could not initialize SDL(%s) - exiting\n",
67--
681.7.10.4
69
diff --git a/meta/recipes-devtools/qemu/qemu.inc b/meta/recipes-devtools/qemu/qemu.inc
index 97e9b7be1c..1b861d7dc9 100644
--- a/meta/recipes-devtools/qemu/qemu.inc
+++ b/meta/recipes-devtools/qemu/qemu.inc
@@ -17,6 +17,7 @@ SRC_URI = "\
17 file://powerpc_rom.bin \ 17 file://powerpc_rom.bin \
18 file://no-strip.patch \ 18 file://no-strip.patch \
19 file://larger_default_ram_size.patch \ 19 file://larger_default_ram_size.patch \
20 file://disable-grabs.patch \
20 " 21 "
21 22
22SRC_URI_append_class-nativesdk = "\ 23SRC_URI_append_class-nativesdk = "\