Re: Wayland generic dmabuf protocol

2014-06-10 Thread Thomas Hellstrom
On 06/09/2014 01:23 PM, Daniel Stone wrote:
> Hi,
>
> On 9 June 2014 12:06, Pekka Paalanen  > wrote:
>
> On Mon, 9 Jun 2014 11:00:04 +0200
> Benjamin Gaignard  > wrote:
> > One of the main comment on the latest patches was that wl_dmabuf use
> > DRM for buffer allocation.
> > This appear to be an issue since wayland doesn't want to rely on one
> > specific framework (DRM, or V4L2) for buffer allocation, so we have
> > start working on a "central dmabuf allocation" on kernel side. The
> > goal is provide some as generic as possible to make it acceptable by
> > wayland.
>
> Why would Wayland need a central allocator for dmabuf?
>
>
> I think you've just answered your own question further below:
>  
>
> > On my hardware the patches you have (+ this one on gstwaylandsink
> > https://bugzilla.gnome.org/show_bug.cgi?id=711155
> 
> )
> allow me to do zero
> > copy between the hardware video decoder and the display engine. I
> > don't have implemented GPU yet because my hardware is able to do
> > compose few video overlays planes and it was enough for my tests.
>
> Right.
>
> What I have been thinking is, that the compositor must be able to use
> the new wl_buffer and we need to guarantee that before-hand. If the
> compositor fails to use a wl_buffer when the client has already
> attached it to a wl_surface and it is time to repaint, it is too late
> and the user will see a glitch. Recovering from that requires asking
> the client to provide a new wl_buffer of a different kind, which might
> take time. Or a very rude compositor would just send a protocol error,
> and then we'd get bug reports like "the video player just disappears
> when I try to play (and ps. I have an old kernel that doesn't support
> importing whatever)".
>
> I believe we must allow the compositor to test the wl_buffer before it
> is usable for the client. That is the reason for the roundtrippy
> design
> of the below proposal.
>
>
> A central allocator would solve these issues, by having everyone agree
> on the restrictions upfront, instead of working out which of the media
> decode engine, camera, GPU, or display controller is the lowest common
> denominator, and forcing all allocations through there.
>
> One such solution was discussed a while back WRT ION:
> https://lwn.net/Articles/565469/
> 
>
> See the 'possible solutions' part for a way for people to agree on
> restrictions wrt tiling, stride, contiguousness, etc.

Hi!

I think before deciding on something like this, one needs also to
account for the virtual drivers like vmwgfx.

Here, a dma-buf internally holds an opaque handle to an object on the
host / hypervisor, and the actual memory buffer is only temporarily
allocated for dma-buf operations that strictly need it. Not to hold the
data while transferring it between devices or applications.

Let's say you'd want to use a USB display controller in a virtual
machine with the vmwgfx exported prime objects, for example. There's no
common denominator. The vmwgfx driver would need to read the dma-buf
data from the host object at sg-table export (dma-buf map) time.

Whereas if you just want to share data between a wayland server and
client, no pages are ever allocated and the only thing passed
around is in effect the opaque handle to the host / hypervisor object.

I'm currently having trouble seeing how a central allocator would be
able to deal with this?

/Thomas











>
> Cheers,
> Daniel
>
>
> ___
> wayland-devel mailing list
> wayland-devel@lists.freedesktop.org
> https://urldefense.proofpoint.com/v1/url?u=http://lists.freedesktop.org/mailman/listinfo/wayland-devel&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=l5Ago9ekmVFZ3c4M6eauqrJWGwjf6fTb%2BP3CxbBFkVM%3D%0A&m=NHSSDNdXVt2oCxexwhcqQAQSZ3K6Xa8Zvuv0jMYfS2c%3D%0A&s=c4f94901274570868164b5aac297336d544bdba1bc12bda6c09b915fa5495423
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


RE: Suggestions on implementing Wayland Protocol Dumper.

2014-06-10 Thread Srivardhan
Thanks All for the suggestions... Will do it in the 2nd way...

Thank-you,
Hebbar

> -Original Message-
> From: wayland-devel [mailto:wayland-devel-
> boun...@lists.freedesktop.org] On Behalf Of Bryce W. Harrington
> Sent: Tuesday, June 10, 2014 2:58 AM
> To: Srivardhan
> Cc: wayland-devel@lists.freedesktop.org
> Subject: Re: Suggestions on implementing Wayland Protocol Dumper.
> 
> On Mon, Jun 09, 2014 at 11:17:20AM +0530, Srivardhan wrote:
> > Hi,
> >
> > The following are the ways in which a Protocol Dumper can be
> implemented:
> > 1. Just before sending a message or when a message is received, the
> > message can be written to a file. This change can be done in
> > libwayland under #ifdef DEBUG. So when built enabling DEBUG, we should
> > get all the protocol messages.
> > 2. We can introduce another layer in Weston for monitoring. This layer
> > would act as Man in the middle. This layer would listen to a socket to
> > which all the Wayland clients would attach and this layer would in
> > turn attach to the server socket. This layer would print the messages
> > it received from the client and would transfer to the server and vise
> > a versa. This could be included in #ifdef DEBUG, so that it is enabled
only in
> DEBUG builds.
> >
> > I feel the 1st approach is simpler, What are your thoughts?
> 
> When I worked at Canonical, us X guys would periodically get called on to
> help troubleshoot issues where a client app was getting an X11 error, and
> needed to utilize xtrace to identify the protocol error.  In some cases
this
> debugging was done on production or embedded hardware where we
> couldn't quite so easily recompile or reinstall X, and in one case was
with
> commercial software for which we didn't have source access.  So for this
use
> case, having the protocol dumper configurable as a separate (packaged and
> pre-compiled) application was advantageous.
> 
> So, while #1 does indeed sound simpler, based on experience debugging
> similar issues in X, I think #2 is going to prove more flexible in the
long term.
> 
> Bryce
> 
> 
> ___
> 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


Re: [PATCH libinput 1/2] Add a log_msg_va function

2014-06-10 Thread Peter Hutterer
On Tue, Jun 10, 2014 at 03:08:03PM +0200, Hans de Goede wrote:
> This is useful for when we use libraries which want us to provide them with
> a logging callback.
> 
> Signed-off-by: Hans de Goede 
> ---
>  src/libinput-private.h |  3 +++
>  src/libinput.c | 16 +++-
>  2 files changed, 14 insertions(+), 5 deletions(-)
> 
> diff --git a/src/libinput-private.h b/src/libinput-private.h
> index c18447a..fd4fc29 100644
> --- a/src/libinput-private.h
> +++ b/src/libinput-private.h
> @@ -97,6 +97,9 @@ typedef void (*libinput_source_dispatch_t)(void *data);
>  
>  void
>  log_msg(enum libinput_log_priority priority, const char *format, ...);
> +void
> +log_msg_va(enum libinput_log_priority priority, const char *format,
> +va_list args);

both patches merged, thanks. Minor style changes to this one before pushing:
our coding style is either all args on one line (if it fits) or every arg on
a separate line.

Cheers,
   Peter

>  
>  int
>  libinput_init(struct libinput *libinput,
> diff --git a/src/libinput.c b/src/libinput.c
> index aee373e..fda6c56 100644
> --- a/src/libinput.c
> +++ b/src/libinput.c
> @@ -111,15 +111,21 @@ static struct log_data log_data = {
>  };
>  
>  void
> +log_msg_va(enum libinput_log_priority priority, const char *format,
> +va_list args)
> +{
> + if (log_data.handler && log_data.priority <= priority)
> + log_data.handler(priority, log_data.user_data, format, args);
> +}
> +
> +void
>  log_msg(enum libinput_log_priority priority, const char *format, ...)
>  {
>   va_list args;
>  
> - if (log_data.handler && log_data.priority <= priority) {
> - va_start(args, format);
> - log_data.handler(priority, log_data.user_data, format, args);
> - va_end(args);
> - }
> + va_start(args, format);
> + log_msg_va(priority, format, args);
> + va_end(args);
>  }
>  
>  LIBINPUT_EXPORT void
> -- 
> 2.0.0
> 
> ___
> 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 2/6] test: add litest_assert_empty_queue helper function

2014-06-10 Thread Peter Hutterer
Checks if the queue is empty and prints informatino about any events before
failing.

Signed-off-by: Peter Hutterer 
---
 test/litest.c   | 61 +
 test/litest.h   |  1 +
 test/touchpad.c |  9 ++---
 3 files changed, 64 insertions(+), 7 deletions(-)

diff --git a/test/litest.c b/test/litest.c
index 1f1bf7b..571cf76 100644
--- a/test/litest.c
+++ b/test/litest.c
@@ -737,6 +737,67 @@ litest_drain_events(struct libinput *li)
}
 }
 
+static void
+litest_print_event(struct libinput_event *event)
+{
+   struct libinput_event_pointer *p;
+   struct libinput_device *dev;
+   enum libinput_event_type type;
+   double x, y;
+
+   dev = libinput_event_get_device(event);
+   type = libinput_event_get_type(event);
+
+   fprintf(stderr,
+   "device %s type %d ",
+   libinput_device_get_sysname(dev),
+   type);
+   switch (type) {
+   case LIBINPUT_EVENT_POINTER_MOTION:
+   p = libinput_event_get_pointer_event(event);
+   x = libinput_event_pointer_get_dx(p);
+   y = libinput_event_pointer_get_dy(p);
+   fprintf(stderr, "motion: %.2f/%.2f", x, y);
+   break;
+   case LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE:
+   p = libinput_event_get_pointer_event(event);
+   x = libinput_event_pointer_get_absolute_x(p);
+   y = libinput_event_pointer_get_absolute_y(p);
+   fprintf(stderr, "motion: %.2f/%.2f", x, y);
+   break;
+   case LIBINPUT_EVENT_POINTER_BUTTON:
+   p = libinput_event_get_pointer_event(event);
+   fprintf(stderr,
+   "button: %d state %d",
+   libinput_event_pointer_get_button(p),
+   libinput_event_pointer_get_button_state(p));
+   break;
+   default:
+   break;
+   }
+
+   fprintf(stderr, "\n");
+}
+
+void
+litest_assert_empty_queue(struct libinput *li)
+{
+   bool empty_queue = true;
+   struct libinput_event *event;
+
+   libinput_dispatch(li);
+   while ((event = libinput_get_event(li))) {
+   empty_queue = false;
+   fprintf(stderr,
+   "Unexpected event: ");
+   litest_print_event(event);
+   libinput_event_destroy(event);
+   libinput_dispatch(li);
+   }
+
+   ck_assert(empty_queue);
+}
+
 struct libevdev_uinput *
 litest_create_uinput_device_from_description(const char *name,
 const struct input_id *id,
diff --git a/test/litest.h b/test/litest.h
index 32e1cb0..170c87c 100644
--- a/test/litest.h
+++ b/test/litest.h
@@ -123,6 +123,7 @@ void litest_keyboard_key(struct litest_device *d,
 unsigned int key,
 bool is_press);
 void litest_drain_events(struct libinput *li);
+void litest_assert_empty_queue(struct libinput *li);
 
 struct libevdev_uinput * litest_create_uinput_device(const char *name,
 struct input_id *id,
diff --git a/test/touchpad.c b/test/touchpad.c
index 9c95309..ec412d3 100644
--- a/test/touchpad.c
+++ b/test/touchpad.c
@@ -182,9 +182,7 @@ START_TEST(touchpad_1fg_tap_n_drag)
assert_button_event(li, BTN_LEFT,
LIBINPUT_BUTTON_STATE_RELEASED);
 
-   libinput_dispatch(li);
-   event = libinput_get_event(li);
-   ck_assert(event == NULL);
+   litest_assert_empty_queue(li);
 }
 END_TEST
 
@@ -192,7 +190,6 @@ START_TEST(touchpad_2fg_tap)
 {
struct litest_device *dev = litest_current_device();
struct libinput *li = dev->libinput;
-   struct libinput_event *event;
 
litest_drain_events(dev->libinput);
 
@@ -209,9 +206,7 @@ START_TEST(touchpad_2fg_tap)
assert_button_event(li, BTN_RIGHT,
LIBINPUT_BUTTON_STATE_RELEASED);
 
-   libinput_dispatch(li);
-   event = libinput_get_event(li);
-   ck_assert(event == NULL);
+   litest_assert_empty_queue(li);
 }
 END_TEST
 
-- 
1.9.3

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


[PATCH libinput 4/6] test: add clickpad software button tests

2014-06-10 Thread Peter Hutterer
Signed-off-by: Peter Hutterer 
---
 test/touchpad.c | 380 
 1 file changed, 380 insertions(+)

diff --git a/test/touchpad.c b/test/touchpad.c
index f9e2820..7b7cb7d 100644
--- a/test/touchpad.c
+++ b/test/touchpad.c
@@ -517,6 +517,377 @@ START_TEST(clickpad_click_n_drag)
 }
 END_TEST
 
+START_TEST(clickpad_softbutton_left)
+{
+   struct litest_device *dev = litest_current_device();
+   struct libinput *li = dev->libinput;
+
+   litest_drain_events(li);
+
+   litest_touch_down(dev, 0, 10, 90);
+   litest_event(dev, EV_KEY, BTN_LEFT, 1);
+   litest_event(dev, EV_SYN, SYN_REPORT, 0);
+
+   assert_button_event(li,
+   BTN_LEFT,
+   LIBINPUT_BUTTON_STATE_PRESSED);
+
+   litest_event(dev, EV_KEY, BTN_LEFT, 0);
+   litest_event(dev, EV_SYN, SYN_REPORT, 0);
+   litest_touch_up(dev, 0);
+
+   assert_button_event(li,
+   BTN_LEFT,
+   LIBINPUT_BUTTON_STATE_RELEASED);
+
+   libinput_dispatch(li);
+
+   litest_assert_empty_queue(li);
+}
+END_TEST
+
+START_TEST(clickpad_softbutton_right)
+{
+   struct litest_device *dev = litest_current_device();
+   struct libinput *li = dev->libinput;
+
+   litest_drain_events(li);
+
+   litest_touch_down(dev, 0, 90, 90);
+   litest_event(dev, EV_KEY, BTN_LEFT, 1);
+   litest_event(dev, EV_SYN, SYN_REPORT, 0);
+
+   assert_button_event(li,
+   BTN_RIGHT,
+   LIBINPUT_BUTTON_STATE_PRESSED);
+
+   litest_event(dev, EV_KEY, BTN_LEFT, 0);
+   litest_event(dev, EV_SYN, SYN_REPORT, 0);
+   litest_touch_up(dev, 0);
+
+   assert_button_event(li,
+   BTN_RIGHT,
+   LIBINPUT_BUTTON_STATE_RELEASED);
+
+   libinput_dispatch(li);
+
+   litest_assert_empty_queue(li);
+}
+END_TEST
+
+START_TEST(clickpad_softbutton_left_tap_n_drag)
+{
+   struct litest_device *dev = litest_current_device();
+   struct libinput *li = dev->libinput;
+
+   litest_drain_events(li);
+
+   /* Tap in left button area, then finger down, button click
+   -> expect left button press/release and left button press
+  Release button, finger up
+   -> expect right button release
+*/
+   litest_touch_down(dev, 0, 20, 20);
+   litest_touch_up(dev, 0);
+   litest_touch_down(dev, 0, 20, 90);
+   litest_event(dev, EV_KEY, BTN_LEFT, 1);
+   litest_event(dev, EV_SYN, SYN_REPORT, 0);
+
+   assert_button_event(li,
+   BTN_LEFT,
+   LIBINPUT_BUTTON_STATE_PRESSED);
+   assert_button_event(li,
+   BTN_LEFT,
+   LIBINPUT_BUTTON_STATE_RELEASED);
+   assert_button_event(li,
+   BTN_LEFT,
+   LIBINPUT_BUTTON_STATE_PRESSED);
+   litest_assert_empty_queue(li);
+
+   litest_event(dev, EV_KEY, BTN_LEFT, 0);
+   litest_event(dev, EV_SYN, SYN_REPORT, 0);
+   litest_touch_up(dev, 0);
+
+   assert_button_event(li,
+   BTN_LEFT,
+   LIBINPUT_BUTTON_STATE_RELEASED);
+   litest_assert_empty_queue(li);
+}
+END_TEST
+
+START_TEST(clickpad_softbutton_right_tap_n_drag)
+{
+   struct litest_device *dev = litest_current_device();
+   struct libinput *li = dev->libinput;
+
+   litest_drain_events(li);
+
+   /* Tap in right button area, then finger down, button click
+   -> expect left button press/release and right button press
+  Release button, finger up
+   -> expect right button release
+*/
+   litest_touch_down(dev, 0, 20, 20);
+   litest_touch_up(dev, 0);
+   litest_touch_down(dev, 0, 90, 90);
+   litest_event(dev, EV_KEY, BTN_LEFT, 1);
+   litest_event(dev, EV_SYN, SYN_REPORT, 0);
+
+   assert_button_event(li,
+   BTN_LEFT,
+   LIBINPUT_BUTTON_STATE_PRESSED);
+   assert_button_event(li,
+   BTN_LEFT,
+   LIBINPUT_BUTTON_STATE_RELEASED);
+   assert_button_event(li,
+   BTN_RIGHT,
+   LIBINPUT_BUTTON_STATE_PRESSED);
+   litest_assert_empty_queue(li);
+
+   litest_event(dev, EV_KEY, BTN_LEFT, 0);
+   litest_event(dev, EV_SYN, SYN_REPORT, 0);
+   litest_touch_up(dev, 0);
+
+   assert_button_event(li,
+   BTN_RIGHT,
+   LIBINPUT_BUTTON_STATE_RELEASED);
+   litest_assert_empty_queue(li);
+}
+END_TEST
+
+START_TEST(clickpad_softbutton_left_1st_fg_move)
+{
+   struct litest_device *dev = litest_current_device();
+   struct libinput *li = dev->libinput;
+   struct libinput_event *event;
+   double x = 0, y =

[PATCH libinput 3/6] test: add a bunch of test for click behavior on touchpads

2014-06-10 Thread Peter Hutterer
Mainly testing the behaviour when clicking during a tap or tap-n-drag. Adds a
new "feature" to the litest system, Apple clickpads don't have software
buttons by default.

Signed-off-by: Peter Hutterer 
---
 test/litest-bcm5974.c |   3 +-
 test/litest.h |   1 +
 test/touchpad.c   | 180 ++
 3 files changed, 183 insertions(+), 1 deletion(-)

diff --git a/test/litest-bcm5974.c b/test/litest-bcm5974.c
index 33127d9..10a9eb4 100644
--- a/test/litest-bcm5974.c
+++ b/test/litest-bcm5974.c
@@ -97,7 +97,8 @@ static int events[] = {
 
 struct litest_test_device litest_bcm5974_device = {
.type = LITEST_BCM5974,
-   .features = LITEST_TOUCHPAD | LITEST_CLICKPAD | LITEST_BUTTON,
+   .features = LITEST_TOUCHPAD | LITEST_CLICKPAD |
+   LITEST_BUTTON | LITEST_APPLE_CLICKPAD,
.shortname = "bcm5974",
.setup = litest_bcm5974_setup,
.interface = &interface,
diff --git a/test/litest.h b/test/litest.h
index 170c87c..ea7d299 100644
--- a/test/litest.h
+++ b/test/litest.h
@@ -55,6 +55,7 @@ enum litest_device_feature {
LITEST_WHEEL = 1 << 5,
LITEST_TOUCH = 1 << 6,
LITEST_SINGLE_TOUCH = 1 << 7,
+   LITEST_APPLE_CLICKPAD = 1 << 8,
 };
 
 struct litest_device {
diff --git a/test/touchpad.c b/test/touchpad.c
index ec412d3..f9e2820 100644
--- a/test/touchpad.c
+++ b/test/touchpad.c
@@ -210,6 +210,179 @@ START_TEST(touchpad_2fg_tap)
 }
 END_TEST
 
+START_TEST(touchpad_1fg_tap_click)
+{
+   struct litest_device *dev = litest_current_device();
+   struct libinput *li = dev->libinput;
+
+   litest_drain_events(dev->libinput);
+
+   /* finger down, button click, finger up
+  -> only one button left event pair */
+   litest_touch_down(dev, 0, 50, 50);
+   litest_event(dev, EV_KEY, BTN_LEFT, 1);
+   litest_event(dev, EV_SYN, SYN_REPORT, 0);
+   litest_event(dev, EV_KEY, BTN_LEFT, 0);
+   litest_event(dev, EV_SYN, SYN_REPORT, 0);
+   litest_touch_up(dev, 0);
+
+   libinput_dispatch(li);
+
+   assert_button_event(li, BTN_LEFT,
+   LIBINPUT_BUTTON_STATE_PRESSED);
+   assert_button_event(li, BTN_LEFT,
+   LIBINPUT_BUTTON_STATE_RELEASED);
+
+   litest_assert_empty_queue(li);
+}
+END_TEST
+
+START_TEST(touchpad_2fg_tap_click)
+{
+   struct litest_device *dev = litest_current_device();
+   struct libinput *li = dev->libinput;
+
+   litest_drain_events(dev->libinput);
+
+   /* two fingers down, button click, fingers up
+  -> only one button left event pair */
+   litest_touch_down(dev, 0, 50, 50);
+   litest_touch_down(dev, 1, 70, 50);
+   litest_event(dev, EV_KEY, BTN_LEFT, 1);
+   litest_event(dev, EV_SYN, SYN_REPORT, 0);
+   litest_event(dev, EV_KEY, BTN_LEFT, 0);
+   litest_event(dev, EV_SYN, SYN_REPORT, 0);
+   litest_touch_up(dev, 1);
+   litest_touch_up(dev, 0);
+
+   libinput_dispatch(li);
+
+   assert_button_event(li, BTN_LEFT,
+   LIBINPUT_BUTTON_STATE_PRESSED);
+   assert_button_event(li, BTN_LEFT,
+   LIBINPUT_BUTTON_STATE_RELEASED);
+
+   litest_assert_empty_queue(li);
+}
+END_TEST
+
+START_TEST(touchpad_2fg_tap_click_apple)
+{
+   struct litest_device *dev = litest_current_device();
+   struct libinput *li = dev->libinput;
+
+   litest_drain_events(dev->libinput);
+
+   /* two fingers down, button click, fingers up
+  -> only one button right event pair
+  (apple have clickfinger enabled by default) */
+   litest_touch_down(dev, 0, 50, 50);
+   litest_touch_down(dev, 1, 70, 50);
+   litest_event(dev, EV_KEY, BTN_LEFT, 1);
+   litest_event(dev, EV_SYN, SYN_REPORT, 0);
+   litest_event(dev, EV_KEY, BTN_LEFT, 0);
+   litest_event(dev, EV_SYN, SYN_REPORT, 0);
+   litest_touch_up(dev, 1);
+   litest_touch_up(dev, 0);
+
+   libinput_dispatch(li);
+
+   assert_button_event(li, BTN_RIGHT,
+   LIBINPUT_BUTTON_STATE_PRESSED);
+   assert_button_event(li, BTN_RIGHT,
+   LIBINPUT_BUTTON_STATE_RELEASED);
+
+   litest_assert_empty_queue(li);
+}
+END_TEST
+
+START_TEST(touchpad_1fg_double_tap_click)
+{
+   struct litest_device *dev = litest_current_device();
+   struct libinput *li = dev->libinput;
+
+   litest_drain_events(dev->libinput);
+
+   /* one finger down, up, down, button click, finger up
+  -> two button left event pairs */
+   litest_touch_down(dev, 0, 50, 50);
+   litest_touch_up(dev, 0);
+   litest_touch_down(dev, 0, 50, 50);
+   litest_event(dev, EV_KEY, BTN_LEFT, 1);
+   litest_event(dev, EV_SYN, SYN_REPORT, 0);
+   litest_event(dev, EV_KEY, BTN_LEFT, 0);
+   litest_event(dev, EV_SYN, SYN_REPORT, 0);
+   litest_touch_up(dev, 0);
+
+   libinput_dispatch(li);
+
+   assert_button_eve

[PATCH libinput 5/6] test: Add description for the T440 synaptics touchpad

2014-06-10 Thread Peter Hutterer
Signed-off-by: Peter Hutterer 
---
 test/Makefile.am |   1 +
 test/litest-synaptics-t440.c | 112 +++
 test/litest.c|   2 +
 test/litest.h|   2 +
 4 files changed, 117 insertions(+)
 create mode 100644 test/litest-synaptics-t440.c

diff --git a/test/Makefile.am b/test/Makefile.am
index 70e83d4..b5dc33c 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -19,6 +19,7 @@ liblitest_la_SOURCES = \
litest-mouse.c \
litest-synaptics.c \
litest-synaptics-st.c \
+   litest-synaptics-t440.c \
litest-trackpoint.c \
litest-wacom-touch.c \
litest.c
diff --git a/test/litest-synaptics-t440.c b/test/litest-synaptics-t440.c
new file mode 100644
index 000..1b66494
--- /dev/null
+++ b/test/litest-synaptics-t440.c
@@ -0,0 +1,112 @@
+/*
+ * Copyright © 2014 Red Hat, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "litest.h"
+#include "litest-int.h"
+
+static void
+litest_synaptics_t440_setup(void)
+{
+   struct litest_device *d = 
litest_create_device(LITEST_SYNAPTICS_TOPBUTTONPAD);
+   litest_set_current_device(d);
+}
+
+static struct input_event down[] = {
+   { .type = EV_KEY, .code = BTN_TOOL_FINGER, .value = 1 },
+   { .type = EV_KEY, .code = BTN_TOUCH, .value = 1 },
+   { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN  },
+   { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN },
+   { .type = EV_ABS, .code = ABS_PRESSURE, .value = 30  },
+   { .type = EV_ABS, .code = ABS_MT_SLOT, .value = LITEST_AUTO_ASSIGN },
+   { .type = EV_ABS, .code = ABS_MT_TRACKING_ID, .value = 
LITEST_AUTO_ASSIGN },
+   { .type = EV_ABS, .code = ABS_MT_POSITION_X, .value = 
LITEST_AUTO_ASSIGN },
+   { .type = EV_ABS, .code = ABS_MT_POSITION_Y, .value = 
LITEST_AUTO_ASSIGN },
+   { .type = EV_SYN, .code = SYN_REPORT, .value = 0 },
+   { .type = -1, .code = -1 },
+};
+
+static struct input_event move[] = {
+   { .type = EV_ABS, .code = ABS_MT_SLOT, .value = LITEST_AUTO_ASSIGN },
+   { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN  },
+   { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN },
+   { .type = EV_ABS, .code = ABS_MT_POSITION_X, .value = 
LITEST_AUTO_ASSIGN },
+   { .type = EV_ABS, .code = ABS_MT_POSITION_Y, .value = 
LITEST_AUTO_ASSIGN },
+   { .type = EV_KEY, .code = BTN_TOOL_FINGER, .value = 1 },
+   { .type = EV_KEY, .code = BTN_TOUCH, .value = 1 },
+   { .type = EV_SYN, .code = SYN_REPORT, .value = 0 },
+   { .type = -1, .code = -1 },
+};
+
+static struct litest_device_interface interface = {
+   .touch_down_events = down,
+   .touch_move_events = move,
+};
+
+static struct input_id input_id = {
+   .bustype = 0x11,
+   .vendor = 0x2,
+   .product = 0x7,
+};
+
+static int events[] = {
+   EV_KEY, BTN_LEFT,
+   EV_KEY, BTN_TOOL_FINGER,
+   EV_KEY, BTN_TOOL_QUINTTAP,
+   EV_KEY, BTN_TOUCH,
+   EV_KEY, BTN_TOOL_DOUBLETAP,
+   EV_KEY, BTN_TOOL_TRIPLETAP,
+   EV_KEY, BTN_TOOL_QUADTAP,
+   INPUT_PROP_MAX, INPUT_PROP_POINTER,
+   INPUT_PROP_MAX, INPUT_PROP_BUTTONPAD,
+   INPUT_PROP_MAX, INPUT_PROP_TOPBUTTONPAD,
+   -1, -1,
+};
+
+static struct input_absinfo absinfo[] = {
+   { ABS_X, 1024, 5112, 0, 0, 42 },
+   { ABS_Y, 2024, 4832, 0, 0, 42 },
+   { ABS_PRESSURE, 0, 255, 0, 0, 0 },
+   { ABS_TOOL_WIDTH, 0, 15, 0, 0, 0 },
+   { ABS_MT_SLOT, 0, 1, 0, 0, 0 },
+   { ABS_MT_POSITION_X, 1024, 5112, 0, 0, 75 },
+   { ABS_MT_POSITION_Y, 2024, 4832, 0, 0, 129 },
+   { ABS_MT_TRACKING_ID, 0, 65535, 0, 0, 0 },
+   { ABS_MT_PRESSURE, 0, 255, 0, 0, 0 },
+   { .value = -1 }
+};
+
+struct litest_test_device litest_s

[PATCH libinput 6/6] test: add a couple of top software button test

2014-06-10 Thread Peter Hutterer
Signed-off-by: Peter Hutterer 
---
 test/touchpad.c | 124 
 1 file changed, 124 insertions(+)

diff --git a/test/touchpad.c b/test/touchpad.c
index 7b7cb7d..147d0e2 100644
--- a/test/touchpad.c
+++ b/test/touchpad.c
@@ -888,6 +888,125 @@ START_TEST(clickpad_softbutton_right_to_left)
 }
 END_TEST
 
+START_TEST(clickpad_topsoftbuttons_left)
+{
+   struct litest_device *dev = litest_current_device();
+   struct libinput *li = dev->libinput;
+
+   litest_drain_events(li);
+
+   litest_touch_down(dev, 0, 10, 5);
+   litest_event(dev, EV_KEY, BTN_LEFT, 1);
+   litest_event(dev, EV_SYN, SYN_REPORT, 0);
+
+   assert_button_event(li,
+   BTN_LEFT,
+   LIBINPUT_BUTTON_STATE_PRESSED);
+   litest_assert_empty_queue(li);
+
+   litest_event(dev, EV_KEY, BTN_LEFT, 0);
+   litest_event(dev, EV_SYN, SYN_REPORT, 0);
+   litest_touch_up(dev, 0);
+
+   assert_button_event(li,
+   BTN_LEFT,
+   LIBINPUT_BUTTON_STATE_RELEASED);
+
+   litest_assert_empty_queue(li);
+}
+END_TEST
+
+START_TEST(clickpad_topsoftbuttons_right)
+{
+   struct litest_device *dev = litest_current_device();
+   struct libinput *li = dev->libinput;
+
+   litest_drain_events(li);
+
+   litest_touch_down(dev, 0, 90, 5);
+   litest_event(dev, EV_KEY, BTN_LEFT, 1);
+   litest_event(dev, EV_SYN, SYN_REPORT, 0);
+
+   assert_button_event(li,
+   BTN_RIGHT,
+   LIBINPUT_BUTTON_STATE_PRESSED);
+   litest_assert_empty_queue(li);
+
+   litest_event(dev, EV_KEY, BTN_LEFT, 0);
+   litest_event(dev, EV_SYN, SYN_REPORT, 0);
+   litest_touch_up(dev, 0);
+
+   assert_button_event(li,
+   BTN_RIGHT,
+   LIBINPUT_BUTTON_STATE_RELEASED);
+
+   litest_assert_empty_queue(li);
+}
+END_TEST
+
+START_TEST(clickpad_topsoftbuttons_middle)
+{
+   struct litest_device *dev = litest_current_device();
+   struct libinput *li = dev->libinput;
+
+   litest_drain_events(li);
+
+   litest_touch_down(dev, 0, 50, 5);
+   litest_event(dev, EV_KEY, BTN_LEFT, 1);
+   litest_event(dev, EV_SYN, SYN_REPORT, 0);
+
+   assert_button_event(li,
+   BTN_MIDDLE,
+   LIBINPUT_BUTTON_STATE_PRESSED);
+   litest_assert_empty_queue(li);
+
+   litest_event(dev, EV_KEY, BTN_LEFT, 0);
+   litest_event(dev, EV_SYN, SYN_REPORT, 0);
+   litest_touch_up(dev, 0);
+
+   assert_button_event(li,
+   BTN_MIDDLE,
+   LIBINPUT_BUTTON_STATE_RELEASED);
+
+   litest_assert_empty_queue(li);
+}
+END_TEST
+
+START_TEST(clickpad_topsoftbuttons_move_out_ignore)
+{
+   struct litest_device *dev = litest_current_device();
+   struct libinput *li = dev->libinput;
+
+   /* Finger down in top button area, wait past enter timeout
+  Move into main area, wait past leave timeout
+  Click
+-> expect no events
+*/
+
+   litest_drain_events(li);
+
+   litest_touch_down(dev, 0, 50, 5);
+   libinput_dispatch(li);
+   usleep(20);
+   libinput_dispatch(li);
+   litest_assert_empty_queue(li);
+
+   litest_touch_move_to(dev, 0, 50, 5, 80, 90, 20);
+   libinput_dispatch(li);
+   usleep(40);
+   libinput_dispatch(li);
+
+   litest_event(dev, EV_KEY, BTN_LEFT, 1);
+   litest_event(dev, EV_SYN, SYN_REPORT, 0);
+   litest_event(dev, EV_KEY, BTN_LEFT, 0);
+   litest_event(dev, EV_SYN, SYN_REPORT, 0);
+
+   litest_touch_up(dev, 0);
+
+   litest_assert_empty_queue(li);
+}
+END_TEST
+
 int main(int argc, char **argv) {
 
litest_add("touchpad:motion", touchpad_1fg_motion, LITEST_TOUCHPAD, 
LITEST_ANY);
@@ -920,5 +1039,10 @@ int main(int argc, char **argv) {
litest_add("touchpad:softbutton", clickpad_softbutton_left_to_right, 
LITEST_CLICKPAD, LITEST_APPLE_CLICKPAD);
litest_add("touchpad:softbutton", clickpad_softbutton_right_to_left, 
LITEST_CLICKPAD, LITEST_APPLE_CLICKPAD);
 
+   litest_add("touchpad:topsoftbuttons", clickpad_topsoftbuttons_left, 
LITEST_TOPBUTTONPAD, LITEST_ANY);
+   litest_add("touchpad:topsoftbuttons", clickpad_topsoftbuttons_right, 
LITEST_TOPBUTTONPAD, LITEST_ANY);
+   litest_add("touchpad:topsoftbuttons", clickpad_topsoftbuttons_middle, 
LITEST_TOPBUTTONPAD, LITEST_ANY);
+   litest_add("touchpad:topsoftbuttons", 
clickpad_topsoftbuttons_move_out_ignore, LITEST_TOPBUTTONPAD, LITEST_ANY);
+
return litest_run(argc, argv);
 }
-- 
1.9.3

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


[PATCH libinput 1/6] touchpad: always call into the the tap state machine

2014-06-10 Thread Peter Hutterer
A button event consumed by the softbutton or clickpad code does not feed into
the tap state machine, leaving it in its current state. The touch generating
that event however may have triggered state changes.

For some tap/click combinations this gives us either double press/release
events or an inconsistent order of events. Those issues include:
* a really short physical click causes a click + tap-click
* a really short physical click on the right software button causes a right
  click + left tap-click
* tap + click causes double button left press events

To avoid these, notify the tap code that a button event has occured and
process that accordingly. Depending on the state this may either continue to
the DEAD state or release the current tap button and then go to the DEAD
state.

Signed-off-by: Peter Hutterer 
---
 src/evdev-mt-touchpad.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
index 8b502b7..0294eb2 100644
--- a/src/evdev-mt-touchpad.c
+++ b/src/evdev-mt-touchpad.c
@@ -545,13 +545,12 @@ tp_post_events(struct tp_dispatch *tp, uint64_t time)
 {
struct tp_touch *t = tp_current_touch(tp);
double dx, dy;
+   int consumed = 0;
 
-   if (tp_post_button_events(tp, time) != 0) {
-   tp_stop_scroll_events(tp, time);
-   return;
-   }
+   consumed |= tp_tap_handle_state(tp, time);
+   consumed |= tp_post_button_events(tp, time);
 
-   if (tp_tap_handle_state(tp, time) != 0) {
+   if (consumed) {
tp_stop_scroll_events(tp, time);
return;
}
-- 
1.9.3

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


Re: Texture object locking

2014-06-10 Thread Neil Roberts
I was trying to be too clever with git-sendmail and I accidentally sent
that message to the wrong list. Please ignore it. Sorry about that.

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


Re: Texture object locking

2014-06-10 Thread Neil Roberts
Jason wrote:

> Kristian and I were looking at this today, and there seems to be a
> substantial race in the way that we are doing texture locking.

Yes, it does look like this is a problem. I also noticed another
dodgy-looking pattern when implementing the GL_ARB_clear_texture
extension. Whenever it enters a meta function that operates on a
texture image it unlocks the texture object and then does stuff
directly using the texture image pointer. Presumably that pointer
could also be freed at any point. Take a look at
copytexsubimage_using_blit_framebuffer in meta.c for an example.

I suppose in practice though it's probably not all that likely that an
application will go and delete textures in another thread without the
other threads expecting it so I don't know whether it's a major
concern.

I knocked up the following patch to Weston's simple-egl example to try
and get it to crash when deleting textures from multiple threads and
sure enough it does segfault.

Regards,
- Neil

--- >8 --- (use git am --scissors to automatically chop here)
Subject: Hack to test multi-threaded deleting textures

---
 clients/simple-egl.c | 125 +--
 1 file changed, 112 insertions(+), 13 deletions(-)

diff --git a/clients/simple-egl.c b/clients/simple-egl.c
index 2097b4c..6e592b4 100644
--- a/clients/simple-egl.c
+++ b/clients/simple-egl.c
@@ -39,6 +39,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "xdg-shell-client-protocol.h"
 
@@ -100,6 +101,13 @@ struct window {
int fullscreen, opaque, buffer_size, frame_sync;
 };
 
+struct thread_data {
+   EGLDisplay dpy;
+   EGLSurface surface;
+   EGLContext ctx;
+   int thread_num;
+};
+
 static const char *vert_shader_text =
"uniform mat4 rotation;\n"
"attribute vec4 pos;\n"
@@ -117,15 +125,25 @@ static const char *frag_shader_text =
"  gl_FragColor = v_color;\n"
"}\n";
 
+static const EGLint context_attribs[] = {
+   EGL_CONTEXT_CLIENT_VERSION, 2,
+   EGL_NONE
+};
+
 static int running = 1;
 
+#define N_THREADS 63
+#define N_TEXTURES 512
+#define TEX_SIZE 128
+
+static pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
+static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
+static uint64_t running_threads;
+static GLuint textures[N_TEXTURES];
+
 static void
 init_egl(struct display *display, struct window *window)
 {
-   static const EGLint context_attribs[] = {
-   EGL_CONTEXT_CLIENT_VERSION, 2,
-   EGL_NONE
-   };
const char *extensions;
 
EGLint config_attribs[] = {
@@ -748,13 +766,101 @@ usage(int error_code)
exit(error_code);
 }
 
+static GLuint
+create_texture(void)
+{
+   GLuint tex;
+   GLubyte data[TEX_SIZE * TEX_SIZE * 4];
+
+   glGenTextures(1, &tex);
+   glBindTexture(GL_TEXTURE_2D, tex);
+   glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, TEX_SIZE, TEX_SIZE, 0,
+GL_RGBA, GL_UNSIGNED_BYTE, data);
+   glBindTexture(GL_TEXTURE_2D, 0);
+
+   return tex;
+}
+
+static void *
+thread_func(void *data)
+{
+   struct thread_data *thread_data = data;
+   int i;
+
+   eglMakeCurrent(thread_data->dpy,
+  thread_data->surface,
+  thread_data->surface,
+  thread_data->ctx);
+
+   while (true) {
+   /* Wait until this thread is told to run */
+   pthread_mutex_lock(&mutex);
+   while (!(running_threads & (1ULL << thread_data->thread_num)))
+   pthread_cond_wait(&cond, &mutex);
+   pthread_mutex_unlock(&mutex);
+
+   /* Delete all of the textures */
+   for (i = 0; i < N_TEXTURES; i++)
+   glDeleteTextures(1, textures + i);
+
+   /* Report that our thread is no longer running */
+   pthread_mutex_lock(&mutex);
+   running_threads &= ~(1ULL << thread_data->thread_num);
+   pthread_cond_broadcast(&cond);
+   pthread_mutex_unlock(&mutex);
+   }
+
+   return data;
+}
+
+static void
+delete_thread_test(struct display *display)
+{
+   pthread_t thread;
+   struct thread_data thread_data[N_THREADS];
+   int i;
+
+   for (i = 0; i < N_THREADS; i++) {
+   thread_data[i].dpy = display->egl.dpy;
+   thread_data[i].surface = display->window->egl_surface;
+   thread_data[i].ctx = eglCreateContext(display->egl.dpy,
+ display->egl.conf,
+ display->egl.ctx,
+ context_attribs);
+   thread_data[i].thread_num = i;
+   pthread_create(&thread,
+  NULL, /* attr */
+  thread_func,
+  thread_data + i);
+   }
+
+

Re: [Mesa-dev] [PATCH mesa] add EGL_TEXTURE_EXTERNAL_WL to WL_bind_wayland_display spec

2014-06-10 Thread Rob Clark
On Mon, Jun 9, 2014 at 5:53 AM, Pekka Paalanen  wrote:
> On Thu, 16 Aug 2012 17:28:19 -0500
> Rob Clark  wrote:
>
>> From: Rob Clark 
>>
>> Signed-off-by: Rob Clark 
>> ---
>>  docs/WL_bind_wayland_display.spec |5 +
>>  include/EGL/eglmesaext.h  |1 +
>>  2 files changed, 6 insertions(+)
>>
>> diff --git a/docs/WL_bind_wayland_display.spec 
>> b/docs/WL_bind_wayland_display.spec
>> index 02bd6ea..ce52e2d 100644
>> --- a/docs/WL_bind_wayland_display.spec
>> +++ b/docs/WL_bind_wayland_display.spec
>> @@ -75,6 +75,7 @@ New Tokens
>>  EGL_TEXTURE_Y_U_V_WL0x31D7
>>  EGL_TEXTURE_Y_UV_WL 0x31D8
>>  EGL_TEXTURE_Y_XUXV_WL   0x31D9
>> +EGL_TEXTURE_EXTERNAL_WL 0x31DA
>>
>>
>>  Additions to the EGL 1.4 Specification:
>> @@ -143,6 +144,10 @@ Additions to the EGL 1.4 Specification:
>>  Two planes, samples Y from the first plane to r in
>>  the shader, U and V from the second plane to g and a.
>>
>> +EGL_TEXTURE_EXTERNAL_WL
>> +Treated as a single plane texture, but sampled with
>> +samplerExternalOES according to OES_EGL_image_external
>> +
>>  After querying the wl_buffer layout, create EGLImages for the
>>  planes by calling eglCreateImageKHR with wl_buffer as
>>  EGLClientBuffer, EGL_WAYLAND_BUFFER_WL as the target, NULL
>> diff --git a/include/EGL/eglmesaext.h b/include/EGL/eglmesaext.h
>> index d476d18..2b91897 100644
>> --- a/include/EGL/eglmesaext.h
>> +++ b/include/EGL/eglmesaext.h
>> @@ -118,6 +118,7 @@ typedef EGLDisplay (EGLAPIENTRYP 
>> PFNEGLGETDRMDISPLAYMESA) (int fd);
>>  #define EGL_TEXTURE_Y_U_V_WL0x31D7
>>  #define EGL_TEXTURE_Y_UV_WL 0x31D8
>>  #define EGL_TEXTURE_Y_XUXV_WL   0x31D9
>> +#define EGL_TEXTURE_EXTERNAL_WL 0x31DA
>>
>>  struct wl_display;
>>  struct wl_buffer;
>
> Hi all,
>
> it looks like this patch never made it into Mesa. Also the
> implementation apparently didn't make it into Mesa, as git pick-axe
> does not find any mention of EGL_TEXTURE_EXTERNAL_WL.
>
> Still, the Weston patch was merged on Aug 31st, 2012.
>
> Oops. :-)

heh, well I guess if weston is already using it, perhaps we should
think about merging the mesa patch ;-)

BR,
-R

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


[PATCH libinput 2/2] timer.h: Add #include libinput-util.h

2014-06-10 Thread Hans de Goede
libinput-util.h is needed for the linked list definitions.

Signed-off-by: Hans de Goede 
---
 src/timer.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/timer.h b/src/timer.h
index df12d0e..5e3b89b 100644
--- a/src/timer.h
+++ b/src/timer.h
@@ -25,6 +25,8 @@
 
 #include 
 
+#include "libinput-util.h"
+
 struct libinput;
 
 struct libinput_timer {
-- 
2.0.0

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


[PATCH libinput 1/2] Add a log_msg_va function

2014-06-10 Thread Hans de Goede
This is useful for when we use libraries which want us to provide them with
a logging callback.

Signed-off-by: Hans de Goede 
---
 src/libinput-private.h |  3 +++
 src/libinput.c | 16 +++-
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/src/libinput-private.h b/src/libinput-private.h
index c18447a..fd4fc29 100644
--- a/src/libinput-private.h
+++ b/src/libinput-private.h
@@ -97,6 +97,9 @@ typedef void (*libinput_source_dispatch_t)(void *data);
 
 void
 log_msg(enum libinput_log_priority priority, const char *format, ...);
+void
+log_msg_va(enum libinput_log_priority priority, const char *format,
+  va_list args);
 
 int
 libinput_init(struct libinput *libinput,
diff --git a/src/libinput.c b/src/libinput.c
index aee373e..fda6c56 100644
--- a/src/libinput.c
+++ b/src/libinput.c
@@ -111,15 +111,21 @@ static struct log_data log_data = {
 };
 
 void
+log_msg_va(enum libinput_log_priority priority, const char *format,
+  va_list args)
+{
+   if (log_data.handler && log_data.priority <= priority)
+   log_data.handler(priority, log_data.user_data, format, args);
+}
+
+void
 log_msg(enum libinput_log_priority priority, const char *format, ...)
 {
va_list args;
 
-   if (log_data.handler && log_data.priority <= priority) {
-   va_start(args, format);
-   log_data.handler(priority, log_data.user_data, format, args);
-   va_end(args);
-   }
+   va_start(args, format);
+   log_msg_va(priority, format, args);
+   va_end(args);
 }
 
 LIBINPUT_EXPORT void
-- 
2.0.0

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


[PATCH libinput] Add a log_msg_va function

2014-06-10 Thread Hans de Goede
This is useful for when we use libraries which want us to provide them with
a logging callback.

Signed-off-by: Hans de Goede 
---
 src/libinput-private.h |  3 +++
 src/libinput.c | 16 +++-
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/src/libinput-private.h b/src/libinput-private.h
index ed8190d..a5f1405 100644
--- a/src/libinput-private.h
+++ b/src/libinput-private.h
@@ -97,6 +97,9 @@ typedef void (*libinput_source_dispatch_t)(void *data);
 
 void
 log_msg(enum libinput_log_priority priority, const char *format, ...);
+void
+log_msg_va(enum libinput_log_priority priority, const char *format,
+  va_list args);
 
 int
 libinput_init(struct libinput *libinput,
diff --git a/src/libinput.c b/src/libinput.c
index 5c66159..a6d7af8 100644
--- a/src/libinput.c
+++ b/src/libinput.c
@@ -111,15 +111,21 @@ static struct log_data log_data = {
 };
 
 void
+log_msg_va(enum libinput_log_priority priority, const char *format,
+  va_list args)
+{
+   if (log_data.handler && log_data.priority <= priority)
+   log_data.handler(priority, log_data.user_data, format, args);
+}
+
+void
 log_msg(enum libinput_log_priority priority, const char *format, ...)
 {
va_list args;
 
-   if (log_data.handler && log_data.priority <= priority) {
-   va_start(args, format);
-   log_data.handler(priority, log_data.user_data, format, args);
-   va_end(args);
-   }
+   va_start(args, format);
+   log_msg_va(priority, format, args);
+   va_end(args);
 }
 
 LIBINPUT_EXPORT void
-- 
2.0.0

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


Re: [PATCH libinput 1/8] Drop empty FFI_CFLAGS

2014-06-10 Thread Hans de Goede
Hi,

All patches in this series look good and are:

Reviewed-by: Hans de Goede 

Regards,

Hans


On 06/06/2014 08:18 AM, Peter Hutterer wrote:
> Leftover from weston
> 
> Signed-off-by: Peter Hutterer 
> ---
>  src/Makefile.am | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/src/Makefile.am b/src/Makefile.am
> index 3337a83..ff93911 100644
> --- a/src/Makefile.am
> +++ b/src/Makefile.am
> @@ -38,7 +38,6 @@ libinput_la_LDFLAGS = -version-info $(LIBINPUT_LT_VERSION)
>  pkgconfigdir = $(libdir)/pkgconfig
>  pkgconfig_DATA = libinput.pc
>  
> -AM_CPPFLAGS = $(FFI_CFLAGS)
>  AM_CFLAGS = $(GCC_CFLAGS)
>  
>  DISTCLEANFILES = libinput-version.h
> 
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel