wacom stylus jumps with latest xserver-xorg-core

Bug #799202 reported by Jean-Baptiste Mardelle
80
This bug affects 12 people
Affects Status Importance Assigned to Milestone
Wizardpen
New
Undecided
Unassigned
qt4-x11 (Ubuntu)
Fix Released
Medium
Chase Douglas

Bug Description

Wacom input jumps while drawing with xserver-xorg-core version 2:1.10.1-1ubuntu1.1
It is working correctly with version 2:1.10.1-1ubuntu1.

This issue is somehow related to issue #762938 (no pressure sensitivity with wacom tablet).

A fix for pressure sensitivity was proposed by Chase Douglas in the utouch-team/unstable ppa.

Using the official ubuntu Qt version, stylus position works fine, but pressure sensitivity does not work.
When using Chase Douglas's ppa, pressure works fine, but the cursor position jumps while drawing.

Note that the issue only happens when using the wacom stylus that is "pressure sensitive", not when using the wacom mouse that has no pressure.

As previously said, the "jumping cursor" issue disappears if I downgrade xserver-xorg-core to version 1.10.1-1ubuntu1

The bug can be seen in Krita, when drawing a line, the cursor jumps, a picture showing the problem can be seen here:
https://bugs.launchpad.net/ubuntu/+source/xorg-server/+bug/799202/+attachment/2174502/+files/pressure_bug.png

I can reproduce the issue on a tablet pc with touch sensitive screen and a desktop pc with usb Wacom tablet.

At least 2 other users are having the same issue, see:
https://bugs.launchpad.net/ubuntu/+source/pencil/+bug/762938

Using Ubuntu 11.04

ProblemType: Bug
DistroRelease: Ubuntu 11.04
Package: xserver-xorg-core 2:1.10.1-1ubuntu1.1
ProcVersionSignature: Ubuntu 2.6.38-10.44-generic-pae 2.6.38.7
Uname: Linux 2.6.38-10-generic-pae i686
Architecture: i386
CompizPlugins: No value set for `/apps/compiz-1/general/screen0/options/active_plugins'
CompositorRunning: kwin
Date: Sat Jun 18 18:44:38 2011
DistUpgraded: Fresh install
DistroCodename: natty
DistroVariant: kubuntu
DkmsStatus:
 virtualbox-ose, 4.0.4, 2.6.38-9-generic-pae, i686: installed
 virtualbox-ose, 4.0.4, 2.6.38-10-generic-pae, i686: installed
GraphicsCard:
 Intel Corporation Core Processor Integrated Graphics Controller [8086:0046] (rev 02) (prog-if 00 [VGA controller])
   Subsystem: Lenovo Device [17aa:215a]
InstallationMedia: Kubuntu 11.04 "Natty Narwhal" - Alpha i386 (20110202)
MachineType: LENOVO 2985FJG
ProcEnviron:
 LANGUAGE=
 LANG=en_US.UTF-8
 SHELL=/bin/bash
ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-2.6.38-10-generic-pae root=UUID=1524b654-818e-4d16-807f-4e0db5f1b26f ro quiet splash vt.handoff=7
ProcKernelCmdLine_: BOOT_IMAGE=/boot/vmlinuz-2.6.38-10-generic-pae root=UUID=1524b654-818e-4d16-807f-4e0db5f1b26f ro quiet splash vt.handoff=7
Renderer: Unknown
SourcePackage: xorg-server
UpgradeStatus: No upgrade log present (probably fresh install)
dmi.bios.date: 09/15/2010
dmi.bios.vendor: LENOVO
dmi.bios.version: 6QET53WW (1.23 )
dmi.board.name: 2985FJG
dmi.board.vendor: LENOVO
dmi.board.version: Not Available
dmi.chassis.asset.tag: No Asset Information
dmi.chassis.type: 10
dmi.chassis.vendor: LENOVO
dmi.chassis.version: Not Available
dmi.modalias: dmi:bvnLENOVO:bvr6QET53WW(1.23):bd09/15/2010:svnLENOVO:pn2985FJG:pvrThinkPadX201Tablet:rvnLENOVO:rn2985FJG:rvrNotAvailable:cvnLENOVO:ct10:cvrNotAvailable:
dmi.product.name: 2985FJG
dmi.product.version: ThinkPad X201 Tablet
dmi.sys.vendor: LENOVO
version.compiz: compiz N/A
version.libdrm2: libdrm2 2.4.23-1ubuntu6
version.libgl1-mesa-dri: libgl1-mesa-dri 7.10.2-0ubuntu2
version.libgl1-mesa-dri-experimental: libgl1-mesa-dri-experimental N/A
version.libgl1-mesa-glx: libgl1-mesa-glx 7.10.2-0ubuntu2
version.xserver-xorg: xserver-xorg 1:7.6+4ubuntu3.1
version.xserver-xorg-video-ati: xserver-xorg-video-ati N/A
version.xserver-xorg-video-intel: xserver-xorg-video-intel 2:2.14.0-4ubuntu7
version.xserver-xorg-video-nouveau: xserver-xorg-video-nouveau N/A

Revision history for this message
Jean-Baptiste Mardelle (jb-kdenlive) wrote :
Revision history for this message
m4v (m4v) wrote :

the screenshot link seems to be broken?

description: updated
Revision history for this message
Jean-Baptiste Mardelle (jb-kdenlive) wrote :

I attached the image to the bug report, since I cannot find a way to link it correctly

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

I believe I found the cause of this regression. The wacom tablet sometimes sends button presses on one of the X devices that does not emit (or has not emitted yet) traditional X and Y coordinates. This confuses the server due to masked valuators and coordinate transformation. The fix is to not generate and propagate any coordinate changes if the incoming event does not have any coordinate changes.

Please test out the xserver-xorg-core package in ppa:utouch-team/unstable after it has built. The package version should be 1.10.2-1ubuntu1.2~utouch1.

Thanks!

Changed in xorg-server (Ubuntu):
assignee: nobody → Chase Douglas (chasedouglas)
importance: Undecided → Medium
status: New → In Progress
Revision history for this message
Jean-Baptiste Mardelle (jb-kdenlive) wrote :

I tested your package (xserver-xorg-core), but it doesn't change anything, sorry. I see no difference with the official 2:1.10.1-1ubuntu1.1 version.

sudo dpkg -s xserver-xorg-core reports:

Package: xserver-xorg-core
Status: install ok installed
Priority: optional
Section: x11
Installed-Size: 3736
Maintainer: Ubuntu X-SWAT <email address hidden>
Architecture: i386
Source: xorg-server
Version: 2:1.10.2-1ubuntu1.2~utouch1
(...)

Revision history for this message
klerfayt (klerfayt-deactivatedaccount) wrote :

I do see a difference: now pressing on "expresskey" won't jump the mouse cursor to the upper left corner. This fixes bug #560180

However Krita is still unusable with odd diagonal lines appearing from (or to) upper left corner of the screen.

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

I was working off of the recording attached in bug 762938. I saw the button presses that warped the pointer to 0/0 and hoped that fixing that would help. Do you see the spurious lines if you play back the recording? If not, can you create a new recording? Instructions can be found at https://wiki.ubuntu.com/Multitouch/Testing/uTouchEvEmu#Debugging.

Thanks!

Revision history for this message
Jean-Baptiste Mardelle (jb-kdenlive) wrote :

Yes, I can see the unwanted lines when playing back the record. I attach the recording in case it can be useful

Revision history for this message
Jean-Baptiste Mardelle (jb-kdenlive) wrote :

I mean that I can see the lines when playing the record from bug 762938, and attached in my previous comment is another recording from me that also shows the lines on playback, here is also my device.prop.

Revision history for this message
klerfayt (klerfayt-deactivatedaccount) wrote :

>I saw the button presses that warped the pointer to 0/0 and hoped that fixing that would help.

Oh, I see ;-)

You didn't tell not to press buttons while moving the stylus! The recording for bug 762938 probably only contains buttons presses that I myself pressed frantically, I think I even used touchring.

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

klerfayt,

Actually, I'm glad you played with all the input knobs on the tablet so I would know if anything was broken :).

I think I realized why I wasn't seeing the issue on my natty development machine. I had installed a newer version of xserver-xorg-input-wacom, and it behaves differently. This may be a bug in the wacom input module that has been fixed already.

With the xorg-server-core package from the ppa installed, please also download and install the Oneiric xserver-xorg-input-wacom package to see if it fixes things. Here are download links:

https://launchpad.net/ubuntu/+archive/primary/+files/xserver-xorg-input-wacom_0.11.0-0ubuntu1_i386.deb
https://launchpad.net/ubuntu/+archive/primary/+files/xserver-xorg-input-wacom_0.11.0-0ubuntu1_amd64.deb

Thanks!

Revision history for this message
klerfayt (klerfayt-deactivatedaccount) wrote :

With xserver-xorg-input-wacom_0.11.0-0ubuntu1_amd64.deb nothing is drawn on the canvas no matter how hard stylus is pressed.
Preview in "edit brush settings" does work, but has same old diagonal lines problem.

Intuos4 in Mypaint works without any problems.

Revision history for this message
Jean-Baptiste Mardelle (jb-kdenlive) wrote :

I also tested, and installing the 0.11 version of xserver-xorg-input-wacom did not change anything for me.

Revision history for this message
klerfayt (klerfayt-deactivatedaccount) wrote :

@ j-b-m, by "not change anything" you mean you can draw in Krita? Strange that we get different results then. I got Intuos4 medium, the same model as you (if I understood everything correctly here).

Revision history for this message
Eduard Hasenleithner (eduard-hasenleithner) wrote :

When will there be an updated package for oneiric? I have the problem of cursor movement to 0/0 when using the PAD device of Intuos4.

Revision history for this message
Eduard Hasenleithner (eduard-hasenleithner) wrote :

This bug has probably been fixed in oneiric, see #806256 (2:1.10.2.902-1ubuntu2).

Revision history for this message
Shaved Wookie (shavedwookie) wrote :

Has anyone tried? If so, do we know if it will be backported to Natty?

Revision history for this message
Shaved Wookie (shavedwookie) wrote :

Ok. I just tried and....

This bug is NOT FIXED in Oneiric.

I have pressure sensitivity, but I still get the jumps and ghost lines. It's a completely fresh and updated install. Vanilla in all other ways, using latest compiled Krita from master.

Revision history for this message
Animtim (animtim) wrote :

I confirm this IS NOT FIXED.
And I can add that Graphire4 tablet doesn't draw anything on canvas in Krita as klerfayt noticed in comment #12,
while Intuos3 can paint with pressure but with jumping ghost lines like shavedwookie describes.

Revision history for this message
Jean-Baptiste Mardelle (jb-kdenlive) wrote :

I investigated a bit and reverting the fix for issue #774938 (1) fixes the problem and my touch / stylus work correctly.
So the regression is introduced by the following patch

503_fix_masked_transformed_valuators.patch

Using a Lenovo X201T with Wacom touchscreen. Let me know if I can help in any other way.

(1) https://bugs.launchpad.net/ubuntu/+source/xorg-server/+bug/774938

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

I don't have any device recordings that show this behavior. Can someone who sees the issue please record the device and attach the files here. Instructions can be found at: https://wiki.ubuntu.com/Multitouch/Testing/uTouchEvEmu#Debugging.

Thanks!

Revision history for this message
Jean-Baptiste Mardelle (jb-kdenlive) wrote :
Revision history for this message
Jean-Baptiste Mardelle (jb-kdenlive) wrote :
Revision history for this message
Jean-Baptiste Mardelle (jb-kdenlive) wrote :

I attached 3 files, with 2 recordings in case it can help. First one is with the bug, second one without the bug (patched xserver-xorg-core):

* "lenovo X201t props" is the result from evemu-describe,
* "lenovo X201t record" is the result from evemu-record (see #1)
* "lenovo X201t patched record" is the result from evemu-record (see #2)

#1: This recording is produced with the official xserver-xorg-core and xf86-input-wacom, using latest Oneiric. In Krita, the stylus gives either no pressure (When trying to draw on the canvas, the pointer moves but nothing is drawn), or I get the random lines appearing (when drawing in "Edit brush" preview zone) as described in comment #12 by klerfayt

#2: This recording is produced with same system as #1 but with xserver-xorg-core recompiled without the 503 and 504 patches (504 conflicts when 503 is not applied) - as described in my previous comment, and the stylus works correctly.

Revision history for this message
Jean-Baptiste Mardelle (jb-kdenlive) wrote :

I don't know if it is of any interest, but I tried to replay the 2 record files that I just attached to this bug report with evmu-play.

When using the official xserver-xorg-core, nothing is drawn in Krita. I can see the cursor move but nothing is drawn with both recordings (the buggy and the correct one).

But when playing them with my patched xserver (without the 503 patch), both files play fine and I can see the drawings without random lines with the 2 recordings.

So it seems that the bug will not be seen in these recording, but is in the way that xorg interprets the recordings...

regards

Revision history for this message
Jussi Pakkanen (jpakkane) wrote :

I get the same behaviour: regular oneiric X does not draw anything on the trace files, taking out patches 503 and 504 makes things work. However there is one major difference.

When I use my own Wacom Bamboo Pen & Touch, pressure sensitivity works. The recordings only produce lines of constant width. Are they supposed to do that or is the pressure data getting lost somewhere?

Revision history for this message
Jussi Pakkanen (jpakkane) wrote :

Another difference: when running an X server with all patches, Krita draws nothing when I use my Wacom, but does draw if I replay either one of the recordings.

It seems that there is a larger bug lurking about and the patch only makes it more/less apparent.

As far as warping goes, the only time I see it is when I drag the canvas and stop moving while still holding the drag button.

Revision history for this message
Jussi Pakkanen (jpakkane) wrote :

I recorded a couple of pressure swipes with a Wacom. When I play back the recordings, Krita does not detect any pressure changes. Does anyone else get pressure info when playing back these traces?

Revision history for this message
Jussi Pakkanen (jpakkane) wrote :
Revision history for this message
Jean-Baptiste Mardelle (jb-kdenlive) wrote :

Pressure works for me on my own recordings. Maybe you need some calibration or configuration of the Krita brush. I can see a very small sign of pressure sensitivity on your recording : the beginning of the first stroke is slightly grey , meaning the opacity was not at 100%

Revision history for this message
Jussi Pakkanen (jpakkane) wrote :

I build my own X server packages without patches 504, 503 or 502. In those cases pressure is properly recognised from both evemu recordings. With patch 502 it is not. Using the Wacom directly works on both (but breaks with 504 as with others).

Revision history for this message
Jussi Pakkanen (jpakkane) wrote :

The cause of (some part) of this bug is somewhere else. I removed all code from patch 503 and left only the part that adds new fields to structs. Effectively it looks like this:

--- a/include/inputstr.h
+++ b/include/inputstr.h
@@ -335,6 +335,8 @@ typedef struct _TouchPointInfo {
     unsigned int history_size; /* Size of history ring buffer */
     InternalEvent *first_history; /* Pointer to first event in history */
     InternalEvent *next_history; /* Pointer to next available event */
+ int untransformed_x;
+ int untransformed_y;
 } TouchPointInfoRec;

 typedef struct _TouchAxisInfo {
@@ -623,6 +625,8 @@ typedef struct _DeviceIntRec {
         float remainder[MAX_VALUATORS];
         int numValuators;
         DeviceIntPtr slave;
+ int untransformed_x;
+ int untransformed_y;
     } last;

Simply applying this patch breaks pressure. Since this gets installed to /usr/include/xorg/inputstr.h, that means that someone (Qt probably) is using these structs incorrectly (creating them by themselves, building arrays or something else).

Revision history for this message
Chase Douglas (chasedouglas) wrote : Re: [Bug 799202] Re: wacom stylus jumps with latest xserver-xorg-core

On 09/12/2011 05:44 AM, Jussi Pakkanen wrote:
> The cause of (some part) of this bug is somewhere else. I removed all
> code from patch 503 and left only the part that adds new fields to
> structs. Effectively it looks like this:
>
> --- a/include/inputstr.h
> +++ b/include/inputstr.h
> @@ -335,6 +335,8 @@ typedef struct _TouchPointInfo {
> unsigned int history_size; /* Size of history ring buffer */
> InternalEvent *first_history; /* Pointer to first event in history */
> InternalEvent *next_history; /* Pointer to next available event */
> + int untransformed_x;
> + int untransformed_y;
> } TouchPointInfoRec;
>
> typedef struct _TouchAxisInfo {
> @@ -623,6 +625,8 @@ typedef struct _DeviceIntRec {
> float remainder[MAX_VALUATORS];
> int numValuators;
> DeviceIntPtr slave;
> + int untransformed_x;
> + int untransformed_y;
> } last;
>
> Simply applying this patch breaks pressure. Since this gets installed to
> /usr/include/xorg/inputstr.h, that means that someone (Qt probably) is
> using these structs incorrectly (creating them by themselves, building
> arrays or something else).

The TouchPointInfo* structure isn't used in xf86-input-evdev, so that
shouldn't be an issue. However, DeviceIntRec is used in the input
modules, so that could be an issue.

Jussi, please rebuild xserver-xorg-input-evdev against a server with
these struct changes to see if it fixes things.

Thanks!

Revision history for this message
Jean-Baptiste Mardelle (jb-kdenlive) wrote :

I just tested using latest Oneiric xserver-xorg (1.10.4)

If I remove all the latest patches starting from the 503, it works fine (pressure ok and no jumping lines).
I see no difference if I only apply the struct changes described by Jussi in comment #32. Pressure and everything still works fine.

But applying the other part of patch 503 (that touches the dix/getevents.c file) makes the bug described in my original report appear (random lines)

I tested with 2 different devices:

1 - A Wacom Intuos 3 usb tablet
2- A Lenovo X201T touchscreen

So maybe the pressure issue described by Jussi is another problem related to his Bamboo?

Revision history for this message
Jussi Pakkanen (jpakkane) wrote :

This is getting weirder and weirder. I updated my packages and tried again. Now the behaviour is different. Just adding the struct elements does *not* break pressure. Previously it did. I verified on previous test results I had written down with an actual pen and paper.

What happens now is slightly different. Patch 503 has three different parts: two code changes and the struct change. If I take out the first code part, I get pressure. Taking out only the second code part does give pressure. However I cannot for the life of me understand why this happens. The code in question does not handle pressure in any way, only coordinates. Somehow the first code block triggers loss of pressure.

If I play the same recording without a Krita window, I get a drag selection box. So transforming the pen to movement+mouse click works.

I suspect that this bug may be platform specific. Can everyone tell what platforms they are using? My tests are run on 32 bit x86 oneiric.

Revision history for this message
Shaved Wookie (shavedwookie) wrote :

32 bit Kubuntu Natty + 32 bit Kubuntu Oneric

Revision history for this message
Jussi Pakkanen (jpakkane) wrote :

This may be a bug in Krita.

When I install qt4-demos and run /usr/lib/qt4/examples/widgets/tablet/tablet, pressure works perfectly. Can someone else with this bug try if the tablet test app works?

Revision history for this message
Jean-Baptiste Mardelle (jb-kdenlive) wrote :

Hmm, looks like we are progressing in what the problem is.

As suggested by Jussi, I tried the tablet sample app from qt4-demos, and I can confirm that pressure works fine.

However in that demo app, when I try to use the "tilt" value from the tablet to set line width (in the Tablet menu > Line width > Tilt), I get some strange results: a rather constant fine line with sometimes a random huge rect appearing. Trying to set the color saturation from the "Tilt" value doesn't work either. The behavior is the same on my Touchscreen and on my Intuos 3 usb.

I tested with the "unpatched" xserver (without the 503 patch), and with this version, setting line width from the tilt value works fine on my intuos 3, and the line width stays fine on my touchscreen that maybe doesn't provide a tilt value, but I never get those random huge rects.

So it looks like the problem introduced (or revealed) by patch 503 may be with the tilt value, not the pressure...

Revision history for this message
Jussi Pakkanen (jpakkane) wrote :

I can confirm that on my Wacom Bamboo Pen & Touch the behaviour is exactly the same as j-b-m. The only addition being that I get the huge rectangles only when I stop moving the pen (but keep it touching the surface).

My tablet probably does not provide tilt information so could you try the following.

First run "xinput list" which shows you all input devices. Check which number it has given to your stylus. Then do "xinput list <idnum>". This shows you which valuators provide the tilt information. These are probably 3 and 4.

Then run "xinput test <idnum>" and move your stylus. What values do you get for tilt axes?

No matter what I do, I can't get any other value than 0 for these. Which would indicate that the huge rectangle values are generated somewhere outside X.

Revision history for this message
Jussi Pakkanen (jpakkane) wrote :

I looked into Qt and there are three locations where x and y tilt values are obtained. They are all in qapplication_x11.cpp in the function QETWidget::translateXinputEvent.

The first one is this (I have removed quite a lot of lines, check the original to be sure):

s = XQueryDeviceState(X11->display, static_cast<XDevice *>(tablet->device));
for (j = 0; j < s->num_classes; j++) {
[stuff]
  if (!proximity) {
      xTilt = short(vs->valuators[WAC_XTILT_I]);
      yTilt = short(vs->valuators[WAC_YTILT_I]);
      pressure = vs->valuators[WAC_PRESSURE_I];

So it loops over something(?) and grabs things. Then a bit later it does this:

if (motion) {
    xTilt = (short) motion->axis_data[3];
    yTilt = (short) motion->axis_data[4];

where motion is an XDeviceMotionEvent.

Immediately afte that it does

} else if (button) {
    xTilt = (short) button->axis_data[3];
    yTilt = (short) button->axis_data[4];

where button is an XDeviceButtonEvent.

Based on this the potential bugs are that either Qt does masked valuators wrong or the X server gives incorrect data in event structures. The xinput output mentioned above would seem to indicate that the fault lies with Qt.

Chase, what do you think?

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

Some background information on XInput: XInput 1.x added "valuators" which are axes that provide data beyond just X and Y. Unfortunately, in the infinite wisdom of the XInput 1.x creators, the valuators were not labeled. Thus, the Qt code has #defines like WAC_XTILT_I. Essentially, in XI 1.x the order of valuators is part of the ABI. However, I think only the Wacom X module has provided a stable valuator ordering, so it's all just a big mess.

This means that the code only works if you are using the X Wacom input module. I'm assuming you all are, but it would be good to double check (check /var/log/Xorg.0.log).

Another quirk in XI 1.x is that it provides valuator ranges instead of a bitmask of changed valuators. So, if the values in axes 3 and 5 changed, XI 1.x must send data for the current values of axes 3, 4, and 5. In XI 2.x, the server sends only the new values of 3 and 5. It is possible that there is an issue in how masked valuators in the internals of the X server are being handled, but I have not seen any indication this is the case. xinput test and xinput test-xi2 are great for testing this. You can run the same recording through both and see if there are any discrepencies. Note that natty and Oneiric are the first X servers that actually use masked valuators internally in the server. Clients who aren't fully compliant to the XI specs will only start to see issues now :).

I just got to this paragraph to summarize things, and then I realized what may be the issue. Notice how the xTilt and yTilt variables are set based on a constant index into the event valuators. This works fine if the event valuator range always begins at 0. However, if only the 3rd and 4th valuators changed, the valuator range from the server would be 3 to 4, and the indexes of valid data would be 0 and 1 (shifted down by 2). See /usr/include/X11/extensions/XInput.h, XDevice*Event.first_axis and XDevice*Event.axes_count for the valuator range of an event.

This would also explain why the issue is seen sporadically with pressure data but not with tilt. When pressure changes, X and Y is likely to also change. This causes the valuator range to start at 0, so the axis indices used in Qt are ok. However, when tilt changes, maybe it usually is the only valuator that changes value. Thus, the valuator range starts at whatever the tilt valuator is, and the indices used by Qt are wrong.

Revision history for this message
Jussi Pakkanen (jpakkane) wrote :

Attached is a quick patch that inspects that valuator accesses do not go out of bounds. I changed only the motion and button accesses and not the Wacom one. The reason being that it seems to loop over all data so it should be valid.

I have not tested the patch in any way, so it might not even compile. I have not tried replacing system Qt ever so I reckon someone with more experience ought to try it first.

As far as the sporadical thing goes, the situation for me is the reverse: I don't get any errors for pressure but I do get it for tilt. Since my tablet does not seem to support tilt, its values should always be zero.

There's also the case that I get different behavior on evemu-traces than the real tablet. Xorg log does say I am using Wacom input module.

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

The attachment "valuator-range.diff" 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-sponsors 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.]

Revision history for this message
Jussi Pakkanen (jpakkane) wrote :

A new Qt version consisting of current packaged code + the valuator patch has just been pushed to uTouch team's unstable PPA. Once it finishes building (and there are no build failures :), please test it out.

It is oneiric only and may eat your soul if mishandled. So be careful.

Revision history for this message
Animtim (animtim) wrote : Re: [Bug 799202] Re: wacom stylus jumps with latest xserver-xorg-core

I've just tried in oneiric, added updates from uTouch PPA unstable:
still same symptoms in Krita (Graphire4: doesn't draw at all ; Intuos3: draw
with pressure but same buggy parasit diagonal lines)

Revision history for this message
Jean-Baptiste Mardelle (jb-kdenlive) wrote :

Animitim, the uTouch Qt4 package is still building (at least from what I can see), it is the following version:
qt4-x11 - 4:4.7.4-0ubuntu3~utouch1

So I think you don't have the update yet. Will try tonight myself.

Revision history for this message
Jussi Pakkanen (jpakkane) wrote :

It has built now. The demo app no longer produces huge rectangles for me.

However Krita does the weird stylus jumps now. Earlier it did not. The jumps do not always go to the top left corner, though they do go mostly towards the top left.

Revision history for this message
Jussi Pakkanen (jpakkane) wrote :

And the jumps happen when I move the pen slowly. When moving it fast, there are no jumps.

Revision history for this message
Animtim (animtim) wrote :

j-b-m : ok so I re-updated.
Now it's "a bit better" as my Graphire4 works now as the Intuos3.
But both still have the jumps.

And as Jussi said above I confirm that strangely the jumps stop when moving
very fast.

Revision history for this message
Jussi Pakkanen (jpakkane) wrote :

Animtim, could you try the qt4 tablet test application mentioned above? Does it behave properly with both pressure and tilt based line width?

Revision history for this message
Animtim (animtim) wrote :
Download full text (4.5 KiB)

Tested /usr/lib/qt4/examples/widgets/tablet/tablet, works ok with both
pressure and tilt.

2011/9/20 Jussi Pakkanen <email address hidden>

> Animtim, could you try the qt4 tablet test application mentioned above?
> Does it behave properly with both pressure and tilt based line width?
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/799202
>
> Title:
> wacom stylus jumps with latest xserver-xorg-core
>
> Status in “xorg-server” package in Ubuntu:
> In Progress
>
> Bug description:
> Wacom input jumps while drawing with xserver-xorg-core version
> 2:1.10.1-1ubuntu1.1
> It is working correctly with version 2:1.10.1-1ubuntu1.
>
> This issue is somehow related to issue #762938 (no pressure
> sensitivity with wacom tablet).
>
> A fix for pressure sensitivity was proposed by Chase Douglas in the
> utouch-team/unstable ppa.
>
> Using the official ubuntu Qt version, stylus position works fine, but
> pressure sensitivity does not work.
> When using Chase Douglas's ppa, pressure works fine, but the cursor
> position jumps while drawing.
>
> Note that the issue only happens when using the wacom stylus that is
> "pressure sensitive", not when using the wacom mouse that has no
> pressure.
>
> As previously said, the "jumping cursor" issue disappears if I
> downgrade xserver-xorg-core to version 1.10.1-1ubuntu1
>
> The bug can be seen in Krita, when drawing a line, the cursor jumps, a
> picture showing the problem can be seen here:
>
> https://bugs.launchpad.net/ubuntu/+source/xorg-server/+bug/799202/+attachment/2174502/+files/pressure_bug.png
>
> I can reproduce the issue on a tablet pc with touch sensitive screen
> and a desktop pc with usb Wacom tablet.
>
> At least 2 other users are having the same issue, see:
> https://bugs.launchpad.net/ubuntu/+source/pencil/+bug/762938
>
> Using Ubuntu 11.04
>
> ProblemType: Bug
> DistroRelease: Ubuntu 11.04
> Package: xserver-xorg-core 2:1.10.1-1ubuntu1.1
> ProcVersionSignature: Ubuntu 2.6.38-10.44-generic-pae 2.6.38.7
> Uname: Linux 2.6.38-10-generic-pae i686
> Architecture: i386
> CompizPlugins: No value set for
> `/apps/compiz-1/general/screen0/options/active_plugins'
> CompositorRunning: kwin
> Date: Sat Jun 18 18:44:38 2011
> DistUpgraded: Fresh install
> DistroCodename: natty
> DistroVariant: kubuntu
> DkmsStatus:
> virtualbox-ose, 4.0.4, 2.6.38-9-generic-pae, i686: installed
> virtualbox-ose, 4.0.4, 2.6.38-10-generic-pae, i686: installed
> GraphicsCard:
> Intel Corporation Core Processor Integrated Graphics Controller
> [8086:0046] (rev 02) (prog-if 00 [VGA controller])
> Subsystem: Lenovo Device [17aa:215a]
> InstallationMedia: Kubuntu 11.04 "Natty Narwhal" - Alpha i386 (20110202)
> MachineType: LENOVO 2985FJG
> ProcEnviron:
> LANGUAGE=
> LANG=en_US.UTF-8
> SHELL=/bin/bash
> ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-2.6.38-10-generic-pae
> root=UUID=1524b654-818e-4d16-807f-4e0db5f1b26f ro quiet splash vt.handoff=7
> ProcKernelCmdLine_: BOOT_IMAGE=/boot/vmlinuz-2.6.38-10-generic-pae
> root=UUID=1524b654-818e-4d16-807f-4e0db5f1b26f ro quiet splash vt.handoff=7
> Rend...

Read more...

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

My guess is that although we now are getting the right data into the right properties, Qt probably is not keeping track of the unchanged valuator values. So, if an event comes in with a valuator range of [1,1] (which implies that only the Y valuator changed), then Qt needs to copy the old X, pressure, and tilt values into the newly created Qt event.

Revision history for this message
Jussi Pakkanen (jpakkane) wrote :

I have just uploaded a Qt version to the PPA that preserves the old values. It should finish building after four hours or so. Please try it out once it is finished. The new version is 4.7.4-0ubuntu3~utouch2.

Revision history for this message
Jussi Pakkanen (jpakkane) wrote :

The new packages do not fix this for me. I still get ghost jumps.

This makes sense, because if the valuators are parsed incorrectly, then the Qt tablet app should draw additional loops as well. I even tried moving the window partially outside the top left corner to make sure any paint operations to (0, 0) would leave a mark on the canvas.

Revision history for this message
Jussi Pakkanen (jpakkane) wrote :

The Krita code that deals with tablet events seems to be this in kis_canvas_controller.cpp:

-----

void KisCanvasController::Private::emitPointerPositionChangedSignals(QEvent *event)
{
    if (!coordinatesConverter) return;
    QPoint pointerPos;
    QMouseEvent *mouseEvent = dynamic_cast<QMouseEvent*>(event);
    if (mouseEvent) {
        pointerPos = mouseEvent->pos();
    } else {
        QTabletEvent *tabletEvent = dynamic_cast<QTabletEvent*>(event);
        if (tabletEvent) {
            pointerPos = tabletEvent->pos();
        }
    }

----

The obvious failure point being that if the argument is neither a mouse nor a tablet event, then pointerPos is uninitialized. I did not have time to check yet whether the bug is caused by this or something else entirely.

Revision history for this message
Jean-Baptiste Mardelle (jb-kdenlive) wrote :

I had a look at the Krita sources, as pointed out by Jussi, and the problem does not come from the kis_canvas_controller code, but seems to come from kis_canvas_widget_base.cpp.

There, we have the following code:

void KisCanvasWidgetBase::processTabletEvent(QTabletEvent *e)
{
    widget()->setFocus(Qt::OtherFocusReason);
    m_d->blockMouseEvent.start(100);

    const QPointF pos = e->hiResGlobalPos() - widget()->mapToGlobal(QPoint(0, 0));
    m_d->toolProxy->tabletEvent(e, m_d->coordinatesConverter->widgetToDocument(pos));

    // HACK
    e->ignore();
    m_d->ignorenextMouseEventExceptRightMiddleClick = true;
    // HACK
}

My debugging shows that the problem is in the Qt hiResGlobalPos method from QTabletEvent.

event->pos() seems to give correct results for the QTabletEvent, but
event->hiResGlobalPos() sometimes gives strange results that cause the random lines.

For exemple, I have the following values from hiResGlobalPos (the x coordinate):

(...)
453.731
453.682
453.779
12.4536 <--- weird value
453.633
453.487
(...)

So my guess is that Qt has problem getting the correct values for this hiResGlobalPos, if anybody with a better inside knowledge of Qt can have a look...

Revision history for this message
Jussi Pakkanen (jpakkane) wrote :

The reason Krita fails is that it uses the high resolution location and not cursor location.

High resolution location evaluation is broken whenever the X server does not send both X and Y coordinates.

Thus the valuator code is still wrong somehow.

I have pushed a hack fix to the PPA that just drops all incoming events that don't have both an X and a Y coordinate specified.

Please test it out once it finishes building.

It may cause other interesting bugs, but at least we should be able to prove conclusively where the real bug is.

Revision history for this message
Animtim (animtim) wrote :

Updated with your new patch, now there's no stroke at all in krita and
"tablet example" demo.

Revision history for this message
Jean-Baptiste Mardelle (jb-kdenlive) wrote :

Good news! I was able to make my 2 wacom devices (touchscreen and Intuos2) work correctly in Krita using the attached patch against Qt. Chase Douglas was right about Qt incorrectly using the recieved events because not all axis are sent. I simply updated Jussi's patches like that:

Instead of just checking the upper limit of the axis index:

if (xIndex < maxIndex)

I check both upper and lower limits:

if (xIndex >= firstAxis && xIndex < maxIndex)

If the index of the axis is inside the range, we use the value, otherwise we put the last recieved value.

Revision history for this message
Jussi Pakkanen (jpakkane) wrote :

Gaah! I knew it had to be something simple that I overlooked.

Pushed a new version to the build service. You know what to do. :)

Revision history for this message
Jussi Pakkanen (jpakkane) wrote :

The PPA packages fix it for me.

Revision history for this message
Animtim (animtim) wrote :

Too bad, I've an issue to test the PPA: some "newer version" installed
instead (***4:4.7.4-0ubuntu3<https://launchpad.net/ubuntu/oneiric/+source/qt4-x11/4:4.7.4-0ubuntu3>
)*, and trying to force version on all those qt4/libqt4 packages looks
complicated…
As Jussi confirmed the fix is ok for him, maybe you can already push the
patch to main repository ?!

Revision history for this message
Jussi Pakkanen (jpakkane) wrote :

I'll push a newer version. In the mean time you can download the packages manually and install them with "dpkg -i *.deb".

Revision history for this message
Jussi Pakkanen (jpakkane) wrote :

I could not upload because the unstable PPA has run out of space. Working on it...

Revision history for this message
Jussi Pakkanen (jpakkane) wrote :

This patch has been accepted into Ubuntu proper. It will be in the next Qt package, which will probably be released on Monday.

Revision history for this message
Animtim (animtim) wrote :

Yees, that's good news!

I confirm I've tested latest PPA build fix is OK (both Graphire4 and Intuos3
works good)
:.)

affects: xorg-server (Ubuntu) → qt4-x11 (Ubuntu)
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package qt4-x11 - 4:4.7.4-0ubuntu4

---------------
qt4-x11 (4:4.7.4-0ubuntu4) oneiric; urgency=low

  [ Felix Geyer ]
  * Move documentation building to override_dh_auto_install where
    dh_listpackages works as expected with dpkg-buildpackage. (LP: #857377)

  [ Didier Roche ]
  * debian/patches/fix_accessible_menu.diff:
    - Contextual QMenu accessible now (LP: #817416)
  * debian/patches/kubuntu_94_xinput_valuators_fix.diff:
    - wacom stylus jumps with latest xserver-xorg-core (LP: #799202)
 -- Didier Roche <email address hidden> Mon, 26 Sep 2011 09:28:36 +0200

Changed in qt4-x11 (Ubuntu):
status: In Progress → Fix Released
Revision history for this message
Scott Kitterman (kitterman) wrote :

I see in some of the comments this is on Natty too. Should this be considered for a Natty SRU?

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

Yes, the X server change that caused this issue was first released in Natty. An SRU for this issue would be good.

Revision history for this message
Animtim (animtim) wrote :

There is a new bug produced by this patched qt :
https://bugs.launchpad.net/ubuntu/+source/koffice/+bug/864014

Please take a look

Revision history for this message
klerfayt (klerfayt-deactivatedaccount) wrote :

Unstable PPA does not contain anything useful for Natty?

https://launchpad.net/~utouch-team/+archive/unstable?field.series_filter=natty

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

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

Changed in qt4-x11 (Ubuntu Natty):
status: New → Confirmed
Revision history for this message
Atheg (hoganaj) wrote :

I still have this problem.

Revision history for this message
Vaclav Cermak (disnel) wrote :

A have this problem with jumping cursor when using GIMP under Oneiric.

Revision history for this message
Vaclav Cermak (disnel) wrote :

OT: How should I properly add another package affected by this bug? I tried to add gimp, but it replaced qt4-x11

affects: qt4-x11 (Ubuntu) → gimp (Ubuntu)
Revision history for this message
Jussi Pakkanen (jpakkane) wrote :

Please file a new bug against Gimp. You can refer to this bug in the description if you want.

affects: gimp (Ubuntu) → qt4-x11 (Ubuntu)
no longer affects: qt4-x11 (Ubuntu Natty)
Revision history for this message
Magnes (magnesus2) wrote :

Still present in Ubuntu 12.10. It isn't dependent on Qt - it's system wide (all applications and desktop).

Revision history for this message
Scott Kitterman (kitterman) wrote :

Then it's a different bug.

Revision history for this message
Magnes (magnesus2) wrote :

Aparently it was fix in latest xserver-xorg-core update though.

To post a comment you must log in.