[ANNOUNCE] libinput 1.6.901

2017-02-22 Thread Peter Hutterer
The first RC for libinput 1.7 is now available. This cycle was quite a large
one and several big features were merged, so expect a few RCs before the
final release.

First big feature: James Ye implemented support for switches, in particular
lid switches. Closing the lid now disables the touchpad to avoid ghost
touches but it also makes the lid switch event itself available to any
callers. This is a new interface announced by the LIBINPUT_DEVICE_CAP_SWITCH
capability, see the documentation for more info:
https://wayland.freedesktop.org/libinput/doc/latest/group__event__switch.html

Touchpads now use pressure values to detect touches instead of relying on
BTN_TOUCH. This enables us to have per-device pressure values where needed
to avoid misdetection of light or hovering touches. For now all touchpads
use the default pressure vaules, if you have had issues with touch
misdetection please file a bug with the required pressure ranges.

Wheel tilt events are now handled as such provided the device is correctly
labelled by the hwdb. A wheel tilt will not be advertised as scroll source
'wheel' but rather 'wheel tilt', making it possible to different between the
two in the caller.

Middle mouse button emulation is now compatible with scroll wheel emulation,
i.e. it is possible to set scroll wheel emulation on the right mouse button
and still enjoy middle button emulation. This is useful mostly on very old
mice and some trackballs.

On the topic of scroll wheel emulation: pressing the scroll button now
always generates a button event (provided now scrolling was triggered).
Previously this depended on an internal timeout which was hard to predict
for users. Of course, if any scrolling is triggered while the button is
down, no button events are sent.

Tablet pad LEDs now hook up correctly to the new kernel LED implementation
available in v4.9 and later. Pressing the respective mode button will thus
toggle pad modes in the events correctly.

Internal cleanup work touched most of libinput. And a gcov run exposed
some untested code paths and a lot of tests have been added for those.
External touchpad-keyboard combos can now be marked with a udev property to
sure we enable disable-while-typing on the correct devices.

Finally, the libinput-debug-events tool now uses colours and hides keycodes
by default. It's now safe to run it in the background to record events
without having to worry that passwords end up in the log. If you do need the
keycodes, run with the --show-keycodes argument.

As usual, the git shortlog is below.

James Ye (4):
  Add a "switch" interface for parts of the SW_* range
  Add evdev_dispatch interface for lid switch
  Pair touchpad and lid_switch for disable
  test: add tests for lid switch

Mihail Konev (1):
  autogen: add default patch prefix

Peter Hutterer (122):
  Add wheel tilt as axis source
  evdev: add support for wheel tilt
  test: remove some untriggered code from the keyboard tests
  test: simplify some checks in the path test
  test: fix pointer accel defaults test
  test: fix some tablet tests' unreached code
  test: check if left-handed is available for the left-handed tests
  Hook up gcov for coverage reports
  test: add a test for keyboard LED updates
  test: add helper function to install a "bug expected" log handler
  test: add test for invalid udev_assign_seat on path context
  test: add test for invalid path operations on udev backends
  util: make all property parsing helpers ignore NULL strings
  test: add tests for checking for buttons for a non-pointer device
  test: test for libinput_device_get/set_user_data
  test: add test for fetching invalid pointer axes
  test: add some device capability checks
  test: add a test to force a destroy for the path backend
  test: add a tablet tool capability check
  test: add test for tablet_tool_get/set_user_data
  test: add a test for tablet pad event timestamps
  test: add a test for the tool ID
  test: add device size/no size checks
  test: test absence of scroll events on keyboards
  test: ad calls to check whether pressure has changed
  test: add more tests for tap-drag config
  test: add tests for tablet buttons and button seat count
  test: check the pad button state in litest_is_pad_button_event
  test: add test to set tap map on unsupported devices
  test: add wheel tilt tests
  pad: implement kernel-based pad led handling
  touchpad: mask out ABS_MT if we don't have or disable MT
  touchpad: convert normalized_length to physical coordinates
  Drop normalized_get_direction, use physical distances instead
  evdev: fix an error message
  touchpad: use a helper function for the libinput context
  autogen.sh: exec the configure script
  evdev: move the lid switch process functions together
  touchpad: check for a switch type before handling the event
  Clar

Re: [PATCH wayland v2 2/4] wayland-util: split out private functionality to separate file

2017-02-22 Thread Eric Engestrom
On Tuesday, 2017-02-21 16:14:27 +, Emil Velikov wrote:
> From: Emil Velikov 
> 
> With next commit we'll make wayland-util a shared library (for reasons
> mentioned in the commit). As such we need to make sure that the private
> symbols are somewhere that they can be used internally. Otherwise we'll
> end up with link errors.
> 
> v2: Rebase.
> 
> Signed-off-by: Emil Velikov 
> ---
>  Makefile.am|   1 +
>  src/wayland-util-private.c | 303 
> +
>  src/wayland-util.c | 272 +---
>  3 files changed, 305 insertions(+), 271 deletions(-)
>  create mode 100644 src/wayland-util-private.c
> 

[snip]

> diff --git a/src/wayland-util.c b/src/wayland-util.c
> index cab7fc5..bb91aa7 100644
> --- a/src/wayland-util.c
> +++ b/src/wayland-util.c
> @@ -30,8 +30,8 @@
>  #include 
>  #include 
>  
> -#include "wayland-util.h"
>  #include "wayland-private.h"
> +#include "wayland-util.h"
>  
>  WL_EXPORT void
>  wl_list_init(struct wl_list *list)

Seeing this raises a red flag in my mind: why is this needed?
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston 21/68] compositor-drm: Use drm_fb for cursor buffers

2017-02-22 Thread Pekka Paalanen
On Fri,  9 Dec 2016 19:57:36 +
Daniel Stone  wrote:

> Now that we have better types in drm_fb, use it for cursor buffers as
> well.
> 
> Differential Revision: https://phabricator.freedesktop.org/D1493
> 
> Signed-off-by: Daniel Stone 
> ---
>  libweston/compositor-drm.c | 73 
> +-
>  1 file changed, 53 insertions(+), 20 deletions(-)

Hi,

looks like this patch causes an FB to be created from cursor bo-s, and
this was not done before and the FBs are not used yet. I think this
requires an explanation in the commit message: what happens and why it
will be useful later.

I assume the purpose is to use them with universal planes, right?

> 
> diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
> index 950c265..557b97d 100644
> --- a/libweston/compositor-drm.c
> +++ b/libweston/compositor-drm.c
> @@ -135,6 +135,7 @@ enum drm_fb_type {
>   BUFFER_CLIENT, /**< directly sourced from client */
>   BUFFER_PIXMAN_DUMB, /**< internal Pixman rendering */
>   BUFFER_GBM_SURFACE, /**< internal EGL rendering */
> + BUFFER_CURSOR, /**< internal cursor buffer */
>  };
>  
>  struct drm_fb {
> @@ -183,11 +184,12 @@ struct drm_output {
>   int disable_pending;
>  
>   struct gbm_surface *gbm_surface;
> - struct gbm_bo *gbm_cursor_bo[2];
> + struct drm_fb *gbm_cursor_fb[2];
>   struct weston_plane cursor_plane;
> - struct weston_plane fb_plane;
>   struct weston_view *cursor_view;
>   int current_cursor;
> +
> + struct weston_plane fb_plane;

What is fb_plane doing here?

>   struct drm_fb *current, *next;
>   struct backlight *backlight;
>  
> @@ -285,7 +287,8 @@ drm_fb_destroy_gbm(struct gbm_bo *bo, void *data)
>  {
>   struct drm_fb *fb = data;
>  
> - assert(fb->type == BUFFER_GBM_SURFACE || fb->type == BUFFER_CLIENT);
> + assert(fb->type == BUFFER_GBM_SURFACE || fb->type == BUFFER_CLIENT ||
> +fb->type == BUFFER_CURSOR);
>   drm_fb_destroy(fb);
>  }
>  
> @@ -493,6 +496,7 @@ drm_fb_unref(struct drm_fb *fb)
>   case BUFFER_PIXMAN_DUMB:
>   drm_fb_destroy_dumb(fb);
>   break;
> + case BUFFER_CURSOR:
>   case BUFFER_CLIENT:
>   gbm_bo_destroy(fb->bo);
>   break;
> @@ -1281,7 +1285,7 @@ drm_output_set_cursor(struct drm_output *output)
>   pixman_region32_fini(&output->cursor_plane.damage);
>   pixman_region32_init(&output->cursor_plane.damage);
>   output->current_cursor ^= 1;
> - bo = output->gbm_cursor_bo[output->current_cursor];
> + bo = output->gbm_cursor_fb[output->current_cursor]->bo;
>  
>   cursor_bo_update(b, bo, ev);
>   handle = gbm_bo_get_handle(bo).s32;
> @@ -1867,6 +1871,48 @@ find_crtc_for_connector(struct drm_backend *b,
>   return -1;
>  }
>  
> +static void drm_output_fini_cursor_egl(struct drm_output *output)
> +{
> + unsigned int i;
> +
> + for (i = 0; i < ARRAY_LENGTH(output->gbm_cursor_fb); i++) {
> + drm_fb_unref(output->gbm_cursor_fb[i]);

Oh this is why drm_fb_unref() silently accepts NULL. I thought we had a
habit of avoiding that, or are destructors an exception?

> + output->gbm_cursor_fb[i] = NULL;
> + }
> +}
> +
> +static int
> +drm_output_init_cursor_egl(struct drm_output *output, struct drm_backend *b)
> +{
> + unsigned int i;
> +
> + for (i = 0; i < ARRAY_LENGTH(output->gbm_cursor_fb); i++) {
> + struct gbm_bo *bo;
> +
> + bo = gbm_bo_create(b->gbm, b->cursor_width, b->cursor_height,
> +GBM_FORMAT_ARGB,
> +GBM_BO_USE_CURSOR | GBM_BO_USE_WRITE);
> + if (!bo)
> + goto err;
> +
> + output->gbm_cursor_fb[i] =
> + drm_fb_get_from_bo(bo, b, GBM_FORMAT_ARGB,
> +BUFFER_CURSOR);
> + if (!output->gbm_cursor_fb[i]) {
> + gbm_bo_destroy(bo);
> + goto err;
> + }
> + }
> +
> + return 0;
> +
> +err:
> + weston_log("cursor buffers unavailable, using gl cursors\n");
> + b->cursors_are_broken = 1;
> + drm_output_fini_cursor_egl(output);
> + return -1;
> +}
> +
>  /* Init output state that depends on gl or gbm */
>  static int
>  drm_output_init_egl(struct drm_output *output, struct drm_backend *b)
> @@ -1875,7 +1921,7 @@ drm_output_init_egl(struct drm_output *output, struct 
> drm_backend *b)
>   output->gbm_format,
>   fallback_format_for(output->gbm_format),
>   };
> - int i, flags, n_formats = 1;
> + int n_formats = 1;
>  
>   output->gbm_surface = gbm_surface_create(b->gbm,
>output->base.current_mode->width,
> @@ -1901,21 +1947,7 @@ drm_output_init_egl(struct drm_output *output, struct 
> drm_backend *b

Re: [PATCH weston 15/68] compositor-drm: Add explicit type member to drm_fb

2017-02-22 Thread Pekka Paalanen
On Tue, 21 Feb 2017 15:29:09 +0200
Pekka Paalanen  wrote:

> On Fri,  9 Dec 2016 19:57:30 +
> Daniel Stone  wrote:
> 
> > Rather than magically trying to infer what the buffer is and what we
> > should do with it when we go to destroy it, add an explicit type
> > instead.
> > 
> > Differential Revision: https://phabricator.freedesktop.org/D1488
> > 
> > Signed-off-by: Daniel Stone 
> > ---
> >  libweston/compositor-drm.c | 50 
> > +-
> >  1 file changed, 32 insertions(+), 18 deletions(-)

> > weston_buffer_reference(&fb->buffer_ref, buffer);
> >  }
> >  
> > @@ -452,15 +461,19 @@ drm_output_release_fb(struct drm_output *output, 
> > struct drm_fb *fb)
> > if (!fb)
> > return;
> >  
> > -   if (fb->map &&
> > -(fb != output->dumb[0] && fb != output->dumb[1])) {
> > -   drm_fb_destroy_dumb(fb);  
> 
> This piece sent me into a recursive "well, actually..." loop.
> 
> It looked like dead code at first hand, as this gets hit when
> output->dumb and fb don't match. When would that be? I would guess when
> video mode changed.
> 
> I think changing resolutions would hit this path, when flipping to a
> new dumb buffer of a different size than one coming out of scanout
> which cannot be destroyed until pageflip completed.
> 
> Except I am wrong in a couple of ways: destroying the buffer is fine,
> the kernel will keep it referenced as long as necessary anyway. And,
> drm_output_switch_mode() does destroy everything immediately.
> 
> So this bit is ok. Unless there is a third well-actually.

And there is it:

< MrCooper> pq: IME KMS framebuffers aren't reference-counted in the
kernel; destroying an fb which is still being scanned out by any CRTCs
turns off those CRTCs

Is it then so, that drm_output_switch_mode() is wrong to destroy the FB
immediately before even flipping a new one, but as it does so, there is
no leak introduced by removing the above drm_fb_destroy_dumb() call?

I.e. the patch does not regress anything because of a bug elsewhere?

If that is so, my R-b stands, as fixing switch_mode is a whole another
matter. Also the refcounting introduced later in this series offer a
much better basis for fixing switch_mode.


Thanks,
pq


pgprcatV6EflH.pgp
Description: OpenPGP digital signature
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston 20/68] compositor-drm: Use refcounted FBs for Pixman

2017-02-22 Thread Pekka Paalanen
On Fri,  9 Dec 2016 19:57:35 +
Daniel Stone  wrote:

> When using the Pixman renderer, use drm_fb refcounting explicitly.
> 
> Differential Revision: https://phabricator.freedesktop.org/D1492
> 
> Signed-off-by: Daniel Stone 
> ---
>  libweston/compositor-drm.c | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
> index a684ac9..950c265 100644
> --- a/libweston/compositor-drm.c
> +++ b/libweston/compositor-drm.c
> @@ -491,7 +491,7 @@ drm_fb_unref(struct drm_fb *fb)
>  
>   switch (fb->type) {
>   case BUFFER_PIXMAN_DUMB:
> - /* nothing: pixman buffers are destroyed manually */
> + drm_fb_destroy_dumb(fb);
>   break;
>   case BUFFER_CLIENT:
>   gbm_bo_destroy(fb->bo);
> @@ -652,7 +652,7 @@ drm_output_render_pixman(struct drm_output *output, 
> pixman_region32_t *damage)
>  
>   output->current_image ^= 1;
>  
> - output->next = output->dumb[output->current_image];
> + output->next = drm_fb_ref(output->dumb[output->current_image]);
>   pixman_renderer_output_set_buffer(&output->base,
> output->image[output->current_image]);
>  
> @@ -1973,7 +1973,7 @@ drm_output_init_pixman(struct drm_output *output, 
> struct drm_backend *b)
>  err:
>   for (i = 0; i < ARRAY_LENGTH(output->dumb); i++) {
>   if (output->dumb[i])
> - drm_fb_destroy_dumb(output->dumb[i]);
> + drm_fb_unref(output->dumb[i]);
>   if (output->image[i])
>   pixman_image_unref(output->image[i]);
>  
> @@ -1993,8 +1993,8 @@ drm_output_fini_pixman(struct drm_output *output)
>   pixman_region32_fini(&output->previous_damage);
>  
>   for (i = 0; i < ARRAY_LENGTH(output->dumb); i++) {
> - drm_fb_destroy_dumb(output->dumb[i]);
>   pixman_image_unref(output->image[i]);
> + drm_fb_unref(output->dumb[i]);
>   output->dumb[i] = NULL;
>   output->image[i] = NULL;
>   }

Reviewed-by: Pekka Paalanen 


Thanks,
pq


pgp4RluGT0uyv.pgp
Description: OpenPGP digital signature
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel