[PATCH weston] compositor-wayland: Fix a use after free

2016-11-23 Thread Dima Ryazanov
When a window is being closed, the frame_done callback often runs after
the output is already destroyed, i.e:

  wayland_output_start_repaint_loop
  input_handle_button
wayland_output_destroy
  frame_done

To fix this, destroy the output from an idle handler (same as compositor-x11),
and also stop creating new frame_done callbacks.

Signed-off-by: Dima Ryazanov 
---
 libweston/compositor-wayland.c | 59 +++---
 1 file changed, 50 insertions(+), 9 deletions(-)

diff --git a/libweston/compositor-wayland.c b/libweston/compositor-wayland.c
index d9cbde5..fc5daf4 100644
--- a/libweston/compositor-wayland.c
+++ b/libweston/compositor-wayland.c
@@ -128,6 +128,13 @@ struct wayland_output {
 
struct weston_mode mode;
uint32_t scale;
+
+   bool destroy_pending;
+};
+
+struct output_destroy_data {
+   struct wayland_backend *backend;
+   struct wayland_output *output;
 };
 
 struct wayland_parent_output {
@@ -460,6 +467,9 @@ wayland_output_start_repaint_loop(struct weston_output 
*output_base)
to_wayland_backend(output->base.compositor);
struct wl_callback *callback;
 
+   if (output->destroy_pending)
+   return;
+
/* If this is the initial frame, we need to attach a buffer so that
 * the compositor can map the surface and include it in its render
 * loop. If the surface doesn't end up in the render loop, the frame
@@ -485,6 +495,9 @@ wayland_output_repaint_gl(struct weston_output *output_base,
struct weston_compositor *ec = output->base.compositor;
struct wl_callback *callback;
 
+   if (output->destroy_pending)
+   return 0;
+
callback = wl_surface_frame(output->parent.surface);
wl_callback_add_listener(callback, &frame_listener, output);
 
@@ -696,6 +709,41 @@ wayland_output_destroy(struct weston_output *base)
free(output);
 }
 
+static void
+output_destroy_cb(void *data)
+{
+   struct output_destroy_data *dd = data;
+
+   assert(dd->output->destroy_pending);
+
+   wayland_output_destroy(&dd->output->base);
+   if (wl_list_empty(&dd->backend->compositor->output_list))
+   weston_compositor_exit(dd->backend->compositor);
+
+   free(dd);
+}
+
+static void
+handle_window_closed(struct wayland_backend *backend, struct wayland_output 
*output)
+{
+   struct wl_event_loop *loop;
+   struct output_destroy_data *data;
+
+   assert(!output->destroy_pending);
+
+   data = malloc(sizeof *data);
+   if (!data)
+   return;  /* Not much we can do here. */
+
+   data->backend = backend;
+   data->output = output;
+
+   loop = wl_display_get_event_loop(backend->compositor->wl_display);
+   wl_event_loop_add_idle(loop, output_destroy_cb, data);
+
+   output->destroy_pending = true;
+}
+
 static const struct wl_shell_surface_listener shell_surface_listener;
 
 static int
@@ -1600,13 +1648,9 @@ input_handle_button(void *data, struct wl_pointer 
*pointer,
}
 
if (frame_status(input->output->frame) & FRAME_STATUS_CLOSE) {
-   wayland_output_destroy(&input->output->base);
+   handle_window_closed(input->backend, input->output);
input->output = NULL;
input->keyboard_focus = NULL;
-
-   if 
(wl_list_empty(&input->backend->compositor->output_list))
-   
weston_compositor_exit(input->backend->compositor);
-
return;
}
 
@@ -1964,12 +2008,9 @@ input_handle_touch_up(void *data, struct wl_touch 
*wl_touch,
frame_touch_up(output->frame, input, id);
 
if (frame_status(output->frame) & FRAME_STATUS_CLOSE) {
-   wayland_output_destroy(&output->base);
+   handle_window_closed(input->backend, output);
input->touch_focus = NULL;
input->keyboard_focus = NULL;
-   if 
(wl_list_empty(&input->backend->compositor->output_list))
-   
weston_compositor_exit(input->backend->compositor);
-
return;
}
if (frame_status(output->frame) & FRAME_STATUS_REPAINT)
-- 
2.9.3

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


RDP backend not working along with fbdev backend

2016-11-23 Thread Arun Kumar
Hi,

I'm trying to port the rdp-backend in  IMX6 ARM target running fb-dev as
the graphic backend. The target has the Weston
compositor with IVI shell.

Target : NXP IMX6
FreeRDP : 1.0.0
Weston /Wayland : 1.9.0
IVI shell. 1.9.1

But once my system is up and running I am able to see my target comeup with
its UI screen on the display.
At this point I started xfreerdp from the host to connect to the
rdp-backend for screen replicaiton. But in the host
I am able to see only the blank window where as the target display still
have the UI screens.


weston.ini
[core]
shell=ivi-shell.so
backend=fbdev-backend.so

[ivi-shell]
ivi-module=ivi-controller.so

$ weston --tty=1


$ weston --backend=rdp-backend.so --rdp-tls-cert=/meta/test.crt
--rdp-tls-key=/meta/test.key --width=1024 --height=768 --socket=wayland-1

== Logs

[12:05:21.471] weston 1.9.0
   http://wayland.freedesktop.org
   Bug reports to:
https://bugs.freedesktop.org/enter_bug.cgi?product=Wayland&component=weston&version=1.9.0
   Build: 1.8.93-2-gb05cdb8 configure.ac: bump to version 1.9.0
for the official release (2015-09-21 18:11:26 -0700)
[12:05:21.471] OS: Linux, 4.1.15-1.2.0+g77f6154, #2 SMP PREEMPT Wed Nov 16
09:36:22 IST 2016, armv7l
[12:05:21.471] warning: XDG_RUNTIME_DIR "/tmp" is not configured
correctly.  Unix access mode must be 0700 (current mode is 777),
and must be owned by the user (current owner is UID 0).
Refer to your distribution on how to get it, or
http://www.freedesktop.org/wiki/Specifications/basedir-spec
on how to implement it.
[12:05:21.475] Using config file '/etc/xdg/weston/weston.ini'
[12:05:21.477] Loading module '/usr/lib/weston/rdp-backend.so'
 [12:05:21.735] Output repaint window is 7 ms maximum.
[12:05:21.737] using FreeRDP version 1.2.5
[12:05:21.737] TLS support activated
[12:05:21:083] [411:411] [INFO][com.freerdp.core.listener] - Listening on
0.0.0.0:3389
[12:05:21.758] Compositor capabilities:
   arbitrary surface rotation: yes
   screen capture uses y-flip: yes
   presentation clock: CLOCK_MONOTONIC_RAW, id 4
[12:05:21.759] Loading module '/usr/lib/weston/ivi-shell.so'
[12:05:21.760] Loading module '/usr/lib/weston/ivi-controller.so'
[12:05:21.763] Loading module '/usr/lib/weston/ivi-input-controller.so'
[12:05:21.765] ivi-input-controller module loaded successfully!

[12:09:11:767] [411:411] [INFO][com.freerdp.core.connection] - Client
Security: NLA:0 TLS:1 RDP:0
[12:09:11:767] [411:411] [INFO][com.freerdp.core.connection] - Server
Security: NLA:0 TLS:1 RDP:1
[12:09:11:767] [411:411] [INFO][com.freerdp.core.connection] - Negotiated
Security: NLA:0 TLS:1 RDP:0
[12:09:11.559] unable to checkDescriptor for 0x170c8c0
[12:09:19:005] [411:411] [INFO][com.freerdp.core.connection] - Client
Security: NLA:0 TLS:1 RDP:0
[12:09:19:005] [411:411] [INFO][com.freerdp.core.connection] - Server
Security: NLA:0 TLS:1 RDP:1
[12:09:19:006] [411:411] [INFO][com.freerdp.core.connection] - Negotiated
Security: NLA:0 TLS:1 RDP:0
[12:09:21:579] [411:411] [INFO][com.freerdp.core.connection] - Accepted
client: linuxpc
[12:09:21:579] [411:411] [INFO][com.freerdp.core.connection] - Accepted
channels:
[12:09:21:580] [411:411] [INFO][com.freerdp.core.gcc] - Active rdp
encryption level: NONE
[12:09:21:580] [411:411] [INFO][com.freerdp.core.gcc] - Selected rdp
encryption method: NONE
[12:09:21.265] kbd_layout:0x409 kbd_type:0x4 kbd_subType:0x0
kbd_functionKeys:0xc
[12:09:21.265] xf_peer_activate: matching layout=us variant=(null)
[12:09:21.381] launching '/usr/libexec/weston-keyboard'
[12:09:21.772] input_method died, respawning...
[12:09:21.773] launching '/usr/libexec/weston-keyboard'
[12:09:21.812] input_method died, respawning...
[12:09:21.813] launching '/usr/libexec/weston-keyboard'
[12:09:21.853] input_method died, respawning...
[12:09:21.853] launching '/usr/libexec/weston-keyboard'
[12:09:21.894] input_method died, respawning...
[12:09:21.895] launching '/usr/libexec/weston-keyboard'
[12:09:21.935] input_method died, respawning...
[12:09:21.935] launching '/usr/libexec/weston-keyboard'


=

>From pc:
$ xfreerdp /v:192.168.0.1 /sec:tls /size:1024x768





Thanks& Regards,
B.Arun kumar.
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston] gl-renderer: Fix an invalid write when closing a Weston window

2016-11-23 Thread Dima Ryazanov
To repro, run "valgrind weston --output-count=2", and close one of the
windows. (When you close the last window, there are even more errors, so
this particular one isn't as noticeable.)

On Wed, Nov 23, 2016 at 6:41 PM, Dima Ryazanov  wrote:

> Call eglMakeCurrent before destroying the native EGL window, similar to
> what
> other sample clients are already doing.
>
> Signed-off-by: Dima Ryazanov 
> ---
>  libweston/gl-renderer.c | 4 
>  1 file changed, 4 insertions(+)
>
> diff --git a/libweston/gl-renderer.c b/libweston/gl-renderer.c
> index d08bfd0..c6091af 100644
> --- a/libweston/gl-renderer.c
> +++ b/libweston/gl-renderer.c
> @@ -2760,6 +2760,10 @@ gl_renderer_output_destroy(struct weston_output
> *output)
> for (i = 0; i < 2; i++)
> pixman_region32_fini(&go->buffer_damage[i]);
>
> +   eglMakeCurrent(gr->egl_display,
> +  EGL_NO_SURFACE, EGL_NO_SURFACE,
> +  EGL_NO_CONTEXT);
> +
> weston_platform_destroy_egl_surface(gr->egl_display,
> go->egl_surface);
>
> free(go);
> --
> 2.9.3
>
>
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH weston] gl-renderer: Fix an invalid write when closing a Weston window

2016-11-23 Thread Dima Ryazanov
Call eglMakeCurrent before destroying the native EGL window, similar to what
other sample clients are already doing.

Signed-off-by: Dima Ryazanov 
---
 libweston/gl-renderer.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/libweston/gl-renderer.c b/libweston/gl-renderer.c
index d08bfd0..c6091af 100644
--- a/libweston/gl-renderer.c
+++ b/libweston/gl-renderer.c
@@ -2760,6 +2760,10 @@ gl_renderer_output_destroy(struct weston_output *output)
for (i = 0; i < 2; i++)
pixman_region32_fini(&go->buffer_damage[i]);
 
+   eglMakeCurrent(gr->egl_display,
+  EGL_NO_SURFACE, EGL_NO_SURFACE,
+  EGL_NO_CONTEXT);
+
weston_platform_destroy_egl_surface(gr->egl_display, go->egl_surface);
 
free(go);
-- 
2.9.3

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


Re: [PATCH weston] Don't include version.h from compositor.h

2016-11-23 Thread Bryce Harrington
On Wed, Nov 23, 2016 at 06:48:42PM +, Daniel Stone wrote:
> Signed-off-by: Daniel Stone 

Nothing in compositor.h or its includes seem to need the 
version #defines from version.h, so LGTM.

Reviewed-by: Bryce Harrington 

> ---
>  libweston/compositor.h | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/libweston/compositor.h b/libweston/compositor.h
> index c78cc3b..ce3d9ab 100644
> --- a/libweston/compositor.h
> +++ b/libweston/compositor.h
> @@ -40,7 +40,6 @@ extern "C" {
>  #define WL_HIDE_DEPRECATED
>  #include 
>  
> -#include "version.h"
>  #include "matrix.h"
>  #include "config-parser.h"
>  #include "zalloc.h"
> -- 
> 2.9.3
> 
> ___
> wayland-devel mailing list
> wayland-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH weston] Don't include version.h from compositor.h

2016-11-23 Thread Daniel Stone
Signed-off-by: Daniel Stone 
---
 libweston/compositor.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/libweston/compositor.h b/libweston/compositor.h
index c78cc3b..ce3d9ab 100644
--- a/libweston/compositor.h
+++ b/libweston/compositor.h
@@ -40,7 +40,6 @@ extern "C" {
 #define WL_HIDE_DEPRECATED
 #include 
 
-#include "version.h"
 #include "matrix.h"
 #include "config-parser.h"
 #include "zalloc.h"
-- 
2.9.3

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


[PATCH v3] protocol: Define further the behavior of input on the presence of grabs

2016-11-23 Thread Carlos Garnacho
The leave events in the respective device interfaces has been further
documented so those can convey the necessary info when input is being
redirected out of their currently focused surface.

Only wl_touch is missing something semantically similar, a wl_touch.leave
event has been added so the touch interface can cope with such input
redirection situations on individual touchpoints.

Signed-off-by: Carlos Garnacho 
---

v2: Reuse leave events for this purpose. This meant one had to be added
on wl_touch.
v3: Improved wording (I hope!) largely inspired on the suggestions from
Daniel Stone. Bumped wl_seat version to 6 for wl_touch.leave.

 protocol/wayland.xml | 61 +++-
 1 file changed, 60 insertions(+), 1 deletion(-)

diff --git a/protocol/wayland.xml b/protocol/wayland.xml
index 6c6d078..16fc0b3 100644
--- a/protocol/wayland.xml
+++ b/protocol/wayland.xml
@@ -1669,7 +1669,7 @@
 

 
-  
+  
 
   A seat is a group of keyboards, pointer and touch devices. This
   object is published as a global during start up, or when such a
@@ -1859,6 +1859,23 @@
 
The leave notification is sent before the enter notification
for the new focus.
+
+   Normally, a pointer will not leave a surface while there are
+   buttons pressed, there's however circumstances where this event
+   may be received in this situation, for example:
+
+   - When a popup is shown by this or other client.
+   - When a drag-and-drop operation is initiated from this or
+ any other surface.
+   - Other compositor-specific grabs, like pointer gestures.
+
+   In these situations, a leave event will be emitted with no
+   pairing button release events on this surface, clients must undo
+   their internal state related to the ongoing button presses.
+
+   Clients must either receive a release or a leave event in a
+   timely manner, and strictly before all other input events from
+   that seat.
   
   
   
@@ -1893,6 +1910,10 @@
enter event.
 The time argument is a timestamp with millisecond
 granularity, with an undefined base.
+
+   Clients should note that pressed/released events may not be paired;
+   in some cases, a leave event will be sent in place of a released event.
+   See wl_pointer.leave for more details.
   
 
   
@@ -2136,6 +2157,17 @@
 
The leave notification is sent before the enter notification
for the new focus.
+
+   There may be circumstances that force the keyboard focus to be taken
+   away from a surface while there are pressed keys, for example:
+
+   - When a popup is shown by this or other client.
+   - When a drag-and-drop operation is initiated from this or
+ any other surface.
+
+   In these situations, a leave event will be emitted with no pairing
+   key release events on this surface, clients must undo their internal
+   state related to the ongoing key presses.
   
   
   
@@ -2154,6 +2186,10 @@
A key was pressed or released.
 The time argument is a timestamp with millisecond
 granularity, with an undefined base.
+
+   Clients should note that pressed/released events may not be paired;
+   in some cases, a leave event will be sent in place of a released event.
+   See wl_keyboard.leave for more details.
   
 
   
@@ -2238,6 +2274,10 @@
The touch point has disappeared. No further events will be sent for
this touch point and the touch point's ID is released and may be
reused in a future touch down event.
+
+   Clients should note that down/up events may not be paired;
+   in some cases, a leave event will be sent in place of a wl_touch.up
+   event. See wl_touch.leave for more details.
   
   
   
@@ -2276,6 +2316,25 @@
 
   
 
+
+
+
+
+  
+   Notification that this touch point is no longer focused on a
+   certain surface.
+
+   Note that, because touch points are always implicitly grabbed,
+   this event will only be emitted when the touch point is taken
+   away from this surface through explicit means, for example:
+
+   - When a popup is shown by this or other client.
+   - When a drag-and-drop operation is initiated from this or
+ any other surface.
+  
+  
+  
+
   
 
   
-- 
2.9.3

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


[PATCH wayland] tests: Test wl_argument_from_va_list

2016-11-23 Thread Yong Bakos
From: Yong Bakos 

connection-test.c did not cover wl_argument_from_va_list, so add one
test that specifically tests this method.

Signed-off-by: Yong Bakos 
---
 tests/connection-test.c | 35 +++
 1 file changed, 35 insertions(+)

diff --git a/tests/connection-test.c b/tests/connection-test.c
index 3e34f77..1c688f1 100644
--- a/tests/connection-test.c
+++ b/tests/connection-test.c
@@ -130,6 +130,41 @@ TEST(connection_queue)
close(s[1]);
 }
 
+static void
+va_list_wrapper(const char *signature, union wl_argument *args, int count, ...)
+{
+   va_list ap;
+   va_start(ap, count);
+   wl_argument_from_va_list(signature, args, count, ap);
+   va_end(ap);
+}
+
+TEST(argument_from_va_list)
+{
+   union wl_argument args[WL_CLOSURE_MAX_ARGS];
+   struct wl_object fake_object;
+   struct wl_array fake_array;
+
+   va_list_wrapper("i", args, 1, 100);
+   assert(args[0].i == 100);
+
+   va_list_wrapper("is", args, 2, 101, "value");
+   assert(args[0].i == 101);
+   assert(strcmp(args[1].s, "value") == 0);
+
+   va_list_wrapper("?iuf?sonah", args, 8,
+   102, 103, wl_fixed_from_int(104), "value",
+   &fake_object, 105, &fake_array, 106);
+   assert(args[0].i == 102);
+   assert(args[1].u == 103);
+   assert(args[2].f == wl_fixed_from_int(104));
+   assert(strcmp(args[3].s, "value") == 0);
+   assert(args[4].o == &fake_object);
+   assert(args[5].n == 105);
+   assert(args[6].a == &fake_array);
+   assert(args[7].h == 106);
+}
+
 struct marshal_data {
struct wl_connection *read_connection;
struct wl_connection *write_connection;
-- 
2.7.2

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


Re: [wayland-protocols v3] linux-dmabuf: advertise format modifiers with modifier event

2016-11-23 Thread Daniel Vetter
On Wed, Nov 23, 2016 at 02:39:01PM +0100, Daniel Vetter wrote:
> On Mon, Nov 21, 2016 at 07:59:51PM +, Daniel Stone wrote:
> > Hi Varad,
> > 
> > On 21 November 2016 at 10:17, Varad Gautam  wrote:
> > > advertise the supported fourcc format modifiers along with supported
> > > formats to the client.
> > >
> > > bump zwp_linux_dmabuf_v1, zwp_linux_buffer_params_v1 interface
> > > versions to 3.
> > 
> > Reviewed-by: Daniel Stone 
> > 
> > I'll wait a little while with this series to see if more review pops
> > up, and then merge it if not.
> 
> Well in upstream kernel we just nerved modifier[1-3] and require they
> match modifier[0]. Oops. Do we need to take adjustments in wayland now
> too? At elast enforcing everywhere that modifiers match is probably a good
> thing, and maybe even adjusting proto extensions and internal storage to
> only carry one?

Reply to the wrong patch. Proto looks good, but the weston implementation
should probably gain some checks to make sure modifier[1-3] == 0 or
modifier[0], and using modifier[0] for the other planes in the egl interop
stuff. Might also want to just throw away the additional modifiers from
internal structs.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [wayland-protocols v3] linux-dmabuf: advertise format modifiers with modifier event

2016-11-23 Thread Daniel Vetter
On Mon, Nov 21, 2016 at 07:59:51PM +, Daniel Stone wrote:
> Hi Varad,
> 
> On 21 November 2016 at 10:17, Varad Gautam  wrote:
> > advertise the supported fourcc format modifiers along with supported
> > formats to the client.
> >
> > bump zwp_linux_dmabuf_v1, zwp_linux_buffer_params_v1 interface
> > versions to 3.
> 
> Reviewed-by: Daniel Stone 
> 
> I'll wait a little while with this series to see if more review pops
> up, and then merge it if not.

Well in upstream kernel we just nerved modifier[1-3] and require they
match modifier[0]. Oops. Do we need to take adjustments in wayland now
too? At elast enforcing everywhere that modifiers match is probably a good
thing, and maybe even adjusting proto extensions and internal storage to
only carry one?
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston] build: fix wayland-backend distcheck

2016-11-23 Thread Peter Hutterer
On Wed, Nov 23, 2016 at 11:46:57AM +0200, Pekka Paalanen wrote:
> From: Pekka Paalanen 
> 
> Fix the following error from 'make distcheck':
> 
>   CC   libweston/wayland_backend_la-compositor-wayland.lo
> ../../libweston/compositor-wayland.c:54:51: fatal error: 
> xdg-shell-unstable-v6-client-protocol.h: No such file or directory
>  #include "xdg-shell-unstable-v6-client-protocol.h"
> 
> Files generated with the scanner belong in nodist_*_SOURCES, not with
> the regular sources.
> 
> Signed-off-by: Pekka Paalanen 

Reviewed-by: Peter Hutterer 

Cheers,
   Peter
> ---
>  Makefile.am | 10 +-
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/Makefile.am b/Makefile.am
> index b90c4c8..b7eefd8 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -394,12 +394,12 @@ wayland_backend_la_CFLAGS = \
>  wayland_backend_la_SOURCES = \
>   libweston/compositor-wayland.c  \
>   libweston/compositor-wayland.h  \
> - protocol/xdg-shell-unstable-v6-protocol.c   \
> - protocol/xdg-shell-unstable-v6-client-protocol.h\
>   shared/helpers.h
> -nodist_wayland_backend_la_SOURCES =  \
> - protocol/fullscreen-shell-unstable-v1-protocol.c\
> - protocol/fullscreen-shell-unstable-v1-client-protocol.h
> +nodist_wayland_backend_la_SOURCES =  \
> + protocol/fullscreen-shell-unstable-v1-protocol.c\
> + protocol/fullscreen-shell-unstable-v1-client-protocol.h \
> + protocol/xdg-shell-unstable-v6-protocol.c   \
> + protocol/xdg-shell-unstable-v6-client-protocol.h
>  endif
>  
>  if ENABLE_HEADLESS_COMPOSITOR
> -- 
> 2.7.3
> 
> ___
> wayland-devel mailing list
> wayland-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/wayland-devel
> 
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston] build: fix wayland-backend distcheck

2016-11-23 Thread Daniel Stone
Hi Pekka,

On 23 November 2016 at 09:46, Pekka Paalanen  wrote:
> Fix the following error from 'make distcheck':
>
>   CC   libweston/wayland_backend_la-compositor-wayland.lo
> ../../libweston/compositor-wayland.c:54:51: fatal error: 
> xdg-shell-unstable-v6-client-protocol.h: No such file or directory
>  #include "xdg-shell-unstable-v6-client-protocol.h"
>
> Files generated with the scanner belong in nodist_*_SOURCES, not with
> the regular sources.

Does what it says on the box; pushed with review.

To ssh://git.freedesktop.org/git/wayland/weston
   2b685d9..9983400  push -> master

Cheers,
Daniel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston] tests: Extend subsurface place_{above, below} hierarchy

2016-11-23 Thread Daniel Stone
Hi,

On 23 November 2016 at 10:15, Pekka Paalanen
 wrote:
> On Tue, 22 Nov 2016 12:42:45 + Daniel Stone  wrote:
>> Following on from b8c16c995b, extend the family tree being tested by
>> place_above and place_below a little, ensuring that subsurfaces can't be
>> placed above or below surfaces which are related to them, but aren't
>> their immediate parent or sibling.
>
> Reviewed-by: Pekka Paalanen 
>
> Otherwise I would've pushed already, except for the unrelated distcheck
> failure I just sent a patch for.

Ah yes, the same one I was just marking as reviewed and about to push
when this mail came through. ;) Pushed with another distcheck run to
be very sure, thanks!

To ssh://git.freedesktop.org/git/wayland/weston
   2b685d9..9983400  push -> master

Cheers,
Daniel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston] tests: Extend subsurface place_{above, below} hierarchy

2016-11-23 Thread Pekka Paalanen
On Tue, 22 Nov 2016 12:42:45 +
Daniel Stone  wrote:

> Following on from b8c16c995b, extend the family tree being tested by
> place_above and place_below a little, ensuring that subsurfaces can't be
> placed above or below surfaces which are related to them, but aren't
> their immediate parent or sibling.
> 
> Signed-off-by: Daniel Stone 
> Cc: Arnaud Vrac 
> Cc: Pekka Paalanen 
> ---
>  tests/subsurface-test.c | 142 
> 
>  1 file changed, 142 insertions(+)

Hi,

Reviewed-by: Pekka Paalanen 

Otherwise I would've pushed already, except for the unrelated distcheck
failure I just sent a patch for.


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


Re: [PATCH wayland] doc: Remove display of WL_PRINTF attribute

2016-11-23 Thread Daniel Stone
Hi Peter, Yong,

On 23 November 2016 at 00:39, Peter Hutterer  wrote:
> On Tue, Nov 22, 2016 at 08:13:43AM -0800, Yong Bakos wrote:
>> Doxygen truncates a WL_PRINTF function attribute, and there does not
>> seem to be any workaround[1]. When using the attribute like this:
>>
>> typedef void (*wl_log_func_t)(const char *, va_list) WL_PRINTF(1, 0);
>>
>> Doxygen generates something that looks like this:
>>
>> typedef void (*wl_log_func_t)(const char *, va_list) WL_PRINTF(1,
>>
>> Configure doxygen to consider WL_PRINTF(x,y) as predefined, so it does
>> not display the attribute at all in the generated documentation.
>
> Reviewed-by: Peter Hutterer 

Pushed, thanks both:
To ssh://git.freedesktop.org/git/wayland/wayland
   c9f6454..20742b7  master -> master

Cheers,
Daniel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH weston] build: fix wayland-backend distcheck

2016-11-23 Thread Pekka Paalanen
From: Pekka Paalanen 

Fix the following error from 'make distcheck':

  CC   libweston/wayland_backend_la-compositor-wayland.lo
../../libweston/compositor-wayland.c:54:51: fatal error: 
xdg-shell-unstable-v6-client-protocol.h: No such file or directory
 #include "xdg-shell-unstable-v6-client-protocol.h"

Files generated with the scanner belong in nodist_*_SOURCES, not with
the regular sources.

Signed-off-by: Pekka Paalanen 
---
 Makefile.am | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index b90c4c8..b7eefd8 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -394,12 +394,12 @@ wayland_backend_la_CFLAGS =   \
 wayland_backend_la_SOURCES =   \
libweston/compositor-wayland.c  \
libweston/compositor-wayland.h  \
-   protocol/xdg-shell-unstable-v6-protocol.c   \
-   protocol/xdg-shell-unstable-v6-client-protocol.h\
shared/helpers.h
-nodist_wayland_backend_la_SOURCES =\
-   protocol/fullscreen-shell-unstable-v1-protocol.c\
-   protocol/fullscreen-shell-unstable-v1-client-protocol.h
+nodist_wayland_backend_la_SOURCES =\
+   protocol/fullscreen-shell-unstable-v1-protocol.c\
+   protocol/fullscreen-shell-unstable-v1-client-protocol.h \
+   protocol/xdg-shell-unstable-v6-protocol.c   \
+   protocol/xdg-shell-unstable-v6-client-protocol.h
 endif
 
 if ENABLE_HEADLESS_COMPOSITOR
-- 
2.7.3

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


[PATCH v2] gl-renderer: support format and modifier queries

2016-11-23 Thread Varad Gautam
From: Varad Gautam 

EGL_EXT_image_dma_buf_import_modifiers allows querying the formats
and modifiers supported by the platform. expose these to the compositor.

v2:
 - change calloc args (Daniel Stone)
 - check for modifier support before querying formats (Daniel Stone)

Signed-off-by: Varad Gautam 
Reviewed-by: Daniel Stone 
---
 libweston/compositor.h |  7 
 libweston/gl-renderer.c| 85 +-
 libweston/weston-egl-ext.h |  7 
 3 files changed, 98 insertions(+), 1 deletion(-)

diff --git a/libweston/compositor.h b/libweston/compositor.h
index e00d285..a2848fb 100644
--- a/libweston/compositor.h
+++ b/libweston/compositor.h
@@ -675,6 +675,13 @@ struct weston_renderer {
/** See weston_compositor_import_dmabuf() */
bool (*import_dmabuf)(struct weston_compositor *ec,
  struct linux_dmabuf_buffer *buffer);
+
+   bool (*query_dmabuf_formats)(struct weston_compositor *ec,
+   int **formats, int *num_formats);
+
+   bool (*query_dmabuf_modifiers)(struct weston_compositor *ec,
+   int format, uint64_t **modifiers,
+   int *num_modifiers);
 };
 
 enum weston_capability {
diff --git a/libweston/gl-renderer.c b/libweston/gl-renderer.c
index 2f46373..77ae1a1 100644
--- a/libweston/gl-renderer.c
+++ b/libweston/gl-renderer.c
@@ -226,6 +226,10 @@ struct gl_renderer {
struct wl_signal destroy_signal;
 
struct wl_listener output_destroy_listener;
+
+   int has_dmabuf_import_modifiers;
+   PFNEGLQUERYDMABUFFORMATSEXTPROC query_dmabuf_formats;
+   PFNEGLQUERYDMABUFMODIFIERSEXTPROC query_dmabuf_modifiers;
 };
 
 static PFNEGLGETPLATFORMDISPLAYEXTPROC get_platform_display = NULL;
@@ -1847,6 +1851,70 @@ import_dmabuf(struct gl_renderer *gr,
 }
 
 static bool
+gl_renderer_query_dmabuf_formats(struct weston_compositor *wc,
+   int **formats, int *num_formats)
+{
+   struct gl_renderer *gr = get_renderer(wc);
+   EGLint num;
+
+   assert(gr->has_dmabuf_import);
+
+   if (!gr->has_dmabuf_import_modifiers ||
+   !gr->query_dmabuf_formats(gr->egl_display, 0, NULL, &num)) {
+   *num_formats = 0;
+   return false;
+   }
+
+   *formats = calloc(num, sizeof(int));
+   if (*formats == NULL) {
+   *num_formats = 0;
+   return false;
+   }
+   if (!gr->query_dmabuf_formats(gr->egl_display, num, *formats,
+   (EGLint*) &num)) {
+   *num_formats = 0;
+   free(*formats);
+   return false;
+   }
+
+   *num_formats = num;
+   return true;
+}
+
+static bool
+gl_renderer_query_dmabuf_modifiers(struct weston_compositor *wc, int format,
+   uint64_t **modifiers,
+   int *num_modifiers)
+{
+   struct gl_renderer *gr = get_renderer(wc);
+   int num;
+
+   assert(gr->has_dmabuf_import);
+
+   if (!gr->has_dmabuf_import_modifiers ||
+   !gr->query_dmabuf_modifiers(gr->egl_display, format, 0, NULL,
+   NULL, &num)) {
+   *num_modifiers = 0;
+   return false;
+   }
+
+   *modifiers = calloc(num, sizeof(uint64_t));
+   if (*modifiers == NULL) {
+   *num_modifiers = 0;
+   return false;
+   }
+   if (!gr->query_dmabuf_modifiers(gr->egl_display, format,
+   num, *modifiers, NULL, &num)) {
+   *num_modifiers = 0;
+   free(*modifiers);
+   return false;
+   }
+
+   *num_modifiers = num;
+   return true;
+}
+
+static bool
 gl_renderer_import_dmabuf(struct weston_compositor *ec,
  struct linux_dmabuf_buffer *dmabuf)
 {
@@ -2818,6 +2886,7 @@ gl_renderer_setup_egl_extensions(struct weston_compositor 
*ec)
 
gr->create_image = (void *) eglGetProcAddress("eglCreateImageKHR");
gr->destroy_image = (void *) eglGetProcAddress("eglDestroyImageKHR");
+
gr->bind_display =
(void *) eglGetProcAddress("eglBindWaylandDisplayWL");
gr->unbind_display =
@@ -2863,6 +2932,15 @@ gl_renderer_setup_egl_extensions(struct 
weston_compositor *ec)
if (weston_check_egl_extension(extensions, 
"EGL_EXT_image_dma_buf_import"))
gr->has_dmabuf_import = 1;
 
+   if (weston_check_egl_extension(extensions,
+   "EGL_EXT_image_dma_buf_import_modifiers")) {
+   gr->query_dmabuf_formats =
+   (void *) eglGetProcAddress("eglQueryDmaBufFormatsEXT");
+   gr->query_dmabuf_modifiers =
+   (void *) 
eglGetProcAddress("eglQueryDmaBufModifiersEXT");
+   gr->has_dmabuf_import_modifiers = 1;
+   }
+
if (weston_check_eg

[PATCH v2] gl-renderer: allow importing fourth dmabuf plane

2016-11-23 Thread Varad Gautam
From: Varad Gautam 

EGL_EXT_image_dma_buf_import_modifiers supports importing upto four dmabuf
planes into an EGLImage.

v2: correct PLANE3_PITCH token (Daniel Stone)

Signed-off-by: Varad Gautam 
Reviewed-by: Daniel Stone 
---
 libweston/gl-renderer.c| 17 -
 libweston/weston-egl-ext.h |  5 +
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/libweston/gl-renderer.c b/libweston/gl-renderer.c
index a70f73c..98442f1 100644
--- a/libweston/gl-renderer.c
+++ b/libweston/gl-renderer.c
@@ -1558,7 +1558,7 @@ import_simple_dmabuf(struct gl_renderer *gr,
  struct dmabuf_attributes *attributes)
 {
struct egl_image *image;
-   EGLint attribs[40];
+   EGLint attribs[50];
int atti = 0;
 
/* This requires the Mesa commit in
@@ -1621,6 +1621,21 @@ import_simple_dmabuf(struct gl_renderer *gr,
}
}
 
+   if (gr->has_dmabuf_import_modifiers) {
+   if (attributes->n_planes > 3) {
+   attribs[atti++] = EGL_DMA_BUF_PLANE3_FD_EXT;
+   attribs[atti++] = attributes->fd[3];
+   attribs[atti++] = EGL_DMA_BUF_PLANE3_OFFSET_EXT;
+   attribs[atti++] = attributes->offset[3];
+   attribs[atti++] = EGL_DMA_BUF_PLANE3_PITCH_EXT;
+   attribs[atti++] = attributes->stride[3];
+   attribs[atti++] = EGL_DMA_BUF_PLANE3_MODIFIER_LO_EXT;
+   attribs[atti++] = attributes->modifier[3] & 0x;
+   attribs[atti++] = EGL_DMA_BUF_PLANE3_MODIFIER_HI_EXT;
+   attribs[atti++] = attributes->modifier[3] >> 32;
+   }
+   }
+
attribs[atti++] = EGL_NONE;
 
image = egl_image_create(gr, EGL_LINUX_DMA_BUF_EXT, NULL,
diff --git a/libweston/weston-egl-ext.h b/libweston/weston-egl-ext.h
index 05eca31..ffea438 100644
--- a/libweston/weston-egl-ext.h
+++ b/libweston/weston-egl-ext.h
@@ -128,12 +128,17 @@ typedef struct wl_buffer * (EGLAPIENTRYP 
PFNEGLCREATEWAYLANDBUFFERFROMIMAGEWL) (
 /* Define tokens from EGL_EXT_image_dma_buf_import_modifiers */
 #ifndef EGL_EXT_image_dma_buf_import_modifiers
 #define EGL_EXT_image_dma_buf_import_modifiers 1
+#define EGL_DMA_BUF_PLANE3_FD_EXT 0x3440
+#define EGL_DMA_BUF_PLANE3_OFFSET_EXT 0x3441
+#define EGL_DMA_BUF_PLANE3_PITCH_EXT  0x3442
 #define EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT 0x3443
 #define EGL_DMA_BUF_PLANE0_MODIFIER_HI_EXT 0x3444
 #define EGL_DMA_BUF_PLANE1_MODIFIER_LO_EXT 0x3445
 #define EGL_DMA_BUF_PLANE1_MODIFIER_HI_EXT 0x3446
 #define EGL_DMA_BUF_PLANE2_MODIFIER_LO_EXT 0x3447
 #define EGL_DMA_BUF_PLANE2_MODIFIER_HI_EXT 0x3448
+#define EGL_DMA_BUF_PLANE3_MODIFIER_LO_EXT 0x3449
+#define EGL_DMA_BUF_PLANE3_MODIFIER_HI_EXT 0x344A
 typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDMABUFFORMATSEXTPROC) (EGLDisplay 
dpy, EGLint max_formats, EGLint *formats, EGLint *num_formats);
 typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDMABUFMODIFIERSEXTPROC) 
(EGLDisplay dpy, EGLint format, EGLint max_modifiers, EGLuint64KHR *modifiers, 
EGLBoolean *external_only, EGLint *num_modifiers);
 #endif
-- 
2.6.2

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


[PATCH v2] clients/simple-dmabuf-drm: import with dmabuf modifiers

2016-11-23 Thread Varad Gautam
From: Varad Gautam 

mesa's freedreno driver supports importing dmabufs with format
DRM_FORMAT_NV12 and DRM_FORMAT_MOD_SAMSUNG_64_32_TILE modifier.
demonstrate weston modifier advertising and import path using this
combination when run with --import-format=NV12.

v2:
 - hard code format if platform doesn't implement
   EGL_EXT_image_dma_buf_import_modifiers and cannot advertise
   format/modifier support.
 - squash using valid frame data to fill dmabuf planes

Signed-off-by: Varad Gautam 
---
 Makefile.am |   4 +-
 clients/simple-dmabuf-drm.c | 185 +++-
 configure.ac|   2 +-
 3 files changed, 153 insertions(+), 38 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 3b58e29..7d4fad9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -584,7 +584,9 @@ endif
 
 if BUILD_SIMPLE_DMABUF_DRM_CLIENT
 demo_clients += weston-simple-dmabuf-drm
-weston_simple_dmabuf_drm_SOURCES = clients/simple-dmabuf-drm.c
+weston_simple_dmabuf_drm_SOURCES = \
+   clients/simple-dmabuf-drm.c \
+   clients/simple-dmabuf-drm-data.h
 nodist_weston_simple_dmabuf_drm_SOURCES =  \
protocol/xdg-shell-unstable-v6-protocol.c   \
protocol/xdg-shell-unstable-v6-client-protocol.h\
diff --git a/clients/simple-dmabuf-drm.c b/clients/simple-dmabuf-drm.c
index 7cf0208..4934af2 100644
--- a/clients/simple-dmabuf-drm.c
+++ b/clients/simple-dmabuf-drm.c
@@ -23,6 +23,7 @@
  */
 
 #include "config.h"
+#include "simple-dmabuf-drm-data.h"
 
 #include 
 #include 
@@ -47,10 +48,12 @@
 
 #include 
 #include "shared/zalloc.h"
+#include "shared/platform.h"
 #include "xdg-shell-unstable-v6-client-protocol.h"
 #include "fullscreen-shell-unstable-v1-client-protocol.h"
 #include "linux-dmabuf-unstable-v1-client-protocol.h"
 
+extern const unsigned nv12_tiled[];
 struct buffer;
 
 struct display {
@@ -61,7 +64,10 @@ struct display {
struct zwp_fullscreen_shell_v1 *fshell;
struct zwp_linux_dmabuf_v1 *dmabuf;
int xrgb_format_found;
+   int nv12_format_found;
+   int nv12_modifier_found;
int req_dmabuf_immediate;
+   int req_dmabuf_modifiers;
 };
 
 struct drm_device {
@@ -98,6 +104,7 @@ struct buffer {
int height;
int bpp;
unsigned long stride;
+   int format;
 };
 
 #define NUM_BUFFERS 3
@@ -246,11 +253,19 @@ fill_content(struct buffer *my_buf)
 
assert(my_buf->mmap);
 
-   for (y = 0; y < my_buf->height; y++) {
-   pix = (uint32_t *)(my_buf->mmap + y * my_buf->stride);
-   for (x = 0; x < my_buf->width; x++) {
-   *pix++ = (0xff << 24) | ((x % 256) << 16) |
-((y % 256) << 8) | 0xf0;
+   if (my_buf->format == DRM_FORMAT_NV12) {
+   pix = (uint32_t *) my_buf->mmap;
+   for (y = 0; y < my_buf->height; y++)
+   memcpy(&pix[y * my_buf->width / 4],
+  &nv12_tiled[my_buf->width * y / 4],
+  my_buf->width);
+   }
+   else {
+   for (y = 0; y < my_buf->height; y++) {
+   pix = (uint32_t *)(my_buf->mmap + y * my_buf->stride);
+   for (x = 0; x < my_buf->width; x++)
+   *pix++ = (0xff << 24) | ((x % 256) << 16) |
+((y % 256) << 8) | 0xf0;
}
}
 }
@@ -382,10 +397,10 @@ static const struct zwp_linux_buffer_params_v1_listener 
params_listener = {
 
 static int
 create_dmabuf_buffer(struct display *display, struct buffer *buffer,
-int width, int height)
+int width, int height, int format)
 {
struct zwp_linux_buffer_params_v1 *params;
-   uint64_t modifier;
+   uint64_t modifier = 0;
uint32_t flags;
struct drm_device *drm_dev;
 
@@ -396,8 +411,18 @@ create_dmabuf_buffer(struct display *display, struct 
buffer *buffer,
drm_dev = buffer->dev;
 
buffer->width = width;
-   buffer->height = height;
-   buffer->bpp = 32; /* hardcoded XRGB format */
+   switch (format) {
+   case DRM_FORMAT_NV12:
+   /* adjust height for allocation of NV12 Y and UV planes */
+   buffer->height = height * 3 / 2;
+   buffer->bpp = 8;
+   modifier = DRM_FORMAT_MOD_SAMSUNG_64_32_TILE;
+   break;
+   default:
+   buffer->height = height;
+   buffer->bpp = 32;
+   }
+   buffer->format = format;
 
if (!drm_dev->alloc_bo(buffer)) {
fprintf(stderr, "alloc_bo failed\n");
@@ -420,10 +445,13 @@ create_dmabuf_buffer(struct display *display, struct 
buffer *buffer,
goto error2;
}
 
-   /* We now have a dmabuf! It should contain 2x2 tiles (i.e. each tile
-* is 256x256) of misc colours

[PATCH v2] gl-renderer: allow importing dmabufs with format modifiers

2016-11-23 Thread Varad Gautam
From: Varad Gautam 

pass over the modifier attributes to EGL.

v2: ensure same modifier is passed for all planes (Daniel Stone)

Signed-off-by: Varad Gautam 
---
 libweston/gl-renderer.c| 29 ++---
 libweston/weston-egl-ext.h |  6 ++
 2 files changed, 32 insertions(+), 3 deletions(-)

diff --git a/libweston/gl-renderer.c b/libweston/gl-renderer.c
index 77ae1a1..a70f73c 100644
--- a/libweston/gl-renderer.c
+++ b/libweston/gl-renderer.c
@@ -1558,7 +1558,7 @@ import_simple_dmabuf(struct gl_renderer *gr,
  struct dmabuf_attributes *attributes)
 {
struct egl_image *image;
-   EGLint attribs[30];
+   EGLint attribs[40];
int atti = 0;
 
/* This requires the Mesa commit in
@@ -1575,7 +1575,6 @@ import_simple_dmabuf(struct gl_renderer *gr,
attribs[atti++] = attributes->height;
attribs[atti++] = EGL_LINUX_DRM_FOURCC_EXT;
attribs[atti++] = attributes->format;
-   /* XXX: Add modifier here when supported */
 
if (attributes->n_planes > 0) {
attribs[atti++] = EGL_DMA_BUF_PLANE0_FD_EXT;
@@ -1584,6 +1583,12 @@ import_simple_dmabuf(struct gl_renderer *gr,
attribs[atti++] = attributes->offset[0];
attribs[atti++] = EGL_DMA_BUF_PLANE0_PITCH_EXT;
attribs[atti++] = attributes->stride[0];
+   if (gr->has_dmabuf_import_modifiers) {
+   attribs[atti++] = EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT;
+   attribs[atti++] = attributes->modifier[0] & 0x;
+   attribs[atti++] = EGL_DMA_BUF_PLANE0_MODIFIER_HI_EXT;
+   attribs[atti++] = attributes->modifier[0] >> 32;
+   }
}
 
if (attributes->n_planes > 1) {
@@ -1593,6 +1598,12 @@ import_simple_dmabuf(struct gl_renderer *gr,
attribs[atti++] = attributes->offset[1];
attribs[atti++] = EGL_DMA_BUF_PLANE1_PITCH_EXT;
attribs[atti++] = attributes->stride[1];
+   if (gr->has_dmabuf_import_modifiers) {
+   attribs[atti++] = EGL_DMA_BUF_PLANE1_MODIFIER_LO_EXT;
+   attribs[atti++] = attributes->modifier[1] & 0x;
+   attribs[atti++] = EGL_DMA_BUF_PLANE1_MODIFIER_HI_EXT;
+   attribs[atti++] = attributes->modifier[1] >> 32;
+   }
}
 
if (attributes->n_planes > 2) {
@@ -1602,6 +1613,12 @@ import_simple_dmabuf(struct gl_renderer *gr,
attribs[atti++] = attributes->offset[2];
attribs[atti++] = EGL_DMA_BUF_PLANE2_PITCH_EXT;
attribs[atti++] = attributes->stride[2];
+   if (gr->has_dmabuf_import_modifiers) {
+   attribs[atti++] = EGL_DMA_BUF_PLANE2_MODIFIER_LO_EXT;
+   attribs[atti++] = attributes->modifier[2] & 0x;
+   attribs[atti++] = EGL_DMA_BUF_PLANE2_MODIFIER_HI_EXT;
+   attribs[atti++] = attributes->modifier[2] >> 32;
+   }
}
 
attribs[atti++] = EGL_NONE;
@@ -1925,8 +1942,14 @@ gl_renderer_import_dmabuf(struct weston_compositor *ec,
assert(gr->has_dmabuf_import);
 
for (i = 0; i < dmabuf->attributes.n_planes; i++) {
-   /* EGL import does not have modifiers */
+   /* return if EGL doesn't support import modifiers */
if (dmabuf->attributes.modifier[i] != 0)
+   if (!gr->has_dmabuf_import_modifiers)
+   return false;
+
+   /* return if modifiers passed are unequal */
+   if (dmabuf->attributes.modifier[i] !=
+   dmabuf->attributes.modifier[0])
return false;
}
 
diff --git a/libweston/weston-egl-ext.h b/libweston/weston-egl-ext.h
index c7a3430..05eca31 100644
--- a/libweston/weston-egl-ext.h
+++ b/libweston/weston-egl-ext.h
@@ -128,6 +128,12 @@ typedef struct wl_buffer * (EGLAPIENTRYP 
PFNEGLCREATEWAYLANDBUFFERFROMIMAGEWL) (
 /* Define tokens from EGL_EXT_image_dma_buf_import_modifiers */
 #ifndef EGL_EXT_image_dma_buf_import_modifiers
 #define EGL_EXT_image_dma_buf_import_modifiers 1
+#define EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT 0x3443
+#define EGL_DMA_BUF_PLANE0_MODIFIER_HI_EXT 0x3444
+#define EGL_DMA_BUF_PLANE1_MODIFIER_LO_EXT 0x3445
+#define EGL_DMA_BUF_PLANE1_MODIFIER_HI_EXT 0x3446
+#define EGL_DMA_BUF_PLANE2_MODIFIER_LO_EXT 0x3447
+#define EGL_DMA_BUF_PLANE2_MODIFIER_HI_EXT 0x3448
 typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDMABUFFORMATSEXTPROC) (EGLDisplay 
dpy, EGLint max_formats, EGLint *formats, EGLint *num_formats);
 typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDMABUFMODIFIERSEXTPROC) 
(EGLDisplay dpy, EGLint format, EGLint max_modifiers, EGLuint64KHR *modifiers, 
EGLBoolean *external_only, EGLint *num_modifiers);
 #endif
-- 
2.6.2

___

Re: [PATCH wayland v2 3/3] tests: add scanner tests

2016-11-23 Thread Pekka Paalanen
On Tue, 22 Nov 2016 07:46:16 -0800
Yong Bakos  wrote:

> Hi Pekka,
> 
> > On Nov 16, 2016, at 3:38 AM, Pekka Paalanen  wrote:
> > 
> > From: Pekka Paalanen 
> > 
> > Add tests that ensure that wayland-scanner output for a given input does
> > not change unexpectedly. This makes it very easy to review
> > wayland-scanner patches.
> > 
> > Before, when patches were proposed for wayland-scanner, I had to
> > build wayland without the patches, save the generated files into a
> > temporary directory, apply the patches, build again, and diff the old
> > vs. new generated file.
> > 
> > No more. Now whenever someone makes intentional changes to
> > wayland-scanner's output, he will also have to patch the example output
> > files to match. That means that reviewers see the diff of the generated
> > files straight from the patch itself. Verifying the diff is true is as
> > easy as 'make check'.
> > 
> > The tests use separate example XML files instead of wayland.xml
> > directly, so that wayland.xml can be updated without fixing scanner
> > tests, avoiding the churn.
> > 
> > example.xml starts as a copy of wayland.xml. If wayland.xml starts using
> > new wayland-scanner features, they should be copied into example.xml
> > again to be covered by the tests.
> > 
> > This patch relies on the previous patch to actually add all the data
> > files for input and reference output.
> > 
> > The scanner output is fed through sed to remove parts that are allowed
> > to vary: the scanner version string.
> > 
> > v2: no need for scanner-test.sh to depend on the test data
> > 
> > Task: https://phabricator.freedesktop.org/T3313
> > Cc: Emilio Pozuelo Monfort 
> > Cc: Yong Bakos 
> > Signed-off-by: Pekka Paalanen   
> 
> This is an awesome addition to the tests for scanner. I modified different
> aspects of the scanner output and the expected workflow of needing to
> also change the corresponding tests/data files seems to work well. I could
> not find any issues with this, so, from where I sit, this is:
> 
> Reviewed-by: Yong Bakos 
> Tested-by: Yong Bakos 
> 
> Thank you,
> yong
> 
> 
> > ---
> > .gitignore|  1 +
> > Makefile.am   | 29 -
> > tests/scanner-test.sh | 51 
> > +++
> > 3 files changed, 80 insertions(+), 1 deletion(-)
> > create mode 100755 tests/scanner-test.sh

Hi,

both patches pushed:
   0242007..c9f6454  master -> master

Yong, I added your Acked-by to the data set patch, since I wasn't sure
if you meant R-b for that too or not, and going through all the data
would be quite much anyway. I hope that's ok. I also added a mention of
which Wayland revision the wayland.xml->example.xml is from, since
wayland.xml has changed already.


Thanks,
pq


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