[RFC wayland] protocol: Add high-resolution wl_touch timestamp event
Jonas Ã…dahl
jadahl at gmail.com
Tue Nov 21 14:52:00 UTC 2017
On Tue, Nov 21, 2017 at 03:45:48PM +0200, Alexandros Frantzis wrote:
> wl_touch events currently use a 32-bit timestamp with millisecond
> resolution. In some cases, notably latency measurements, this resolution
> is too coarse-grained to be useful.
>
> This protocol update adds a wl_touch.timestamp event, which is emitted
> just before an up, motion or down touch event. The timestamp event
> contains a high-resolution, and ideally higher-accuracy, version of the
> 'time' argument of the up/motion/down event that follows.
>
> From a client implementation perspective clients can just ignore this event if
> they don't care about the improved resolution. Clients that care just need to
> keep track of the last timestamp event they receive and associate it with the
> next up/motion/down event that arrives.
>
> Some points for discussion:
>
> 1. Should there be a request to explicitly enable/disable the timestamp event
> (to reduce extra event overhead when improved timestamps are not needed)?
Is there any overhead though? Or are you assuming compositors compress
events when it wouldn't be enabled, or that it'd some how take more
effort to fetch higher resolution timestamps?
>
> 2. Should we introduce similar timestamp events for keyboard and pointer?
Not too sure about that. We considered using micro seconds for the
relative pointer protocol[0], but eventually decided not to. Maybe that was
the wrong decision anyhow.
>
> 3. Should this be a separate protocol instead of a core update (being separate
> would also take care of point (1))?
Not too sure. It's trivial to add it as an extension, but it's also
trivial to add it to wayland.xml. I guess if (1) is actually useful it'd
be better to make it an extension.
>
> A proof of concept implementation for weston can be found at:
>
> https://git.collabora.com/cgit/user/alf/weston.git/log/?h=wl-touch-v7
>
> Note that the weston implementation depends on a patchset that changes weston
> to use higher resolution timestamps internally. The patchset been submitted
> for review at:
>
> https://lists.freedesktop.org/archives/wayland-devel/2017-November/035851.html
>
> Signed-off-by: Alexandros Frantzis <alexandros.frantzis at collabora.com>
> ---
> protocol/wayland.xml | 27 +++++++++++++++++++++++----
> 1 file changed, 23 insertions(+), 4 deletions(-)
>
> diff --git a/protocol/wayland.xml b/protocol/wayland.xml
> index aabc7ae..b01811e 100644
> --- a/protocol/wayland.xml
> +++ b/protocol/wayland.xml
> @@ -1657,7 +1657,7 @@
> </request>
> </interface>
>
> - <interface name="wl_seat" version="6">
> + <interface name="wl_seat" version="7">
> <description summary="group of input devices">
> A seat is a group of keyboards, pointer and touch devices. This
> object is published as a global during start up, or when such a
> @@ -1766,7 +1766,7 @@
>
> </interface>
>
> - <interface name="wl_pointer" version="6">
> + <interface name="wl_pointer" version="7">
> <description summary="pointer input device">
> The wl_pointer interface represents one or more input devices,
> such as mice, which control the pointer location and pointer_focus
> @@ -2089,7 +2089,7 @@
> </event>
> </interface>
>
> - <interface name="wl_keyboard" version="6">
> + <interface name="wl_keyboard" version="7">
> <description summary="keyboard input device">
> The wl_keyboard interface represents one or more keyboards
> associated with a seat.
> @@ -2200,7 +2200,7 @@
> </event>
> </interface>
>
> - <interface name="wl_touch" version="6">
> + <interface name="wl_touch" version="7">
> <description summary="touchscreen input device">
> The wl_touch interface represents a touchscreen
> associated with a seat.
> @@ -2342,6 +2342,25 @@
> <arg name="id" type="int" summary="the unique ID of this touch point"/>
> <arg name="orientation" type="fixed" summary="angle between major axis and positive surface y-axis in degrees"/>
> </event>
> +
> + <!-- Version 7 additions -->
> +
> + <event name="timestamp" since="7">
> + <description summary="high-resolution timestamp event">
> + The timestamp event is sent just before a wl_touch.up, wl_touch.motion
> + or wl_touch.down event and provides a high-resolution version of the
> + time argument of the event that follows.
> +
> + The timestamp provided by this event is at least as accurate
> + as the timestamp provided by the wl_touch event that follows.
> + </description>
> + <arg name="tv_sec_hi" type="uint"
> + summary="high 32 bits of the seconds part of the timestamp"/>
> + <arg name="tv_sec_lo" type="uint"
> + summary="low 32 bits of the seconds part of the timestamp"/>
> + <arg name="tv_nsec" type="uint"
> + summary="nanoseconds part of the timestamp"/>
Is nano-seconds really necessary? FWIW, you'll only get timestamps with
up to micro seconds granularity from libinput, and protocol wise it'd be
a simple usec_hi::u32, usec_lo::u32 pair, and in code it could be passed
around as a uint64_t (as is done in libinput).
ALso, tv_nsec as a 32 bit uint doesn't seem enough. In struct timesec
tv_nsec is 64 bit.
Jonas
[0] https://lists.freedesktop.org/archives/wayland-devel/2015-November/025497.html
> + </event>
> </interface>
>
> <interface name="wl_output" version="3">
> --
> 2.14.1
>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/wayland-devel
More information about the wayland-devel
mailing list