From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751500AbdBUIxm (ORCPT ); Tue, 21 Feb 2017 03:53:42 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:36185 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750954AbdBUIxc (ORCPT ); Tue, 21 Feb 2017 03:53:32 -0500 Date: Tue, 21 Feb 2017 09:53:28 +0100 From: Pali =?utf-8?B?Um9ow6Fy?= To: "H. Nikolaus Schaller" Cc: Dmitry Torokhov , Sebastian Reichel , Mark Rutland , =?utf-8?Q?Beno=C3=AEt?= Cousson , Tony Lindgren , Russell King , Arnd Bergmann , Michael Welling , Mika =?utf-8?B?UGVudHRpbMOk?= , Javier Martinez Canillas , Igor Grinberg , "Andrew F. Davis" , Mark Brown , Jonathan Cameron , Rob Herring , Alexander Stein , Eric Engestrom , Hans de Goede , Benjamin Tissoires , Petr Cvek , Mauro Carvalho Chehab , Hans Verkuil , Nick Dyer , Siebren Vroegindeweij , Michel Verlaan , linux-input@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, letux-kernel@openphoenux.org, linux-iio@vger.kernel.org, kernel@pyra-handheld.com, Aaro Koskinen , Pavel Machek , Andrey Gelman , Haibo Chen Subject: Re: [PATCH v9 1/8] drivers:input:tsc2007: add new common binding names, pre-calibration, flipping and rotation Message-ID: <20170221085328.GC9795@pali> References: <201702202207.38582@pali> <201702202254.35023@pali> <4BA8DA1B-D6CB-4D38-AAD6-3B1CF217E521@goldelico.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <4BA8DA1B-D6CB-4D38-AAD6-3B1CF217E521@goldelico.com> User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tuesday 21 February 2017 07:42:17 H. Nikolaus Schaller wrote: > Hi Pali, > > > Am 20.02.2017 um 22:54 schrieb Pali Rohár : > > > > On Monday 20 February 2017 22:24:31 H. Nikolaus Schaller wrote: > >> Hi Pali, > >> > >>> Am 20.02.2017 um 22:07 schrieb Pali Rohár : > >>> > >>> On Monday 20 February 2017 21:35:18 H. Nikolaus Schaller wrote: > >>>> Hi Pali, > >>>> > >>>>> Am 20.02.2017 um 20:42 schrieb Pali Rohár : > >>>>> > >>>>> Hi Nikolaus! > >>>>> > >>>>> On Monday 20 February 2017 17:50:04 H. Nikolaus Schaller wrote: > >>>>>> Hi Dmitry, > >>>>>> > >>>>>>> Input driver may set resolution for given axis in units per mm > >>>>>>> (or units per radian for rotational axis ABS_RX, ABS_RY, > >>>>>>> ABS_RZ), and if you check the binding, you can use > >>>>>>> "touchscreen-x-mm" and "touchscreen-y-mm" to specify the size > >>>>>>> of entire touch surface and set resolution from it so that > >>>>>>> userspace can calculate the proper scaling factor. > >>>>>> > >>>>>> How is this information exposed by the kernel to user-space? By > >>>>>> scanning the DT file or tree? > >>>>> > >>>>> Set input_abs_set_res() from kernel. And in userspace call > >>>>> EVIOCGABS ioctl() on input device. Look at struct input_absinfo, > >>>>> you should have all needed information here. This is generic > >>>>> input interface, no DT is needed. > >>>> > >>>> This assumes that I can and want to write a graphics system > >>>> myself. > >>> > >>> Not only. There are already existing graphics systems. And you need > >>> to provide needed information from kernel, so they can start using > >>> it. > >>> > >>> So input_abs_set_res() is needed to use in your kernel driver. > >> > >> I didn't know about this feature and obviously nobody else has > >> implemented it in the tsc2007 driver. > > > > So... before doing other things, can you deeply look at it and check if > > it really fixes this problem? Because I think that yes. > > > > You can probably set it from DT and in your DT file you can have stored > > screen size (or resolution factor). > > > > Also for testing, you can set it even via userspace (ioctl which I wrote > > in previous email). > > Interesting thing. It does not seem to be well known because nobody else > brought it up during several months of lenghty discussions. > > I have seen it is in use for scaling topics, e.g. https://lkml.org/lkml/2015/7/9/749 E.g. my touchpad (ALPS) exports this information. It is not touchscreen device, but still it is absolute positioned device. And looking into kernel tree it is used by more input drivers... > > > >>>> And if it does, it does it in a > >>>> plethora of different implementation states. That is the reason > >>>> why we want to solve it once for all userlands in the kernel and > >>>> not rely on user-space help. > >>> > >>> For me this looks like "we are going to fix userspace bugs in > >>> kernel". > >> > >> Such things are system bugs and it is neither necessarily a userspace > >> or kernel bug. > > > > In case kernel defines stable API/ABI and correctly provides information > > via that API/ABI and application does not work correctly, then I would > > say it is bug in application. Not in kernel. > > So a kernel can simply add a new interface and declare bugs for userland? That is something different. But yes it could be problematic if you create userspace and immediately after that kernel define some API which is against usage of your userspace. So something like this would depend on situation. But I hope right now it is clear. That resolution property is there for a long time and new code (which is your case) should use it. > > > > We can say that some kernel API/ABI is wrong too. And in this case it > > could be bug in kernel. > > > > So is current stable kernel API/ABI for input device wrong? I do not > > thing. > > Difficult to judge because there is scarce documentation of this. > > > But if you think that yes, please show us what exactly and we can > > start discussing how to fix such problem which you see/have. I know that > > no application is without bugs, but in my opinion problem which you are > > describing is already solved and defined by current stable kernel ABI. > > > >>> Really! Not a good idea. Plus I still see this as abusing kernel > >>> API/ABI as resolution should be handled differently as you are > >>> proposing. > >> > >> I don't understand what you say here. Where are we abusing kernel > >> API/ABI? > > > > I mean that we already have stable API/ABI how to export size of input > > screen from kernel to userspace. And you want to rescale event data > > directly in kernel to workaround problem of screen size. So I think this > > is abusing API/ABI as kernel already have API for it. > > BR and thanks, > Nikolaus > -- Pali Rohár pali.rohar@gmail.com From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pali =?utf-8?B?Um9ow6Fy?= Subject: Re: [PATCH v9 1/8] drivers:input:tsc2007: add new common binding names, pre-calibration, flipping and rotation Date: Tue, 21 Feb 2017 09:53:28 +0100 Message-ID: <20170221085328.GC9795@pali> References: <201702202207.38582@pali> <201702202254.35023@pali> <4BA8DA1B-D6CB-4D38-AAD6-3B1CF217E521@goldelico.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Content-Disposition: inline In-Reply-To: <4BA8DA1B-D6CB-4D38-AAD6-3B1CF217E521-xXXSsgcRVICgSpxsJD1C4w@public.gmane.org> Sender: linux-iio-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: "H. Nikolaus Schaller" Cc: Dmitry Torokhov , Sebastian Reichel , Mark Rutland , =?utf-8?Q?Beno=C3=AEt?= Cousson , Tony Lindgren , Russell King , Arnd Bergmann , Michael Welling , Mika =?utf-8?B?UGVudHRpbMOk?= , Javier Martinez Canillas , Igor Grinberg , "Andrew F. Davis" , Mark Brown , Jonathan Cameron , Rob Herring , Alexander Stein , Eric Engestrom , Hans de Goede , Benjamin Tissoires List-Id: devicetree@vger.kernel.org On Tuesday 21 February 2017 07:42:17 H. Nikolaus Schaller wrote: > Hi Pali, > > > Am 20.02.2017 um 22:54 schrieb Pali Rohár : > > > > On Monday 20 February 2017 22:24:31 H. Nikolaus Schaller wrote: > >> Hi Pali, > >> > >>> Am 20.02.2017 um 22:07 schrieb Pali Rohár : > >>> > >>> On Monday 20 February 2017 21:35:18 H. Nikolaus Schaller wrote: > >>>> Hi Pali, > >>>> > >>>>> Am 20.02.2017 um 20:42 schrieb Pali Rohár : > >>>>> > >>>>> Hi Nikolaus! > >>>>> > >>>>> On Monday 20 February 2017 17:50:04 H. Nikolaus Schaller wrote: > >>>>>> Hi Dmitry, > >>>>>> > >>>>>>> Input driver may set resolution for given axis in units per mm > >>>>>>> (or units per radian for rotational axis ABS_RX, ABS_RY, > >>>>>>> ABS_RZ), and if you check the binding, you can use > >>>>>>> "touchscreen-x-mm" and "touchscreen-y-mm" to specify the size > >>>>>>> of entire touch surface and set resolution from it so that > >>>>>>> userspace can calculate the proper scaling factor. > >>>>>> > >>>>>> How is this information exposed by the kernel to user-space? By > >>>>>> scanning the DT file or tree? > >>>>> > >>>>> Set input_abs_set_res() from kernel. And in userspace call > >>>>> EVIOCGABS ioctl() on input device. Look at struct input_absinfo, > >>>>> you should have all needed information here. This is generic > >>>>> input interface, no DT is needed. > >>>> > >>>> This assumes that I can and want to write a graphics system > >>>> myself. > >>> > >>> Not only. There are already existing graphics systems. And you need > >>> to provide needed information from kernel, so they can start using > >>> it. > >>> > >>> So input_abs_set_res() is needed to use in your kernel driver. > >> > >> I didn't know about this feature and obviously nobody else has > >> implemented it in the tsc2007 driver. > > > > So... before doing other things, can you deeply look at it and check if > > it really fixes this problem? Because I think that yes. > > > > You can probably set it from DT and in your DT file you can have stored > > screen size (or resolution factor). > > > > Also for testing, you can set it even via userspace (ioctl which I wrote > > in previous email). > > Interesting thing. It does not seem to be well known because nobody else > brought it up during several months of lenghty discussions. > > I have seen it is in use for scaling topics, e.g. https://lkml.org/lkml/2015/7/9/749 E.g. my touchpad (ALPS) exports this information. It is not touchscreen device, but still it is absolute positioned device. And looking into kernel tree it is used by more input drivers... > > > >>>> And if it does, it does it in a > >>>> plethora of different implementation states. That is the reason > >>>> why we want to solve it once for all userlands in the kernel and > >>>> not rely on user-space help. > >>> > >>> For me this looks like "we are going to fix userspace bugs in > >>> kernel". > >> > >> Such things are system bugs and it is neither necessarily a userspace > >> or kernel bug. > > > > In case kernel defines stable API/ABI and correctly provides information > > via that API/ABI and application does not work correctly, then I would > > say it is bug in application. Not in kernel. > > So a kernel can simply add a new interface and declare bugs for userland? That is something different. But yes it could be problematic if you create userspace and immediately after that kernel define some API which is against usage of your userspace. So something like this would depend on situation. But I hope right now it is clear. That resolution property is there for a long time and new code (which is your case) should use it. > > > > We can say that some kernel API/ABI is wrong too. And in this case it > > could be bug in kernel. > > > > So is current stable kernel API/ABI for input device wrong? I do not > > thing. > > Difficult to judge because there is scarce documentation of this. > > > But if you think that yes, please show us what exactly and we can > > start discussing how to fix such problem which you see/have. I know that > > no application is without bugs, but in my opinion problem which you are > > describing is already solved and defined by current stable kernel ABI. > > > >>> Really! Not a good idea. Plus I still see this as abusing kernel > >>> API/ABI as resolution should be handled differently as you are > >>> proposing. > >> > >> I don't understand what you say here. Where are we abusing kernel > >> API/ABI? > > > > I mean that we already have stable API/ABI how to export size of input > > screen from kernel to userspace. And you want to rescale event data > > directly in kernel to workaround problem of screen size. So I think this > > is abusing API/ABI as kernel already have API for it. > > BR and thanks, > Nikolaus > -- Pali Rohár pali.rohar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org