libxi: Changes to 'debian-experimental'
ChangeLog | 41 ++++++
configure.ac | 2
debian/changelog | 9 -
debian/control | 2
debian/patches/0001_scroll_increment_value.patch | 34 -----
debian/patches/series | 2
src/XExtInt.c | 140 ++++++++++++++++-------
7 files changed, 151 insertions(+), 79 deletions(-)
New commits:
commit a67812efa86bb3f2594f966a95d3d354e8a3d8ce
Author: Chase Douglas <chase.douglas@canonical.com>
Date: Fri Mar 30 17:54:54 2012 -0700
Remove scroll increment patch, merged upstream
diff --git a/debian/changelog b/debian/changelog
index 1388991..31698c2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,11 +2,9 @@ libxi (2:1.6.0-1) UNRELEASED; urgency=low
* New upstream release
* Bump build deps on x11proto-input-dev
- * Fix scroll valuator increment value on 32-bit machines
- - Added 0001_scroll_increment_value.patch
* Bump lintian standards version to 3.9.3
- -- Chase Douglas <chase.douglas@ubuntu.com> Fri, 30 Mar 2012 17:51:18 -0700
+ -- Chase Douglas <chase.douglas@ubuntu.com> Fri, 30 Mar 2012 17:54:20 -0700
libxi (2:1.5.99.2-1) experimental; urgency=low
diff --git a/debian/patches/0001_scroll_increment_value.patch b/debian/patches/0001_scroll_increment_value.patch
deleted file mode 100644
index 4c12f18..0000000
--- a/debian/patches/0001_scroll_increment_value.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-From 2a31d05ade5a37eac7874f3d118fda80f2fa074c Mon Sep 17 00:00:00 2001
-From: Chase Douglas <chase.douglas@canonical.com>
-Date: Wed, 7 Mar 2012 14:09:17 -0800
-Subject: [PATCH] Use unsigned long long for double fractional calculation
-
-This fixes scroll class increment values on 32-bit machines. Performing
-1UL << 32 shifts the bit off the end of a 32-bit unsigned long value. By
-expanding to 1ULL, we have the full 64-bits of an unsigned long long
-including on 32-bit machines.
-
-Before this change, xinput list --long would output scroll increment
-values of -nan.
-
-Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
----
- src/XExtInt.c | 2 +-
- 1 files changed, 1 insertions(+), 1 deletions(-)
-
-diff --git a/src/XExtInt.c b/src/XExtInt.c
-index 7694f06..89c0894 100644
---- a/src/XExtInt.c
-+++ b/src/XExtInt.c
-@@ -1695,7 +1695,7 @@ copy_classes(XIDeviceInfo* to, xXIAnyInfo* from, int *nclasses)
- cls_lib->scroll_type= cls_wire->scroll_type;
- cls_lib->flags = cls_wire->flags;
- cls_lib->increment = cls_wire->increment.integral;
-- cls_lib->increment += (unsigned int)cls_wire->increment.frac/(double)(1UL << 32);
-+ cls_lib->increment += (unsigned int)cls_wire->increment.frac/(double)(1ULL << 32);
-
- to->classes[cls_idx++] = any_lib;
- }
---
-1.7.9
-
diff --git a/debian/patches/series b/debian/patches/series
index b58d4b7..fdffa2a 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1 @@
-0001_scroll_increment_value.patch
+# placeholder
commit a8f9343158e7135c35d168a58c8bc6d75b84e79f
Author: Chase Douglas <chase.douglas@canonical.com>
Date: Fri Mar 30 17:51:39 2012 -0700
Bump lintian standards version to 3.9.3
diff --git a/debian/changelog b/debian/changelog
index fcd8366..1388991 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,8 +4,9 @@ libxi (2:1.6.0-1) UNRELEASED; urgency=low
* Bump build deps on x11proto-input-dev
* Fix scroll valuator increment value on 32-bit machines
- Added 0001_scroll_increment_value.patch
+ * Bump lintian standards version to 3.9.3
- -- Chase Douglas <chase.douglas@ubuntu.com> Fri, 30 Mar 2012 17:49:28 -0700
+ -- Chase Douglas <chase.douglas@ubuntu.com> Fri, 30 Mar 2012 17:51:18 -0700
libxi (2:1.5.99.2-1) experimental; urgency=low
diff --git a/debian/control b/debian/control
index b7ff2cd..a503100 100644
--- a/debian/control
+++ b/debian/control
@@ -22,7 +22,7 @@ Build-Depends:
xorg-sgml-doctools (>= 1:1.8),
xsltproc,
w3m,
-Standards-Version: 3.9.2
+Standards-Version: 3.9.3
Vcs-Git: git://git.debian.org/git/pkg-xorg/lib/libxi
Vcs-Browser: http://git.debian.org/?p=pkg-xorg/lib/libxi.git
commit fe729aa9d49255a753ab9b806600ccb647d53261
Author: Chase Douglas <chase.douglas@canonical.com>
Date: Fri Mar 30 17:50:29 2012 -0700
Bump changelogs.
diff --git a/ChangeLog b/ChangeLog
index d05afbf..2d34b6a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,44 @@
+commit 70b730b0548ca9e408f14f2576b972beb32a0ad0
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date: Thu Mar 8 16:03:50 2012 +1000
+
+ libXi 1.6.0
+
+ Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 1b9f0394c3d4d3833f8560ae8170a4d5842419ab
+Author: Chase Douglas <chase.douglas@canonical.com>
+Date: Wed Mar 7 14:52:54 2012 -0800
+
+ Fix XIScrollClass increment value on 32-bit machines
+
+ This fixes scroll class increment values on 32-bit machines. Performing
+ 1UL << 32 shifts the bit off the end of a 32-bit unsigned long value. By
+ expanding to 1ULL, we have the full 64-bits of an unsigned long long
+ including on 32-bit machines.
+
+ Before this change, xinput list --long would output scroll increment
+ values of -nan.
+
+ Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
+ Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit c1a5a70b51f12dedf354102217c7cd4247ed3a4b
+Author: Michał Masłowski <mtjm@mtjm.eu>
+Date: Tue Feb 21 20:54:40 2012 +0100
+
+ Fix bus error on MIPS N32 for bug #38331.
+
+ XIValuatorClassInfo and XIScrollClassInfo might have an address
+ of 4 bytes modulo 8, while they contain doubles which need 8 byte
+ alignment. This is fixed by adding extra padding after each structure
+ or array in sizeDeviceClassType and adding helper functions to
+ determine sizes and padding only in one place.
+
+ Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=38331
+ Signed-off-by: Michał Masłowski <mtjm@mtjm.eu>
+ Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
commit 34964b05c16161de65709d60799b9ad97ce56296
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date: Fri Jan 27 15:35:44 2012 +1000
diff --git a/debian/changelog b/debian/changelog
index 542e326..fcd8366 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,11 +1,11 @@
-libxi (2:1.5.99.3-1) UNRELEASED; urgency=low
+libxi (2:1.6.0-1) UNRELEASED; urgency=low
- * New upstream release candidate
+ * New upstream release
* Bump build deps on x11proto-input-dev
* Fix scroll valuator increment value on 32-bit machines
- Added 0001_scroll_increment_value.patch
- -- Chase Douglas <chase.douglas@ubuntu.com> Wed, 07 Mar 2012 14:18:45 -0800
+ -- Chase Douglas <chase.douglas@ubuntu.com> Fri, 30 Mar 2012 17:49:28 -0700
libxi (2:1.5.99.2-1) experimental; urgency=low
commit 70b730b0548ca9e408f14f2576b972beb32a0ad0
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date: Thu Mar 8 16:03:50 2012 +1000
libXi 1.6.0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
diff --git a/configure.ac b/configure.ac
index 77341da..fc8c1f2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,7 +1,7 @@
# Initialize Autoconf
AC_PREREQ([2.60])
-AC_INIT([libXi], [1.5.99.3],
+AC_INIT([libXi], [1.6.0],
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [libXi])
AC_CONFIG_SRCDIR([Makefile.am])
AC_CONFIG_HEADERS([src/config.h])
commit 1b9f0394c3d4d3833f8560ae8170a4d5842419ab
Author: Chase Douglas <chase.douglas@canonical.com>
Date: Wed Mar 7 14:52:54 2012 -0800
Fix XIScrollClass increment value on 32-bit machines
This fixes scroll class increment values on 32-bit machines. Performing
1UL << 32 shifts the bit off the end of a 32-bit unsigned long value. By
expanding to 1ULL, we have the full 64-bits of an unsigned long long
including on 32-bit machines.
Before this change, xinput list --long would output scroll increment
values of -nan.
Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
diff --git a/src/XExtInt.c b/src/XExtInt.c
index 7694f06..89c0894 100644
--- a/src/XExtInt.c
+++ b/src/XExtInt.c
@@ -1695,7 +1695,7 @@ copy_classes(XIDeviceInfo* to, xXIAnyInfo* from, int *nclasses)
cls_lib->scroll_type= cls_wire->scroll_type;
cls_lib->flags = cls_wire->flags;
cls_lib->increment = cls_wire->increment.integral;
- cls_lib->increment += (unsigned int)cls_wire->increment.frac/(double)(1UL << 32);
+ cls_lib->increment += (unsigned int)cls_wire->increment.frac/(double)(1ULL << 32);
to->classes[cls_idx++] = any_lib;
}
commit c1a5a70b51f12dedf354102217c7cd4247ed3a4b
Author: Michał Masłowski <mtjm@mtjm.eu>
Date: Tue Feb 21 20:54:40 2012 +0100
Fix bus error on MIPS N32 for bug #38331.
XIValuatorClassInfo and XIScrollClassInfo might have an address
of 4 bytes modulo 8, while they contain doubles which need 8 byte
alignment. This is fixed by adding extra padding after each structure
or array in sizeDeviceClassType and adding helper functions to
determine sizes and padding only in one place.
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=38331
Signed-off-by: Michał Masłowski <mtjm@mtjm.eu>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
diff --git a/src/XExtInt.c b/src/XExtInt.c
index b12886d..7694f06 100644
--- a/src/XExtInt.c
+++ b/src/XExtInt.c
@@ -1036,6 +1036,55 @@ sizeDeviceEvent(int buttons_len, int valuators_len,
return len;
}
+/* Return the size with added padding so next element would be
+ double-aligned unless the architecture is known to allow unaligned
+ data accesses. Not doing this can cause a bus error on
+ MIPS N32. */
+static int
+pad_to_double(int size)
+{
+#if !defined(__i386__) && !defined(__sh__)
+ if (size % sizeof(double) != 0)
+ size += sizeof(double) - size % sizeof(double);
+#endif
+ return size;
+}
+
+/**
+ * Set structure and atoms to size in bytes of XIButtonClassInfo, its
+ * button state mask and labels array.
+ */
+static void
+sizeXIButtonClassType(int num_buttons, int* structure, int* state, int* atoms)
+{
+ int size;
+ int labels;
+
+ *structure = pad_to_double(sizeof(XIButtonClassInfo));
+ size = ((((num_buttons + 7)/8) + 3)/4);
+
+ /* Force mask alignment with longs to avoid unaligned
+ * access when accessing the atoms. */
+ *state = pad_to_double(size * 4);
+ labels = num_buttons * sizeof(Atom);
+
+ /* Force mask alignment with longs to avoid
+ * unaligned access when accessing the atoms. */
+ labels += ((((num_buttons + 7)/8) + 3)/4) * sizeof(Atom);
+ *atoms = pad_to_double(labels);
+}
+
+/**
+ * Set structure and keycodes to size in bytes of XIKeyClassInfo and
+ * its keycodes array.
+ */
+static void
+sizeXIKeyClassType(int num_keycodes, int* structure, int* keycodes)
+{
+ *structure = pad_to_double(sizeof(XIKeyClassInfo));
+ *keycodes = pad_to_double(num_keycodes * sizeof(int));
+}
+
/**
* Return the size in bytes required to store the matching class type
* num_elements is num_buttons for XIButtonClass or num_keycodes for
@@ -1047,27 +1096,26 @@ static int
sizeDeviceClassType(int type, int num_elements)
{
int l = 0;
+ int extra1 = 0;
+ int extra2 = 0;
switch(type)
{
case XIButtonClass:
- l = sizeof(XIButtonClassInfo);
- l += num_elements * sizeof(Atom);
- /* Force mask alignment with longs to avoid
- * unaligned access when accessing the atoms. */
- l += ((((num_elements + 7)/8) + 3)/4) * sizeof(Atom);
+ sizeXIButtonClassType(num_elements, &l, &extra1, &extra2);
+ l += extra1 + extra2;
break;
case XIKeyClass:
- l = sizeof(XIKeyClassInfo);
- l += num_elements * sizeof(int);
+ sizeXIKeyClassType(num_elements, &l, &extra1);
+ l += extra1;
break;
case XIValuatorClass:
- l = sizeof(XIValuatorClassInfo);
+ l = pad_to_double(sizeof(XIValuatorClassInfo));
break;
case XIScrollClass:
- l = sizeof(XIScrollClassInfo);
+ l = pad_to_double(sizeof(XIScrollClassInfo));
break;
case XITouchClass:
- l = sizeof(XITouchClassInfo);
+ l = pad_to_double(sizeof(XITouchClassInfo));
break;
default:
printf("sizeDeviceClassType: unknown type %d\n", type);
@@ -1156,20 +1204,21 @@ copyDeviceChangedEvent(XGenericEventCookie *in_cookie,
{
case XIButtonClass:
{
- int size;
+ int struct_size;
+ int state_size;
+ int labels_size;
XIButtonClassInfo *bin, *bout;
bin = (XIButtonClassInfo*)any;
- bout = next_block(&ptr, sizeof(XIButtonClass));
+ sizeXIButtonClassType(bin->num_buttons, &struct_size,
+ &state_size, &labels_size);
+ bout = next_block(&ptr, struct_size);
*bout = *bin;
- /* Force mask alignment with longs to avoid unaligned
- * access when accessing the atoms. */
- size = bout->state.mask_len/4 * sizeof(Atom);
- bout->state.mask = next_block(&ptr, size);
+ bout->state.mask = next_block(&ptr, state_size);
memcpy(bout->state.mask, bin->state.mask,
bout->state.mask_len);
- bout->labels = next_block(&ptr, bout->num_buttons * sizeof(Atom));
+ bout->labels = next_block(&ptr, labels_size);
memcpy(bout->labels, bin->labels, bout->num_buttons * sizeof(Atom));
out->classes[i] = (XIAnyClassInfo*)bout;
break;
@@ -1177,11 +1226,15 @@ copyDeviceChangedEvent(XGenericEventCookie *in_cookie,
case XIKeyClass:
{
XIKeyClassInfo *kin, *kout;
+ int struct_size;
+ int keycodes_size;
kin = (XIKeyClassInfo*)any;
+ sizeXIKeyClassType(kin->num_keycodes, &struct_size,
+ &keycodes_size);
- kout = next_block(&ptr, sizeof(XIKeyClass));
+ kout = next_block(&ptr, struct_size);
*kout = *kin;
- kout->keycodes = next_block(&ptr, kout->num_keycodes * sizeof(int));
+ kout->keycodes = next_block(&ptr, keycodes_size);
memcpy(kout->keycodes, kin->keycodes, kout->num_keycodes * sizeof(int));
out->classes[i] = (XIAnyClassInfo*)kout;
break;
@@ -1190,7 +1243,8 @@ copyDeviceChangedEvent(XGenericEventCookie *in_cookie,
{
XIValuatorClassInfo *vin, *vout;
vin = (XIValuatorClassInfo*)any;
- vout = next_block(&ptr, sizeof(XIValuatorClass));
+ vout = next_block(&ptr,
+ sizeDeviceClassType(XIValuatorClass, 0));
*vout = *vin;
out->classes[i] = (XIAnyClassInfo*)vout;
break;
@@ -1199,7 +1253,8 @@ copyDeviceChangedEvent(XGenericEventCookie *in_cookie,
{
XIScrollClassInfo *sin, *sout;
sin = (XIScrollClassInfo*)any;
- sout = next_block(&ptr, sizeof(XIScrollClassInfo));
+ sout = next_block(&ptr,
+ sizeDeviceClassType(XIScrollClass, 0));
*sout = *sin;
out->classes[i] = (XIAnyClassInfo*)sout;
break;
@@ -1478,7 +1533,8 @@ size_classes(xXIAnyInfo* from, int nclasses)
xXIAnyInfo *any_wire;
char *ptr_wire;
- len = nclasses * sizeof(XIAnyClassInfo*); /* len for to->classes */
+ /* len for to->classes */
+ len = pad_to_double(nclasses * sizeof(XIAnyClassInfo*));
ptr_wire = (char*)from;
for (i = 0; i < nclasses; i++)
{
@@ -1533,7 +1589,8 @@ copy_classes(XIDeviceInfo* to, xXIAnyInfo* from, int *nclasses)
ptr_wire = (char*)from;
ptr_lib = to->classes;
- to->classes = next_block(&ptr_lib, (*nclasses) * sizeof(XIAnyClassInfo*));
+ to->classes = next_block(&ptr_lib,
+ pad_to_double((*nclasses) * sizeof(XIAnyClassInfo*)));
memset(to->classes, 0, (*nclasses) * sizeof(XIAnyClassInfo*));
len = 0; /* count wire length */
@@ -1549,24 +1606,26 @@ copy_classes(XIDeviceInfo* to, xXIAnyInfo* from, int *nclasses)
XIButtonClassInfo *cls_lib;
xXIButtonInfo *cls_wire;
uint32_t *atoms;
- int size;
int j;
+ int struct_size;
+ int state_size;
+ int labels_size;
- cls_lib = next_block(&ptr_lib, sizeof(XIButtonClassInfo));
cls_wire = (xXIButtonInfo*)any_wire;
+ sizeXIButtonClassType(cls_wire->num_buttons,
+ &struct_size, &state_size,
+ &labels_size);
+ cls_lib = next_block(&ptr_lib, struct_size);
cls_lib->type = cls_wire->type;
cls_lib->sourceid = cls_wire->sourceid;
cls_lib->num_buttons = cls_wire->num_buttons;
- size = ((((cls_wire->num_buttons + 7)/8) + 3)/4);
- cls_lib->state.mask_len = size * 4;
- /* Force mask alignment with longs to avoid unaligned
- * access when accessing the atoms. */
- cls_lib->state.mask = next_block(&ptr_lib, size * sizeof(Atom));
+ cls_lib->state.mask_len = state_size;
+ cls_lib->state.mask = next_block(&ptr_lib, state_size);
memcpy(cls_lib->state.mask, &cls_wire[1],
cls_lib->state.mask_len);
- cls_lib->labels = next_block(&ptr_lib, cls_lib->num_buttons * sizeof(Atom));
+ cls_lib->labels = next_block(&ptr_lib, labels_size);
atoms =(uint32_t*)((char*)&cls_wire[1] + cls_lib->state.mask_len);
for (j = 0; j < cls_lib->num_buttons; j++)
cls_lib->labels[j] = *atoms++;
@@ -1578,15 +1637,18 @@ copy_classes(XIDeviceInfo* to, xXIAnyInfo* from, int *nclasses)
{
XIKeyClassInfo *cls_lib;
xXIKeyInfo *cls_wire;
+ int struct_size;
+ int keycodes_size;
- cls_lib = next_block(&ptr_lib, sizeof(XIKeyClassInfo));
cls_wire = (xXIKeyInfo*)any_wire;
+ sizeXIKeyClassType(cls_wire->num_keycodes,
+ &struct_size, &keycodes_size);
+ cls_lib = next_block(&ptr_lib, struct_size);
cls_lib->type = cls_wire->type;
cls_lib->sourceid = cls_wire->sourceid;
cls_lib->num_keycodes = cls_wire->num_keycodes;
- cls_lib->keycodes = next_block(&ptr_lib,
- cls_lib->num_keycodes * sizeof(int));
+ cls_lib->keycodes = next_block(&ptr_lib, keycodes_size);
memcpy(cls_lib->keycodes, &cls_wire[1],
cls_lib->num_keycodes);
@@ -1598,7 +1660,9 @@ copy_classes(XIDeviceInfo* to, xXIAnyInfo* from, int *nclasses)
XIValuatorClassInfo *cls_lib;
xXIValuatorInfo *cls_wire;
- cls_lib = next_block(&ptr_lib, sizeof(XIValuatorClassInfo));
+ cls_lib =
+ next_block(&ptr_lib,
+ sizeDeviceClassType(XIValuatorClass, 0));
cls_wire = (xXIValuatorInfo*)any_wire;
cls_lib->type = cls_wire->type;
@@ -1620,7 +1684,9 @@ copy_classes(XIDeviceInfo* to, xXIAnyInfo* from, int *nclasses)
XIScrollClassInfo *cls_lib;
xXIScrollInfo *cls_wire;
- cls_lib = next_block(&ptr_lib, sizeof(XIScrollClassInfo));
+ cls_lib =
+ next_block(&ptr_lib,
+ sizeDeviceClassType(XIScrollClass, 0));
cls_wire = (xXIScrollInfo*)any_wire;
cls_lib->type = cls_wire->type;
Reply to: