dix: plug memory leak in freeing TouchClass

==15562== 1,800 bytes in 1 blocks are definitely lost in loss record 298 of 330
==15562==    at 0x4A06B6F: calloc (vg_replace_malloc.c:593)
==15562==    by 0x4312C7: InitTouchClassDeviceStruct (devices.c:1644)

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
(cherry picked from commit 7d722796c678532e8c5897c673c43184da353f44)
dix: don't overwrite proximity/focus classes

InitPointerClassDeviceStruct/InitKeyboardDeviceStruct allocate a
proximity/focus class, respectively. If a driver calls
InitFocusClassDeviceStruct or InitProximityClassDeviceStruct beforehand,
the previously allocated class is overwritten, leaking the memory.

Neither takes a parameter other than the device, so we can simply skip
initialising it if we already have one.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit 8a88b0ab52ba375ae84463a90503db88af10e368)
os: Reset input buffer's 'ignoreBytes' field

If a client sends a request larger than maxBigRequestSize, the server is
supposed to ignore it.

Before commit cf88363d, the server would simply disconnect the client.  After
that commit, it attempts to gracefully ignore the request by remembering how
long the client specified the request to be, and ignoring that many bytes.
However, if a client sends a BigReq header with a large size and disconnects
before actually sending the rest of the specified request, the server will
reuse the ConnectionInput buffer without resetting the ignoreBytes field.  This
makes the server ignore new X clients' requests.

This fixes that behavior by resetting the ignoreBytes field when putting the
ConnectionInput buffer back on the FreeInputs list.

Signed-off-by: Robert Morell <rmorell@nvidia.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 67c66606c760c263d7a4c2d1bba43ed6225a4e7c)
dix: pre-scale x by the screen:device:resolution ratio

commit 61a99aff9d33728a0b67920254d2d4d79f80cf39
    dix: pre-scale relative events from abs devices to desktop ratio (#31636)

added pre-scaling of relative coordinates coming from absolute devices to
undo uneven scaling based on the screen dimensions.

Devices have their own device width/height ratio as well (in a specific
resolution) and this must be applied for relative devices as well to avoid
scaling of the relative events into the device's ratio.

e.g. a Wacom Intuos4 6x9 is in 16:10 format with equal horiz/vert
resolution (dpi). A movement by 1000/1000 coordinates is a perfect diagonal
on the tablet and must be reflected as such on the screen.

However, we map the relative device-coordinate events to absolute screen
coordinates based on the axis ranges. This results in an effective scaling
of 1000/(1000 * 1.6) and thus an uneven x/y axis movement - the y
axis is always faster.

So we need to pre-scale not only by the desktop dimenstions but also by the
device width/height ratio _and_ the resolution ratio.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 5cc2c96f824dbb28b9f8da61efc41596f8bd0561)
dix: fix device scaling to use a [min,max[ range.

defmin/defmax are screen coords and thus use a min-inclusive, max-exclusive
range. device axes ranges are inclusive, so bump the max up by one to get the
scaling right.

This fixes off-by-one coordinate errors if the coordinate matrix is used to
bind the device to a fraction of the screen. It introduces an off-by-one
scaling error in the device coordinate range, but since most devices have a
higher resolution than the screen (e.g. a Wacom I4 has 5080 dpi) the effect
of this should be limited.

This error manifests when we have numScreens > 1, as the scaling from
desktop size back to screen size drops one device unit.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 756ab88d93542f0589c9bf46f40ccc57df64f0fd)
Bump rev from 1.14.1.901 to 1.14.1.902
Only call xf86platformVTProbe() when it's defined

Fixes build on non-udev systems, since XSERVER_PLATFORM_BUS is only
defined in configure.ac if $CONFIG_UDEV_KMS is true.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>