Inconsistent mouse events for Acer T231H multitouch monitor

Bug #1015183 reported by Martin von Gagern
138
This bug affects 24 people
Affects Status Importance Assigned to Milestone
HWE Next
Fix Released
Undecided
Unassigned
Saucy
Fix Released
Undecided
Unassigned
X.Org X server
Fix Released
Medium
xorg-server (Ubuntu)
Fix Released
High
Chase Douglas
Nominated for Quantal by James M. Leddy
Precise
Won't Fix
Undecided
Maarten Lankhorst

Bug Description

I already submitted this at http://askubuntu.com/questions/153043/ but decided to update to the latest development snapshot in order to give that a try and write a proper bug report if the issue persists. It does persist.

My setup is a quantal alpha 1, just upgraded from precise, with an Acer T231H multitouch monitor connected to it, as well as an ordinary mouse for testing. The mouse events as X sends them to the applications are inconsitent. This can be debugged using xev.

The first touch of the screen is preceeded by a MotionNotify event which already has state 0x100, i.e. left mouse button pressed. After that comes a ButtonPress event, again with state 0x100 although that value should indicate the state of the buttons before the event occurred. The subsequent drag is all right, and the ButtonRelease as well, but the 0x100 bit in the state value will never become zero again.

Even if I've got an ordinary mouse connected as well, it will henceforth report every movement as if I were keeping the left mouse button down. The only cure that I could find was restarting the X server. Together with the ButtonPress and ButtonRelease events, this constant bit for left mouse button amounts to an inconsistent reporting of button state.

Java applications e.g. will report every move as a drag due to this issue, with severe implications for focus management. This makes using differenent parts of the application almost impossible, as mouse movement will only be reported to the component where the mouse entered the application window.

Since reporting at askubuntu, I've run some tests with evtest. The data coming from the event device looks sane enough: BTN_TOUCH events for the first finger, with value 1 for pressed and 0 for released. ABS_MT_TRACKING_ID for all fingers, with a non-negative value for pressed and -1 for released. The grouping into syn groups looks sane as well. So I'd say the kernel driver works as intended, and somewhere from there to the xevent layer, some internal state gets messed up.

I'm willing to try out any patches you might propose, be it in an attempt to fix this, or only to gather more information.

Expected behaviour:

    MotionNotify with state 0x000 when dragging the ordinary mouse
    MotionNotify with state 0x000 for move prior to touch, or no event at all
    ButtonPress with state 0x000 when touching the screen
    MotionNotify with state 0x100 while dragging the finger
    ButtonRelease with state 0x100 when lifting the finger
    MotionNotify with state 0x000 when dragging the ordinary mouse afterwards

Actual behaviour:

    MotionNotify with state 0x000 when dragging the ordinary mouse before the first touch
    MotionNotify with state 0x100 for prior to ButtonPress event
    ButtonPress with state 0x100 when touching the screen
    MotionNotify with state 0x100 while dragging the finger
    ButtonRelease with state 0x100 when lifting the finger
    MotionNotify with state 0x100 when dragging the ordinary mouse afterwards

ProblemType: Bug
DistroRelease: Ubuntu 12.10
Package: xserver-xorg-input-evdev 1:2.7.0-0ubuntu2
ProcVersionSignature: Ubuntu 3.4.0-5.11-generic 3.4.0
Uname: Linux 3.4.0-5-generic x86_64
ApportVersion: 2.2.3-0ubuntu5
Architecture: amd64
CurrentDmesg: [ 7.381404] ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
Date: Tue Jun 19 17:56:46 2012
DistUpgraded: 2012-06-19 17:51:23,756 DEBUG enabling apt cron job
DistroCodename: quantal
DistroVariant: ubuntu
InstallationMedia: Ubuntu 12.04 LTS "Precise Pangolin" - Release amd64 (20120425)
ProcEnviron:
 TERM=xterm
 PATH=(custom, no user)
 LANG=en_US.UTF-8
 SHELL=/bin/bash
ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-3.4.0-5-generic root=UUID=88133c52-550c-4c43-9da5-15f180bdb767 ro quiet splash vt.handoff=7
SourcePackage: xserver-xorg-input-evdev
UpgradeStatus: Upgraded to quantal on 2012-06-19 (0 days ago)
dmi.bios.date: 09/22/2011
dmi.bios.vendor: American Megatrends Inc.
dmi.bios.version: 4.6.4
dmi.board.name: AMD HUDSON-M1
dmi.board.vendor: ZOTAC
dmi.chassis.type: 3
dmi.modalias: dmi:bvnAmericanMegatrendsInc.:bvr4.6.4:bd09/22/2011:svn:pn:pvr:rvnZOTAC:rnAMDHUDSON-M1:rvr:cvn:ct3:cvr:
version.compiz: compiz 1:0.9.7.8-0ubuntu3
version.ia32-libs: ia32-libs N/A
version.libdrm2: libdrm2 2.4.33-1
version.libgl1-mesa-dri: libgl1-mesa-dri 8.0.3-0ubuntu1
version.libgl1-mesa-dri-experimental: libgl1-mesa-dri-experimental N/A
version.libgl1-mesa-glx: libgl1-mesa-glx 8.0.3-0ubuntu1
version.xserver-xorg-core: xserver-xorg-core 2:1.11.4-0ubuntu11
version.xserver-xorg-input-evdev: xserver-xorg-input-evdev 1:2.7.0-0ubuntu2
version.xserver-xorg-video-ati: xserver-xorg-video-ati 1:6.14.99~git20111219.aacbd629-0ubuntu2
version.xserver-xorg-video-intel: xserver-xorg-video-intel 2:2.19.0-1ubuntu1
version.xserver-xorg-video-nouveau: xserver-xorg-video-nouveau 1:0.0.16+git20120614+36d3f8c-1

Revision history for this message
Martin von Gagern (gagern) wrote :
Revision history for this message
Martin von Gagern (gagern) wrote :

I had hoped that backing http://cgit.freedesktop.org/xorg/xserver/commit/?id=634b0da9a83076d0e9e0fc44dc5dc77b0c368bc1 out of the xorg server core code base might be enough to solve this, but if I do so, core events never have any buttons set in their state, so that is not a solution. Nevertheless, it might well be that this problem lies somewhere inside the xorg server itself, and not the evdev driver module. Although I haven't yet pinpointed the location in the sources where that state is managed, it seems to me as if the evdev code were pretty stateless, submitting only button press and release events as appropriate. And as those apparently arrive correctly at xev, the state management appears to be wrong for some other reason.

Searching for ways to obtain more information, I just ran "xinput test-xi2 2" where 2 is the id of my virtual core pointer. When I drag my finger inside the test window, here is what I see in the console (after enlarging my scrollback appropriately):

 - DeviceChanged due to SlaveSwitch
 - RawTouchBegin
 - Enter, buttons: (empty)
 - Motion (emulated), buttons: 1
 - ButtonPress (emulated), buttons: 1
 - Motion (emulated), buttons: 1, repeated while dragging
 - ButtonRelease (emulated), buttons: 1
 - TouchBegin, buttons: (empty)
 - TouchUpdate: buttons: (empty), repeated to mimic the original drag

There are a number of things very strange about this:
 - The whole TouchBegin/TouchUpdate sequence only gets emitted after I release my finger.
 - The TouchBegin does not have a matching TouchEnd. Very likely this causes the error in core event state.
 - After I release my finger, the mouse cursor jumps to the location where I began my drag.
   This behaviour is only within the xinput test window, outside the cursor will stay at the end of a drag.

Repeating the test for input device 9, which is the touch screen, I see this:
 - RawTouchBegin
 - Motion (emulated), button: 1
 - TouchBegin, buttons: (empty)
 - ButtonPress (emulated), buttons: 1
 - RawTouchUpdate
 - TouchUpdate, buttons: (empty)
 - Motion (emulated), buttons: 1
 - The preceeding three events repeated in this order for the duration of the drag
 - RawTouchEnd
 - TouchEnd, buttons: (empty)
 - ButtonRelease (emulated), buttons: 1

So here the Touch events are delivered in sync with the Motion events, there is a TouchEnd where one would expect it to be. The jumping of the mouse cursor to the position where the drag began still remains, though.

To me this looks a lot as if the events made it into the dix layer all right, but the emulation of a core pointer based on these events is somehow broken. For this reason, I now believe the problem to lie within the xserver-xorg-core binary package.

"xinput test 2" does not work at all ("unable to find device 2"), whereas "xinput test 9" shows pretty sane behaviour: a single motion followed by a button press 1 at the beginning, a sequence of motion events during the drag, and a button release 1 at the end. When launched with the -proximity flag, it complains of a bad request and terminates immediately. Makes sense, as this device doesn't provide any proximity information.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in xorg-server (Ubuntu):
status: New → Confirmed
Changed in xserver-xorg-input-evdev (Ubuntu):
status: New → Confirmed
bugbot (bugbot)
tags: added: kubuntu
tags: added: touch
Revision history for this message
Krastanov (krastanov-stefan) wrote :

The same behavior on another hardware is reported in this question:
https://answers.launchpad.net/ubuntu/+source/xserver-xorg-input-evdev/+question/201072
concerning the wetab tablet with egalax touchscreen

Revision history for this message
Martin von Gagern (gagern) wrote :

Similar behaviour, but not entirely the same: I do receive press events. The incorrect status is the same, though.

Revision history for this message
Krastanov (krastanov-stefan) wrote :

Does `xdotool mousedown/mouseup/click/etc` or similar commands using `xte` change the status back to 0x000?

They do not help for the egalax touchscreen.

Revision history for this message
Martin von Gagern (gagern) wrote :

OK, I bvelieve I've identified the main problem here:

http://cgit.freedesktop.org/xorg/xserver/commit/?id=a986f2f30cbe2a00e72ded7315c4951d7703e549
http://anonscm.debian.org/gitweb/?p=pkg-xorg/xserver/xorg-server.git;a=commitdiff;h=96d8df5bc9d400d55830b23afe5525b222f8dfc7

Due to that commit, the ET_TouchEnd branch of UpdateDeviceState never receives the TOUCH_END flag it expects, so it never lifts the button. In fact, there are currently only two references to the TOUCH_END macro in the whole upstream xorg git tree: one its definition in include/input.h, the other this check in Xi/exevents.c. There is noone left ever setting this flag.
http://cgit.freedesktop.org/xorg/xserver/tree/include/input.h?id=a986f2f30cbe2a00e72ded7315c4951d7703e549#n80
http://cgit.freedesktop.org/xorg/xserver/tree/Xi/exevents.c?id=a986f2f30cbe2a00e72ded7315c4951d7703e549#n974

The reodering of events which the commit does will also break the state reported for the release event. As far as I understand things (and as it behaves for my regular mouse), the state should reflect the state of buttons BEFORE the event happened. There is a comment to that effect somewhere in the X sources. Reordering the calls in ProcessTouchEvent will cause the state to be already 0 for the release event, where it should be 0x100 still.

As the original commit originated from Chase Douglas who is a member of the ubuntu-x-swat team, I suppose he will read this message here and might provide additional information as to how his change was intended to work, and whether backing it out of the code will likely break things for other users. If he doesn't usually follow bug mail, someone please make him aware of this issue here.

The only remaining problem is the fact that the ButtonPress event has state 0x100 already, where it should have state 0x000 to match the lack of pressed buttons preceeding that event. I'll see whether I can pinpoint that problem as well. If I can, I will attach a patch including that fix as well. Otherwise a simple reverse application of the commit I pointed out above will be enough.

@Stefan Krastanov, please see if this fix works for you, otherwise please open a new bug report for your issue.

Revision history for this message
Martin von Gagern (gagern) wrote :

OK, I believe I now have a good idea as to why the first ButtonPress in xev has state 0x100. This appears to be due to an TouchOwnership event. If ownership changes, such an event is inserted into the queue, so it will always be processed after the BeginTouch event. I wonder how much later it might get processed, but as there appears to be some history, I simply assume everything is all right there. So the TouchBegin arrives, sets state = 0x100, enqueues an Ownership event, and when that arrives, ProcessTouchOwnershipEvent will first run TouchRejected. This in turn will call EmitTouchEnd, but will not update state. Then TouchPuntToNextOwner will replay the history. The ButtonPress core event corresponding to the initial TouchBegin is now delivered with the CURRENT device state, i.e. 0x100.

For source code of TouchRejected, see
http://cgit.freedesktop.org/xorg/xserver/tree/Xi/exevents.c?id=a986f2f30cbe2a00e72ded7315c4951d7703e549#n1210

I haven't come up with a fix yet, as I haven't fully understood this whole ownership and history/replay business here. But I assume that a proper fix would be restoring the state to what it was at the beginning of the history before replaying said history. Input from people more fluent in that code would be greatly appreciated.

Revision history for this message
Martin von Gagern (gagern) wrote :

I have a patch for the second issue of the mouse state during replay. Will attach it here shortly. I'm currently trying to get this to my PPA, for quantal first and for precise afterwards.

Editing the change log, I found that the removal of the TOUCH_END is not part of the orig tarball, but comes from an ubuntu patch, 507_touchscreen_fixes.patch. The changelog entry by Chase Douglas quotes bug #974887 as a reference on those modifications.

Revision history for this message
Martin von Gagern (gagern) wrote :
Revision history for this message
Martin von Gagern (gagern) wrote :
Revision history for this message
Martin von Gagern (gagern) wrote :

OK, here are the two patches which I currently use to get a working core pointer from my touch screen. I've included them in packages available from https://launchpad.net/~gagern/+archive/ppa for precise and quantal, so feel free to use those to give things a try.

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "Reverse commit which removed TOUCH_END" of this bug report has been identified as being a patch. The ubuntu-reviewers team has been subscribed to the bug report so that they can review the patch. In the event that this is in fact not a patch you can resolve this situation by removing the tag 'patch' from the bug report and editing the attachment so that it is not flagged as a patch. Additionally, if you are member of the ubuntu-reviewers team please also unsubscribe the team from this bug report.

[This is an automated message performed by a Launchpad user owned by Brian Murray. Please contact him regarding any issues with the action taken in this bug report.]

tags: added: patch
Revision history for this message
Martin von Gagern (gagern) wrote :

As the core pointer button state appears to be exclusively maintained inside the x server core, the evdev driver is blameless.

Changed in xserver-xorg-input-evdev (Ubuntu):
status: Confirmed → Invalid
Revision history for this message
Cédric Dufour (cdufour-keyword-ubuntu-086000) wrote :

Also affected: Atmel maXtouch (see https://answers.launchpad.net/utouch/+question/183765)

Revision history for this message
Cédric Dufour (cdufour-keyword-ubuntu-086000) wrote :

I applied the patches in #11 and #12 to the current precise xserver-xorg-core source (1.11.4-0ubuntu10.2) and unfortunately, it does not solve the atmel maXtouch "loss of single click" (I can reproduce that behavior systematically by calling Compiz's Expo plugin and double-clicking one of the viewport; after that single-click is lost).
Worse, drag'n drop does not work anylonger (e.g. to move a window by cliking-holding-moving its title bar).
Sorry for the negative report.

Revision history for this message
Chase Douglas (chasedouglas) wrote :

Hi Martin,

Thanks for finding this issue. Good work on making some patches, but I don't think they are quite right. We need to set the internal button state of the device when the touch begin comes in, otherwise we will not get the right result when we call {X,XI}QueryPointer().

A simpler solution would be to modify DeliverTouchEmulatedEvent(). There is the following line:

ptrev->device_event.corestate = event_get_corestate(dev, kbd);

We need to modify it so that it also passes in a boolean to event_get_corestate() to determine whether to mix the touch emulated button state in with the normal button state. Then, we tell the function to mix in the touch emulated state only on touch update and end events. We can reason that this is correct because only one touch may be emulated at a time per device, and because only one window may receive an emulated button press for the touch begin at a time.

I will attempt to make a test and a patch for this tomorrow.

Thanks!

Changed in xorg-server (Ubuntu):
status: Confirmed → In Progress
importance: Undecided → Medium
assignee: nobody → Chase Douglas (chasedouglas)
no longer affects: xserver-xorg-input-evdev (Ubuntu)
Revision history for this message
Chase Douglas (chasedouglas) wrote :
Revision history for this message
Cédric Dufour (cdufour-keyword-ubuntu-086000) wrote :

Hello Chase,
Thank you for looking into this.
When not subscribed to the X.org mailing list, obtaining the patch is kind of a hassle (I couldn't find a download option and I'd rather avoid copy/paste). Can you post it here too, so we can download/test it? Or will it be included in the next xserver-xorg-core package update?
Thanks again,
Cédric

Revision history for this message
Martin von Gagern (gagern) wrote :

Hi Chase,

thank you for looking into this, and working towards a solution.

Is the patch you referenced intended as a replacement for both my patches? Working with the touch screen alone, things work out fairly well. But if I also use a mouse, then the lack of a TOUCH_END event still causes the mouse moves to register as drags, i.e. with state 0x100. So I feel like your patch might be a suitable replacement for the one in comment #12, but the one in comment #11 is still required.

I guess you head a good reason to write the changes I mentioned in comment #8, the ones which #11 backs out. I must confess I still haven't fully understood the rationale behind that commit, mostly because I still don't know about that listener concept. So perhaps you want to improve that change instead of reverting it. A proper proof should probably get rid of every occurrence of the TOUCH_END macro in the code. It should be tested on a setup with both a touch and a classical mouse device.

Revision history for this message
Martin von Gagern (gagern) wrote :

With that patch by Chase, I also wonder what would happen if two touch devices were used simultaneously.

When I both touch my screen and click my conventional mouse button, I get two button events, but the state is the bitwise or of both, so the second click will be "pressed button 1 while button 1 was pressed". Makes sense, in a certain way, although it might well confuse some applications.

But what if I had two touch devices controlling the core pointer? I believe it is likely with the current setup that in this case, the second device would generate a ButtonPress with state 0x000. Or is it impossible for more than one touch device to control the core pointer at a given time? I don't have more than one device, so I can't test this.

I'll agree that given current technology, this seems a rather rare corner case, and probably not worth the effort to deal with properly. But any shortcomings in that respect should perhaps at least be documented somewhere.

Revision history for this message
Martin von Gagern (gagern) wrote :
Revision history for this message
Martin von Gagern (gagern) wrote :

Cédric, I attached the patch, after copy & paste from gmane. But it applies all right, at least to the xorg-server-1.12.1.902-1ubuntu1 currently in quantal. For precise, some adjustments are required.

I updated https://launchpad.net/~gagern/+archive/ppa to provide fixed versions of the latest packages, and they use the patches from comment #11 and comment #19.

Revision history for this message
Cédric Dufour (cdufour-keyword-ubuntu-086000) wrote :

Hello,

Thanks Martin for your PPA and the precise packages; unfortunately, I run amd64 :-/

I first applied only #19 patch (yes, it did require some adjustments) to the latest precise X.org packages (1.11.4-0ubuntu10.3): behavior remains the same (at least as far as Compiz plugins are concerned: "Expo" triggers the issue systematically, "Shift Switcher" one time out of two).

Then I saw Martin's comment and applied patches #11 and #19: behavior remains the same (as far as Compiz plugins...) AND windows moving (clicking-holding-dragging) is lost right from the start.

I think we can conclude that #11 triggers the "windows moving (clicking-holding-dragging) is lost" issue (since I also bumped into it #17)

Now, I'm wondering whether Compiz might have some problem on its own. Example given: I loose single/double click as soon as I launch the "Expo" plugin and select (double-click on) a viewport. After, no amount of single/double-clicking does anything (on desktop icons, windows minimize/maximize/close buttons, panel applets, etc.). BUT, single/double-clicking still work in Compiz plugin (if I launch the "Expo" or "Shift Switcher", single/double-clicking works).

I also gave #19 patch (alone) a try without launching Compiz (use metacity alone instead) or multi-touch (ginn) stuff. Before, even in that (no-compiz/no-ginn) scenario, single/double-clicking got lost rather rapidly. Here, I've been clicking and double-clicking around and using applications for several minutes without any problem. As soon as I launch ginn again, I start to have some problems with the applets icons (most of the time, they don't react to single click, though they sometime - rarely - still do). Other single/double-clicking still works.
Launching Compiz alone (without ginn), and all problems are back.

Conclusion using patch #19, without patch #11 (cf. "windows moving (clicking-holding-dragging) is lost" issue), without Compiz (cf. "single/double-clicking is lost" issue) and without ginn (cf. "applets react only whimsically to single-click" issue), single/double-clicking at least seems to work reliably enough to allow the touchscreen to be used (before, it was a "no go"), even if sometime, one must (single) click two time on an icon for the expected behavior to happen.

About that "sometime, one must (single) click two time on an icon for the expected behavior to happen": I can reproduce the behavior systematically by: 1. clicking on a network-manager icon (menu opens), 2. clicking on the desktop to close the menu (menu closes), 3. clicking on a network-manager icon again (menu does not open; instead, a selection rectangle is drawn), 4. clicking on a network-manager icon again (this time, menu opens again)

Let me know if I can help any further.

Revision history for this message
Martin von Gagern (gagern) wrote :

Hi Cédric,

Although this took a little while longer, the amd packages have been built successfully by now, and are available from my ppa.

I have the impression that your problems manifest in cases when some application is listening to the higher level touch interfaces, presumably using XInput. My problems on the other hand occur in a bare bones X where applications only use the core pointer. Those appear to be two sides of a coin: the commit reverted by comment #11 was intended to deal with a changing set of listeners, which to me sounds like some gesture-interpreting software. So it seems you need that fix, but I can't have it, as it breaks the core pointer. Let's hope someone finds a fix which will work with multiple listeners and still maintain proper core pointer state. As things work all right for me at the moment, I have little incentive to work on a part of this issue that doesn't affect me. Particularly as I haven't got all this gesture stuff set up to work for me, so I cannot test things yet.

Revision history for this message
Cédric Dufour (cdufour-keyword-ubuntu-086000) wrote :

Hello Martin,
Yes indeed, it seems we're bumping is several different issues. Yours - and its fix - helped improve the global picture. I have absolutely no understanding of how all that X and multi-touch works, so I don't know where to start from (in respect with where/how to report the other issues). All I can do is give as detailed a report as possible, so those who know can extract what hopefully useful information they can (and maybe point some directions for further bug reporting and/or testing).
Thanks for keeping up with me so far ;-)
Cheers

Revision history for this message
Chase Douglas (chasedouglas) wrote : Re: [Bug 1015183] Re: Inconsistent mouse events for Acer T231H multitouch monitor

On 07/04/2012 03:30 AM, Martin von Gagern wrote:
> Is the patch you referenced intended as a replacement for both my
> patches? Working with the touch screen alone, things work out fairly
> well. But if I also use a mouse, then the lack of a TOUCH_END event
> still causes the mouse moves to register as drags, i.e. with state
> 0x100. So I feel like your patch might be a suitable replacement for the
> one in comment #12, but the one in comment #11 is still required.

If you aren't receiving a TouchEnd event, then there is something wrong.
The patch you are reverting is needed to fix a different bug. If you can
reproduce the issue easily, please describe how. Then we can look to
resolve it.

Thanks!

Revision history for this message
Chase Douglas (chasedouglas) wrote :

On 07/04/2012 03:37 AM, Martin von Gagern wrote:
> With that patch by Chase, I also wonder what would happen if two touch
> devices were used simultaneously.
>
> When I both touch my screen and click my conventional mouse button, I
> get two button events, but the state is the bitwise or of both, so the
> second click will be "pressed button 1 while button 1 was pressed".
> Makes sense, in a certain way, although it might well confuse some
> applications.
>
> But what if I had two touch devices controlling the core pointer? I
> believe it is likely with the current setup that in this case, the
> second device would generate a ButtonPress with state 0x000. Or is it
> impossible for more than one touch device to control the core pointer at
> a given time? I don't have more than one device, so I can't test this.
>
> I'll agree that given current technology, this seems a rather rare
> corner case, and probably not worth the effort to deal with properly.
> But any shortcomings in that respect should perhaps at least be
> documented somewhere.

Great point here :). I had to look at the code to determine the correct
answer. I worried that, like you said, it would be buggy if you had two
touchscreens. However, this should not be a problem.

Input devices have a two-layer hierarchy. There are slave devices and
master devices. Slave devices represent a physical device, like a
touchscreen. Master devices represent a group of slave devices. Most
people only have one master device configured, and all the slave devices
are attached to it. If you have two mice, you can create a second master
and attach one slave mouse to each. Then you'll have two independent
pointers on screen :).

A client can listen to events from master and/or slave devices. The
events look and behave almost exactly the same. When you press your
mouse button, a button press event is generated for the slave device and
the attached master device.

If you have two touchscreens with one master, then each slave device can
emulate a button press event. However, there can be only one emulated
touch per device (no matter whether it's a slave or a master), so the
first touch is emulated for the master, and the second touch is not.

Thanks!

Revision history for this message
Martin von Gagern (gagern) wrote :

On 05.07.2012 23:35, Chase Douglas wrote:
> If you aren't receiving a TouchEnd event, then there is something wrong.

I am receiving the TouchEnd, but it doesn't update the core state the
way it should.

> The patch you are reverting is needed to fix a different bug. If you can
> reproduce the issue easily, please describe how. Then we can look to
> resolve it.

Please re-read comment #8.

Steps to reproduce:
 1. Start xev
 2. Touch screen and release
 3. Move regular mouse

Expected behaviour:
 2. Release event with state 0x100
 3. Mouse move with state 0x000

Actual behaviour:
 3. Mouse move with state 0x100

Behaviour if you simply disable the check for the TOUCH_END flag in
UpdateDeviceState:
 2. Release event already with state 0x000

Revision history for this message
Trent Piepho (tpiepho) wrote :

I see this same behavior on a Samsung Slate 7, which has an Atmel maxtouch multitouch touchscreen. Running Precise, with xserver-xorg-input-evdev 1:2.7.0-0ubuntu1.2 and xserver-xorg-core 2:1.11.4-0ubuntu10.8.

If I don't touch the touchscreen since the X server has started, xev reports the state of events as expected when using a mouse. 0x000 for the ButtonPress, 0x100 for motion with the button down and the ButtonRelease, then 0x000 after. However, after the touchscreen is touched once, the state becomes 0x100 for the first ButtonPress from the touchscreen and stays at 0x100 thereafter, even after the ButtonRelease. Keyboard keys, mouse clicks, mouse motion, etc. are all state 0x100 until the X server is restarted.

Revision history for this message
Trent Piepho (tpiepho) wrote :

Found out something new. I compiled the git version of evdev, xf86-input-evdev-2.7.0-20-g5af11b6, and when multitouch isn't enabled, the core state problem is gone. The autoconf script doesn't detect XI22 on Precise because the X.org version is too old, so MT isn't enabled by default.

Once I modified configure.ac to turn MULTITOUCH back on, then the problem was back as well and state is locked to 0x100 after the touchscreen is used.

I've also found that I get far more of the problems Cédric mentions when ginn is running. It seems like what happens is the touchscreen stops generating ButtonPress events, but it still does motion events and state is still locked at 0x100. So the effect is that one is moving the pointer around with the button held down, but never pushing the button. This usually seems like left-click has stopped working. But I imagine the state problem and the resulting "drags with no click" can explain in some strange behavior seen in certain apps.

Revision history for this message
In , Timo Aaltonen (tjaalton) wrote :

I'm able to "lock up" the Unity session by opening menus quickly by using a touchscreen. Seems as if there's a grab active. I can see the tooltips from launcher icons, interact with focused apps, but that's it.

Can't reproduce with plain metacity, because the menus open so quickly with it, whereas with Unity on this hw the effects slow it down so that the race is hit.

Tried several of the recent patches on top of 1.13, but they haven't helped. Now I see there are newer patches available. I'll give them a try. Filed this one for tracking this particular issue.

Revision history for this message
In , Timo Aaltonen (tjaalton) wrote :

tried patches from 56558 and 55738, also "Sync TouchListener memory.." from Carlos Garnacho, didn't help.

Revision history for this message
In , Daniel d'Andrada (dandrader) wrote :

I just repeatedly tap on the top-most icon (the one which has the Ubuntu logo) of Ubuntu's launcher in a touchscreen. Those taps alternately open and close the dash (a fullscreen window that shows icons for applications, media and other files). Eventually those taps stop having any effect. I.e., the launcher no longer gets ButtonPress and ButtonRelease events out of them.

I've added a wealth of logging (see xorg.log attachment) to try to understand what's happening on the server. From looking at it could see the following:
From touches 2 to 26, launcher is the first window in the list of listeners. From touch 27 onwards, the root window is the first one. Problem is, from touch 27 onwards, xserver fails to pass the touch ownership down to the launcher window because there's always an older pointer-emulated touch (touch 26) lying around which it apparently can't get rid of (i.e. properly process).

Revision history for this message
In , Daniel d'Andrada (dandrader) wrote :

Created attachment 70064
log output of the "repeated tapping on ubuntu logo launcher icon" use case

Revision history for this message
In , Peter Hutterer (peter-hutterer) wrote :

Do cross-check with Bug 56557 as well, this can cause issues if any grabs are activated on the root window and I wonder if that influences the behaviour here

Revision history for this message
In , Daniel d'Andrada (dandrader) wrote :

(In reply to comment #4)
> Do cross-check with Bug 56557 as well, this can cause issues if any grabs
> are activated on the root window and I wonder if that influences the
> behaviour here

Yes, they are at least closely related (most likely have the same cause) as a pointer-emulated touch gets "stuck" because of failed resource lookups in RetrieveTouchDeliveryData() as well.

Revision history for this message
In , Daniel d'Andrada (dandrader) wrote :

Created attachment 70422
log output of use case with patches from bug 56557 applied

With the 4 patches mentioned in bug 56557 applied (comments 3 and 4), the bug (missing ButtonPress and ButtonRelease events) manifests itself already on the second tap on the touchscreen.

Again, due to a failure in RetrieveTouchDeliveryData()

Revision history for this message
In , Peter Hutterer (peter-hutterer) wrote :
Revision history for this message
In , Daniel d'Andrada (dandrader) wrote :

Created attachment 70656
log output of use case with patches from Comment 7 also applied

This is the log output I get with this new set of patches (from Comment 7) applied on top of those mentioned in Comment 6.

Again, the same problem.

The first tap on the icon with the ubuntu logo in the launcher (top left corner of the screen) works fine and displays the dash (a fullscreen window showing application icons, etc). The launcher now has a active pointer grab.

Upon the second tap on the ubuntu icon, xserver fails to deliver events to that listener (laucnher's active pointer grab) because the corresponding RetrieveTouchDeliveryData() call fails. A snippet from the log:

"""
(II) TouchBeginDDXTouch: ddx id 0, touch 2 - returning with emulate pointer == 1
[ 2859.473] (II) ProcessTouchEvent: TouchBegin, master pointer, touch 2
 ...
[ 2859.474] (II) RetrieveTouchDeliveryData: listener(window=launcher, listener=1105199104, type=pointer_grab, state=begin, level=core)
[ 2859.474] (II) dixLookupClient: failed! - rid & SERVER_BIT
[ 2859.474] (II) - Not delivering to listener 1105199104 because his delivery data couldn't be retrieved.
"""

tags: added: blocks-hwcert-enablement
Revision history for this message
Maarten Lankhorst (mlankhorst) wrote :

Could you recheck on raring? It seems there have been some touch related fixes in xorg-server since the quantal xserver release.

Revision history for this message
In , Jrand (jrand) wrote :

We are also experiencing this bug with other touch screen software, not Unity related. The underlying X problem seems to be identical. Has a solution been found?

Revision history for this message
In , Timo Aaltonen (tjaalton) wrote :

Nope, the bug is still there. Rasterman reproduced it with E17 and commented on the downstream bug:

https://bugs.launchpad.net/ubuntu-nexus7/+bug/1068994/comments/24

Revision history for this message
In , Peter Hutterer (peter-hutterer) wrote :

can you test this branch here please? http://cgit.freedesktop.org/~whot/xserver/log/?h=touch-grab-race-condition-56578

Last 5 commits (currently), starting with 2cd9c4f709f105b7a7faf31b8c10993d0949563c

Revision history for this message
In , Timo Aaltonen (tjaalton) wrote :

unfortunately still able to reproduce it :/

I needed these commits on top of 1.13.2 to be able to compile with the new patches:
cc79107a5b60d2926e16ddbee04149e8d5acc969
fe59774c55e5d423633405e0869c22f4ce382548
91ab237358c6e33da854914d3de493a9cbea7637
9ad0fdb135a1c336771aee1f6eab75a6ad874aff

Revision history for this message
In , Peter Hutterer (peter-hutterer) wrote :

You'll need all of http://cgit.freedesktop.org/~whot/xserver/log/?h=server-1.13-branch, at the least. I haven't tested this on 1.13.x at all, purely working from git master for now.

Revision history for this message
In , Peter Hutterer (peter-hutterer) wrote :

Sorry, to clarify: you need that 1.13 branch linked above AND the patches from Comment 11

Revision history for this message
In , Timo Aaltonen (tjaalton) wrote :

Created attachment 74845
evemu-record from the touchscreen

attached the evemu dump from reproducing the bug by hitting the unity indicators quickly a couple of times.

I'll try the more complete 1.13 build next.

Revision history for this message
In , Peter Hutterer (peter-hutterer) wrote :

Ok, analysis of the bug as follows. To trigger this bug, we need the following client stack:
* touch client with a passive touch grab
* core client with a passive button grab in GrabmodeSync
* optional: core client with button mask on window
The touch client must reject the touch.

As the touch grab activates, all events are sent to the touch client, and stored in the touch event history. When the client rejects, the events are replayed on the next client.

The replayed TouchBegin will trigger the core passive grab, and switch the device's processInputProc to EnqueueEvent().
BUG 1: because touch event history replaying calls DeliverTouchEvents directly, EnqueueEvent is side-stepped and no events end up in the sync'd queue. Later, when the client calls XAllowEvents no events are there for syncing, ComputeFreezes() exits early and the emulated motion/release events are not sent to the client.

Fixing that is possible so that EnqueueEvent is honoured. Tricky though, because it will have a number of side-effects, see below.

BUG 2: because the TouchEnd never ends up in the history (by design) no release event ends up in the queue. So when replaying, the emulated button release is missing. Not sure yet how to fix this.

BUG3: If there's the optional third client, it's implicit passive grab currently does not get released. That's the easiest one to fix.

Side effects of the first bug:
If we use EnqueueEvent() for event history replaying, we will replay touch events into the sync buffer, but not actually process them. If there is at least one touch client below the client with the sync passive core grab, it cannot get touch events until the grabbing client calls XAllowEvents. If that touch client has the ownership mask set, that behaviour is against the protocol spec.

Coincidentally, this bug already exists anyway, it's just gone unnoticed so far because touch clients appear to be generally above the normal clients.

To be compliant with the touch specs, we need to wrap EnqueueEvent to still handle touch events for clients with the ownership mask even if the device is currently synced.

Revision history for this message
In , Peter Hutterer (peter-hutterer) wrote :

Branch available for testing here. I think this fixes the issue but I've been unsuccessful getting this backported to a 1.13 ubuntu server.

http://cgit.freedesktop.org/~whot/xserver/log/?h=touch-grab-race-condition-56578-v2

If you can test this, that'd be much appreciated.

Revision history for this message
In , Jrand (jrand) wrote :

Hi Peter, I think your recent patches do fix the issue.

I compiled your server and a fresh xinput evdev 2.7.3. I confirmed TouchBegin TouchEnd were being sent with a brief xinput test-xi2 test.

# xdpyinfo |grep -E '(vendor|version)'
version number: 11.0
vendor string: The X.Org Foundation
vendor release number: 11399902
X.Org version: 1.13.99.902

My usual scenario to experience this problem is:
  run Chrome
  xwininfo [tap root screen, get window id of chrome window]
  xev -id 0x.... [use window id of chrome window]
  tap screen a few times to see xev notify events
  ctrl-C
  on screen, touch a UI button
  the press activates the UI button
  screen switches to new page <-- ButtonRelease is dropped somewhere from here
  the new UI button underlying where my finger just pressed is stuck down
  ^--- to here

With these same testing steps above I cannot get a stuck button on your new xserver branch. It seems that the ButtonRelease event arrives correctly.

Revision history for this message
In , Peter Hutterer (peter-hutterer) wrote :
Revision history for this message
In , Timo Aaltonen (tjaalton) wrote :

Ok I've tested them as well by building 1.14rc minus the video abi changing stuff (and commits on top of them), and added the touch branch. This allowed me to test on the nexus7 & tegra3 blob.

Looks like it's much better now, although sometimes the touch appears to get somewhat hung but can recover from it later on, and when this happens also generates messages like

[ 5101.196] [Xi] Too many valuators reported for device 'Virtual core pointer'. Ignoring event.

on the logfile. The buffered actions prior to the hang are replayed after waiting for a while. At this stage it's quite easy to crash the server.

Revision history for this message
Jrand (jrand) wrote :

note recent updates for the xorg bug here:
https://bugs.freedesktop.org/show_bug.cgi?id=56578#c17

Revision history for this message
In , Peter Hutterer (peter-hutterer) wrote :

do you have a good backtrace for the crashes? random, or always the same spot? Is it regular in response to some interaction? can it be caused by the backports?

Revision history for this message
In , Timo Aaltonen (tjaalton) wrote :

Created attachment 76003
backtrace

Here's the backtrace, seems to be the same every time.

Way to reproduce here:

1. open an app, so there's a window around
2. attach an external pointer device
3. tailf the X logfile
4. hit the panel indicators frantically with the touchscreen, until the touch input is locked
5. move the window with the other pointer device
6. see how some "[Xi] ..." messages appear on the logfile
7. repeat the steps until..
8. .. when the touch input is locked the logfile will get these Xi messages after every touch.. when this happens keep hitting the screen until it crashes, can take a couple of minutes :)

so, it's only after using the other pointer device for a grab when the touch input grab is released. Also, while in step 8 I noticed that the multitouch gestures of unity seemed to work, while the panel menus failed to react. Also, Onboard seemed to work as well. So, while locked I can drag a window with a three-touch gesture but not by a single touch drag from the titlebar.

Not sure what backports you mean, this is 1.14 with your branch, but ajax's video abi commits reverted so the blob (and thus unity) work.

Revision history for this message
In , Maarten Lankhorst (mlankhorst) wrote :

Created attachment 76034
valgrind spam that occurs when following tjaalton's instructions

I can reproduce this on x1.14 with my macbook pro in the manner tjaalton described. It didn't need the video abi revert.

Revision history for this message
In , Peter Hutterer (peter-hutterer) wrote :

did you rebuild the drivers too? just wondering, because I used to get a similar crash on my backports but only when running against the system drivers, not against the upstream ones.

Revision history for this message
In , Maarten Lankhorst (mlankhorst) wrote :

I still crashed even if I rebuilt the drivers against the patched xorg-server, so it's not that.

Revision history for this message
In , Maarten Lankhorst (mlankhorst) wrote :

It seems that the ubuntu patches for synaptics trigger it, most likely not these:

02-do-not-use-synaptics-for-keyboards.patch
- makes synaptics no longer match input.keyboard

101_resolution_detect_option.patch
- Add resolutiondetect atom and config option, to add a way to disable autodetect

115_evdev_only.patch
- uncomment 50-synaptics.conf

118_quell_error_msg.patch
- only affects tools
124_syndaemon_events.patch
- only affects syndaemon

But these change some things around:
103_enable_cornertapping.patch
- sets RTCornerButton default to 2, and RBCornerButton default to 3

104_always_enable_tapping.patch
- always sets up tap buttons in set_default_parameters

106_always_enable_vert_edge_scroll.patch
- guess :-)

128_disable_three_click_action.patch
129_disable_three_touch_tap.patch
- both disable 3 touch actions, to make three-touch gestures work

Presumably one of those default tweaks would cause it. I'll try to nail it down.

Revision history for this message
In , Timo Aaltonen (tjaalton) wrote :

well I'm not using synaptics, so it's not the same crasher then?

Revision history for this message
In , Maarten Lankhorst (mlankhorst) wrote :

crashes unpatched too, after all :)

I guess I didn't hammer enough on the touchpad like a 3 year old

Revision history for this message
In , Maarten Lankhorst (mlankhorst) wrote :

The crash is in xorg-server by the way, not in the driver, and seems to involve memory freed in xorg-server. It just seems more likely that it involves multitouch handling in xorg-server in general, and is not a bug in a specific driver.

Either that or there are 2 different bugs in evdev and synaptics that both cause a similar backtrace in xorg-server, this somehow seems less likely to me. :)

Revision history for this message
In , Peter Hutterer (peter-hutterer) wrote :

can you bisect the server then? I honestly don't know where it triggers and given that it's 19 patches it'll be easier to bisect than figure it out otherwise.

fwiw, I've pushed the rebased branch (only a few squashes and reshuffling), please make sure you pull first.

Revision history for this message
In , Maarten Lankhorst (mlankhorst) wrote :

for reference, 1.13 server branch (at time of writing 1.13.3 release) crashes just as hard.

Revision history for this message
criser (devel-god) wrote :

I had similiar problems with ubuntu 13.04 on an Acer Iconia Tab W500.
The patches in https://bugs.freedesktop.org/show_bug.cgi?id=56578#c17 solved the problem for me.

Revision history for this message
In , Dsd-o (dsd-o) wrote :

Thanks a lot for the hard work here. We see the same issue in Sugar, the UI is basically unusable with touch as we have a "global" grab.

I tested the patches from comment 19 against xserver-1.14.0, they do solve the problem, and I cannot see any new issues introduced by them.

I also tested to 1.13.3. In order to do that I first had to backport a few commits:
* Update the MD's position when a touch event is received
* Don't use GetTouchEvents when replaying events
* Don't use GetTouchEvents in EmitTouchEnd

Then I added the patches from comment #19, and things are now working equally well there.

Revision history for this message
In , Timo Aaltonen (tjaalton) wrote :

Created attachment 77097
backtrace

the backport seems incomplete, since it's trivial to crash the server with unity by switching between opening the dash or indicator menus

Revision history for this message
In , Dsd-o (dsd-o) wrote :

The backported patches on 1.13.3 (from comment #32) have now been in OLPC's development builds for over a week and we haven't seen any adverse effects.

I've also done some testing on 1.14.0. I can make this crash (with no backtrace) simply by going a bit crazy on the touchscreen for a few minutes, both before and after this patch series. A problem for another day.

Based on this I would vote for going ahead with the merge of this patch series into master.

I also found a related bug with both 1.13.3 and 1.14.0 (both before and after these patches), and posted a patch here:
http://lists.x.org/archives/xorg-devel/2013-April/035878.html

Revision history for this message
In , Maarten Lankhorst (mlankhorst) wrote :

first valgrind error is on

int emulate_pointer = ! !(ev->device_event.flags & TOUCH_POINTER_EMULATED);

So I guess it's safe to assume that ev is garbage..
Other writes seem to be related to ev too, judging from the valgrind output I guess random stuff gets overwritten.

Looking at SetTapState output:

0 -> 1
1 -> 10
moving state stuff
10 -> 2
2 -> 10
moving state stuff
10 -> 2

and then a few more 2 -> 10 and 10 -> 2 with moves until valgrinds starts complaining and xserver starts crashing:

(II) SetTapState - 10 -> 2 (millis:3928387395)
==25788== Invalid read of size 4
==25788== at 0x24236E: ProcessOtherEvent (exevents.c:1519)
==25788== by 0x264CAE: ProcessPointerEvent (xkbAccessX.c:751)
==25788== by 0x166641: PlayReleasedEvents (events.c:1217)
==25788== by 0x16DED4: ComputeFreezes (events.c:1297)
==25788== by 0x16E2E3: AllowSome (events.c:1725)
==25788== by 0x16E495: ProcAllowEvents (events.c:1785)
==25788== by 0x15DC45: Dispatch (dispatch.c:432)
==25788== by 0x14C5B9: main (main.c:295)
==25788== Address 0x122336b0 is 16 bytes before a block of size 152 free'd
==25788== at 0x4C2BA6C: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==25788== by 0x806D84A: sna_mode_wakeup (sna_display.c:3500)
==25788== by 0x161F3B: WakeupHandler (dixutils.c:426)
==25788== by 0x2AF6E3: WaitForSomething (WaitFor.c:224)
==25788== by 0x15D9A0: Dispatch (dispatch.c:361)
==25788== by 0x14C5B9: main (main.c:295)

This is with the patches from comment #19 + daniel drake's patch

Digging more, looking up the InternalEvent struct..

    int emulate_pointer = ! !(ev->device_event.flags & TOUCH_POINTER_EMULATED);

Now this is a function that is looking verrrrrrrry suspicious for type == ET_TouchOwnership..

I think it would make sense to have ET_TouchOwnership handled directly by ProcessTouchOwnershipEvent, rather than through ProcessTouchEvent. Patch attached below..

Revision history for this message
In , Maarten Lankhorst (mlankhorst) wrote :

Created attachment 77621
Call ProcessTouchOwnershipEvent directly

Revision history for this message
In , Maarten Lankhorst (mlankhorst) wrote :

Valgrind came up with this complaint on 1.13.3 with the backported patches:

==15921== Invalid read of size 4
==15921== at 0x1D0A00: DeliverTouchEvents (exevents.c:1297)
==15921== by 0x1D2589: ProcessOtherEvent (exevents.c:1611)
==15921== by 0x1567C1: TouchEventHistoryReplay (touch.c:491)
==15921== by 0x1D0EBB: TouchPuntToNextOwner (exevents.c:1120)
==15921== by 0x1D11EB: TouchRejected (exevents.c:1196)
==15921== by 0x1D28B5: ProcessOtherEvent (exevents.c:1223)
==15921== by 0x1E7DAB: ProcessPointerEvent (xkbAccessX.c:751)
==15921== by 0x204DC5: mieqProcessDeviceEvent (mieq.c:556)
==15921== by 0x1570A7: TouchListenerAcceptReject (touch.c:1013)
==15921== by 0x1D6AD3: ProcXIAllowEvents (xiallowev.c:128)
==15921== by 0x1D2BD5: ProcIDispatch (extinit.c:406)
==15921== by 0x13CC0D: Dispatch (dispatch.c:428)
==15921== Address 0xc6a0bac is 4 bytes inside a block of size 68 free'd
==15921== at 0x482E5B0: free (vg_replace_malloc.c:446)
==15921== by 0x14C129: DeletePassiveGrab (grabs.c:336)
==15921== by 0x1527FD: doFreeResource (resource.c:873)
==15921== by 0x152F7F: FreeResource (resource.c:903)
==15921== by 0x14C49F: DeletePassiveGrabFromList (grabs.c:686)
==15921== by 0x144A7D: ProcUngrabButton (events.c:5640)
==15921== by 0x13CC0D: Dispatch (dispatch.c:428)
==15921== by 0x132035: main (main.c:298)

I picked the fixes from 57301 to 1.13 too: Xi: fix touch event selction conflicts (#57301), and the commit before that to make it apply.

This brings 1.13 dix and Xi to the 1.14 equivalent minus pointer barriers, as far as I can tell, but then I was getting the following segfault:

==1748== Invalid read of size 4
==1748== at 0x4831DCC: memcpy (mc_replace_strmem.c:878)
==1748== by 0x156959: TouchConvertToPointerEvent (touch.c:637)
==1748== by 0x1D0FA3: DeliverTouchEmulatedEvent.isra.0.part.1 (exevents.c:1375)
==1748== by 0x1D0C5F: DeliverTouchEvents (exevents.c:1920)
==1748== by 0x1D25B1: ProcessOtherEvent (exevents.c:1611)
==1748== by 0x1E7E03: ProcessPointerEvent (xkbAccessX.c:751)
==1748== by 0x1423B1: PlayReleasedEvents (events.c:1214)
==1748== by 0x146D13: ComputeFreezes (events.c:1294)
==1748== by 0x146F6B: AllowSome (events.c:1722)
==1748== by 0x1470BF: ProcAllowEvents (events.c:1785)
==1748== by 0x13CC0D: Dispatch (dispatch.c:428)
==1748== by 0x132035: main (main.c:298)
==1748== Address 0xcaa1284 is 156 bytes inside a block of size 280,000 free'd
==1748== at 0x482E5B0: free (vg_replace_malloc.c:446)
==1748== by 0x1570E3: TouchListenerAcceptReject (touch.c:1015)
==1748== by 0x146D6F: ComputeFreezes (events.c:1282)
==1748== by 0x146F6B: AllowSome (events.c:1722)
==1748== by 0x1470BF: ProcAllowEvents (events.c:1785)
==1748== by 0x13CC0D: Dispatch (dispatch.c:428)
==1748== by 0x132035: main (main.c:298)

Revision history for this message
In , Maarten Lankhorst (mlankhorst) wrote :

Note: macbook pro (synaptics) seems to work just fine with the 1.13.3 backports, so it looks like it's a separate bug due to different behavior on a true touch device. The valgrind backtraces were on arm/tegra, which also enables a software keyboard.

The easiest way to crash on ubuntu's xserver on the tegra is by making sure valgrind is running with --free-fill=fe so the freed memory is always reset to an invalid value.

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

I have partial (full) success (on the Lenovo Thinkpad Twist, an Intel-based convertible, see also bug 1068994):

I have rebuilt the current Raring package of xorg-server (1.13.3-0ubuntu5) with the following two patches:

1. http://cgit.freedesktop.org/~whot/xserver/commit/?h=touch-grab-race-condition-56578-v2&id=0498a4f0e0b90a850df7022a3356f10adabff855

(found via https://bugs.freedesktop.org/show_bug.cgi?id=56578#c17)

2. http://lists.x.org/archives/xorg-devel/2013-April/035878.html

and after that clicking via touch screen on the Lenovo Thinkpad Twist works reliably. Only remaining problems are (but the touch click ability does not get lost by them):

a. In Chromium when you create a new tab, the new tab contains icons for web apps (at least the app store and perhaps some examples). These icons cannot be clicked by touch, only with a mouse. All the rest in Chromium is clickable by touch.

b. Touch clicks do not work in XBMC, but after using and leaving XBMC with an external mouse on the normal desktop touch-clicking works again.

These are probably separate bugs which got revealed by the now working touch click.

Complete patch for xorg-server is attached.

Changed in xorg-server (Ubuntu):
importance: Medium → High
milestone: none → ubuntu-13.04
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

This bug is perhaps duplicate of bug 1099289 or bug 1068994. I have attached a patch (for xorg-server) to that bugs which solves the problem on the Lenovo Thinkpad Twist.

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Sorry, previous comment was meant for another bug.

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Possibly bug 1099289 or bug 1068994 are duplicates of this one.

Revision history for this message
In , Till Kamppeter (till-kamppeter) wrote :

Created attachment 78124
touch-fix.patch

I have partial (full?) success (on the Lenovo Thinkpad Twist, an Intel-based convertible, see also https://launchpad.net/bugs/1068994 and https://launchpad.net/bugs/1015183):

I have rebuilt the current Ubuntu Raring package of xorg-server (1.13.3-0ubuntu5) with the following two patches:

1. http://cgit.freedesktop.org/~whot/xserver/commit/?h=touch-grab-race-condition-56578-v2&id=0498a4f0e0b90a850df7022a3356f10adabff855

(found via comment #17)

2. http://lists.x.org/archives/xorg-devel/2013-April/035878.html

and after that clicking via touch screen on the Lenovo Thinkpad Twist works reliably. Only remaining (minor) problems are (but the touch click ability does not get lost by them):

a. In Chromium when you create a new tab, the new tab contains icons for web apps (at least the app store and perhaps some examples). These icons cannot be clicked by touch, only with a mouse. All the rest in Chromium is clickable by touch.

b. Touch clicks do not work in XBMC, but after using and leaving XBMC with an external mouse on the normal desktop touch-clicking works again.

These are probably separate bugs which got revealed by the now working touch click.

Complete patch for xorg-server is attached.

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Sorry, patch is not complete. Here is the correct one.

Revision history for this message
In , Till Kamppeter (till-kamppeter) wrote :

Created attachment 78125
touch-fix.patch

Sorry, patch is not complete. Here is the correct one.

Revision history for this message
In , Peter Hutterer (peter-hutterer) wrote :

ok, thanks to Maarten's debugging we've found the issue. listener->grab is not copied but rather referenced, leaving the grab stale once it was deleted. Reproducible test case is simply:

XGrabButton()
pointer-emulating touch down
XUngrabButton()
trigger touch update/end

This doesn't necessarily crash, but once you run through valgrind to reset memory after freeing it we have a reliable crasher.

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

I have built xorg-server with my patch also on the Nexus7 now and it works perfectly there with the desktop and all applications, too, and on the Nexu7 XBMC and Chromium's web apps work with touch.

It also seems to fix the Nexus 7 (bug 1068994).

Revision history for this message
In , Till Kamppeter (till-kamppeter) wrote :

I have built xorg-server with my patch also on the Nexus 7 (armhf) now and it works perfectly there with the desktop and all applications, too, and on the Nexus 7 XBMC and Chromium's web apps work with touch.

It also seems to fix the Nexus 7.

Revision history for this message
Krastanov (krastanov-stefan) wrote :

@till-kamppeter, could you provide these modified builds in order to test them on different hardware.

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

I have uploaded a test package (xorg-server 1.13.3-0ubuntu6~ppa1) to my PPA now. Please install it following the instructions to include the PPA as described in the section "Adding this PPA to your system" on https://launchpad.net/~till-kamppeter/+archive/ppa and then running the commands

sudo apt-get update
sudo apt-get upgrade

Does this fix your touch screen click problem?

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Binary test packages for the Nexus 7/armhf attached to bug 1068994.

Changed in xorg-server:
importance: Unknown → Medium
status: Unknown → In Progress
Revision history for this message
Krastanov (krastanov-stefan) wrote :

The packages can not be tested on 13.04 because of:

xserver-xorg-core:
 Depends: libaudit1 (>=1:2.2.1) but it is not installable
  Depends: libc6 (>=2.17) but 2.15-0ubuntu20.1 is to be installed
 Depends: libudev1 (>=183) but it is not installable

Revision history for this message
In , Peter Hutterer (peter-hutterer) wrote :

ok, I'll be honest. this is a giant mess where we potentially access dangling pointers and sorting this out is nasty. my attempts to do so today have failed badly. fix will come, but not too soon I'm afraid

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Krastanov, is your 13.04 completely up-to-date? I have created and tested the packages on an up-to-date 13.04 and there they work. Are you using the PPA (i386, amd64) or the binary package tarball (Nexus 7/armhf)?

Revision history for this message
Krastanov (krastanov-stefan) wrote :

I use the PPA and I have updated and upgraded the system before adding the PPA (but maybe my mirror was not up-to-date). Given your confirmation that it works, I will search for the error on my side. Thank you!

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Created a Blueprint about convertibles and the Ubuntu desktop with touch screen:

https://blueprints.launchpad.net/ubuntu/+spec/client-1305-convertibles-and-touch-desktop

Revision history for this message
In , Dsd-o (dsd-o) wrote :

Yes, I can see how time consuming this must be. Thanks for continuing to work on it, at OLPC we can promise you some testing once code is ready.

In the mean time I will add the latest 2 patches to our development builds for further testing:

Xi: Do not handle ET_TouchOwnership in ProcessTouchEvent
dix: copy event in TouchConvertToPointerEvent correctly

Revision history for this message
In , Peter Hutterer (peter-hutterer) wrote :

Please have a test of this branch here:
http://cgit.freedesktop.org/~whot/xserver/log/?h=touch-grab-race-condition-56578-v2

I'm not 100% sure yet if there's a memleak introduced - haven't done the required checks yet. but it fixes the crasher caused by the invalid memory dereference.

Revision history for this message
In , Till Kamppeter (till-kamppeter) wrote :

Peter, I have tested your new branch on the Lenovo Thinkpad Twist now. I do not get any crashes and left clicking by tapping is absolutely reliable for me. Right-clicking via onboard does not work for me though. If I activate the right-click mode and tap, the tap is interpreted as left click (right-click mode ignored). At least I do not get a stuck-left-button effect by the right click. I do not get any crash nore a stuck-button effect at all, independent what I am doing. What is missing now is a fix for the right click.

Revision history for this message
In , Dsd-o (dsd-o) wrote :

Thanks for continuing to work on this.

I believe the touch-grab-race-condition-56578-v2 patch series so far creates a problem with mouse input. In Sugar's Paint application, I can't paint anything by moving the mouse around with the button held down.

Running xev, I can see that clicking and holding the mouse button doesn't actually trigger any events. Only when I release, ButtonPress and ButtonRelease appear in quick succession.

If nobody beats me to it, I'll bisect this later this week. Also, the above test was done on xserver-1.13.3, I should also test on a newer version to make sure there aren't any other factors at play.

Revision history for this message
In , Till Kamppeter (till-kamppeter) wrote :

Daniel, Peter, I am using the the full GIT branch touch-grab-race-condition-56578-v2 which is 1.14 and here I have no problem with Sugar's Paint application (rgbPaint, am I right?). I can paint both with an external Bluetooth mouse with the left button held down and with my finger on the touch screen of the Lenovo Thinkpad Twist.

Revision history for this message
In , Dsd-o (dsd-o) wrote :

Thanks for testing. Sugar's paint app is http://activities.sugarlabs.org/en-US/sugar/addon/4082

It is probably more meaningful to do the xev test though. Click the mouse button and hold, you would expect a ButtonPress event to show immediately, but it doesn't. And do that under sugar, in case the global touch grabs are affecting things.

Revision history for this message
In , Till Kamppeter (till-kamppeter) wrote :

Daniel, on my 1.14 I do not see any problem, also when testing with xev. Both with the external mouse and my finger on the touch screen I see ButtonPress events when I press and hold the mouse button or when I put my finger onto the screen and I get ButtonRelease events when I release the mouse button or take my finger from the screen. This works all correctly for me.

Revision history for this message
In , Peter Hutterer (peter-hutterer) wrote :

Till, can you run this under valgrind please to make sure I didn't introduce any memory leaks?

Revision history for this message
In , Till Kamppeter (till-kamppeter) wrote :

Peter, how do I run the xorg server under Valgrind? I have a Ubuntu Raring system.

Revision history for this message
In , Till Kamppeter (till-kamppeter) wrote :

Another touch problem: If I run Chromium browser and try to drag and drop one of the tabs using the touch screen, the left button gets stuck down and it does not get even unstuck if I continue working with the external Bluetooth mouse. I can only kill the session.

It also happens sometimes that X crashes but without any message in /var/log/syslog.

Revision history for this message
In , Maarten Lankhorst (mlankhorst) wrote :

Created attachment 78472
/etc/X11/X-valgrind

For valgrinding xserver you want to install the xserver-xorg-core-dbg package from the binary you generated, and also install xserver-xorg-input*dbg and xserver-xorg-video*dbg and valgrind

I enabled auto valgrinding by creating /etc/X11/X-valgrind with the contents of this adjustment, make the file executable and then point the /etc/X11/X symlink to it. It will append the log to /var/log/Xorg-valgrind.HOSTNAME, so if xserver crashes you'll get detailed information why. :-)

Revision history for this message
In , Till Kamppeter (till-kamppeter) wrote :

Also with 1.14 XBMC behaves as in comment #39, not reacting to touch clicks. Looking more deeply into XBMC's behavior, the mouse cursor is put into the lower right corner of the screen when touch-clicking an arbitrary place, perhaps all touch clicks are registered with the coordinates of the lower right corner.

Revision history for this message
In , Till Kamppeter (till-kamppeter) wrote :

I have set up running X under Valgrind now. I have installed

xserver-xorg-core-dbg
valgrind
xserver-xorg-video-intel-dbg
xserver-xorg-video-modesetting-dbg
xserver-xorg-input-evdev-dbg
xserver-xorg-input-synaptics-dbg
libdrm2-dbg
libdrm-intel1-dbg

ThenI have installed Maarten's script, made it executable, and linked it. After that I have restarted X via

sudo restart lightdm

X is mnuch slower now, probably due to Valgrind's work.

Revision history for this message
In , Till Kamppeter (till-kamppeter) wrote :

First observation under Valgrind:

onboard pops up when touch-clicking an input field, but onboard is non-functional. Independent whether I touch-click the keys or use my external mouse, the keys do not react. No changes of the key's color, no character appearing in the input field. Also right-clicking does not work as one cannot operate the right-click button.

Revision history for this message
In , Till Kamppeter (till-kamppeter) wrote :

Created attachment 78475
Xorg-valgrind.till-twist

My Valgrind log as of now.

Revision history for this message
In , Till Kamppeter (till-kamppeter) wrote :

Installed libunwind8-dbg to improve Valgrind log, then restarted lightdm, logged in, and now onboard works.

Revision history for this message
In , Till Kamppeter (till-kamppeter) wrote :

Created attachment 78476
Xorg-valgrind.till-twist

Update of Valgrind log.

Revision history for this message
In , Till Kamppeter (till-kamppeter) wrote :

I have more experience with the onboard-aided right click (same running under Val;grind or without Valgrind):

Touch-clicking the right-click key on onboard makes it turning grey. After that doing one touch click on the desktop background does nothing. A second touch click on the background makes the right-click menu open and onboard disappear.

Right-clicking in Chromium does not work. The second click only makes onboard disappear but does not pop up the right-click menu of Chromium.

Revision history for this message
In , Till Kamppeter (till-kamppeter) wrote :

Same with the double-click emulation button of onboard: It also executes the double-click only on the second touch click (tested with Nautilus).

Revision history for this message
In , Till Kamppeter (till-kamppeter) wrote :

Created attachment 78483
Xorg-valgrind.till-twist.gz

Finally I succeeded to make X crashing again, I opened several programs (Firefox, Chromium, Thunderbird, Calculator, digikam), did some clicks in them, and closed them again. Then I opened LibreOffice Writer via the Launcher and got a window asking to recover a previous document which was not correctly closed. I rejected and when I answered the question whether I really want to reject with "Yes", X crashed.

Valgrind log attached.

Revision history for this message
In , Till Kamppeter (till-kamppeter) wrote :

Created attachment 78484
Xorg-valgrind.till-twist.gz

With LibreOffice Writer I can reproduce the crash reliably. Right after login I touch-click its icon in the Launcher, get the dialog to recover the document of the previous session, I reject, and as soon as I click "Yes" to confirm, X crashes, and X crashes fast enough so that LibreOffice does not clean up the document which I have rejected. In the next session I will get asked again.

If you cannot reproduce the crash as you do not have a broken document, try starting a new document and then "kill -9" LibreOffice. On the next session it should ask you for recovering your document.

Revision history for this message
In , Till Kamppeter (till-kamppeter) wrote :

Note: In the last two comments (and also in my other tests), I did all operations by touch clicking (if not otherwise stated).

Revision history for this message
In , Till Kamppeter (till-kamppeter) wrote :

Created attachment 78485
Xorg-valgrind.till-twist.gz

X crashes as well if I do the described steps with LibreOffice using my external Bluetooth mouse for all clicks and not the touch screen.

Valgrind log attached.

Revision history for this message
In , Dsd-o (dsd-o) wrote :

(In reply to comment #47)
> I believe the touch-grab-race-condition-56578-v2 patch series so far creates
> a problem with mouse input. In Sugar's Paint application, I can't paint
> anything by moving the mouse around with the button held down.
>
> Running xev, I can see that clicking and holding the mouse button doesn't
> actually trigger any events. Only when I release, ButtonPress and
> ButtonRelease appear in quick succession.

I have reproduced this by checking out the git branch in question and building it directly, so it was not a side effect of my earlier attempt (above) where I had backported this to 1.13.3.

The problem can be reproduced very easily: xinit /usr/bin/xev (running over ssh from another machine, to be able to see stdout)

Move the mouse cursor to the top left (where the xev window is). Click and hold the mouse button, and keep holding. No output from xev. Now release the mouse button, ButtonPress and ButtonRelease arrive at the same time. No touch input is needed to see this problem.

A few churns of "git bisect" later I have tracked this down to:

3e1515898545b0ed9e1f0794800c07061c8c8039 is the first bad commit
commit 3e1515898545b0ed9e1f0794800c07061c8c8039
Author: Peter Hutterer <email address hidden>
Date: Thu Apr 18 10:32:11 2013 +1000

    dix: drop DeviceIntRec's activeGrab struct

Revision history for this message
IDWMaster (webadm) wrote :

Can confirm this bug on a Samsung Series 7 slate. No touch input is recognized for Plasma Active or Unity, however XInput is reporting touch events (acts just like a mouse, instead of a multitouch screen).

Revision history for this message
In , Till Kamppeter (till-kamppeter) wrote :

Created attachment 78643
Xorg-valgrind.till-twist.gz

Another crash, this time I was visiting http://www.tagesspiegel.de/ with the Chrome browser. As usual, Valgrind log attached.

Revision history for this message
In , Till Kamppeter (till-kamppeter) wrote :

Created attachment 78644
Xorg-valgrind.till-twist.gz

Another crash: Still visiting http://m.tagesspiegel.org/, watching one of the videos, tried to maximize the Chrome window -> X crashed. Valgrind log attached again.

Revision history for this message
RobertZenz (robert-zenz) wrote :

I can reproduce this (not reliable) on a Tega v2 (aka Viewpad 10, aka Nexoc Pad 10). Touchscreen is reported as "1d6b:0002 Hanvon 10.1 Touch screen overlay". xev reports a mousebutton release, but no press/keydown/whatever it is shown.

Revision history for this message
In , Peter Hutterer (peter-hutterer) wrote :

the libreoffice hint helped a lot tracking this down. New branch posted (top commit b8a2de82e36dd922843618f15703113dd556b164 dix: fix cursor refcounting
). Please give this a test. looks like my test box here is happy and valgrind doesn't see any leaks (yet)

Revision history for this message
In , Maarten Lankhorst (mlankhorst) wrote :

Created attachment 78801
nexus valgrind log for latest attempt

Still a bit buggy. On the nexus7 I can cause it to drop events in the same way still..

What I do is touch the ubuntu dash icon in upper left, then release finger and make a dragging motion with the dash icon. I'm not 100% sure if the touch was fully released, or it just stopped registering my finger. But this (still) results in the following spam from xserver:

[Xi] Virtual core pointer: Failed to get event 8 for touchpoint 1
[Xi] Virtual core pointer: Failed to get event 8 for touchpoint 1
[Xi] Virtual core pointer: Failed to get event 8 for touchpoint 2
source device 7: history size 100 overflowing for touch 12
(history size overflowing repeated a lot, for touch 12 and 13)

Stopping lightdm doesn't crash any more and shows no leak. Only thing that may or may not be relevant is a still reachable warning:

==3663== 16,384 bytes in 4 blocks are still reachable in loss record 245 of 246
==3663== at 0x482D4B8: calloc (vg_replace_malloc.c:593)
==3663== by 0x216F23: WriteToClient (io.c:1017)
==3663== by 0x142667: WriteEventsToClient (events.c:5982)
==3663== by 0x142747: TryClientEvents (events.c:1968)
==3663== by 0x144905: DeliverEventToInputClients (events.c:2116)
==3663== by 0x144A99: DeliverEventsToWindow (events.c:2151)
==3663== by 0x144D51: ProcSendEvent (events.c:5411)
==3663== by 0x13B9D5: Dispatch (dispatch.c:432)
==3663== by 0x130D2F: main (main.c:295)

Full log for the session is attached as vg.nexus

Revision history for this message
In , Till Kamppeter (till-kamppeter) wrote :

Peter, I have tried your new snapshot (comment #70) and so far I did not get crashes. Touch operation without right-clicking works well for me now. The right-click emulation via Onboard is still broken, though.

Revision history for this message
In , Dsd-o (dsd-o) wrote :

(In reply to comment #70)
> the libreoffice hint helped a lot tracking this down. New branch posted (top
> commit b8a2de82e36dd922843618f15703113dd556b164 dix: fix cursor refcounting
> ). Please give this a test. looks like my test box here is happy and
> valgrind doesn't see any leaks (yet)

I would like OLPC to help with this testing, but the xev problem in comment #67 is getting in our way. Have you had a chance to investigate this yet?

Revision history for this message
In , Peter Hutterer (peter-hutterer) wrote :

daniel - xev behaves normally for me in the last branch. is it still misbehaving for you?

Revision history for this message
In , Dsd-o (dsd-o) wrote :

Yep, reproduced with HEAD b8a2de82e3, bisection identifies the first bad commit as 3e15158985.

Revision history for this message
In , Peter Hutterer (peter-hutterer) wrote :

tried to bisect this, but I can't see any difference in the xev output before or after that commit. Tested several revisions after (and 3e15158985) and xev works as expected.

fwiw, my test box here is Ubuntu 12.10 with the server branch above, rest as-is. mouse used is a trackpoint, which for all purposes looks like a mouse.

test case was xinit /usr/bin/xev -- /opt/xorg/bin/Xorg -retro, then clicking+dragging into the xev window. events as expected.

Revision history for this message
In , Peter Hutterer (peter-hutterer) wrote :

> ==3663== 16,384 bytes in 4 blocks are still reachable in loss record 245 of
> 246
> ==3663== at 0x482D4B8: calloc (vg_replace_malloc.c:593)
> ==3663== by 0x216F23: WriteToClient (io.c:1017)
> ==3663== by 0x142667: WriteEventsToClient (events.c:5982)
> ==3663== by 0x142747: TryClientEvents (events.c:1968)
> ==3663== by 0x144905: DeliverEventToInputClients (events.c:2116)
> ==3663== by 0x144A99: DeliverEventsToWindow (events.c:2151)
> ==3663== by 0x144D51: ProcSendEvent (events.c:5411)
> ==3663== by 0x13B9D5: Dispatch (dispatch.c:432)
> ==3663== by 0x130D2F: main (main.c:295)

This appears to be present in 1.14.0, not introduced by this series.

I raise a white flag on the other issue though, like the bug Daniel sees I cannot reproduce it here.

Revision history for this message
In , Dsd-o (dsd-o) wrote :

(In reply to comment #76)
> tried to bisect this, but I can't see any difference in the xev output
> before or after that commit. Tested several revisions after (and 3e15158985)
> and xev works as expected.

Thanks for testing - I have now looked closer.

The patch removes a field from struct _GrabInfoRec. That is an ABI change, what does it affect? It does seem to break stuff outside of the xserver according to my initial test.

If I readd the field, even though it is now unused, xev works again.

Revision history for this message
In , Peter Hutterer (peter-hutterer) wrote :

oh, right. sorry, I forgot to mention this - it is indeed a ABI break so you have to recompile the drivers (or add the now-unused field back in). Maarten, this could also be the reason for your bug?

Revision history for this message
In , Peter Hutterer (peter-hutterer) wrote :

Pushed the branch with a fix to keep the ABI, please test de12ce91d8e44ab9398e730b457e5abc8d1acbe6

Revision history for this message
In , Timo Aaltonen (tjaalton) wrote :

I built it, and changing between dash and indicators soon hangs with this on the log:

[ 3110.957] (EE) BUG: triggered 'if (!pGrab)'
[ 3110.957] (EE) BUG: ../../dix/grabs.c:258 in FreeGrab()
[ 3110.957] (EE)
[ 3110.957] (EE) Backtrace:
[ 3110.957] (EE)

gdb doesn't give anything, just the usual WaitForSomething etc

Revision history for this message
In , Dsd-o (dsd-o) wrote :

(In reply to comment #80)
> Pushed the branch with a fix to keep the ABI, please test
> de12ce91d8e44ab9398e730b457e5abc8d1acbe6

Built this and can't see any problems after a quick test. I'll ship this in upcoming OLPC development builds for wider testing.

Revision history for this message
In , pauls (paulatgm) wrote :

I have a lenovo S10-3t with full keyboard, synaptics touchpad and cando 2 touch screen that I'd like to try this on. I have ubuntu 13.04 on it. What are the git commands to access de12ce91d8e44ab9398e730b457e5abc8d1acbe6 and does it just replace the xserver-xorg or do I have to rebuild the other xorg parts too?

Revision history for this message
In , pauls (paulatgm) wrote :

Sorry, I found the files on the pages referenced above, so don't need any reply.

Revision history for this message
In , Maarten Lankhorst (mlankhorst) wrote :

Is make check failing for anyone else with v3?

(EE) test device: not enough space for touch events (max 5 touchpoints). Dropping this event.
(EE) test device: not enough space for touch events (max 5 touchpoints). Dropping this event.
(EE) test device: not enough space for touch events (max 5 touchpoints). Dropping this event.
/bin/bash: line 5: 26164 Segmentation fault MALLOC_PERTURB_=15 ${dir}$tst
FAIL: touch

Program received signal SIGSEGV, Segmentation fault.
TouchInitTouchPoint (t=t@entry=0x4196e950, v=0x0, index=index@entry=0) at ../../dix/touch.c:243
243 ti->valuators = valuator_mask_new(v->numAxes);

Revision history for this message
In , pauls (paulatgm) wrote :

I still need help compiling the test branch of xserver on ubuntu 13.04. If I try to compile it, detailed here http://www.x.org/wiki/CompileXserverManually it fails with complaints of wrong versions of x11proto. But, I have verified that the correct packages are actually installed on my system. So, I tried using jhbuild which builds everything in your home directory, details here http://www.x.org/wiki/JhBuildInstructions But, when I launch the jhbuild version, it crashes because it doesn't include my synaptics touchpad or cando touch screen. It won't run without input devices. So, can you provide some insight as to how I can build and test this xserver? Since some of you are using ubuntu, perhaps more specific instructions would work for me.

TIA

Revision history for this message
In , Peter Hutterer (peter-hutterer) wrote :

(In reply to comment #85)
> Is make check failing for anyone else with v3?

caused by a patch merged into master (and thus picked up on v3), fix is here:
http://patchwork.freedesktop.org/patch/13687/

Revision history for this message
In , Maarten Lankhorst (mlankhorst) wrote :

paul:

add-apt-repository ppa:canonical-x/x-staging
apt-get update
apt-get dist-upgrade
apt-get build-dep xorg-server

will get you 1.14 + necessary build dependencies. Copy the debian directory from xserver 1.14, and comment out each patch that fails to apply in debian/patches/series

Revision history for this message
In , John Faulkner (johnnyuk) wrote :

(In reply to comment #88)

Hello.

I would like to provide testing for this bug if possible but I'm not exactly clued up on compiling xorg-server from scratch. I figure it could be useful to have a none-standard (ie not a laptop or tablet device) low-end hardware test case but if it's unlikely to be useful then please let me know.

One thing I've noticed is that once this bug has triggered (rendering most GTK applications and the unity dash unusable), Nautilus continues to function normally with the touch screen. Can anyone else confirm this on a standard Ubuntu 13.04 installation?

Anyway, I can see the branch you're talking about and can clone the git repository no problem.

> Copy the debian directory from xserver 1.14, and comment out each patch that fails to apply in debian/patches/series

I'm not certain which directory / patches you're referring to here, could you point me in the right direction?

I can duplicate this bug every time with a custom application which uses a GtkToolPalette. It appears to trigger every time I tap a category which produces a smooth roll-out animation - the hardware is pretty low end so I suppose this additional load triggers a race condition? I can trigger the bug in other normal uses but this one is guaranteed every time.

Revision history for this message
In , Maarten Lankhorst (mlankhorst) wrote :

grab http://people.canonical.com/~mlankhorst/xorg-server_1.14.1.orig.tar.gz
and xorg-server_1.14.1-0ubuntu0.3+1.15rc1+touch.diff.gz

Revision history for this message
In , John Faulkner (johnnyuk) wrote :

(In reply to comment #90)

Thank you, Maarten. I can patch and compile that copy but for some reason I'm getting a compilation error with the de12ce91d8e44ab9398e730b457e5abc8d1acbe6 branch in /dix/window.c line 421-425:

> REGION_INIT(pScreen, &pWin->clipList, &box, 1);
> REGION_INIT(pScreen, &pWin->winSize, &box, 1);
> REGION_INIT(pScreen, &pWin->borderSize, &box, 1);
> REGION_INIT(pScreen, &pWin->borderClip, &box, 1);

> window.c:421:5: error: the comparison will always evaluate as ‘true’ for the
> address of ‘box’ will never be NULL [-Werror=address]

Any ideas?

Revision history for this message
In , Peter Hutterer (peter-hutterer) wrote :

sorry guys, please take the compilation errors to the list. This bug is confusing enough with >90 comments and I'd like to keep off-topic stuff to a minimum.

pushed a new version of the branch after fixing a cursor refcounting issue that crashed my server when dragging and email in thunderbird. new branch tip is 9a5ad65330693b3273972b63d10f2907d9ab954a. This one also includes the fix Daniel wrote originally to avoid stuck buttons (http://lists.x.org/archives/xorg-devel/2013-April/035878.html)

Revision history for this message
In , Maarten Lankhorst (mlankhorst) wrote :

That fixed up the background corruptions and hangs on armhf/nexus 7, but I'm still seeing a stuck mouse button, and [ 77305.765] [Xi] Virtual core pointer: Failed to get event 8 for touchpoint 1.

Revision history for this message
In , Maarten Lankhorst (mlankhorst) wrote :

nm, bg is still corrupt when running in valgrind :(

Changed in hwe-next:
status: New → In Progress
assignee: nobody → James M. Leddy (jm-leddy)
Revision history for this message
In , Peter Hutterer (peter-hutterer) wrote :

fwiw, the latest branch got merged into master. It's still buggy but an improvement over the previous state.

commit c76a1b343d6a56aa9529e87f0eda8d61355d562b
Merge: 891123c 9a5ad65
Author: Keith Packard <email address hidden>
Date: Thu May 23 19:58:36 2013 -0600

    Merge remote-tracking branch 'whot/touch-grab-race-condition-56578-v3'

Revision history for this message
In , Dsd-o (dsd-o) wrote :

Thanks for all your work on this. At OLPC we've been testing the branch but have been a couple of commits behind the tip. Anyway, I think its still worth contributing the test result: no problems seen.

Revision history for this message
In , Jrenyard (jrenyard) wrote :

I would like to be any help I can with this bug fix. I am able to test on an 18.5" Winmate M185D as well as a 10" Winmate device (W10ID3S-PCH1). I am currently running Unity 13.04 and can make any necessary changes to the system. Please let me know what I can do to test and how to do it. I feel a bit over my head, but am willing to learn in order to be helpful.

Revision history for this message
In , Cody Swanson (codyswanson4) wrote :

Wondering if anything has been happening in a while...

Revision history for this message
In , Dsd-o (dsd-o) wrote :

Peter fixed a load of stuff and it got merged in xserver master. Unfortunately there have not been any development releases of xserver master since that happened, but that will come in time.

If you are still seeing problems, and are definitely using xserver master, then I suggest explaining your problem here (if you are sure that you are seeing the same issue), or opening a new bug report (if it seems like your issue might be unrelated).

Revision history for this message
In , Maarten Lankhorst (mlankhorst) wrote :

The fix for bug #66720 looks relevant, commit 8eeaa74bc241acb41f1d upstream, it seems something broke for me though, so I can't test it right now.

Revision history for this message
In , Maarten Lankhorst (mlankhorst) wrote :

Nope, and I noticed a BUG on !pGrab in FreeGrab, I'll try it a bit more on monday.

Revision history for this message
In , Cody Swanson (codyswanson4) wrote :

(In reply to comment #99)
> Peter fixed a load of stuff and it got merged in xserver master.
> Unfortunately there have not been any development releases of xserver master
> since that happened, but that will come in time.
>
> If you are still seeing problems, and are definitely using xserver master,
> then I suggest explaining your problem here (if you are sure that you are
> seeing the same issue), or opening a new bug report (if it seems like your
> issue might be unrelated).

Thanks for the sumary! I was just wondering. Thanks!

Revision history for this message
In , Peter Hutterer (peter-hutterer) wrote :

(In reply to comment #101)
> Nope, and I noticed a BUG on !pGrab in FreeGrab, I'll try it a bit more on
> monday.

merged as 0e3be0b25fcfeff386bad132526352c2e45f1932 yesterday.

as for the rest, I really need something that's reproducible.

Revision history for this message
In , Maarten Lankhorst (mlankhorst) wrote :

I think the changes to onboard to use xinput2 directly may have fixed the remaining issue I was having. When I checked out onboard from trunk and used it on my nexus7 things worked, and nothing got stuck.

Revision history for this message
In , Till Kamppeter (till-kamppeter) wrote :

Maarten, I have checked with the new onboard ("bzr branch lp:onboard") now on an up-to-date Saucy with xserver packages from the x-staging PPA and I do not get a stuck-mouse-button effect any more.

Revision history for this message
In , Till Kamppeter (till-kamppeter) wrote :

I did further testing over longer time and no stuck button. Its seems that with the current X from the x-staging PPA and the current Onboard from the onboard PPA the problem is solved.

Revision history for this message
In , Peter Hutterer (peter-hutterer) wrote :

Thanks for testing. I'm going to close this one as fixed since we definitely fixed quite a few bugs in this patch set. If there's something left please file a new bug so we can narrow down the new (old? :) issues.

Changed in xorg-server:
status: In Progress → Fix Released
Revision history for this message
Maarten Lankhorst (mlankhorst) wrote :

Upstream marked this as fixed. So this should be fixed in saucy now. Backporting this is non-trivial, and it might be easier to test if using a newer version of onboard fixes this problem. Newer versions of onboard workaround it by using xi2 events directly.

Changed in xorg-server (Ubuntu):
status: In Progress → Fix Released
Changed in xorg-server (Ubuntu Precise):
assignee: nobody → Maarten Lankhorst (mlankhorst)
Revision history for this message
Chris Fester (camaronut) wrote :

For folks using Ubuntu 12.04LTS, and can't use the quantal/raring/newer X server (due to whatever reasons, like maybe a binary-only video driver for a "legacy" video card), this patch may work for you.

It's a first attempt at backporting Peter Hutterer's touch-grab-race-condition-56578-v3 branch. Some sections aren't pretty due to all the indentation changes, but it works for me. :) The patch was done mostly by hand.

In order to use the patch you have to comment out the following from the series file:
505_query_pointer_touchscreen.patch
506_touchscreen_pointer_emulation_checks.patch
507_touchscreen_fixes.patch

Let me re-state, this patch is for xserver-xorg-core_1.11.4-0ubuntu10.*.deb Specifically I based it off of xserver-xorg-core_1.11.4-0ubuntu10.14_i386.deb

Please let me know what you think. Thanks!
Chris

Revision history for this message
francisct (franciscotetremblay) wrote :

Can someone sum up what we have to do in 13.04 to get rid of the stuck click problem? I am new to ubuntu, I have installed ubuntu 13.04 on my nexus 7. When I dist-upgrade from ppa:canonical-x/x-staging, it just boot up to a black screen. I get notification or error and I have anotification that I am connected to my network but desktop is black. What do I do?

Revision history for this message
Chris Fester (camaronut) wrote :

Hi all,

The patch I posted previously had a bug in xf86UnrealizeCursor(). I had accidentally used dixLookupScreenPrivate(), when I should have used dixLookupPrivate(). The attached patch is an update with the fix.

Chris

Revision history for this message
Shawn Rutledge (shawn-t-rutledge) wrote :

This is quite a severe bug. If you have a touchscreen connected, and you have touched it at some point:

1) start gitk or tkinfo or a recent Qt Creator (or probably many other Qt 5 programs)
2) scroll some long text with the mouse wheel
3) move the mouse

It selects text as if the left mouse button was being pressed. So in other words if you have a touchscreen your mouse wheel isn't very useful anymore in certain applications.

I think it should be fixed in 12.04 too, not just in newer releases.

Revision history for this message
Maarten Lankhorst (mlankhorst) wrote :

It should be fixable on precise by installing xserver-xorg-lts-saucy.

Changed in hwe-next:
assignee: James M. Leddy (jm-leddy) → nobody
Revision history for this message
Steve Langasek (vorlon) wrote :

The Precise Pangolin has reached end of life, so this bug will not be fixed for that release

Changed in xorg-server (Ubuntu Precise):
status: New → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Related questions

Remote bug watches

Bug watches keep track of this bug in other bug trackers.