[PATCHv3] dix: add 3x3 transformation matrix xinput property for multi-head handling

Peter Hutterer peter.hutterer at who-t.net
Thu May 27 23:55:06 PDT 2010


On Tue, May 25, 2010 at 11:03:28AM +0200, Peter Korsgaard wrote:
> For absolute input devices (E.G. touchscreens) in multi-head setups,
> we need a way to bind the device to an randr output. This adds the
> infrastructure to the server to allow us to do so.
> 
> positionSprite() scales input coordinates to the dimensions of the shared
> (total) screen frame buffer, so to restrict motion to an output we need to
> scale/rotate/translate device coordinates to a subset of the frame buffer
> before passing them on to positionSprite.
> 
> This is done here using a 3x3 transformation matrix, which is applied to
> the device coordinates using homogeneous coordinates, E.G.:
> 
> [ c0 c1 c2 ]   [ x ]
> [ c3 c4 c5 ] * [ y ]
> [ c6 c7 c8 ]   [ 1 ]
> 
> Notice: As input devices have varying input ranges, the coordinates are
> first scaled to the [0..1] range for generality, and afterwards scaled
> back up.
> 
> E.G. for a dual head setup (using same resolution) next to each other, you
> would want to scale the X coordinates of the touchscreen connected to the
> both heads by 50%, and translate (offset) the coordinates of the rightmost
> head by 50%, or in matrix form:
> 
>    left:            right:
> [ 0.5 0 0 ]     [ 0.5 0 0.5 ]
> [ 0   1 0 ]     [ 0   1 0   ]
> [ 0   0 1 ]     [ 0   0 0   ]
> 
> Which can be done using xinput:
> 
> xinput set-prop <left> --type=float "Coordinate Transformation Matrix" \
>        0.5 0 0 0 1 0 0 0 1
> 
> xinput set-prop <right> --type=float "Coordinate Transformation Matrix" \
>        0.5 0 0.5 0 1 0 0 0 1
> 
> Likewise more complication setups involving more heads, rotation or
> different resolution can be handled.
> 
> Signed-off-by: Peter Korsgaard <peter.korsgaard at barco.com>
> ---

Just wondering - do you have any plans of exposing this as an xorg.conf
option as well? I guess it would be handy, especially for permanent
touchscreen configurations.

Simon's pointer accel integration in xf86XInput.c is probably the best code
to look at and steal the approach.
 
Cheers,
  Peter


More information about the xorg-devel mailing list