[PATCH v2 0/7] Improve latency of IR decoding
Matthias Reichl
hias at horus.com
Tue Apr 10 10:53:43 PDT 2018
Hi Sean,
On Sun, Apr 08, 2018 at 10:19:35PM +0100, Sean Young wrote:
> The current IR decoding is much too slow. Many IR protocols rely on
> a trailing space for decoding (e.g. rc-6 needs to know when the bits
> end). The trailing space is generated by the IR timeout, and if this
> is longer than required, buttons can feel slow to respond.
>
> The other issue is the keyup timer. IR has no concept of a keyup message,
> this is implied by the absence of IR. So, minimising the timeout for
> this makes buttons less "sticky"; the are released much quicker.
>
> With these patches in place, using IR with the builtin decoders is much
> improved and feels very snappy.
>
> Changes since v1:
> - lost more testing
> - fixed various issues with mce decoder
> - fixed mceusb so it can use better timeout too
thanks, this version is working fine with meson-ir and gpio-rc-recv
(latter on RPi). I mainly tested it with rc-5 remotes so far, more
will follow and I'll update LibreELEC in a day or two to include
the v2 series.
Also thanks a lot for the mce_kbd fixes, I was just going to dig
into the decoder (we received a bug report about stuck keys with
mce_kbd last week), your patches can in just at the right time :)
I had a closer look at ir-mce_kbd-decoder.c and noticed 2 things
(which can be handled separately):
It looks like the input_sync call in the state machine error
path is not necessary:
out:
dev_dbg(&dev->dev, "failed at state %i (%uus %s)\n",
data->state, TO_US(ev.duration), TO_STR(ev.pulse));
data->state = STATE_INACTIVE;
input_sync(data->idev);
return -EINVAL;
If I followed the code paths correctly states that generate
input events won't go to out, only paths were no events are
generated jump to out - but better verify that, I could have
missed something.
The other thing I noticed is that there's no spinlock synchronizing
the events from the timeout callback with the ones from the state
machine - like keylock in rc-main. So the code could potentially
be racy (if the timeout fires while the state machine is outputting
events).
so long,
Hias
>
> Sean Young (7):
> media: rc: set timeout to smallest value required by enabled protocols
> media: rc: add ioctl to get the current timeout
> media: rc: per-protocol repeat period and minimum keyup timer
> media: rc: mce_kbd decoder: low timeout values cause double keydowns
> media: rc: mce_kbd protocol encodes two scancodes
> media: rc: mce_kbd decoder: fix stuck keys
> media: rc: mceusb: allow the timeout to be configurable
>
> Documentation/media/uapi/rc/lirc-func.rst | 1 +
> .../media/uapi/rc/lirc-set-rec-timeout.rst | 14 +++--
> drivers/media/cec/cec-core.c | 2 +-
> drivers/media/rc/ir-imon-decoder.c | 1 +
> drivers/media/rc/ir-jvc-decoder.c | 1 +
> drivers/media/rc/ir-mce_kbd-decoder.c | 36 +++++++-----
> drivers/media/rc/ir-nec-decoder.c | 1 +
> drivers/media/rc/ir-rc5-decoder.c | 1 +
> drivers/media/rc/ir-rc6-decoder.c | 1 +
> drivers/media/rc/ir-sanyo-decoder.c | 1 +
> drivers/media/rc/ir-sharp-decoder.c | 1 +
> drivers/media/rc/ir-sony-decoder.c | 1 +
> drivers/media/rc/ir-xmp-decoder.c | 1 +
> drivers/media/rc/lirc_dev.c | 9 ++-
> drivers/media/rc/mceusb.c | 22 +++++++
> drivers/media/rc/rc-core-priv.h | 1 +
> drivers/media/rc/rc-ir-raw.c | 31 +++++++++-
> drivers/media/rc/rc-main.c | 68 +++++++++++-----------
> include/uapi/linux/lirc.h | 6 ++
> 19 files changed, 144 insertions(+), 55 deletions(-)
>
> --
> 2.14.3
>
More information about the linux-amlogic
mailing list