Re: [PATCH] drm-backend: for now, on the egl backend, force gl cursors to be used instead of hardware cursors

2015-05-19 Thread Pekka Paalanen
On Mon, 18 May 2015 22:10:27 -0400
nerdopolis bluescreen_aven...@verizon.net wrote:

 Hardware cursors have been causing some problems with some drivers, mostly 
 i915
 
 This will probably be changed once Atomic Mode Setting arrives, to probably 
 only force gl cursors
 to always be on when Atomic Mode Setting isn't supported by the driver, or 
 kernel version
 ---
  src/compositor-drm.c | 3 +++
  1 file changed, 3 insertions(+)
 
 diff --git a/src/compositor-drm.c b/src/compositor-drm.c
 index 0cdb8f4..0636a37 100644
 --- a/src/compositor-drm.c
 +++ b/src/compositor-drm.c
 @@ -1641,6 +1641,9 @@ drm_output_init_egl(struct drm_output *output, struct 
 drm_compositor *ec)
   weston_log(cursor buffers unavailable, using gl cursors\n);
   ec-cursors_are_broken = 1;
   }
 + /* TODO Remove when atomic mode setting is merged into the mainline 
 kernel, and detect if the
 +  * running kernel supports atomic mode setting instead. */
 + ec-cursors_are_broken = 1;
  
   return 0;
  }

Hi,

I think this is the wrong place to set this, we need it also for the
Pixman path. It should just be set in the same place we set
sprites_are_broken.

There is also quite a lot more background info I would like to record
with this commit, so I went ahead and just rewrote this patch. I will
be sending it to the list right now.


Thanks,
pq
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH weston] compositor-wayland: Handle window close events more gracefully

2015-05-19 Thread Dima Ryazanov
When a compositor window is closed, remove the output instead of just exiting.

(The if (!input-output) checks are kind of ugly - but I couldn't find
a better way to handle the output going away.)

Signed-off-by: Dima Ryazanov d...@gmail.com
---
 src/compositor-wayland.c | 22 +++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/src/compositor-wayland.c b/src/compositor-wayland.c
index c9983e0..aaf205b 100644
--- a/src/compositor-wayland.c
+++ b/src/compositor-wayland.c
@@ -1307,6 +1307,9 @@ input_handle_pointer_leave(void *data, struct wl_pointer 
*pointer,
 {
struct wayland_input *input = data;
 
+   if (!input-output)
+   return;
+
if (input-output-frame) {
frame_pointer_leave(input-output-frame, input);
 
@@ -1327,6 +1330,9 @@ input_handle_motion(void *data, struct wl_pointer 
*pointer,
int32_t fx, fy;
enum theme_location location;
 
+   if (!input-output)
+   return;
+
if (input-output-frame) {
location = frame_pointer_motion(input-output-frame, input,
wl_fixed_to_int(x),
@@ -1368,6 +1374,9 @@ input_handle_button(void *data, struct wl_pointer 
*pointer,
enum frame_button_state fstate;
enum theme_location location;
 
+   if (!input-output)
+   return;
+
if (input-output-frame) {
fstate = state == WL_POINTER_BUTTON_STATE_PRESSED ?
FRAME_BUTTON_PRESSED : FRAME_BUTTON_RELEASED;
@@ -1384,8 +1393,15 @@ input_handle_button(void *data, struct wl_pointer 
*pointer,
return;
}
 
-   if (frame_status(input-output-frame)  FRAME_STATUS_CLOSE)
-   
wl_display_terminate(input-compositor-base.wl_display);
+   if (frame_status(input-output-frame)  FRAME_STATUS_CLOSE) {
+   wayland_output_destroy(input-output-base);
+   input-output = input-keyboard_focus = NULL;
+
+   if (wl_list_empty(input-compositor-base.output_list))
+   
wl_display_terminate(input-compositor-base.wl_display);
+
+   return;
+   }
 
if (frame_status(input-output-frame)  FRAME_STATUS_REPAINT)
weston_output_schedule_repaint(input-output-base);
@@ -1521,7 +1537,7 @@ input_handle_keyboard_leave(void *data,
 
focus = input-keyboard_focus;
if (!focus)
-   return; /* This shouldn't happen */
+   return;
 
focus-keyboard_count--;
if (!focus-keyboard_count  focus-frame) {
-- 
2.4.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH wayland] Add enum attribute to arg elements

2015-05-19 Thread Christian Stroetmann

Am 19.05.2015 09:19, schrieb Christian Stroetmann:

On the 19th of May 2015 08:33, Pekka Paalanen wrote:

On Mon, 18 May 2015 19:23:20 -0700
Bryce Harringtonbr...@osg.samsung.com  wrote:


On Sat, May 02, 2015 at 11:52:22PM +0200, Auke Booij wrote:

On 19 April 2015 at 14:51, Jeroen Bollenjbin...@gmail.com  wrote:

Hello,

It seems like this discussion died off. Currently there is no way 
to tell,
from the Wayland XML specification whether an argument is a 
bitfield, or

whether the argument takes an enum and what enum this is.

Since we're only a couple weeks out from a release, and since this
obviously is a non-trivial change to the API, I'd be most 
comfortable if

we held this until 1.9 opens, and land it then; that would give us
maximum time to test this.

Hi,

yeah, this is definitely not post-alpha material, because it is
changing the Wayland protocol XML language, which is even more
fundamental than the wayland.xml itself. Also, with wayland.xml we know
what things change ABI, but changing the XML language is much harder to
reason about, as the discussion shows.

Sorry, but I do not have time to look into this soon.


Thanks,
pq


Aloha

I am not sure if
enumeration.xsd https://developer.bluetooth.org/ schema/ 
Documentation/ enumeration_xsd.html

and
bitfield xsd 
https://developer.bluetooth.org/schema/Documentation/bitfield_xsd.html


might help, but the XML Schema Definitions (XSDs) have the right 
names, seem to be related, and are included in the General Agreement 
on Tariffs and Trade (GATT) Schemas found under 
https://developer.bluetooth.org/gatt/Pages/FormatTypes.aspx on the 
Bluetooth developer portal.




Please, let me correct the email.

enumeration.xsd 
https://developer.bluetooth.org/schema/Documentation/enumeration_xsd.html


bitfield.xsd 
https://developer.bluetooth.org/schema/Documentation/bitfield_xsd.html


(GATT) Schemas index 
https://developer.bluetooth.org/schema/Documentation/indexPage.html


Somehow, it seems to be that the access to the Documentation directory 
on the website bluetooth.org is connected with a user account.


C.S.



Thanks
Best Regards
Have fun
C.S:



___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH weston] compositor-drm: disable hardware cursors

2015-05-19 Thread Pekka Paalanen
From: Pekka Paalanen pekka.paala...@collabora.co.uk

With the recent universal plane and atomic modeset / nuclear pageflip
development in the kernel, cursor content updates on Intel are currently causing
an extra wait for vblank. This drops Weston's framerate to a fraction by
2 when cursor contents update. This combined with the damage tracking
bug in Weston which causes cursor content updates on every frame the
cursor moves makes using hw cursors really bad.

It is possible that the Intel DRM driver will get fixed and cursor
updates there revert to their old behaviour on the contemporary KMS API.
However, it is hardware dependant whether cursor updates can happen
immediately.  Some other hardware, especially ARM-related, may not be
able to do immediate updates. Therefore it is better to just not even
try - we should rely only on the lowest common denominator behaviour
between hardware and drivers as there is no and will not be any way to
reliably detect it.

Note, that while having different drivers do different things (immediate
update vs. update that gets latched on the next vblank), we cannot
rearrange the contemporary KMS API calls such that it would always work
fine. Either some hardware would update the cursor too early, or other
hardware would update the cursor too late and perhaps cause the
framerate decimation.

Mark hardware cursors broken by default. This avoids using them, and
works around the immediate problem of framerate issues in Weston. This
follows the same reasoning why hardware overlay planes have been
disabled by default for a long time.

This disablement will be removed once the current code for hardware
planes and cursors is replaced with code using the atomic KMS API.

The Intel driver change that exposed this problem is
https://github.com/torvalds/linux/commit/38f3ce3af5742eb5a3e9b01997f5ab85109c5762
which is first included in Linux 4.0-rc1.

Signed-off-by: Pekka Paalanen pekka.paala...@collabora.co.uk
Cc: nerdopolis bluescreen_aven...@verizon.net
Cc: Daniel Stone dan...@fooishbar.org
Cc: Giulio Camuffo giuliocamu...@gmail.com
---

There are no bug reports or emails to be referenced here, are there?
At least I couldn't find any.

Thanks,
pq

 src/compositor-drm.c | 12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/compositor-drm.c b/src/compositor-drm.c
index 313860b..0a9af5d 100644
--- a/src/compositor-drm.c
+++ b/src/compositor-drm.c
@@ -2817,9 +2817,17 @@ drm_compositor_create(struct wl_display *display,
if (ec == NULL)
return NULL;
 
-   /* KMS support for sprites is not complete yet, so disable the
-* functionality for now. */
+   /*
+* KMS support for hardware planes cannot properly synchronize
+* without nuclear page flip. Without nuclear/atomic, hw plane
+* and cursor plane updates would either tear or cause extra
+* waits for vblanks which means dropping the compositor framerate
+* to a fraction.
+*
+* These can be enabled again when nuclear/atomic support lands.
+*/
ec-sprites_are_broken = 1;
+   ec-cursors_are_broken = 1;
 
section = weston_config_get_section(config, core, NULL, NULL);
if (get_gbm_format_from_section(section,
-- 
2.3.6

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH 0/2] Misc fixes for the RDP compositor

2015-05-19 Thread David FORT
This serie contains a patch to force keys and certificates with the RDP
compositor as it is almost unusable without them. It also makes dynamic the 
seat allocated per connection, so that we can free the RDP context and
keep alive the seat (to workaround the fact that we can't safely free a seat).

David FORT (2):
  RDP compositor: make the seat dynamic and don't destroy it on removal
  RDP compositor: enforce certificate and key

 src/compositor-rdp.c | 45 +
 1 file changed, 33 insertions(+), 12 deletions(-)

-- 
1.9.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH 2/2] RDP compositor: enforce certificate and key

2015-05-19 Thread David FORT
The RDP compositor is usable without certificates and key in a very limited
number of cases (local usage using xfreerdp), so let's force the presence of
keys and certificates.
---
 src/compositor-rdp.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/src/compositor-rdp.c b/src/compositor-rdp.c
index f1dcda0..261fa4b 100644
--- a/src/compositor-rdp.c
+++ b/src/compositor-rdp.c
@@ -1278,5 +1278,11 @@ backend_init(struct wl_display *display, int *argc, char 
*argv[],
};
 
parse_options(rdp_options, ARRAY_LENGTH(rdp_options), argc, argv);
+   if (!config.rdp_key  (!config.server_cert || !config.server_key)) {
+   weston_log(the RDP compositor requires keys and an optional 
certificate for RDP or TLS security (
+   --rdp4-key or 
--rdp-tls-cert/--rdp-tls-key)\n);
+   return NULL;
+   }
+
return rdp_compositor_create(display, config, argc, argv, wconfig);
 }
-- 
1.9.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH 1/2] RDP compositor: make the seat dynamic and don't destroy it on removal

2015-05-19 Thread David FORT
This patch makes the seat dynamic and leak it on purpose during seat removal to
prevent the ghost object case.
---
 src/compositor-rdp.c | 39 +++
 1 file changed, 27 insertions(+), 12 deletions(-)

diff --git a/src/compositor-rdp.c b/src/compositor-rdp.c
index 3185141..f1dcda0 100644
--- a/src/compositor-rdp.c
+++ b/src/compositor-rdp.c
@@ -105,7 +105,7 @@ enum peer_item_flags {
 struct rdp_peers_item {
int flags;
freerdp_peer *peer;
-   struct weston_seat seat;
+   struct weston_seat *seat;
 
struct wl_list link;
 };
@@ -606,6 +606,7 @@ static void
 rdp_peer_context_free(freerdp_peer* client, RdpPeerContext* context)
 {
int i;
+   struct weston_seat *seat;
if (!context)
return;
 
@@ -616,9 +617,17 @@ rdp_peer_context_free(freerdp_peer* client, 
RdpPeerContext* context)
}
 
if (context-item.flags  RDP_PEER_ACTIVATED) {
-   weston_seat_release_keyboard(context-item.seat);
-   weston_seat_release_pointer(context-item.seat);
-   weston_seat_release(context-item.seat);
+   seat = context-item.seat;
+   weston_seat_release_keyboard(seat);
+   weston_seat_release_pointer(seat);
+
+   /* picked from weston_seat_release(context-item.seat); */
+   wl_list_remove(seat-link);
+   if (seat-saved_kbd_focus)
+   wl_list_remove(seat-saved_kbd_focus_listener.link);
+   wl_global_destroy(seat-global);
+   wl_signal_emit(seat-destroy_signal, seat);
+
}
 
Stream_Free(context-encode_stream, TRUE);
@@ -887,9 +896,15 @@ xf_peer_activate(freerdp_peer* client)
else
snprintf(seat_name, sizeof(seat_name), RDP peer @%s, 
settings-ClientAddress);
 
-   weston_seat_init(peersItem-seat, c-base, seat_name);
-   weston_seat_init_keyboard(peersItem-seat, keymap);
-   weston_seat_init_pointer(peersItem-seat);
+   peersItem-seat = zalloc(sizeof(*peersItem-seat));
+   if (!peersItem-seat) {
+   weston_log(unable to allocate the seat for %s, seat_name);
+   return FALSE;
+   }
+
+   weston_seat_init(peersItem-seat, c-base, seat_name);
+   weston_seat_init_keyboard(peersItem-seat, keymap);
+   weston_seat_init_pointer(peersItem-seat);
 
peersItem-flags |= RDP_PEER_ACTIVATED;
 
@@ -929,7 +944,7 @@ xf_mouseEvent(rdpInput *input, UINT16 flags, UINT16 x, 
UINT16 y) {
if (x  output-base.width  y  output-base.height) {
wl_x = wl_fixed_from_int((int)x);
wl_y = wl_fixed_from_int((int)y);
-   notify_motion_absolute(peerContext-item.seat, 
weston_compositor_get_time(),
+   notify_motion_absolute(peerContext-item.seat, 
weston_compositor_get_time(),
wl_x, wl_y);
}
}
@@ -942,7 +957,7 @@ xf_mouseEvent(rdpInput *input, UINT16 flags, UINT16 x, 
UINT16 y) {
button = BTN_MIDDLE;
 
if (button) {
-   notify_button(peerContext-item.seat, 
weston_compositor_get_time(), button,
+   notify_button(peerContext-item.seat, 
weston_compositor_get_time(), button,
(flags  PTR_FLAGS_DOWN) ? 
WL_POINTER_BUTTON_STATE_PRESSED : WL_POINTER_BUTTON_STATE_RELEASED
);
}
@@ -958,7 +973,7 @@ xf_mouseEvent(rdpInput *input, UINT16 flags, UINT16 x, 
UINT16 y) {
if (flags  PTR_FLAGS_WHEEL_NEGATIVE)
axis = -axis;
 
-   notify_axis(peerContext-item.seat, 
weston_compositor_get_time(),
+   notify_axis(peerContext-item.seat, 
weston_compositor_get_time(),
WL_POINTER_AXIS_VERTICAL_SCROLL,
axis);
}
@@ -976,7 +991,7 @@ xf_extendedMouseEvent(rdpInput *input, UINT16 flags, UINT16 
x, UINT16 y) {
if (x  output-base.width  y  output-base.height) {
wl_x = wl_fixed_from_int((int)x);
wl_y = wl_fixed_from_int((int)y);
-   notify_motion_absolute(peerContext-item.seat, 
weston_compositor_get_time(),
+   notify_motion_absolute(peerContext-item.seat, 
weston_compositor_get_time(),
wl_x, wl_y);
}
 
@@ -1039,7 +1054,7 @@ xf_input_keyboard_event(rdpInput *input, UINT16 flags, 
UINT16 code)
 
/*weston_log(code=%x ext=%d vk_code=%x scan_code=%x\n, code, 
(flags  KBD_FLAGS_EXTENDED) ? 1 : 0,
vk_code, scan_code);*/
-   notify_key(peerContext-item.seat, 
weston_compositor_get_time(),
+   notify_key(peerContext-item.seat, weston_compositor_get_time(),
scan_code - 8, keyState, 
STATE_UPDATE_AUTOMATIC);
}
 

Re: [PATCH weston] compositor-drm: disable hardware cursors

2015-05-19 Thread Hardening
Le 19/05/2015 09:26, Pekka Paalanen a écrit :
 From: Pekka Paalanen pekka.paala...@collabora.co.uk
 
 With the recent universal plane and atomic modeset / nuclear pageflip
 development in the kernel, cursor content updates on Intel are currently 
 causing
 an extra wait for vblank. This drops Weston's framerate to a fraction by
 2 when cursor contents update. This combined with the damage tracking
 bug in Weston which causes cursor content updates on every frame the
 cursor moves makes using hw cursors really bad.
 
 It is possible that the Intel DRM driver will get fixed and cursor
 updates there revert to their old behaviour on the contemporary KMS API.
 However, it is hardware dependant whether cursor updates can happen
 immediately.  Some other hardware, especially ARM-related, may not be
 able to do immediate updates. Therefore it is better to just not even
 try - we should rely only on the lowest common denominator behaviour
 between hardware and drivers as there is no and will not be any way to
 reliably detect it.
 
 Note, that while having different drivers do different things (immediate
 update vs. update that gets latched on the next vblank), we cannot
 rearrange the contemporary KMS API calls such that it would always work
 fine. Either some hardware would update the cursor too early, or other
 hardware would update the cursor too late and perhaps cause the
 framerate decimation.
 
 Mark hardware cursors broken by default. This avoids using them, and
 works around the immediate problem of framerate issues in Weston. This
 follows the same reasoning why hardware overlay planes have been
 disabled by default for a long time.
 
 This disablement will be removed once the current code for hardware
 planes and cursors is replaced with code using the atomic KMS API.
 
 The Intel driver change that exposed this problem is
 https://github.com/torvalds/linux/commit/38f3ce3af5742eb5a3e9b01997f5ab85109c5762
 which is first included in Linux 4.0-rc1.
 
 Signed-off-by: Pekka Paalanen pekka.paala...@collabora.co.uk
 Cc: nerdopolis bluescreen_aven...@verizon.net
 Cc: Daniel Stone dan...@fooishbar.org
 Cc: Giulio Camuffo giuliocamu...@gmail.com
 ---
 
 There are no bug reports or emails to be referenced here, are there?
 At least I couldn't find any.
 
 Thanks,
 pq
 
  src/compositor-drm.c | 12 ++--
  1 file changed, 10 insertions(+), 2 deletions(-)
 
 diff --git a/src/compositor-drm.c b/src/compositor-drm.c
 index 313860b..0a9af5d 100644
 --- a/src/compositor-drm.c
 +++ b/src/compositor-drm.c
 @@ -2817,9 +2817,17 @@ drm_compositor_create(struct wl_display *display,
   if (ec == NULL)
   return NULL;
  
 - /* KMS support for sprites is not complete yet, so disable the
 -  * functionality for now. */
 + /*
 +  * KMS support for hardware planes cannot properly synchronize
 +  * without nuclear page flip. Without nuclear/atomic, hw plane
 +  * and cursor plane updates would either tear or cause extra
 +  * waits for vblanks which means dropping the compositor framerate
 +  * to a fraction.
 +  *
 +  * These can be enabled again when nuclear/atomic support lands.
 +  */
   ec-sprites_are_broken = 1;
 + ec-cursors_are_broken = 1;
  
   section = weston_config_get_section(config, core, NULL, NULL);
   if (get_gbm_format_from_section(section,
 
Perhaps it would be nice if the most adventurous of us could re-enable
the cursors using a configuration file option...

Except this non blocking remark,
Reviewed-By: David FORT cont...@hardening-consulting.com


-- 
David FORT
website: http://www.hardening-consulting.com/

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston] compositor-drm: disable hardware cursors

2015-05-19 Thread Pekka Paalanen
On Tue, 19 May 2015 10:17:49 +0200
Hardening rdp.eff...@gmail.com wrote:

 Le 19/05/2015 09:26, Pekka Paalanen a écrit :
  From: Pekka Paalanen pekka.paala...@collabora.co.uk
  

   src/compositor-drm.c | 12 ++--
   1 file changed, 10 insertions(+), 2 deletions(-)
  
  diff --git a/src/compositor-drm.c b/src/compositor-drm.c
  index 313860b..0a9af5d 100644
  --- a/src/compositor-drm.c
  +++ b/src/compositor-drm.c
  @@ -2817,9 +2817,17 @@ drm_compositor_create(struct wl_display *display,
  if (ec == NULL)
  return NULL;
   
  -   /* KMS support for sprites is not complete yet, so disable the
  -* functionality for now. */
  +   /*
  +* KMS support for hardware planes cannot properly synchronize
  +* without nuclear page flip. Without nuclear/atomic, hw plane
  +* and cursor plane updates would either tear or cause extra
  +* waits for vblanks which means dropping the compositor framerate
  +* to a fraction.
  +*
  +* These can be enabled again when nuclear/atomic support lands.
  +*/
  ec-sprites_are_broken = 1;
  +   ec-cursors_are_broken = 1;
   
  section = weston_config_get_section(config, core, NULL, NULL);
  if (get_gbm_format_from_section(section,
  
 Perhaps it would be nice if the most adventurous of us could re-enable
 the cursors using a configuration file option...

Oh but you can, I believe. Except it's not a config option, it is a
debug key binding.

Debug key 'c' toggles hw cursors.
Debug key 'v' toggles hw overlays (sprites).
Debug key 'o' causes hw overlays to not be shown if they are used, so
you can see what's behind them while the compositor still thinks they
are there.

We should probably document those, but in the mean time
$ git grep -A1 add_debug_binding
will find all debug key bindings.

 Except this non blocking remark,
 Reviewed-By: David FORT cont...@hardening-consulting.com

Thanks,
pq
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston] compositor-drm: disable hardware cursors

2015-05-19 Thread Pekka Paalanen
On Tue, 19 May 2015 10:26:10 +0300
Pekka Paalanen ppaala...@gmail.com wrote:

 From: Pekka Paalanen pekka.paala...@collabora.co.uk
 
 With the recent universal plane and atomic modeset / nuclear pageflip
 development in the kernel, cursor content updates on Intel are currently 
 causing
 an extra wait for vblank. This drops Weston's framerate to a fraction by
 2 when cursor contents update. This combined with the damage tracking
 bug in Weston which causes cursor content updates on every frame the
 cursor moves makes using hw cursors really bad.
 
 It is possible that the Intel DRM driver will get fixed and cursor
 updates there revert to their old behaviour on the contemporary KMS API.
 However, it is hardware dependant whether cursor updates can happen
 immediately.  Some other hardware, especially ARM-related, may not be
 able to do immediate updates. Therefore it is better to just not even
 try - we should rely only on the lowest common denominator behaviour
 between hardware and drivers as there is no and will not be any way to
 reliably detect it.
 
 Note, that while having different drivers do different things (immediate
 update vs. update that gets latched on the next vblank), we cannot
 rearrange the contemporary KMS API calls such that it would always work
 fine. Either some hardware would update the cursor too early, or other
 hardware would update the cursor too late and perhaps cause the
 framerate decimation.
 
 Mark hardware cursors broken by default. This avoids using them, and
 works around the immediate problem of framerate issues in Weston. This
 follows the same reasoning why hardware overlay planes have been
 disabled by default for a long time.
 
 This disablement will be removed once the current code for hardware
 planes and cursors is replaced with code using the atomic KMS API.
 
 The Intel driver change that exposed this problem is
 https://github.com/torvalds/linux/commit/38f3ce3af5742eb5a3e9b01997f5ab85109c5762
 which is first included in Linux 4.0-rc1.
 
 Signed-off-by: Pekka Paalanen pekka.paala...@collabora.co.uk
 Cc: nerdopolis bluescreen_aven...@verizon.net
 Cc: Daniel Stone dan...@fooishbar.org
 Cc: Giulio Camuffo giuliocamu...@gmail.com
 ---

With Daniel's (irc) and David's R-bs, pushed.
   c4cfe85..6858383  master - master


Thanks,
pq
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH 1/2] RDP compositor: make the seat dynamic and don't destroy it on removal

2015-05-19 Thread Hardening
Le 19/05/2015 11:20, Pekka Paalanen a écrit :
 On Tue, 19 May 2015 10:07:39 +0200
 David FORT rdp.eff...@gmail.com wrote:
 
 This patch makes the seat dynamic and leak it on purpose during seat removal 
 to
 prevent the ghost object case.
 ---
  src/compositor-rdp.c | 39 +++
  1 file changed, 27 insertions(+), 12 deletions(-)

 diff --git a/src/compositor-rdp.c b/src/compositor-rdp.c
 index 3185141..f1dcda0 100644
 --- a/src/compositor-rdp.c
 +++ b/src/compositor-rdp.c
 @@ -105,7 +105,7 @@ enum peer_item_flags {
  struct rdp_peers_item {

[...]
 +weston_seat_release_pointer(seat);
 +
 +/* picked from weston_seat_release(context-item.seat); */
 +wl_list_remove(seat-link);
 +if (seat-saved_kbd_focus)
 +wl_list_remove(seat-saved_kbd_focus_listener.link);
 +wl_global_destroy(seat-global);
 
 Hi,
 
 are you sure destroying the global is ok? Ah, but the thing you want to
 keep are the *existing* protocol objects.
 

I have picked code weston_seat_release() from that was releasing things
in the seat without freeing it, but...

Thinking of it, it's really a bad idea to destroy the global, it could
cause clients to be disconnected if they try to do anything with the
seat. We're really lacking the release event...

I will modify this to try to handle this more nicely.

Thanks.
-- 
David FORT
website: http://www.hardening-consulting.com/

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: libinput parallel test suite attempts and results

2015-05-19 Thread Peter Hutterer
On Mon, May 18, 2015 at 07:27:01PM -0700, Bryce Harrington wrote:
 On Tue, May 19, 2015 at 12:04:34PM +1000, Peter Hutterer wrote:
  This is mostly just a comment on a failed attempt, in case someone is
  tempted to try it or has any feedback otherwise.
  
  The libinput tests suite has a couple of binaries (test-touchpad,
  test-pointer, etc.). The .NOTPARALLEL directive makes sure they're run
  serialised during make check. Because of the various timeouts we test again,
  a test run now takes nearly 3 minutes to complete. Which is annoying.
 
 Could you do something like swap in a synthetic clock where they're
 doing time dependent stuff, that you can advance at will to trigger the
 timeouts?

hmm, interesting idea. theoretically yes, but it could be awkward with
events that are sent through the kernel and thus have the timestamp that the
kernel applies. Short of filtering this on read somehow, I don't know how to
deal with that.

I think it may also solve the wrong problem, even without timeouts the
creation of devices, waiting for udev, etc. takes time. Though now that I
write this, I guess I should run gprof first before I start optimising.

Cheers,
   Peter

  Most tests could in theory run parallel because we only ever listen to one
  or two devices per test and ignore the rest. Alas, I have yet to get a
  single parallel run to succeed (and even that's with only running
  path-backend tests in parallel, forget about the udev tests altogether).
  
  The Makefile.am changes are trivial, see below, but even at make -j2 usually
  one or two tests fail (the wheel-only one most often since it needs custom
  udev rules), at higher -j levels you can forget about it altogether.
  
  So without some larger rewrite and figuring out how uinput + udev becomes
  reliable when you're hammering hundreds of devices per second against it the
  test suite will have to stay serial. 
  
  Any ideas welcome though.
  
  Cheers,
 Peter
  
  diff --git a/test/Makefile.am b/test/Makefile.am
  index 46959fd..c2f0fde 100644
  --- a/test/Makefile.am
  +++ b/test/Makefile.am
  @@ -38,18 +38,31 @@ liblitest_la_SOURCES = \
  litest-vmware-virtual-usb-mouse.c \
  litest.c
   liblitest_la_LIBADD = $(top_builddir)/src/libinput-util.la
  +liblitest_la_CFLAGS = $(AM_CFLAGS)
  +if HAVE_LIBUNWIND
  +liblitest_la_LIBADD += $(LIBUNWIND_LIBS) -ldl
  +liblitest_la_CFLAGS += $(LIBUNWIND_CFLAGS)
  +endif
  +
  +parallel_tests = \
  +   touchpad.test \
  +   device.test \
  +   pointer.test \
  +   touch.test \
  +   trackpoint.test \
  +   path.test \
  +   log.test \
  +   misc.test \
  +   keyboard.test \
  +   litest-selftest.test
  +
  +serial_tests = \
  +   udev.test
   
   run_tests = \
  -   test-touchpad \
  -   test-device \
  -   test-pointer \
  -   test-touch \
  -   test-trackpoint \
  -   test-udev \
  -   test-path \
  -   test-log \
  -   test-misc \
  -   test-keyboard
  +   $(parallel_tests) \
  +   $(serial_tests)
  +
   build_tests = \
  test-build-cxx \
  test-build-linker \
  @@ -60,47 +73,52 @@ noinst_PROGRAMS = $(build_tests) $(run_tests)
   noinst_SCRIPTS = symbols-leak-test
   TESTS = $(run_tests) symbols-leak-test
   
  -.NOTPARALLEL:
  +udev_test_SOURCES = udev.c
  +udev_test_LDADD = $(TEST_LIBS)
  +udev_test_LDFLAGS = -no-install
   
  -test_udev_SOURCES = udev.c
  -test_udev_LDADD = $(TEST_LIBS)
  -test_udev_LDFLAGS = -no-install
  +path_test_SOURCES = path.c
  +path_test_LDADD = $(TEST_LIBS)
  +path_test_LDFLAGS = -no-install
   
  -test_path_SOURCES = path.c
  -test_path_LDADD = $(TEST_LIBS)
  -test_path_LDFLAGS = -no-install
  +pointer_test_SOURCES = pointer.c
  +pointer_test_LDADD = $(TEST_LIBS)
  +pointer_test_LDFLAGS = -no-install
   
  -test_pointer_SOURCES = pointer.c
  -test_pointer_LDADD = $(TEST_LIBS)
  -test_pointer_LDFLAGS = -no-install
  +touch_test_SOURCES = touch.c
  +touch_test_LDADD = $(TEST_LIBS)
  +touch_test_LDFLAGS = -no-install
   
  -test_touch_SOURCES = touch.c
  -test_touch_LDADD = $(TEST_LIBS)
  -test_touch_LDFLAGS = -no-install
  +log_test_SOURCES = log.c
  +log_test_LDADD = $(TEST_LIBS)
  +log_test_LDFLAGS = -no-install
   
  -test_log_SOURCES = log.c
  -test_log_LDADD = $(TEST_LIBS)
  -test_log_LDFLAGS = -no-install
  +touchpad_test_SOURCES = touchpad.c
  +touchpad_test_LDADD = $(TEST_LIBS)
  +touchpad_test_LDFLAGS = -no-install
   
  -test_touchpad_SOURCES = touchpad.c
  -test_touchpad_LDADD = $(TEST_LIBS)
  -test_touchpad_LDFLAGS = -no-install
  +trackpoint_test_SOURCES = trackpoint.c
  +trackpoint_test_LDADD = $(TEST_LIBS)
  +trackpoint_test_LDFLAGS = -no-install
   
  -test_trackpoint_SOURCES = trackpoint.c
  -test_trackpoint_LDADD = $(TEST_LIBS)
  -test_trackpoint_LDFLAGS = -no-install
  +misc_test_SOURCES = misc.c
  +misc_test_LDADD = $(TEST_LIBS)
  +misc_test_LDFLAGS = -no-install
   
  -test_misc_SOURCES = misc.c
  -test_misc_LDADD = $(TEST_LIBS)
  -test_misc_LDFLAGS = -no-install
  +keyboard_test_SOURCES = keyboard.c
  +keyboard_test_LDADD = 

Re: [PATCH weston] terminal: Fix segmentation fault when processing DCH ANSI escape code

2015-05-19 Thread aaron

 Since d is not used subsequently in this function, why not combine the
 above two if statements into an and clause.  Then the patch is just a
 one-liner.
It needs to short-circuit the else block, so I can't put the conditions
together.

 It looks like this also gets called for ICH codes, where it looks like d
 isn't restricted to positive only values (afaict).  Will this cause any
 weird behaviors in that case?
I'll take a look at the way ICH needs to use it, good catch. :)
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH 1/2] RDP compositor: make the seat dynamic and don't destroy it on removal

2015-05-19 Thread Pekka Paalanen
On Tue, 19 May 2015 10:07:39 +0200
David FORT rdp.eff...@gmail.com wrote:

 This patch makes the seat dynamic and leak it on purpose during seat removal 
 to
 prevent the ghost object case.
 ---
  src/compositor-rdp.c | 39 +++
  1 file changed, 27 insertions(+), 12 deletions(-)
 
 diff --git a/src/compositor-rdp.c b/src/compositor-rdp.c
 index 3185141..f1dcda0 100644
 --- a/src/compositor-rdp.c
 +++ b/src/compositor-rdp.c
 @@ -105,7 +105,7 @@ enum peer_item_flags {
  struct rdp_peers_item {
   int flags;
   freerdp_peer *peer;
 - struct weston_seat seat;
 + struct weston_seat *seat;
  
   struct wl_list link;
  };
 @@ -606,6 +606,7 @@ static void
  rdp_peer_context_free(freerdp_peer* client, RdpPeerContext* context)
  {
   int i;
 + struct weston_seat *seat;
   if (!context)
   return;
  
 @@ -616,9 +617,17 @@ rdp_peer_context_free(freerdp_peer* client, 
 RdpPeerContext* context)
   }
  
   if (context-item.flags  RDP_PEER_ACTIVATED) {
 - weston_seat_release_keyboard(context-item.seat);
 - weston_seat_release_pointer(context-item.seat);
 - weston_seat_release(context-item.seat);
 + seat = context-item.seat;
 + weston_seat_release_keyboard(seat);
 + weston_seat_release_pointer(seat);
 +
 + /* picked from weston_seat_release(context-item.seat); */
 + wl_list_remove(seat-link);
 + if (seat-saved_kbd_focus)
 + wl_list_remove(seat-saved_kbd_focus_listener.link);
 + wl_global_destroy(seat-global);

Hi,

are you sure destroying the global is ok? Ah, but the thing you want to
keep are the *existing* protocol objects.

I'd like to have a little more explanation in the code comment on why
this is so strangely coded, and what it actually achieves.

 + wl_signal_emit(seat-destroy_signal, seat);
 +

Feel free to add that comment and push. These two patches are
Acked-by: Pekka Paalanen pekka.paala...@collabora.co.uk

I think it is ok to land these before RC2.


Thanks,
pq
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH 1/2] RDP compositor: make the seat dynamic and don't destroy it on removal

2015-05-19 Thread Pekka Paalanen
On Tue, 19 May 2015 11:39:24 +0200
Hardening rdp.eff...@gmail.com wrote:

 Le 19/05/2015 11:20, Pekka Paalanen a écrit :
  On Tue, 19 May 2015 10:07:39 +0200
  David FORT rdp.eff...@gmail.com wrote:
  
  This patch makes the seat dynamic and leak it on purpose during seat 
  removal to
  prevent the ghost object case.
  ---
   src/compositor-rdp.c | 39 +++
   1 file changed, 27 insertions(+), 12 deletions(-)
 
  diff --git a/src/compositor-rdp.c b/src/compositor-rdp.c
  index 3185141..f1dcda0 100644
  --- a/src/compositor-rdp.c
  +++ b/src/compositor-rdp.c
  @@ -105,7 +105,7 @@ enum peer_item_flags {
   struct rdp_peers_item {
 
 [...]
  +  weston_seat_release_pointer(seat);
  +
  +  /* picked from weston_seat_release(context-item.seat); */
  +  wl_list_remove(seat-link);
  +  if (seat-saved_kbd_focus)
  +  wl_list_remove(seat-saved_kbd_focus_listener.link);
  +  wl_global_destroy(seat-global);
  
  Hi,
  
  are you sure destroying the global is ok? Ah, but the thing you want to
  keep are the *existing* protocol objects.
  
 
 I have picked code weston_seat_release() from that was releasing things
 in the seat without freeing it, but...

I was more looking an answer for the questions *why* do you want a
modified version of weston_seat_release(), and *how* it changes the end
result from normal.

 Thinking of it, it's really a bad idea to destroy the global, it could
 cause clients to be disconnected if they try to do anything with the
 seat. We're really lacking the release event...

But you are only destroying the global advertisement, which causes
sending out wl_registry.global_remove events and prevents the global
from being advertised again. I think that is what you want, no?

It won't destroy already created protocol objects, e.g. those created
by binding to the global. Right?

I'm going on a old memory here...


Thanks,
pq
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston] compositor-wayland: Handle window close events more gracefully

2015-05-19 Thread Bryce Harrington
On Mon, May 18, 2015 at 11:14:16PM -0700, Dima Ryazanov wrote:
 When a compositor window is closed, remove the output instead of just exiting.
 
 (The if (!input-output) checks are kind of ugly - but I couldn't find
 a better way to handle the output going away.)
 
 Signed-off-by: Dima Ryazanov d...@gmail.com
Reviewed-by: Bryce Harrington br...@osg.samsung.com

 ---
  src/compositor-wayland.c | 22 +++---
  1 file changed, 19 insertions(+), 3 deletions(-)
 
 diff --git a/src/compositor-wayland.c b/src/compositor-wayland.c
 index c9983e0..aaf205b 100644
 --- a/src/compositor-wayland.c
 +++ b/src/compositor-wayland.c
 @@ -1307,6 +1307,9 @@ input_handle_pointer_leave(void *data, struct 
 wl_pointer *pointer,
  {
   struct wayland_input *input = data;
  
 + if (!input-output)
 + return;
 +
   if (input-output-frame) {
   frame_pointer_leave(input-output-frame, input);
  
 @@ -1327,6 +1330,9 @@ input_handle_motion(void *data, struct wl_pointer 
 *pointer,
   int32_t fx, fy;
   enum theme_location location;
  
 + if (!input-output)
 + return;
 +
   if (input-output-frame) {
   location = frame_pointer_motion(input-output-frame, input,
   wl_fixed_to_int(x),
 @@ -1368,6 +1374,9 @@ input_handle_button(void *data, struct wl_pointer 
 *pointer,
   enum frame_button_state fstate;
   enum theme_location location;
  
 + if (!input-output)
 + return;
 +
   if (input-output-frame) {
   fstate = state == WL_POINTER_BUTTON_STATE_PRESSED ?
   FRAME_BUTTON_PRESSED : FRAME_BUTTON_RELEASED;
 @@ -1384,8 +1393,15 @@ input_handle_button(void *data, struct wl_pointer 
 *pointer,
   return;
   }
  
 - if (frame_status(input-output-frame)  FRAME_STATUS_CLOSE)
 - 
 wl_display_terminate(input-compositor-base.wl_display);
 + if (frame_status(input-output-frame)  FRAME_STATUS_CLOSE) {
 + wayland_output_destroy(input-output-base);
 + input-output = input-keyboard_focus = NULL;
 +
 + if (wl_list_empty(input-compositor-base.output_list))
 + 
 wl_display_terminate(input-compositor-base.wl_display);
 +
 + return;
 + }
  
   if (frame_status(input-output-frame)  FRAME_STATUS_REPAINT)
   weston_output_schedule_repaint(input-output-base);
 @@ -1521,7 +1537,7 @@ input_handle_keyboard_leave(void *data,
  
   focus = input-keyboard_focus;
   if (!focus)
 - return; /* This shouldn't happen */
 + return;
  
   focus-keyboard_count--;
   if (!focus-keyboard_count  focus-frame) {
 -- 
 2.4.1
 
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH libinput 5/6] test: add --filter-group argument to match test groups (suites)

2015-05-19 Thread Peter Hutterer
Same as CK_RUN_SUITE, but supports fnmatch-like globs

Signed-off-by: Peter Hutterer peter.hutte...@who-t.net
---
 doc/test-suite.dox | 12 ++--
 test/litest.c  | 14 ++
 2 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/doc/test-suite.dox b/doc/test-suite.dox
index 757dc86..83cae24 100644
--- a/doc/test-suite.dox
+++ b/doc/test-suite.dox
@@ -77,8 +77,16 @@ litest-specific shortnames, see the output of `--list`. For 
example:
 $ ./test/test-touchpad --filter-device=synaptics*
 @endcode
 
-The `--filter-device` argument can be combined with `--list` to show
-which devices will be affected.
+The `--filter-group` argument enables selective running of test groups
+through basic shell-style test group matching. The test groups matched are
+litest-specific test groups, see the output of `--list`. For example:
+
+@code
+$ ./test/test-touchpad --filter-group=touchpad:*hover*
+@endcode
+
+The `--filter-device` and `--filter-group` arguments can be combined with
+`--list` to show which groups and devices will be affected.
 
 @section test-verbosity Controlling test output
 
diff --git a/test/litest.c b/test/litest.c
index fb4e1b9..2b1e183 100644
--- a/test/litest.c
+++ b/test/litest.c
@@ -53,6 +53,7 @@ static int in_debugger = -1;
 static int verbose = 0;
 const char *filter_test = NULL;
 const char *filter_device = NULL;
+const char *filter_group = NULL;
 
 struct test {
struct list node;
@@ -304,6 +305,10 @@ litest_add_tcase(const char *suite_name,
fnmatch(filter_test, funcname, 0) != 0)
return;
 
+   if (filter_group 
+   fnmatch(filter_group, suite_name, 0) != 0)
+   return;
+
suite = get_suite(suite_name);
 
if (required == LITEST_DISABLE_DEVICE 
@@ -406,6 +411,10 @@ _litest_add_ranged_for_device(const char *name,
 
assert(type  LITEST_NO_DEVICE);
 
+   if (filter_group 
+   fnmatch(filter_group, name, 0) != 0)
+   return;
+
s = get_suite(name);
for (; *dev; dev++) {
if (filter_device 
@@ -1916,12 +1925,14 @@ litest_parse_argv(int argc, char **argv)
enum {
OPT_FILTER_TEST,
OPT_FILTER_DEVICE,
+   OPT_FILTER_GROUP,
OPT_LIST,
OPT_VERBOSE,
};
static const struct option opts[] = {
{ filter-test, 1, 0, OPT_FILTER_TEST },
{ filter-device, 1, 0, OPT_FILTER_DEVICE },
+   { filter-group, 1, 0, OPT_FILTER_GROUP },
{ list, 0, 0, OPT_LIST },
{ verbose, 0, 0, OPT_VERBOSE },
{ 0, 0, 0, 0}
@@ -1941,6 +1952,9 @@ litest_parse_argv(int argc, char **argv)
case OPT_FILTER_DEVICE:
filter_device = optarg;
break;
+   case OPT_FILTER_GROUP:
+   filter_group = optarg;
+   break;
case OPT_LIST:
litest_list_tests(all_tests);
exit(0);
-- 
2.3.5

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH libinput 3/6] test: add filtering to litest framework

2015-05-19 Thread Peter Hutterer
Complementary to CK_RUN_SUITE and CK_RUN_CASE, this filters on actual test
function names with a simple fnmatch.

./test/test-touchpad --filter-test=*1fg_tap*

Most of this patch is renaming litest_add_* to _litest_add_* so we can use the
macros to get at the function names.

Signed-off-by: Peter Hutterer peter.hutte...@who-t.net
---
 doc/test-suite.dox |   8 ++-
 test/litest.c  | 190 +
 test/litest.h  |  55 +++-
 3 files changed, 160 insertions(+), 93 deletions(-)

diff --git a/doc/test-suite.dox b/doc/test-suite.dox
index 5bcaee0..079018c 100644
--- a/doc/test-suite.dox
+++ b/doc/test-suite.dox
@@ -62,8 +62,12 @@ $ CK_RUN_CASE=wheel only ./test/test-device
 $ CK_RUN_SUITE=device:wheel CK_RUN_CASE=wheel only ./test/test-device
 @endcode
 
-Check and litest currently do not provide a way to run a specific test
-function only.
+The `--filter-test` argument enables selective running of tests through
+basic shell-style function name matching. For example:
+
+@code
+$ ./test/test-touchpad --filter-test=*1fg_tap*
+@endcode
 
 @section test-verbosity Controlling test output
 
diff --git a/test/litest.c b/test/litest.c
index d581018..fb0403d 100644
--- a/test/litest.c
+++ b/test/litest.c
@@ -29,6 +29,7 @@
 #include dirent.h
 #include errno.h
 #include fcntl.h
+#include fnmatch.h
 #include getopt.h
 #include poll.h
 #include stdint.h
@@ -50,6 +51,7 @@
 
 static int in_debugger = -1;
 static int verbose = 0;
+const char *filter_test = NULL;
 
 struct test {
struct list node;
@@ -187,6 +189,7 @@ litest_drop_udev_rules(void)
 
 static void
 litest_add_tcase_for_device(struct suite *suite,
+   const char *funcname,
void *func,
const struct litest_test_device *dev,
const struct range *range)
@@ -254,53 +257,6 @@ litest_add_tcase_no_device(struct suite *suite,
suite_add_tcase(suite-suite, t-tc);
 }
 
-static void
-litest_add_tcase(struct suite *suite, void *func,
-enum litest_device_feature required,
-enum litest_device_feature excluded,
-const struct range *range)
-{
-   struct litest_test_device **dev = devices;
-
-   assert(required = LITEST_DISABLE_DEVICE);
-   assert(excluded = LITEST_DISABLE_DEVICE);
-
-   if (required == LITEST_DISABLE_DEVICE 
-   excluded == LITEST_DISABLE_DEVICE) {
-   litest_add_tcase_no_device(suite, func, range);
-   } else if (required != LITEST_ANY || excluded != LITEST_ANY) {
-   while (*dev) {
-   if (((*dev)-features  required) == required 
-   ((*dev)-features  excluded) == 0)
-   litest_add_tcase_for_device(suite, func, *dev, 
range);
-   dev++;
-   }
-   } else {
-   while (*dev) {
-   litest_add_tcase_for_device(suite, func, *dev, range);
-   dev++;
-   }
-   }
-}
-
-void
-litest_add_no_device(const char *name, void *func)
-{
-   litest_add(name, func, LITEST_DISABLE_DEVICE, LITEST_DISABLE_DEVICE);
-}
-
-void
-litest_add_ranged_no_device(const char *name,
-   void *func,
-   const struct range *range)
-{
-   litest_add_ranged(name,
- func,
- LITEST_DISABLE_DEVICE,
- LITEST_DISABLE_DEVICE,
- range);
-}
-
 static struct suite *
 get_suite(const char *name)
 {
@@ -325,39 +281,114 @@ get_suite(const char *name)
return s;
 }
 
-void
-litest_add(const char *name,
-  void *func,
-  enum litest_device_feature required,
-  enum litest_device_feature excluded)
+static void
+litest_add_tcase(const char *suite_name,
+const char *funcname,
+void *func,
+enum litest_device_feature required,
+enum litest_device_feature excluded,
+const struct range *range)
 {
-   litest_add_ranged(name, func, required, excluded, NULL);
-}
+   struct litest_test_device **dev = devices;
+   struct suite *suite;
 
-void
-litest_add_ranged(const char *name,
- void *func,
- enum litest_device_feature required,
- enum litest_device_feature excluded,
- const struct range *range)
-{
-   litest_add_tcase(get_suite(name), func, required, excluded, range);
+   assert(required = LITEST_DISABLE_DEVICE);
+   assert(excluded = LITEST_DISABLE_DEVICE);
+
+   if (filter_test 
+   fnmatch(filter_test, funcname, 0) != 0)
+   return;
+
+   suite = get_suite(suite_name);
+
+   if (required == LITEST_DISABLE_DEVICE 
+   excluded == LITEST_DISABLE_DEVICE) {
+   

[PATCH libinput 2/6] test: move argument parsing into a separate function

2015-05-19 Thread Peter Hutterer
Signed-off-by: Peter Hutterer peter.hutte...@who-t.net
---
 test/litest.c | 62 +--
 1 file changed, 35 insertions(+), 27 deletions(-)

diff --git a/test/litest.c b/test/litest.c
index c0b515b..d581018 100644
--- a/test/litest.c
+++ b/test/litest.c
@@ -456,12 +456,6 @@ struct libinput_interface interface = {
.close_restricted = close_restricted,
 };
 
-static const struct option opts[] = {
-   { list, 0, 0, 'l' },
-   { verbose, 0, 0, 'v' },
-   { 0, 0, 0, 0}
-};
-
 static int
 litest_run(int argc, char **argv)
 {
@@ -482,27 +476,6 @@ litest_run(int argc, char **argv)
srunner_add_suite(sr, s-suite);
}
 
-   while(1) {
-   int c;
-   int option_index = 0;
-
-   c = getopt_long(argc, argv, , opts, option_index);
-   if (c == -1)
-   break;
-   switch(c) {
-   case 'l':
-   litest_list_tests(all_tests);
-   return 0;
-   case 'v':
-   verbose = 1;
-   break;
-   default:
-   fprintf(stderr, usage: %s [--list]\n, 
argv[0]);
-   return 1;
-
-   }
-   }
-
if (getenv(LITEST_VERBOSE))
verbose = 1;
 
@@ -1887,9 +1860,44 @@ litest_semi_mt_touch_up(struct litest_device *d,
litest_event(d, EV_SYN, SYN_REPORT, 0);
 }
 
+static int
+litest_parse_argv(int argc, char **argv)
+{
+   static const struct option opts[] = {
+   { list, 0, 0, 'l' },
+   { verbose, 0, 0, 'v' },
+   { 0, 0, 0, 0}
+   };
+
+   while(1) {
+   int c;
+   int option_index = 0;
+
+   c = getopt_long(argc, argv, , opts, option_index);
+   if (c == -1)
+   break;
+   switch(c) {
+   case 'l':
+   litest_list_tests(all_tests);
+   exit(0);
+   case 'v':
+   verbose = 1;
+   break;
+   default:
+   fprintf(stderr, usage: %s [--list]\n, argv[0]);
+   return 1;
+   }
+   }
+
+   return 0;
+}
+
 int
 main(int argc, char **argv)
 {
+   if (litest_parse_argv(argc, argv) != 0)
+   return EXIT_FAILURE;
+
litest_setup_tests();
 
return litest_run(argc, argv);
-- 
2.3.5

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH libinput 6/6] doc: drop leftovers of Check's selective test running

2015-05-19 Thread Peter Hutterer
CK_RUN_CASE and CK_RUN_SUITE still work because we're still using check
underneath, but it's better to use the arguments.

Signed-off-by: Peter Hutterer peter.hutte...@who-t.net
---
 doc/test-suite.dox | 18 --
 1 file changed, 4 insertions(+), 14 deletions(-)

diff --git a/doc/test-suite.dox b/doc/test-suite.dox
index 83cae24..30dd157 100644
--- a/doc/test-suite.dox
+++ b/doc/test-suite.dox
@@ -25,10 +25,10 @@ resulting `/dev/input/eventX` nodes. Some tests require 
temporary udev rules.
 
 @section test-filtering Selective running of tests
 
-Check enables tests to be grouped into suites and test cases, litest uses
-test suites as a general feature-specific grouping (e.g. touchpad:tap) and
-instantiates one test case per device. The --list flag shows the list of
-suites and tests.
+litest's tests are grouped by test groups and devices. A test group is e.g.
+touchpad:tap and incorporates all tapping-related tests for touchpads.
+Each test function is (usually) run with one or more specific devices.
+The `--list` commandline argument shows the list of suites and tests.
 @code
 $ ./test/test-device --list
 device:wheel:
@@ -52,16 +52,6 @@ uinput by litest. The no device entry signals that litest 
does not
 instantiate a uinput device for a specific test (though the test itself may
 instantiate one).
 
-Check provides two filters through environment variables: bCK_RUN_SUITE/b
-and bCK_RUN_CASE/b. They may be used independently or combined to narrow
-down the set of tests to run. For example:
-
-@code
-$ CK_RUN_SUITE=device:wheel ./test/test-device
-$ CK_RUN_CASE=wheel only ./test/test-device
-$ CK_RUN_SUITE=device:wheel CK_RUN_CASE=wheel only ./test/test-device
-@endcode
-
 The `--filter-test` argument enables selective running of tests through
 basic shell-style function name matching. For example:
 
-- 
2.3.5

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH libinput 1/6] test: move main() into litest

2015-05-19 Thread Peter Hutterer
This allows us to filter things based on argv before setting up tests, etc.

Signed-off-by: Peter Hutterer peter.hutte...@who-t.net
---
 test/device.c |  5 ++---
 test/keyboard.c   |  6 ++
 test/litest.c | 10 +-
 test/litest.h |  2 +-
 test/log.c|  5 ++---
 test/misc.c   |  5 ++---
 test/path.c   |  6 ++
 test/pointer.c|  5 ++---
 test/touch.c  |  6 ++
 test/touchpad.c   |  5 ++---
 test/trackpoint.c |  5 ++---
 test/udev.c   |  6 ++
 12 files changed, 30 insertions(+), 36 deletions(-)

diff --git a/test/device.c b/test/device.c
index 22569d2..c44efab 100644
--- a/test/device.c
+++ b/test/device.c
@@ -946,7 +946,8 @@ START_TEST(device_wheel_only)
 }
 END_TEST
 
-int main (int argc, char **argv)
+void
+litest_setup_tests(void)
 {
struct range abs_range = { 0, ABS_MISC };
struct range abs_mt_range = { ABS_MT_SLOT + 1, ABS_CNT };
@@ -987,6 +988,4 @@ int main (int argc, char **argv)
litest_add_no_device(device:invalid devices, 
abs_mt_device_missing_res);
 
litest_add(device:wheel, device_wheel_only, LITEST_WHEEL, 
LITEST_RELATIVE|LITEST_ABSOLUTE);
-
-   return litest_run(argc, argv);
 }
diff --git a/test/keyboard.c b/test/keyboard.c
index 03d62dd..1c8092b 100644
--- a/test/keyboard.c
+++ b/test/keyboard.c
@@ -310,14 +310,12 @@ START_TEST(keyboard_keys_bad_device)
 }
 END_TEST
 
-int
-main(int argc, char **argv)
+void
+litest_setup_tests(void)
 {
litest_add_no_device(keyboard:seat key count, 
keyboard_seat_key_count);
litest_add_no_device(keyboard:key counting, 
keyboard_ignore_no_pressed_release);
litest_add_no_device(keyboard:key counting, 
keyboard_key_auto_release);
litest_add(keyboard:keys, keyboard_has_key, LITEST_KEYS, LITEST_ANY);
litest_add(keyboard:keys, keyboard_keys_bad_device, LITEST_ANY, 
LITEST_ANY);
-
-   return litest_run(argc, argv);
 }
diff --git a/test/litest.c b/test/litest.c
index f637d4e..c0b515b 100644
--- a/test/litest.c
+++ b/test/litest.c
@@ -462,7 +462,7 @@ static const struct option opts[] = {
{ 0, 0, 0, 0}
 };
 
-int
+static int
 litest_run(int argc, char **argv)
 {
struct suite *s, *snext;
@@ -1886,3 +1886,11 @@ litest_semi_mt_touch_up(struct litest_device *d,
 
litest_event(d, EV_SYN, SYN_REPORT, 0);
 }
+
+int
+main(int argc, char **argv)
+{
+   litest_setup_tests();
+
+   return litest_run(argc, argv);
+}
diff --git a/test/litest.h b/test/litest.h
index 38d3c1b..b6aaa6f 100644
--- a/test/litest.h
+++ b/test/litest.h
@@ -130,7 +130,7 @@ void litest_add_ranged_no_device(const char *name,
 void *func,
 const struct range *range);
 
-int litest_run(int argc, char **argv);
+extern void litest_setup_tests(void);
 struct litest_device * litest_create_device(enum litest_device_type which);
 struct litest_device * litest_add_device(struct libinput *libinput,
 enum litest_device_type which);
diff --git a/test/log.c b/test/log.c
index 4eb554d..504f4c8 100644
--- a/test/log.c
+++ b/test/log.c
@@ -139,12 +139,11 @@ START_TEST(log_priority)
 }
 END_TEST
 
-int main (int argc, char **argv)
+void
+litest_setup_tests(void)
 {
litest_add_no_device(log:defaults, log_default_priority);
litest_add_no_device(log:logging, log_handler_invoked);
litest_add_no_device(log:logging, log_handler_NULL);
litest_add_no_device(log:logging, log_priority);
-
-   return litest_run(argc, argv);
 }
diff --git a/test/misc.c b/test/misc.c
index e9d5462..ec6d820 100644
--- a/test/misc.c
+++ b/test/misc.c
@@ -583,7 +583,8 @@ START_TEST(trackpoint_accel_parser)
 }
 END_TEST
 
-int main (int argc, char **argv)
+void
+litest_setup_tests(void)
 {
litest_add_no_device(events:conversion, 
event_conversion_device_notify);
litest_add_for_device(events:conversion, event_conversion_pointer, 
LITEST_MOUSE);
@@ -600,6 +601,4 @@ int main (int argc, char **argv)
litest_add_no_device(misc:dpi parser, dpi_parser);
litest_add_no_device(misc:wheel click parser, wheel_click_parser);
litest_add_no_device(misc:trackpoint accel parser, 
trackpoint_accel_parser);
-
-   return litest_run(argc, argv);
 }
diff --git a/test/path.c b/test/path.c
index df649da..c28c6ff 100644
--- a/test/path.c
+++ b/test/path.c
@@ -874,8 +874,8 @@ START_TEST(path_seat_recycle)
 }
 END_TEST
 
-int
-main(int argc, char **argv)
+void
+litest_setup_tests(void)
 {
litest_add_no_device(path:create, path_create_NULL);
litest_add_no_device(path:create, path_create_invalid);
@@ -896,6 +896,4 @@ main(int argc, char **argv)
litest_add_for_device(path:device events, path_remove_device, 
LITEST_SYNAPTICS_CLICKPAD);
litest_add_for_device(path:device events, path_double_remove_device, 
LITEST_SYNAPTICS_CLICKPAD);
litest_add_no_device(path:seat, path_seat_recycle);
-
-   return 

[PATCH libinput 4/6] test: add --filter-device argument

2015-05-19 Thread Peter Hutterer
Similar to the CK_RUN_CASE environment variable, but it does support
fnmatch()-style wildcards, e.g.

./test/test-touchpad --filter-device=synaptics*

Signed-off-by: Peter Hutterer peter.hutte...@who-t.net
---
 doc/test-suite.dox | 11 +++
 test/litest.c  | 46 +-
 2 files changed, 44 insertions(+), 13 deletions(-)

diff --git a/doc/test-suite.dox b/doc/test-suite.dox
index 079018c..757dc86 100644
--- a/doc/test-suite.dox
+++ b/doc/test-suite.dox
@@ -69,6 +69,17 @@ basic shell-style function name matching. For example:
 $ ./test/test-touchpad --filter-test=*1fg_tap*
 @endcode
 
+The `--filter-device` argument enables selective running of tests through
+basic shell-style device name matching. The device names matched are the
+litest-specific shortnames, see the output of `--list`. For example:
+
+@code
+$ ./test/test-touchpad --filter-device=synaptics*
+@endcode
+
+The `--filter-device` argument can be combined with `--list` to show
+which devices will be affected.
+
 @section test-verbosity Controlling test output
 
 Each test supports the `--verbose` commandline option to enable debugging
diff --git a/test/litest.c b/test/litest.c
index fb0403d..fb4e1b9 100644
--- a/test/litest.c
+++ b/test/litest.c
@@ -52,6 +52,7 @@
 static int in_debugger = -1;
 static int verbose = 0;
 const char *filter_test = NULL;
+const char *filter_device = NULL;
 
 struct test {
struct list node;
@@ -237,6 +238,10 @@ litest_add_tcase_no_device(struct suite *suite,
struct test *t;
const char *test_name = no device;
 
+   if (filter_device 
+   fnmatch(filter_device, test_name, 0) != 0)
+   return;
+
list_for_each(t, suite-tests, node) {
if (strcmp(t-name, test_name) != 0)
continue;
@@ -305,24 +310,31 @@ litest_add_tcase(const char *suite_name,
excluded == LITEST_DISABLE_DEVICE) {
litest_add_tcase_no_device(suite, func, range);
} else if (required != LITEST_ANY || excluded != LITEST_ANY) {
-   while (*dev) {
-   if (((*dev)-features  required) == required 
-   ((*dev)-features  excluded) == 0)
-   litest_add_tcase_for_device(suite,
-   funcname,
-   func,
-   *dev,
-   range);
-   dev++;
+   for (; *dev; dev++) {
+   if (filter_device 
+   fnmatch(filter_device, (*dev)-shortname, 0) != 0)
+   continue;
+   if (((*dev)-features  required) != required ||
+   ((*dev)-features  excluded) != 0)
+   continue;
+
+   litest_add_tcase_for_device(suite,
+   funcname,
+   func,
+   *dev,
+   range);
}
} else {
-   while (*dev) {
+   for (; *dev; dev++) {
+   if (filter_device 
+   fnmatch(filter_device, (*dev)-shortname, 0) != 0)
+   continue;
+
litest_add_tcase_for_device(suite,
funcname,
func,
*dev,
range);
-   dev++;
}
}
 }
@@ -395,7 +407,11 @@ _litest_add_ranged_for_device(const char *name,
assert(type  LITEST_NO_DEVICE);
 
s = get_suite(name);
-   while (*dev) {
+   for (; *dev; dev++) {
+   if (filter_device 
+   fnmatch(filter_device, (*dev)-shortname, 0) != 0)
+   continue;
+
if ((*dev)-type == type) {
litest_add_tcase_for_device(s,
funcname,
@@ -404,7 +420,6 @@ _litest_add_ranged_for_device(const char *name,
range);
return;
}
-   dev++;
}
 
ck_abort_msg(Invalid test device type);
@@ -1900,11 +1915,13 @@ litest_parse_argv(int argc, char **argv)
 {
enum {
OPT_FILTER_TEST,
+   OPT_FILTER_DEVICE,
OPT_LIST,
OPT_VERBOSE,
};
static const struct option opts[] = {
{ filter-test, 1, 0, OPT_FILTER_TEST },

EGL-X Applications on XWayland

2015-05-19 Thread Prabhu S
Hi All,
Wondering whether possible to run EGL-X on Xwayland?

If my understanding correct EGL applications need be built natively with
wayland-egl/EGL?

Thanks
Prabhu
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: EGL-X Applications on XWayland

2015-05-19 Thread Jasper St. Pierre
Currently, EGL-X applications will fall back to software rendering,
assuming you're using a mesa-based GL, simply because mesa doesn't
have support for DRI3 in its EGL layer, and Xwayland doesn't have
support for DRI2.

Either of those can be fixed, it's just that nobody has tried yet.

On Tue, May 19, 2015 at 10:06 AM, Prabhu S prabhusun...@gmail.com wrote:
 Hi All,
 Wondering whether possible to run EGL-X on Xwayland?

 If my understanding correct EGL applications need be built natively with
 wayland-egl/EGL?

 Thanks
 Prabhu

 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel




-- 
  Jasper
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH libinput 6/7] evdev: sync the initial state for absolute pointer devices

2015-05-19 Thread Peter Hutterer
Signed-off-by: Peter Hutterer peter.hutte...@who-t.net
---
 src/evdev.c|  2 ++
 test/pointer.c | 59 ++
 2 files changed, 61 insertions(+)

diff --git a/src/evdev.c b/src/evdev.c
index 48c969d..f710d85 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -1865,6 +1865,8 @@ evdev_configure_device(struct evdev_device *device)
device-abs.fake_resolution = 1;
device-abs.absinfo_x = libevdev_get_abs_info(evdev, ABS_X);
device-abs.absinfo_y = libevdev_get_abs_info(evdev, ABS_Y);
+   device-abs.point.x = device-abs.absinfo_x-value;
+   device-abs.point.y = device-abs.absinfo_y-value;
 
if (evdev_is_fake_mt_device(device)) {
udev_tags = ~EVDEV_UDEV_TAG_TOUCHSCREEN;
diff --git a/test/pointer.c b/test/pointer.c
index cbc3802..9eebedd 100644
--- a/test/pointer.c
+++ b/test/pointer.c
@@ -170,6 +170,61 @@ START_TEST(pointer_motion_absolute)
 }
 END_TEST
 
+START_TEST(pointer_absolute_initial_state)
+{
+   struct litest_device *dev = litest_current_device();
+   struct libinput *libinput1, *libinput2;
+   struct libinput_event *ev1, *ev2;
+   struct libinput_event_pointer *p1, *p2;
+   int axis = _i; /* looped test */
+
+   dev = litest_current_device();
+   libinput1 = dev-libinput;
+   litest_touch_down(dev, 0, 40, 60);
+   litest_touch_up(dev, 0);
+
+   /* device is now on some x/y value */
+   litest_drain_events(libinput1);
+
+   libinput2 = litest_create_context();
+   libinput_path_add_device(libinput2,
+libevdev_uinput_get_devnode(dev-uinput));
+   litest_drain_events(libinput2);
+
+   if (axis == ABS_X)
+   litest_touch_down(dev, 0, 40, 70);
+   else
+   litest_touch_down(dev, 0, 70, 60);
+   litest_touch_up(dev, 0);
+
+   litest_wait_for_event(libinput1);
+   litest_wait_for_event(libinput2);
+
+   while (libinput_next_event_type(libinput1)) {
+   ev1 = libinput_get_event(libinput1);
+   ev2 = libinput_get_event(libinput2);
+
+   ck_assert_int_eq(libinput_event_get_type(ev1),
+LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE);
+   ck_assert_int_eq(libinput_event_get_type(ev1),
+libinput_event_get_type(ev2));
+
+   p1 = libinput_event_get_pointer_event(ev1);
+   p2 = libinput_event_get_pointer_event(ev2);
+
+   ck_assert_int_eq(libinput_event_pointer_get_absolute_x(p1),
+libinput_event_pointer_get_absolute_x(p2));
+   ck_assert_int_eq(libinput_event_pointer_get_absolute_y(p1),
+libinput_event_pointer_get_absolute_y(p2));
+
+   libinput_event_destroy(ev1);
+   libinput_event_destroy(ev2);
+   }
+
+   libinput_unref(libinput2);
+}
+END_TEST
+
 static void
 test_unaccel_event(struct litest_device *dev, int dx, int dy)
 {
@@ -1263,6 +1318,8 @@ END_TEST
 
 int main (int argc, char **argv)
 {
+   struct range axis_range = {ABS_X, ABS_Y + 1};
+
litest_add(pointer:motion, pointer_motion_relative, LITEST_RELATIVE, 
LITEST_ANY);
litest_add(pointer:motion, pointer_motion_absolute, LITEST_ABSOLUTE, 
LITEST_ANY);
litest_add(pointer:motion, pointer_motion_unaccel, LITEST_RELATIVE, 
LITEST_ANY);
@@ -1300,5 +1357,7 @@ int main (int argc, char **argv)
litest_add(pointer:middlebutton, middlebutton_default_touchpad, 
LITEST_TOUCHPAD, LITEST_CLICKPAD);
litest_add(pointer:middlebutton, middlebutton_default_disabled, 
LITEST_ANY, LITEST_BUTTON);
 
+   litest_add_ranged(pointer:state, pointer_absolute_initial_state, 
LITEST_ABSOLUTE, LITEST_ANY, axis_range);
+
return litest_run(argc, argv);
 }
-- 
2.3.5

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH libinput 4/7] evdev: add an interface hook to suspend a device

2015-05-19 Thread Peter Hutterer
The touchpad carries enough state around that calling release_all_keys() isn't
enough to properly suspend it. e.g. a button down after tapping won't be
released by trying to release the physical button for it.

We need to clear the state properly, but that's interface-specific so add a
new hook for it.

Signed-off-by: Peter Hutterer peter.hutte...@who-t.net
---
 src/evdev-mt-touchpad.c | 10 ++
 src/evdev.c | 14 --
 src/evdev.h |  4 
 3 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
index c85986e..026f9ee 100644
--- a/src/evdev-mt-touchpad.c
+++ b/src/evdev-mt-touchpad.c
@@ -854,6 +854,15 @@ tp_suspend(struct tp_dispatch *tp, struct evdev_device 
*device)
 }
 
 static void
+tp_interface_suspend(struct evdev_dispatch *dispatch,
+struct evdev_device *device)
+{
+   struct tp_dispatch *tp = (struct tp_dispatch *)dispatch;
+
+   tp_clear_state(tp);
+}
+
+static void
 tp_resume(struct tp_dispatch *tp, struct evdev_device *device)
 {
if (tp-buttons.has_topbuttons) {
@@ -1060,6 +1069,7 @@ tp_interface_tag_device(struct evdev_device *device,
 
 static struct evdev_dispatch_interface tp_interface = {
tp_interface_process,
+   tp_interface_suspend,
tp_interface_remove,
tp_interface_destroy,
tp_interface_device_added,
diff --git a/src/evdev.c b/src/evdev.c
index 87c59dc..d45264b 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -813,6 +813,13 @@ release_pressed_keys(struct evdev_device *device)
 }
 
 static void
+fallback_suspend(struct evdev_dispatch *dispatch,
+struct evdev_device *device)
+{
+   release_pressed_keys(device);
+}
+
+static void
 fallback_destroy(struct evdev_dispatch *dispatch)
 {
free(dispatch);
@@ -869,6 +876,7 @@ evdev_calibration_get_default_matrix(struct libinput_device 
*libinput_device,
 
 struct evdev_dispatch_interface fallback_interface = {
fallback_process,
+   fallback_suspend,
NULL, /* remove */
fallback_destroy,
NULL, /* device_added */
@@ -2414,14 +2422,16 @@ evdev_device_suspend(struct evdev_device *device)
 {
evdev_notify_suspended_device(device);
 
+   if (device-dispatch-interface-suspend)
+   device-dispatch-interface-suspend(device-dispatch,
+device);
+
if (device-source) {
libinput_remove_source(device-base.seat-libinput,
   device-source);
device-source = NULL;
}
 
-   release_pressed_keys(device);
-
if (device-mtdev) {
mtdev_close_delete(device-mtdev);
device-mtdev = NULL;
diff --git a/src/evdev.h b/src/evdev.h
index 20c0b55..086e3b7 100644
--- a/src/evdev.h
+++ b/src/evdev.h
@@ -227,6 +227,10 @@ struct evdev_dispatch_interface {
struct input_event *event,
uint64_t time);
 
+   /* Device is being suspended */
+   void (*suspend)(struct evdev_dispatch *dispatch,
+   struct evdev_device *device);
+
/* Device is being removed (may be NULL) */
void (*remove)(struct evdev_dispatch *dispatch);
 
-- 
2.3.5

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH libinput 2/7] touchpad: rename all interface functions for clarity

2015-05-19 Thread Peter Hutterer
Add interface to the name to make things a bit clearer.

Signed-off-by: Peter Hutterer peter.hutte...@who-t.net
---
 src/evdev-mt-touchpad.c | 42 +-
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
index 3ebb559..c85986e 100644
--- a/src/evdev-mt-touchpad.c
+++ b/src/evdev-mt-touchpad.c
@@ -739,10 +739,10 @@ tp_handle_state(struct tp_dispatch *tp,
 }
 
 static void
-tp_process(struct evdev_dispatch *dispatch,
-  struct evdev_device *device,
-  struct input_event *e,
-  uint64_t time)
+tp_interface_process(struct evdev_dispatch *dispatch,
+struct evdev_device *device,
+struct input_event *e,
+uint64_t time)
 {
struct tp_dispatch *tp =
(struct tp_dispatch *)dispatch;
@@ -779,7 +779,7 @@ tp_remove_sendevents(struct tp_dispatch *tp)
 }
 
 static void
-tp_remove(struct evdev_dispatch *dispatch)
+tp_interface_remove(struct evdev_dispatch *dispatch)
 {
struct tp_dispatch *tp =
(struct tp_dispatch*)dispatch;
@@ -792,7 +792,7 @@ tp_remove(struct evdev_dispatch *dispatch)
 }
 
 static void
-tp_destroy(struct evdev_dispatch *dispatch)
+tp_interface_destroy(struct evdev_dispatch *dispatch)
 {
struct tp_dispatch *tp =
(struct tp_dispatch*)dispatch;
@@ -953,8 +953,8 @@ tp_keyboard_event(uint64_t time, struct libinput_event 
*event, void *data)
 }
 
 static void
-tp_device_added(struct evdev_device *device,
-   struct evdev_device *added_device)
+tp_interface_device_added(struct evdev_device *device,
+ struct evdev_device *added_device)
 {
struct tp_dispatch *tp = (struct tp_dispatch*)device-dispatch;
unsigned int bus_tp = libevdev_get_id_bustype(device-evdev),
@@ -997,8 +997,8 @@ tp_device_added(struct evdev_device *device,
 }
 
 static void
-tp_device_removed(struct evdev_device *device,
- struct evdev_device *removed_device)
+tp_interface_device_removed(struct evdev_device *device,
+   struct evdev_device *removed_device)
 {
struct tp_dispatch *tp = (struct tp_dispatch*)device-dispatch;
struct libinput_device *dev;
@@ -1036,8 +1036,8 @@ tp_device_removed(struct evdev_device *device,
 }
 
 static void
-tp_tag_device(struct evdev_device *device,
- struct udev_device *udev_device)
+tp_interface_tag_device(struct evdev_device *device,
+   struct udev_device *udev_device)
 {
int bustype;
 
@@ -1059,14 +1059,14 @@ tp_tag_device(struct evdev_device *device,
 }
 
 static struct evdev_dispatch_interface tp_interface = {
-   tp_process,
-   tp_remove,
-   tp_destroy,
-   tp_device_added,
-   tp_device_removed,
-   tp_device_removed, /* device_suspended, treat as remove */
-   tp_device_added,   /* device_resumed, treat as add */
-   tp_tag_device,
+   tp_interface_process,
+   tp_interface_remove,
+   tp_interface_destroy,
+   tp_interface_device_added,
+   tp_interface_device_removed,
+   tp_interface_device_removed, /* device_suspended, treat as remove */
+   tp_interface_device_added,   /* device_resumed, treat as add */
+   tp_interface_tag_device,
 };
 
 static void
@@ -1495,7 +1495,7 @@ evdev_mt_touchpad_create(struct evdev_device *device)
tp-model = tp_get_model(device);
 
if (tp_init(tp, device) != 0) {
-   tp_destroy(tp-base);
+   tp_interface_destroy(tp-base);
return NULL;
}
 
-- 
2.3.5

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH libinput 5/7] evdev: sync the initial x/y position for touchscreens

2015-05-19 Thread Peter Hutterer
Unlikely, but there's the odd chance of the first touch coming in with the
same X or Y coordinate the kernel already has internally. This would generate
a x/0 or 0/y event in libinput.

Sync the slot state on init, at least for Protocol B devices. For Protocol A
devices and mtdev, don't bother.

Signed-off-by: Peter Hutterer peter.hutte...@who-t.net
---
 src/evdev.c  | 12 --
 test/touch.c | 72 
 2 files changed, 82 insertions(+), 2 deletions(-)

diff --git a/src/evdev.c b/src/evdev.c
index d45264b..48c969d 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -1781,8 +1781,16 @@ evdev_configure_mt_device(struct evdev_device *device)
 
for (slot = 0; slot  num_slots; ++slot) {
slots[slot].seat_slot = -1;
-   slots[slot].point.x = 0;
-   slots[slot].point.y = 0;
+
+   if (evdev_need_mtdev(device))
+   continue;
+
+   slots[slot].point.x = libevdev_get_slot_value(evdev,
+ slot,
+ 
ABS_MT_POSITION_X);
+   slots[slot].point.y = libevdev_get_slot_value(evdev,
+ slot,
+ 
ABS_MT_POSITION_Y);
}
device-mt.slots = slots;
device-mt.slots_len = num_slots;
diff --git a/test/touch.c b/test/touch.c
index d78deed..828c6ed 100644
--- a/test/touch.c
+++ b/test/touch.c
@@ -582,9 +582,79 @@ START_TEST(touch_protocol_a_2fg_touch)
 }
 END_TEST
 
+START_TEST(touch_initial_state)
+{
+   struct litest_device *dev;
+   struct libinput *libinput1, *libinput2;
+   struct libinput_event *ev1, *ev2;
+   struct libinput_event_touch *t1, *t2;
+   struct libinput_device *device1, *device2;
+   int axis = _i; /* looped test */
+
+   dev = litest_current_device();
+   device1 = dev-libinput_device;
+   libinput_device_config_tap_set_enabled(device1,
+  LIBINPUT_CONFIG_TAP_DISABLED);
+
+   libinput1 = dev-libinput;
+   litest_touch_down(dev, 0, 40, 60);
+   litest_touch_up(dev, 0);
+
+   /* device is now on some x/y value */
+   litest_drain_events(libinput1);
+
+   libinput2 = litest_create_context();
+   device2 = libinput_path_add_device(libinput2,
+  libevdev_uinput_get_devnode(
+  dev-uinput));
+   libinput_device_config_tap_set_enabled(device2,
+  LIBINPUT_CONFIG_TAP_DISABLED);
+   litest_drain_events(libinput2);
+
+   if (axis == ABS_X)
+   litest_touch_down(dev, 0, 40, 70);
+   else
+   litest_touch_down(dev, 0, 70, 60);
+   litest_touch_up(dev, 0);
+
+   litest_wait_for_event(libinput1);
+   litest_wait_for_event(libinput2);
+
+   while (libinput_next_event_type(libinput1)) {
+   ev1 = libinput_get_event(libinput1);
+   ev2 = libinput_get_event(libinput2);
+
+   t1 = litest_is_touch_event(ev1, 0);
+   t2 = litest_is_touch_event(ev2, 0);
+
+   ck_assert_int_eq(libinput_event_get_type(ev1),
+libinput_event_get_type(ev2));
+
+   if (libinput_event_get_type(ev1) == LIBINPUT_EVENT_TOUCH_UP ||
+   libinput_event_get_type(ev1) == LIBINPUT_EVENT_TOUCH_FRAME)
+   break;
+
+   ck_assert_int_eq(libinput_event_touch_get_x(t1),
+libinput_event_touch_get_x(t2));
+   ck_assert_int_eq(libinput_event_touch_get_y(t1),
+libinput_event_touch_get_y(t2));
+
+   libinput_event_destroy(ev1);
+   libinput_event_destroy(ev2);
+   }
+
+   libinput_event_destroy(ev1);
+   libinput_event_destroy(ev2);
+
+   libinput_unref(libinput2);
+}
+END_TEST
+
 int
 main(int argc, char **argv)
 {
+   struct range axes = { ABS_X, ABS_Y + 1};
+
litest_add(touch:frame, touch_frame_events, LITEST_TOUCH, LITEST_ANY);
litest_add_no_device(touch:abs-transform, touch_abs_transform);
litest_add_no_device(touch:many-slots, touch_many_slots);
@@ -605,5 +675,7 @@ main(int argc, char **argv)
litest_add(touch:protocol a, touch_protocol_a_touch, 
LITEST_PROTOCOL_A, LITEST_ANY);
litest_add(touch:protocol a, touch_protocol_a_2fg_touch, 
LITEST_PROTOCOL_A, LITEST_ANY);
 
+   litest_add_ranged(touch:state, touch_initial_state, LITEST_TOUCH, 
LITEST_PROTOCOL_A, axes);
+
return litest_run(argc, argv);
 }
-- 
2.3.5

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org

[PATCH libinput 7/7] touchpad: sync the initial touch state

2015-05-19 Thread Peter Hutterer
Unlikely, but there's the odd chance of the first touch coming in with the
same X or Y coordinate the kernel already has internally. This would
generate a bogus delta on the second event when the touch coordinate jumps
from 0/y or x/0 to the real coordinates.

For touchpads with distance support this is a real issue since the default
value for a touch distance is  0.

Signed-off-by: Peter Hutterer peter.hutte...@who-t.net
---
 src/evdev-mt-touchpad.c | 28 ++
 test/touchpad.c | 62 +
 2 files changed, 90 insertions(+)

diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
index 026f9ee..409d81e 100644
--- a/src/evdev-mt-touchpad.c
+++ b/src/evdev-mt-touchpad.c
@@ -1087,6 +1087,28 @@ tp_init_touch(struct tp_dispatch *tp,
t-has_ended = true;
 }
 
+static void
+tp_sync_touch(struct tp_dispatch *tp,
+ struct evdev_device *device,
+ struct tp_touch *t,
+ int slot)
+{
+   struct libevdev *evdev = device-evdev;
+
+   if (!libevdev_fetch_slot_value(evdev,
+  slot,
+  ABS_MT_POSITION_X,
+  t-point.x))
+   t-point.x = libevdev_get_event_value(evdev, EV_ABS, ABS_X);
+   if (!libevdev_fetch_slot_value(evdev,
+  slot,
+  ABS_MT_POSITION_Y,
+  t-point.y))
+   t-point.y = libevdev_get_event_value(evdev, EV_ABS, ABS_Y);
+
+   libevdev_fetch_slot_value(evdev, slot, ABS_MT_DISTANCE, t-distance);
+}
+
 static int
 tp_init_slots(struct tp_dispatch *tp,
  struct evdev_device *device)
@@ -1134,6 +1156,12 @@ tp_init_slots(struct tp_dispatch *tp,
for (i = 0; i  tp-ntouches; i++)
tp_init_touch(tp, tp-touches[i]);
 
+   /* Always sync the first touch so we get ABS_X/Y synced on
+* single-touch touchpads */
+   tp_sync_touch(tp, device, tp-touches[0], 0);
+   for (i = 1; i  tp-num_slots; i++)
+   tp_sync_touch(tp, device, tp-touches[i], i);
+
return 0;
 }
 
diff --git a/test/touchpad.c b/test/touchpad.c
index f7f9dd5..3bdcc2b 100644
--- a/test/touchpad.c
+++ b/test/touchpad.c
@@ -4530,9 +4530,69 @@ START_TEST(touchpad_trackpoint_no_trackpoint)
 }
 END_TEST
 
+START_TEST(touchpad_initial_state)
+{
+   struct litest_device *dev;
+   struct libinput *libinput1, *libinput2;
+   struct libinput_event *ev1, *ev2;
+   struct libinput_event_pointer *p1, *p2;
+   int axis = _i; /* looped test */
+   int x = 40, y = 60;
+
+   dev = litest_current_device();
+   libinput1 = dev-libinput;
+
+   libinput_device_config_tap_set_enabled(dev-libinput_device,
+  LIBINPUT_CONFIG_TAP_DISABLED);
+
+   litest_touch_down(dev, 0, x, y);
+   litest_touch_up(dev, 0);
+
+   /* device is now on some x/y value */
+   litest_drain_events(libinput1);
+
+   libinput2 = litest_create_context();
+   libinput_path_add_device(libinput2,
+libevdev_uinput_get_devnode(dev-uinput));
+   litest_drain_events(libinput2);
+
+   if (axis == ABS_X)
+   x = 30;
+   else
+   y = 30;
+   litest_touch_down(dev, 0, x, y);
+   litest_touch_move_to(dev, 0, x, y, 80, 80, 10, 1);
+   litest_touch_up(dev, 0);
+
+   litest_wait_for_event(libinput1);
+   litest_wait_for_event(libinput2);
+
+   while (libinput_next_event_type(libinput1)) {
+   ev1 = libinput_get_event(libinput1);
+   ev2 = libinput_get_event(libinput2);
+
+   p1 = litest_is_motion_event(ev1);
+   p2 = litest_is_motion_event(ev2);
+
+   ck_assert_int_eq(libinput_event_get_type(ev1),
+libinput_event_get_type(ev2));
+
+   ck_assert_int_eq(libinput_event_pointer_get_dx(p1),
+libinput_event_pointer_get_dx(p2));
+   ck_assert_int_eq(libinput_event_pointer_get_dy(p1),
+libinput_event_pointer_get_dy(p2));
+   libinput_event_destroy(ev1);
+   libinput_event_destroy(ev2);
+   }
+
+   libinput_unref(libinput2);
+}
+END_TEST
+
 int main(int argc, char **argv)
 {
struct range multitap_range = {3, 8};
+   struct range axis_range = {ABS_X, ABS_Y + 1};
 
litest_add(touchpad:motion, touchpad_1fg_motion, LITEST_TOUCHPAD, 
LITEST_ANY);
litest_add(touchpad:motion, touchpad_2fg_no_motion, LITEST_TOUCHPAD, 
LITEST_SINGLE_TOUCH);
@@ -4675,5 +4735,7 @@ int main(int argc, char **argv)
litest_add_for_device(touchpad:trackpoint, 
touchpad_trackpoint_buttons_2fg_scroll, LITEST_SYNAPTICS_TRACKPOINT_BUTTONS);
litest_add_for_device(touchpad:trackpoint, 

[PATCH libinput 3/7] evdev: move release_pressed_keys() up

2015-05-19 Thread Peter Hutterer
Just a move to make the next diff easier

Signed-off-by: Peter Hutterer peter.hutte...@who-t.net
---
 src/evdev.c | 104 ++--
 1 file changed, 52 insertions(+), 52 deletions(-)

diff --git a/src/evdev.c b/src/evdev.c
index 435bc52..87c59dc 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -761,6 +761,58 @@ fallback_process(struct evdev_dispatch *dispatch,
 }
 
 static void
+release_pressed_keys(struct evdev_device *device)
+{
+   struct libinput *libinput = device-base.seat-libinput;
+   uint64_t time;
+   int code;
+
+   if ((time = libinput_now(libinput)) == 0)
+   return;
+
+   for (code = 0; code  KEY_CNT; code++) {
+   int count = get_key_down_count(device, code);
+
+   if (count == 0)
+   continue;
+
+   if (count  1) {
+   log_bug_libinput(libinput,
+Key %d is down %d times.\n,
+code,
+count);
+   }
+
+   switch (get_key_type(code)) {
+   case EVDEV_KEY_TYPE_NONE:
+   break;
+   case EVDEV_KEY_TYPE_KEY:
+   evdev_keyboard_notify_key(
+   device,
+   time,
+   code,
+   LIBINPUT_KEY_STATE_RELEASED);
+   break;
+   case EVDEV_KEY_TYPE_BUTTON:
+   evdev_pointer_notify_physical_button(
+   device,
+   time,
+   evdev_to_left_handed(device, code),
+   LIBINPUT_BUTTON_STATE_RELEASED);
+   break;
+   }
+
+   count = get_key_down_count(device, code);
+   if (count != 0) {
+   log_bug_libinput(libinput,
+Releasing key %d failed.\n,
+code);
+   break;
+   }
+   }
+}
+
+static void
 fallback_destroy(struct evdev_dispatch *dispatch)
 {
free(dispatch);
@@ -2317,58 +2369,6 @@ evdev_stop_scroll(struct evdev_device *device,
device-scroll.direction = 0;
 }
 
-static void
-release_pressed_keys(struct evdev_device *device)
-{
-   struct libinput *libinput = device-base.seat-libinput;
-   uint64_t time;
-   int code;
-
-   if ((time = libinput_now(libinput)) == 0)
-   return;
-
-   for (code = 0; code  KEY_CNT; code++) {
-   int count = get_key_down_count(device, code);
-
-   if (count == 0)
-   continue;
-
-   if (count  1) {
-   log_bug_libinput(libinput,
-Key %d is down %d times.\n,
-code,
-count);
-   }
-
-   switch (get_key_type(code)) {
-   case EVDEV_KEY_TYPE_NONE:
-   break;
-   case EVDEV_KEY_TYPE_KEY:
-   evdev_keyboard_notify_key(
-   device,
-   time,
-   code,
-   LIBINPUT_KEY_STATE_RELEASED);
-   break;
-   case EVDEV_KEY_TYPE_BUTTON:
-   evdev_pointer_notify_physical_button(
-   device,
-   time,
-   evdev_to_left_handed(device, code),
-   LIBINPUT_BUTTON_STATE_RELEASED);
-   break;
-   }
-
-   count = get_key_down_count(device, code);
-   if (count != 0) {
-   log_bug_libinput(libinput,
-Releasing key %d failed.\n,
-code);
-   break;
-   }
-   }
-}
-
 void
 evdev_notify_suspended_device(struct evdev_device *device)
 {
-- 
2.3.5

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH libinput 1/7] evdev: log a bug if releasing a key fails, but don't loop forever

2015-05-19 Thread Peter Hutterer
If a physical button is down but releasing said button doesn't actually
release it, we loop endlessly. Detect that and log a bug instead.

Reproducible: trigger a tap-n-drag on a touchpad device, then remove it.

Signed-off-by: Peter Hutterer peter.hutte...@who-t.net
---
 src/evdev.c | 47 ---
 1 file changed, 28 insertions(+), 19 deletions(-)

diff --git a/src/evdev.c b/src/evdev.c
index 4ce9250..435bc52 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -2330,6 +2330,9 @@ release_pressed_keys(struct evdev_device *device)
for (code = 0; code  KEY_CNT; code++) {
int count = get_key_down_count(device, code);
 
+   if (count == 0)
+   continue;
+
if (count  1) {
log_bug_libinput(libinput,
 Key %d is down %d times.\n,
@@ -2337,25 +2340,31 @@ release_pressed_keys(struct evdev_device *device)
 count);
}
 
-   while (get_key_down_count(device, code)  0) {
-   switch (get_key_type(code)) {
-   case EVDEV_KEY_TYPE_NONE:
-   break;
-   case EVDEV_KEY_TYPE_KEY:
-   evdev_keyboard_notify_key(
-   device,
-   time,
-   code,
-   LIBINPUT_KEY_STATE_RELEASED);
-   break;
-   case EVDEV_KEY_TYPE_BUTTON:
-   evdev_pointer_notify_physical_button(
-   device,
-   time,
-   evdev_to_left_handed(device, code),
-   LIBINPUT_BUTTON_STATE_RELEASED);
-   break;
-   }
+   switch (get_key_type(code)) {
+   case EVDEV_KEY_TYPE_NONE:
+   break;
+   case EVDEV_KEY_TYPE_KEY:
+   evdev_keyboard_notify_key(
+   device,
+   time,
+   code,
+   LIBINPUT_KEY_STATE_RELEASED);
+   break;
+   case EVDEV_KEY_TYPE_BUTTON:
+   evdev_pointer_notify_physical_button(
+   device,
+   time,
+   evdev_to_left_handed(device, code),
+   LIBINPUT_BUTTON_STATE_RELEASED);
+   break;
+   }
+
+   count = get_key_down_count(device, code);
+   if (count != 0) {
+   log_bug_libinput(libinput,
+Releasing key %d failed.\n,
+code);
+   break;
}
}
 }
-- 
2.3.5

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel