(→Touch Latency) |
(→Touch Latency) |
||
| (2 intermediate revisions not shown) | |||
| Line 20: | Line 20: | ||
By instrumenting the xorg-x11-driver-mtev we can determine the amount of time spent between 2 through 5. By instrumenting Qt we can determine the time spent between 5 and 7. Accurately measuring the time between 7 and 8 is difficult. For the purpose of measuring the part that we can control in the touch stack, measuring 2 through 7 is sufficient. | By instrumenting the xorg-x11-driver-mtev we can determine the amount of time spent between 2 through 5. By instrumenting Qt we can determine the time spent between 5 and 7. Accurately measuring the time between 7 and 8 is difficult. For the purpose of measuring the part that we can control in the touch stack, measuring 2 through 7 is sufficient. | ||
| - | The patches | + | The patches to add this information can be found here: |
| - | * [http://api.meego.com/public/source/home:jketreno/xorg-x11-drv-mtev/debug.patch?rev= | + | * [http://api.meego.com/public/source/home:jketreno:touch-latency/xorg-x11-drv-mtev/debug.patch?rev=b3b40537385aa6b1aabda46fd851e05b xorg-x11-drv-mtev] |
| - | * [ | + | * [http://api.meego.com/public/source/home:jketreno:touch-latency/qt/qtTouchLatencyDebug.patch?rev=8636c4689650fd41c2121f56fce95714 Qt Touch Latency Debug patch] |
| - | + | ||
| + | Versions of Qt and xorg-x11-drv-mtev with the above patches applied can be found in my home project in the [http://build.meego.com/project/show?project=home%3Ajketreno%3Atouch-latency MeeGo OBS system]. | ||
=Using Touch with MeeGo= | =Using Touch with MeeGo= | ||
Contents |
The kernel's multi-touch-protocol is now supported in MeeGo. Qt applications will receive Touch events and can use the Qt gesture infrastructure. Non-Qt applications will need to write to XInput2.0 and extract contact data from the XEvent data.
The general flow is:
HW => Kernel driver => multi-touch-protocol => xorg-x11-input-mtev => XEvent => Application
xorg-x11-input-mtev uses libmtdev in order to easily support both of the protocol A and B exposed by the kernel.
When dealing with touch based interaction concepts, it is critical to minimize time difference between when the user attempts to interact with the UI and when the user receives feedback that something is happening. The variables at play which contribute heavily to this latency include:
By instrumenting the xorg-x11-driver-mtev we can determine the amount of time spent between 2 through 5. By instrumenting Qt we can determine the time spent between 5 and 7. Accurately measuring the time between 7 and 8 is difficult. For the purpose of measuring the part that we can control in the touch stack, measuring 2 through 7 is sufficient.
The patches to add this information can be found here:
Versions of Qt and xorg-x11-drv-mtev with the above patches applied can be found in my home project in the MeeGo OBS system.
MeeGo 1.2 provides a GestureArea element derived from the qml-gesturearea project.
As gesture support is added to the official versions QML, MeeGo will work to maintain compatibility with those features in a way which allows applications written with the MeeGo Components' GestureArea to still work.
For the current status of Gesture support in Qt, you can see the following bugreports:
Qt on MeeGo is configured to listen to pointer (mouse) events the first core pointer provided by X. Additional core pointers are ignored. Touch events are received from any touch device bound to the first core pointer, as well as any touch devices which are floating (not bound to any core pointer)
See BMC#17865 if you have something to add to this topic.
If you do nothing, X will default to binding an input device to the first Core Pointer. This means that the touch screen will default to control the cursor --as you move your finger around, mouse events will be generated, the cursor will move, etc. This is typically the behavior you want.
However, if you don't want the touch device to control the pointer, you can use the xinput utility to "float" the touch device. On the Lenovo S10, running 'xinput list' shows something like the following:
⎡ Virtual core pointer id=2 [master pointer (3)] ⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)] ⎜ ↳ Cando Corporation Cando 10.1 Multi Touch Panel with Controller id=13 [slave pointer (2)] ⎜ ↳ SynPS/2 Synaptics TouchPad id=16 [slave pointer (2)] ...
Looking at the above, you can see the touch device (Cando Corporation...) is device id 13. To float that input device, run:
xinput float 13
NOTE: If you don't have xinput, you can install it on MeeGo by running:
zypper install xorg-x11-utils-xinput
Once you float the input device, it will no longer move the mouse pointer. To reattach it, run:
xinput reattach 13 2
'2' is the device ID for the 'Virtual core pointer' you are reattaching the device to.
To keep X from connecting a device to the core pointer when starting the system, you can add:
Option "SendCoreEvents" "false"
to the InputClass section for the device, for example you can place the following in /usr/share/X11/xorg.conf.d as 60-cando.conf:
Section "InputClass"
Identifier "Cando Multi Touch Panel"
MatchVendor "Cando"
MatchDevicePath "/dev/input/event*"
Driver "mtev"
Option "SendCoreEvents" "false"
EndSection
To perform the above steps on this wiki, you may need to install the xinput utility:
zypper install xorg-x11-utils-xinput
If you are using the evtouch driver on your system, you may experience problems due to the input driver your kernel is using. If the kernel driver does not advertise to user space that it supports the left button (by setting the BTN_LEFT bit in the input_device's keybit field) then the X input driver will not map those button identifiers to the "Button Left" label. Qt relies on correctly set button labels in order to map the incoming touch data to the appropriate touch device.
You can determine if this is the case on your system by running:
xinput list --long "Virtual core pointer"
On a functional input driver, you will see various text names for the field 'Button labels:' On a broken input driver, you will see a series of X BadAtom errors or "Button Unknown" labels. A correct driver will report labels such as: Button Left, Button Right, etc.
See BMC#12777 for additional details on this problem.
Fixing the driver for your system may be as easy as adding the following line to the driver's initialization sequence:
ts->idev->keybit[BIT_WORD(BTN_LEFT)] = BIT_MASK(BTN_LEFT);