Fix logspam when trying to free a non-existant grab.

- Update touch patch to upstream version (from fdo #66720)
- re-add xephyr resizable patch, got lost in rebase (#976995)
This commit is contained in:
Peter Hutterer 2013-07-15 10:26:01 +10:00
parent 9dc0b02a88
commit 0e1e01a399
4 changed files with 274 additions and 6 deletions

View File

@ -0,0 +1,49 @@
From af07795a384943723de5c6207d07d5af9fb883db Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer@who-t.net>
Date: Fri, 12 Jul 2013 14:10:10 +1000
Subject: [PATCH] dix: UpdateTouchesForGrab must only free the listener grab if
it is non-NULL
If a client calls XIGrabDevice in response to a ButtonPress event (regular
event selection), the device will have a grab, but listener->grab is NULL.
Check for that, to avoid logspam.
[ 26293.863] (EE) BUG: triggered 'if (!pGrab)'
[ 26293.863] (EE) BUG: grabs.c:256 in FreeGrab()
[ 26293.863] (EE)
[ 26293.863] (EE) Backtrace:
[ 26293.864] (EE) 0: /usr/bin/Xorg (FreeGrab+0x54) [0x45d3fc]
[ 26293.864] (EE) 1: /usr/bin/Xorg (UpdateTouchesForGrab+0x135) [0x447d4e]
[ 26293.864] (EE) 2: /usr/bin/Xorg (ActivatePointerGrab+0x1ba) [0x447f3d]
[ 26293.864] (EE) 3: /usr/bin/Xorg (GrabDevice+0x3e6) [0x4503bc]
[ 26293.864] (EE) 4: /usr/bin/Xorg (ProcXIGrabDevice+0x1f9) [0x5981b1]
[ 26293.865] (EE) 5: /usr/bin/Xorg (ProcIDispatch+0x78) [0x58aa17]
[ 26293.865] (EE) 6: /usr/bin/Xorg (Dispatch+0x30d) [0x43347e]
[ 26293.865] (EE) 7: /usr/bin/Xorg (main+0x61d) [0x498175]
[ 26293.865] (EE) 8: /lib64/libc.so.6 (__libc_start_main+0xf5) [0x3df5621b75]
[ 26293.865] (EE) 9: /usr/bin/Xorg (_start+0x29) [0x423a19]
[ 26293.866] (EE) 10: ? (?+0x29) [0x29]
[ 26293.866] (EE)
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
---
dix/events.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/dix/events.c b/dix/events.c
index 03b2d2e..ed3138d 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -1441,7 +1441,8 @@ UpdateTouchesForGrab(DeviceIntPtr mouse)
listener->type = LISTENER_POINTER_GRAB;
else
listener->type = LISTENER_GRAB;
- FreeGrab(listener->grab);
+ if (listener->grab)
+ FreeGrab(listener->grab);
listener->grab = AllocGrab(grab);
}
}
--
1.8.2.1

View File

@ -1,4 +1,4 @@
From 43f732478606e952fe728a109adeb8edbb63fc13 Mon Sep 17 00:00:00 2001
From 8eeaa74bc241acb41f1d3ed64971e0b01e794776 Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer@who-t.net>
Date: Tue, 9 Jul 2013 13:27:19 +1000
Subject: [PATCH] dix: when ungrabbing an active grab, accept pointer grabs
@ -14,15 +14,70 @@ UngrabDevice. That is against the core grab behaviour.
X.Org Bug 66720 <http://bugs.freedesktop.org/show_bug.cgi?id=66720>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
---
dix/events.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
Xi/exevents.c | 33 ++++++++++++++++++++++-----------
dix/events.c | 11 +++++++++--
2 files changed, 31 insertions(+), 13 deletions(-)
diff --git a/Xi/exevents.c b/Xi/exevents.c
index 2bbc6f0..fd4b80c 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -1223,9 +1223,13 @@ ProcessTouchOwnershipEvent(TouchOwnershipEvent *ev,
else if (ev->reason == XIAcceptTouch) {
int i;
- /* Go through the motions of ending the touch if the listener has
+
+ /* For pointer-emulated listeners that ungrabbed the active grab,
+ * the state was forced to LISTENER_HAS_END. Still go
+ * through the motions of ending the touch if the listener has
* already seen the end. This ensures that the touch record is ended in
- * the server. */
+ * the server.
+ */
if (ti->listeners[0].state == LISTENER_HAS_END)
TouchEmitTouchEnd(dev, ti, TOUCH_ACCEPT, ti->listeners[0].listener);
@@ -1883,16 +1887,23 @@ DeliverTouchEndEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, InternalEvent *ev,
if (listener->type == LISTENER_POINTER_REGULAR ||
listener->type == LISTENER_POINTER_GRAB) {
- rc = DeliverTouchEmulatedEvent(dev, ti, ev, listener, client, win,
- grab, xi2mask);
+ /* Note: If the active grab was ungrabbed, we already changed the
+ * state to LISTENER_HAS_END but still get here. So we mustn't
+ * actually send the event.
+ * This is part two of the hack in DeactivatePointerGrab
+ */
+ if (listener->state != LISTENER_HAS_END) {
+ rc = DeliverTouchEmulatedEvent(dev, ti, ev, listener, client, win,
+ grab, xi2mask);
- /* Once we send a TouchEnd to a legacy listener, we're already well
- * past the accepting/rejecting stage (can only happen on
- * GrabModeSync + replay. This listener now gets the end event,
- * and we can continue.
- */
- if (rc == Success)
- listener->state = LISTENER_HAS_END;
+ /* Once we send a TouchEnd to a legacy listener, we're already well
+ * past the accepting/rejecting stage (can only happen on
+ * GrabModeSync + replay. This listener now gets the end event,
+ * and we can continue.
+ */
+ if (rc == Success)
+ listener->state = LISTENER_HAS_END;
+ }
goto out;
}
diff --git a/dix/events.c b/dix/events.c
index e5db348..de41d6f 100644
index e5db348..03b2d2e 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -1522,13 +1522,16 @@ DeactivatePointerGrab(DeviceIntPtr mouse)
@@ -1522,13 +1522,20 @@ DeactivatePointerGrab(DeviceIntPtr mouse)
for (i = 0; !wasPassive && mouse->touch && i < mouse->touch->num_touches; i++) {
TouchPointInfoPtr ti = mouse->touch->touches + i;
if (ti->active && TouchResourceIsOwner(ti, grab_resource)) {
@ -34,6 +89,10 @@ index e5db348..de41d6f 100644
- !xi2mask_isset(mouse->deviceGrab.grab->xi2mask, mouse, XI_TouchBegin))
+ !xi2mask_isset(mouse->deviceGrab.grab->xi2mask, mouse, XI_TouchBegin)) {
+ mode = XIAcceptTouch;
+ /* NOTE: we set the state here, but
+ * ProcessTouchOwnershipEvent() will still call
+ * TouchEmitTouchEnd for this listener. The other half of
+ * this hack is in DeliverTouchEndEvent */
ti->listeners[0].state = LISTENER_HAS_END;
- TouchListenerAcceptReject(mouse, ti, 0, XIRejectTouch);
+ }

View File

@ -0,0 +1,151 @@
From 3aac7a59dc6ef2d8bbf46ba5d37acdf6013e9450 Mon Sep 17 00:00:00 2001
From: Daniel Martin <daniel.martin@secunet.com>
Date: Tue, 11 Dec 2012 17:23:55 +0100
Subject: [PATCH] ephyr: Add -resizeable option
With this option passed, ephyr windows can be resized like normal
windows on the fly, without the need of an explicit parent window.
Signed-off-by: Daniel Martin <daniel.martin@secunet.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
---
hw/kdrive/ephyr/ephyr.c | 1 +
hw/kdrive/ephyr/ephyrinit.c | 6 ++++++
hw/kdrive/ephyr/hostx.c | 32 +++++++++++++++++++++-----------
3 files changed, 28 insertions(+), 11 deletions(-)
diff --git a/hw/kdrive/ephyr/ephyr.c b/hw/kdrive/ephyr/ephyr.c
index e6520d0..f32e432 100644
--- a/hw/kdrive/ephyr/ephyr.c
+++ b/hw/kdrive/ephyr/ephyr.c
@@ -56,6 +56,7 @@ typedef struct _EphyrInputPrivate {
} EphyrKbdPrivate, EphyrPointerPrivate;
Bool EphyrWantGrayScale = 0;
+Bool EphyrWantResize = 0;
Bool
ephyrInitialize(KdCardInfo * card, EphyrPriv * priv)
diff --git a/hw/kdrive/ephyr/ephyrinit.c b/hw/kdrive/ephyr/ephyrinit.c
index 5e2eb67..adacac9 100644
--- a/hw/kdrive/ephyr/ephyrinit.c
+++ b/hw/kdrive/ephyr/ephyrinit.c
@@ -31,6 +31,7 @@
extern Window EphyrPreExistingHostWin;
extern Bool EphyrWantGrayScale;
+extern Bool EphyrWantResize;
extern Bool kdHasPointer;
extern Bool kdHasKbd;
@@ -116,6 +117,7 @@ ddxUseMsg(void)
ErrorF("-host-cursor Re-use exisiting X host server cursor\n");
ErrorF("-fullscreen Attempt to run Xephyr fullscreen\n");
ErrorF("-grayscale Simulate 8bit grayscale\n");
+ ErrorF("-resizeable Make Xephyr windows resizeable\n");
ErrorF
("-fakexa Simulate acceleration using software rendering\n");
ErrorF("-verbosity <level> Set log verbosity level\n");
@@ -210,6 +212,10 @@ ddxProcessArgument(int argc, char **argv, int i)
EphyrWantGrayScale = 1;
return 1;
}
+ else if (!strcmp(argv[i], "-resizeable")) {
+ EphyrWantResize = 1;
+ return 1;
+ }
else if (!strcmp(argv[i], "-fakexa")) {
ephyrFuncs.initAccel = ephyrDrawInit;
ephyrFuncs.enableAccel = ephyrDrawEnable;
diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c
index aed0285..c8642cb 100644
--- a/hw/kdrive/ephyr/hostx.c
+++ b/hw/kdrive/ephyr/hostx.c
@@ -117,6 +117,8 @@ extern EphyrKeySyms ephyrKeySyms;
extern int monitorResolution;
+extern Bool EphyrWantResize;
+
char *ephyrResName = NULL;
int ephyrResNameFromCmd = 0;
char *ephyrTitle = NULL;
@@ -697,7 +699,7 @@ hostx_screen_init(EphyrScreenInfo screen,
XResizeWindow(HostX.dpy, host_screen->win, width, height);
/* Ask the WM to keep our size static */
- if (host_screen->win_pre_existing == None) {
+ if (host_screen->win_pre_existing == None && !EphyrWantResize) {
size_hints = XAllocSizeHints();
size_hints->max_width = size_hints->min_width = width;
size_hints->max_height = size_hints->min_height = height;
@@ -1012,19 +1014,27 @@ hostx_get_event(EphyrHostXEvent * ev)
case ConfigureNotify:
{
- struct EphyrHostScreen *host_screen =
- host_screen_from_window(xev.xconfigure.window);
+ struct EphyrHostScreen *host_screen;
- if (host_screen && host_screen->win_pre_existing != None) {
- ev->type = EPHYR_EV_CONFIGURE;
- ev->data.configure.width = xev.xconfigure.width;
- ev->data.configure.height = xev.xconfigure.height;
- ev->data.configure.window = xev.xconfigure.window;
- ev->data.configure.screen = host_screen->mynum;
- return 1;
+ /* event compression as for Expose events, cause
+ * we don't want to resize the framebuffer for
+ * every single change */
+ while (XCheckTypedWindowEvent(HostX.dpy, xev.xconfigure.window,
+ ConfigureNotify, &xev));
+ host_screen = host_screen_from_window(xev.xconfigure.window);
+
+ if (!host_screen ||
+ (host_screen->win_pre_existing == None && !EphyrWantResize)) {
+ return 0;
}
- return 0;
+ ev->type = EPHYR_EV_CONFIGURE;
+ ev->data.configure.width = xev.xconfigure.width;
+ ev->data.configure.height = xev.xconfigure.height;
+ ev->data.configure.window = xev.xconfigure.window;
+ ev->data.configure.screen = host_screen->mynum;
+
+ return 1;
}
default:
break;
--
1.8.2.1
From 49521edaf8930b335afac2185209e26e7000820b Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer@who-t.net>
Date: Wed, 15 May 2013 08:51:51 +1000
Subject: [PATCH] ephyr: add -resizeable to the man page
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
---
hw/kdrive/ephyr/man/Xephyr.man | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/hw/kdrive/ephyr/man/Xephyr.man b/hw/kdrive/ephyr/man/Xephyr.man
index 792511b..f14f6c8 100644
--- a/hw/kdrive/ephyr/man/Xephyr.man
+++ b/hw/kdrive/ephyr/man/Xephyr.man
@@ -59,6 +59,10 @@ set 'cursor acceleration':
The host's cursor is reused. This is only really there to aid
debugging by avoiding server paints for the cursor. Performance
improvement is negligible.
+.TP 8
+.B -resizeable
+Allow the Xephyr window to be resized, even if not embedded into a parent
+window. By default, the Xephyr window has a fixed size.
.SH "SIGNALS"
Send a SIGUSR1 to the server (e.g. pkill -USR1 Xephyr) to
toggle the debugging mode.
--
1.8.2.1

View File

@ -42,7 +42,7 @@
Summary: X.Org X11 X server
Name: xorg-x11-server
Version: 1.14.2
Release: 4%{?gitdate:.%{gitdate}}%{dist}
Release: 5%{?gitdate:.%{gitdate}}%{dist}
URL: http://www.x.org
License: MIT
Group: User Interface/X
@ -142,11 +142,15 @@ Patch8034: 0035-dix-remove-logspam-in-RefCursor.patch
# Bug 66720 - Server crash when ungrabbing a touch device on the second touch
# https://bugs.freedesktop.org/show_bug.cgi?id=66720
Patch8035: 0001-dix-when-ungrabbing-an-active-grab-accept-pointer-gr.patch
Patch8037: 0001-dix-UpdateTouchesForGrab-must-only-free-the-listener.patch
# Bug 972095 - X server fails on 32-bit Fedora 19 with VirtualBox Guest Additions installed
# https://bugzilla.redhat.com/show_bug.cgi?id=972095
Patch8036: 0001-glx-fix-uninitialized-var-in-__glXDRIscreenProbe.patch
# Bug 962572 - X-sandboxes are not resizeable
Patch8038: 0001-ephyr-Add-resizeable-option.patch
# upstream in -next for 1.15, e21e183059df5975e7086850d1931edb2c1bbd06
%if !0%{?rhel}
Patch7071: 0001-os-use-libunwind-to-generate-backtraces.patch
@ -624,6 +628,11 @@ rm -rf $RPM_BUILD_ROOT
%{xserver_source_dir}
%changelog
* Mon Jul 15 2013 Peter Hutterer <peter.hutterer@redhat.com> 1.14.2-5
- Fix logspam when trying to free a non-existant grab.
- Update touch patch to upstream version (from fdo #66720)
- re-add xephyr resizable patch, got lost in rebase (#976995)
* Fri Jul 12 2013 Dave Airlie <airlied@redhat.com> 1.14.2-4
- reapply dropped patch to fix regression (#981953)