[PATCH xserver] xf86ScaleAxis: support for high resolution devices

Benjamin Tissoires tissoire at cena.fr
Tue Apr 13 01:14:05 PDT 2010



Le 12/04/2010 09:17, Philippe Ribet a écrit :
> Dan Nicholson wrote:
>> On Fri, Apr 9, 2010 at 7:51 AM, Benjamin Tissoires<tissoire at cena.fr>
>> wrote:
>>> High resolution devices was generating integer overflow.
>>> For instance the wacom Cintiq 21UX has an axis value up to
>>> 87000. Thus the term (dSx * (Cx - Rxlow)) is greater than
>>> MAX_INT32.
>>>
>>> Using 64bits integer avoids such problem.
>>>
>>> Signed-off-by: Philippe Ribet<ribet at cena.fr>
>>> Signed-off-by: Benjamin Tissoires<tissoire at cena.fr>
>>> ---
>>> hw/xfree86/common/xf86Xinput.c | 6 +++---
>>> 1 files changed, 3 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/hw/xfree86/common/xf86Xinput.c
>>> b/hw/xfree86/common/xf86Xinput.c
>>> index 8229227..80bdd19 100644
>>> --- a/hw/xfree86/common/xf86Xinput.c
>>> +++ b/hw/xfree86/common/xf86Xinput.c
>>> @@ -1172,12 +1172,12 @@ xf86ScaleAxis(int Cx,
>>> int Rxlow )
>>> {
>>> int X;
>>> - int dSx = Sxhigh - Sxlow;
>>> - int dRx = Rxhigh - Rxlow;
>>> + int64_t dSx = Sxhigh - Sxlow;
>>> + int64_t dRx = Rxhigh - Rxlow;
>> Not sure, but would you not also need to change the function
>> parameters to int64_t?
> I don't expect any input peripheral to send values bigger than 32 bits.
>
long answer:

there are 2 problems if we change the function parameters:
1) this will break the ABI and we don't have any devices that send its 
values on 64 bits, so does it worth the effort?
2) we will still have an integer overflow if the two input values are 
beyond MAX_INT32.... so changing the prototype to int64_t does not help.

Anyway thanks for your review, we will post the new patch soon

Cheers,
Benjamin


More information about the xorg-devel mailing list