* [PATCH 1/2] qemu: add option to disable X grabs
@ 2013-09-18 16:48 Ross Burton
2013-09-18 16:48 ` [PATCH 2/2] qemurunner: disable grabs in automated testing Ross Burton
2013-09-18 20:28 ` [PATCH 1/2] qemu: add option to disable X grabs Eric Bénard
0 siblings, 2 replies; 5+ messages in thread
From: Ross Burton @ 2013-09-18 16:48 UTC (permalink / raw)
To: openembedded-core
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.
Signed-off-by: Ross Burton <ross.burton@intel.com>
---
.../qemu/files/disable-grabs.patch | 69 ++++++++++++++++++++
meta/recipes-devtools/qemu/qemu.inc | 1 +
2 files changed, 70 insertions(+)
create mode 100644 meta/recipes-devtools/qemu/files/disable-grabs.patch
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 0000000..0e82cc8
--- /dev/null
+++ b/meta/recipes-devtools/qemu/files/disable-grabs.patch
@@ -0,0 +1,69 @@
+When the pointer enters the Qemu window it calls SDL_WM_GrabInput, which calls
+XGrabPointer in a busyloop until it returns GrabSuccess. However if there's already
+a pointer grab (screen is locked, a menu is open) then qemu will hang until the
+grab can be taken. In the specific case of a headless X server on an autobuilder, once
+the screensaver has kicked in any qemu instance that appears underneath the
+pointer will hang.
+
+I'm not entirely sure why pointer grabs are required (the documentation
+explicitly says it doesn't do grabs when using a tablet, which we are) so wrap
+them in a conditional that can be set by the autobuilder environment, preserving
+the current grabbing behaviour for everyone else.
+
+Upstream-Status: Pending
+Signed-off-by: Ross Burton <ross.burton@intel.com>
+
+
+From 4b1988ecb01a178269ec0513a75f2ec620c7ef6a Mon Sep 17 00:00:00 2001
+From: Ross Burton <ross.burton@intel.com>
+Date: Wed, 18 Sep 2013 14:04:54 +0100
+Subject: [PATCH] sdl.c: allow user to disable pointer grabs
+
+Signed-off-by: Ross Burton <ross.burton@intel.com>
+---
+ ui/sdl.c | 9 +++++++--
+ 1 file changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/ui/sdl.c b/ui/sdl.c
+index 39a42d6..6095aa6 100644
+--- a/ui/sdl.c
++++ b/ui/sdl.c
+@@ -59,6 +59,7 @@ static SDL_Cursor *guest_sprite = NULL;
+ static SDL_PixelFormat host_format;
+ static int scaling_active = 0;
+ static Notifier mouse_mode_notifier;
++static doing_grabs = True;
+
+ static void sdl_update(DisplayChangeListener *dcl,
+ int x, int y, int w, int h)
+@@ -384,14 +385,16 @@ static void sdl_grab_start(void)
+ SDL_WarpMouse(guest_x, guest_y);
+ } else
+ sdl_hide_cursor();
+- SDL_WM_GrabInput(SDL_GRAB_ON);
++ if (doing_grabs)
++ SDL_WM_GrabInput(SDL_GRAB_ON);
+ gui_grab = 1;
+ sdl_update_caption();
+ }
+
+ static void sdl_grab_end(void)
+ {
+- SDL_WM_GrabInput(SDL_GRAB_OFF);
++ if (doing_grabs)
++ SDL_WM_GrabInput(SDL_GRAB_OFF);
+ gui_grab = 0;
+ sdl_show_cursor();
+ sdl_update_caption();
+@@ -909,7 +912,8 @@ void sdl_display_init(DisplayState *ds, int full_screen, int no_frame)
+ * This requires SDL >= 1.2.14. */
+ setenv("SDL_DISABLE_LOCK_KEYS", "1", 1);
+
++ doing_grabs = (getenv("QEMU_DONT_GRAB") == NULL);
++
+ flags = SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE;
+ if (SDL_Init (flags)) {
+ fprintf(stderr, "Could not initialize SDL(%s) - exiting\n",
+--
+1.7.10.4
+
diff --git a/meta/recipes-devtools/qemu/qemu.inc b/meta/recipes-devtools/qemu/qemu.inc
index 97e9b7b..1b861d7 100644
--- a/meta/recipes-devtools/qemu/qemu.inc
+++ b/meta/recipes-devtools/qemu/qemu.inc
@@ -17,6 +17,7 @@ SRC_URI = "\
file://powerpc_rom.bin \
file://no-strip.patch \
file://larger_default_ram_size.patch \
+ file://disable-grabs.patch \
"
SRC_URI_append_class-nativesdk = "\
--
1.7.10.4
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 2/2] qemurunner: disable grabs in automated testing
2013-09-18 16:48 [PATCH 1/2] qemu: add option to disable X grabs Ross Burton
@ 2013-09-18 16:48 ` Ross Burton
2013-09-18 20:28 ` [PATCH 1/2] qemu: add option to disable X grabs Eric Bénard
1 sibling, 0 replies; 5+ messages in thread
From: Ross Burton @ 2013-09-18 16:48 UTC (permalink / raw)
To: openembedded-core
Use the new QEMU_DONT_GRAB environment variable to disable grabs,
finally/hopefully solving the random hangs that the autobuilder has been hitting
for a while.
[ YOCTO #5131 ]
Signed-off-by: Ross Burton <ross.burton@intel.com>
---
meta/lib/oeqa/utils/qemurunner.py | 3 +++
1 file changed, 3 insertions(+)
diff --git a/meta/lib/oeqa/utils/qemurunner.py b/meta/lib/oeqa/utils/qemurunner.py
index d362ede..256cf3c 100644
--- a/meta/lib/oeqa/utils/qemurunner.py
+++ b/meta/lib/oeqa/utils/qemurunner.py
@@ -78,6 +78,9 @@ class QemuRunner:
else:
os.environ["DEPLOY_DIR_IMAGE"] = self.deploy_dir_image
+ # Set this flag so that Qemu doesn't do any grabs as SDL grabs interact
+ # badly with screensavers.
+ os.environ["QEMU_DONT_GRAB"] = "1"
self.qemuparams = 'bootparams="console=tty1 console=ttyS0,115200n8" qemuparams="-serial tcp:127.0.0.1:%s"' % self.serverport
if qemuparams:
self.qemuparams = self.qemuparams[:-1] + " " + qemuparams + " " + '\"'
--
1.7.10.4
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH 1/2] qemu: add option to disable X grabs
2013-09-18 16:48 [PATCH 1/2] qemu: add option to disable X grabs Ross Burton
2013-09-18 16:48 ` [PATCH 2/2] qemurunner: disable grabs in automated testing Ross Burton
@ 2013-09-18 20:28 ` Eric Bénard
2013-09-18 21:16 ` Richard Purdie
1 sibling, 1 reply; 5+ messages in thread
From: Eric Bénard @ 2013-09-18 20:28 UTC (permalink / raw)
To: Ross Burton; +Cc: openembedded-core
Hi Ross,
Le Wed, 18 Sep 2013 17:48:45 +0100,
Ross Burton <ross.burton@intel.com> a écrit :
> diff --git a/meta/recipes-devtools/qemu/qemu.inc b/meta/recipes-devtools/qemu/qemu.inc
> index 97e9b7b..1b861d7 100644
> --- a/meta/recipes-devtools/qemu/qemu.inc
> +++ b/meta/recipes-devtools/qemu/qemu.inc
> @@ -17,6 +17,7 @@ SRC_URI = "\
> file://powerpc_rom.bin \
> file://no-strip.patch \
> file://larger_default_ram_size.patch \
> + file://disable-grabs.patch \
> "
>
> SRC_URI_append_class-nativesdk = "\
that seems to break the build here (while building meta-toolchain-qte) :
ERROR: Command Error: exit status: 1 Output:
Applying patch disable-grabs.patch
patching file ui/sdl.c
Hunk #3 FAILED at 912.
1 out of 3 hunks FAILED -- rejects in file ui/sdl.c
Patch disable-grabs.patch does not apply (enforce with -f)
ERROR: Function failed: patch_do_patch
ERROR: Logfile of failure stored
in: /scratch/eb/eukrea2/master/setup-scripts/build/tmp-defaultsetup-eglibc-eglibc/work/i686-nativesdk-oesdk-linux/nativesdk-qemu/1.5.0-r0/temp/log.do_patch.14821
ERROR: Task 2313
(virtual:nativesdk:/scratch/eb/eukrea2/master/setup-scripts/sources/openembedded-core/meta/recipes-devtools/qemu/qemu_1.5.0.bb,
do_patch) failed with exit code '1'
Eric
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] qemu: add option to disable X grabs
2013-09-18 20:28 ` [PATCH 1/2] qemu: add option to disable X grabs Eric Bénard
@ 2013-09-18 21:16 ` Richard Purdie
2013-09-18 21:40 ` Burton, Ross
0 siblings, 1 reply; 5+ messages in thread
From: Richard Purdie @ 2013-09-18 21:16 UTC (permalink / raw)
To: Eric Bénard; +Cc: openembedded-core
On Wed, 2013-09-18 at 22:28 +0200, Eric Bénard wrote:
> Hi Ross,
>
> Le Wed, 18 Sep 2013 17:48:45 +0100,
> Ross Burton <ross.burton@intel.com> a écrit :
> > diff --git a/meta/recipes-devtools/qemu/qemu.inc b/meta/recipes-devtools/qemu/qemu.inc
> > index 97e9b7b..1b861d7 100644
> > --- a/meta/recipes-devtools/qemu/qemu.inc
> > +++ b/meta/recipes-devtools/qemu/qemu.inc
> > @@ -17,6 +17,7 @@ SRC_URI = "\
> > file://powerpc_rom.bin \
> > file://no-strip.patch \
> > file://larger_default_ram_size.patch \
> > + file://disable-grabs.patch \
> > "
> >
> > SRC_URI_append_class-nativesdk = "\
>
> that seems to break the build here (while building meta-toolchain-qte) :
> ERROR: Command Error: exit status: 1 Output:
> Applying patch disable-grabs.patch
> patching file ui/sdl.c
> Hunk #3 FAILED at 912.
> 1 out of 3 hunks FAILED -- rejects in file ui/sdl.c
> Patch disable-grabs.patch does not apply (enforce with -f)
> ERROR: Function failed: patch_do_patch
> ERROR: Logfile of failure stored
> in: /scratch/eb/eukrea2/master/setup-scripts/build/tmp-defaultsetup-eglibc-eglibc/work/i686-nativesdk-oesdk-linux/nativesdk-qemu/1.5.0-r0/temp/log.do_patch.14821
> ERROR: Task 2313
> (virtual:nativesdk:/scratch/eb/eukrea2/master/setup-scripts/sources/openembedded-core/meta/recipes-devtools/qemu/qemu_1.5.0.bb,
> do_patch) failed with exit code '1'
Thanks for the report. I looked into it and somehow the patch was
corrupted. I've pushed a fix in.
Cheers,
Richard
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] qemu: add option to disable X grabs
2013-09-18 21:16 ` Richard Purdie
@ 2013-09-18 21:40 ` Burton, Ross
0 siblings, 0 replies; 5+ messages in thread
From: Burton, Ross @ 2013-09-18 21:40 UTC (permalink / raw)
To: Richard Purdie; +Cc: OE-core
On 18 September 2013 22:16, Richard Purdie
<richard.purdie@linuxfoundation.org> wrote:
> Thanks for the report. I looked into it and somehow the patch was
> corrupted. I've pushed a fix in.
There was a typo in my patch and instead of re-generating it I did the
transposition in emacs, which presumably decided to be "clever" and
re-write the patch headers incorrectly. Thanks, emacs!
Sorry about that,
Ross
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-09-18 21:40 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-18 16:48 [PATCH 1/2] qemu: add option to disable X grabs Ross Burton
2013-09-18 16:48 ` [PATCH 2/2] qemurunner: disable grabs in automated testing Ross Burton
2013-09-18 20:28 ` [PATCH 1/2] qemu: add option to disable X grabs Eric Bénard
2013-09-18 21:16 ` Richard Purdie
2013-09-18 21:40 ` Burton, Ross
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox