[PATCH weston] Add a missing error check to weston_wm_handle_icon

2018-03-16 Thread Dima Ryazanov
This fixes a crash when launching Duke Nukem Forever.
(Sorry, I wish I had a less ridiculous test case...)

Signed-off-by: Dima Ryazanov 
---
 xwayland/window-manager.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/xwayland/window-manager.c b/xwayland/window-manager.c
index c307e199..e9c60c1e 100644
--- a/xwayland/window-manager.c
+++ b/xwayland/window-manager.c
@@ -1368,6 +1368,9 @@ weston_wm_handle_icon(struct weston_wm *wm, struct 
weston_wm_window *window)
  wm->atom.net_wm_icon, XCB_ATOM_ANY, 0,
  UINT32_MAX);
reply = xcb_get_property_reply(wm->conn, cookie, NULL);
+   if (!reply)
+   return;
+
length = xcb_get_property_value_length(reply);
 
/* This is in 32-bit words, not in bytes. */
-- 
2.14.3

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


Re: [PATCH v2] xwm: Update input region on resize

2018-03-16 Thread Scott Moreau
Hi Pekka,

On Fri, Mar 16, 2018 at 9:20 AM, Pekka Paalanen  wrote:

> On Tue, 13 Mar 2018 21:22:04 -0600
> Scott Moreau  wrote:
>
> > Commit 332d1892 introduced a bug because the window was
> > shaped only when the frame was created, leaving the input
> > region unchanged regardless if the window was resized.
> > This patch updates the input region shape on resize,
> > fixing the problem.
> >
> > ---
> >
> > Changed in v2:
> >
> > - Bail in shape function if (window->override_redirect || !window->frame)
> > - Call shape function from send_configure()
> >
> >  xwayland/window-manager.c | 53 +-
> -
> >  1 file changed, 33 insertions(+), 20 deletions(-)
>
> Hi,
>
> while trying to wrap my head around this, I started feeling dizzy. For
> real. So I have to keep this short.
>

I think this is what happens when trying to sync two display servers.


>
> The first decision we should make is, do we want a quick patch for an
> immediate issue at hand, or do we want to make things better in the long
> run. Taking in this patch as is seems to be the former to me, and given
> the phase of the release cycle can be justified.
>
> The following mind flow is for a long term solution, and the comments
> inlined with the code below are for the quick patch.
>
>
> Taking a step back, the aim to keep the input shape up-to-date whenever
> something happens.
>
> If we have a frame window with decorations, then we call
> frame_resize_inside() to adjust its size. Would it not be logical to
> set the input shape in at least all those cases?
>

Yes, maybe there can be a function that calls frame_resize_inside and the
shape function to replace calls to frame_resize_inside.


>
> Except it looks like we can have decorated O-R windows, and those
> should be exempt? Oh, I'm told decorated O-R windows don't make sense,
> but I see some code in weston that would only apply in such case...
> if (window->override_redirect) { ... if (window->frame)
> frame_resize_inside(...)
>
> All windows that go through map_request handler will get the frame
> window (window->frame_id) and the frame (window->frame) created. The
> only windows that don't get this treatment are therefore windows that
> are O-R at the time of mapping them. It's somewhat complicated by the
> fact that XWM does not support dynamically changing O-R flag... or
> maybe it makes it easier.
>
> Now, we have configure_request and configure_notify handlers. O-R
> windows will not hit configure_request handler, and the X server
> processes XWM's configure commands immediately. This sounds like
> configure_request handler would be a good place to update the input
> shape.
>

Yes

>
> configure_notify handler gets called for O-R as well, and it happens
> after the fact, so updating there would be a tiny bit late. Would you
> agree?
>
I was thinking there might be some change that comes in configure notify
that we don't know about until the event happens.

>
> That leaves the XWM originated resizes, which boils down to...
> send_configure(), or actually weston_wm_window_configure()?
>
Yes

>
> It looks like configure_request handler is open-coding all of
> weston_wm_window_configure() but it also adds some bits specific to the
> configure request.
>
> Am I making sense?
>
Yes, and thanks for taking the time to try and help unravel this.


>
> > diff --git a/xwayland/window-manager.c b/xwayland/window-manager.c
> > index c307e19..cd72a59 100644
> > --- a/xwayland/window-manager.c
> > +++ b/xwayland/window-manager.c
> > @@ -659,6 +659,33 @@ weston_wm_window_get_input_rect(struct
> weston_wm_window *window,
> >  }
> >
> >  static void
> > +weston_wm_window_shape(struct weston_wm_window *window)
> > +{
> > + struct weston_wm *wm = window->wm;
> > + xcb_rectangle_t rect;
> > + int x, y, width, height;
> > +
> > + if (window->override_redirect || !window->frame)
> > + return;
> > +
> > + weston_wm_window_get_input_rect(window, , , , );
> > +
> > + rect.x = x;
> > + rect.y = y;
> > + rect.width = width;
> > + rect.height = height;
> > +
> > + /* The window frame was created with position and size which
> include
> > +  * an offset for margins and shadow. Set the input region to ignore
> > +  * shadow. */
> > + xcb_shape_rectangles(wm->conn,
> > +  XCB_SHAPE_SO_SET,
> > +  XCB_SHAPE_SK_INPUT,
> > +  0, window->frame_id,
> > +  0, 0, 1, );
> > +}
> > +
> > +static void
> >  weston_wm_window_send_configure_notify(struct weston_wm_window *window)
> >  {
> >   xcb_configure_notify_event_t configure_notify;
> > @@ -789,6 +816,8 @@ weston_wm_handle_configure_notify(struct weston_wm
> *wm, xcb_generic_event_t *eve
> >   xwayland_api->set_xwayland(window->shsurf,
> >  window->x, window->y);
> > 

[PATCH weston 0/3] Allow simple-dmabuf-drm to pass y_inverted flag and cleanups

2018-03-16 Thread Guido Günther
Changes from v2

 - Explain OPT_* usage
 - Switch is_immediate to OPT_*
 - use getopt_long

Changes from v1

 - introduce opts as a bitmask of features that can be used to
   manipulate the displayed image

Guido Günther (3):
  Allow simple-dmabuf-drm to pass y_inverted flag
  simple-dmabuf-drm: use opt bitmask instead of is_immediate
  simple-dmabuf-drm: use getopt_long

 clients/simple-dmabuf-drm.c | 76 -
 1 file changed, 47 insertions(+), 29 deletions(-)

-- 
2.16.1

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


[PATCH weston v3 3/3] simple-dmabuf-drm: use getopt_long

2018-03-16 Thread Guido Günther
Signed-off-by: Guido Günther 
---
 clients/simple-dmabuf-drm.c | 51 -
 1 file changed, 27 insertions(+), 24 deletions(-)

diff --git a/clients/simple-dmabuf-drm.c b/clients/simple-dmabuf-drm.c
index 427597ab..4f26e4a9 100644
--- a/clients/simple-dmabuf-drm.c
+++ b/clients/simple-dmabuf-drm.c
@@ -38,6 +38,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -877,30 +878,32 @@ main(int argc, char **argv)
struct window *window;
int opts = 0;
int import_format = DRM_FORMAT_XRGB;
-   int ret = 0, i = 0;
-
-   if (argc > 1) {
-   static const char import_mode[] = "--import-immediate=";
-   static const char format[] = "--import-format=";
-   static const char y_inverted[] = "--y-inverted=";
-   for (i = 1; i < argc; i++) {
-   if (!strncmp(argv[i], import_mode,
-sizeof(import_mode) - 1)) {
-   if (is_true(argv[i] + sizeof(import_mode) - 1))
-   opts |= OPT_IMMEDIATE;
-   }
-   else if (!strncmp(argv[i], format, sizeof(format) - 1)) 
{
-   import_format = parse_import_format(argv[i]
-   + sizeof(format) - 1);
-   }
-   else if (!strncmp(argv[i], y_inverted,
- sizeof(y_inverted) - 1)) {
-   if (is_true(argv[i] + sizeof(y_inverted) - 1))
-   opts |= OPT_Y_INVERTED;
-   }
-   else {
-   print_usage_and_exit();
-   }
+   int c, option_index, ret = 0;
+
+   static struct option long_options[] = {
+   {"import-format",required_argument, 0,  'f' },
+   {"import-immediate", required_argument, 0,  'i' },
+   {"y-inverted",   required_argument, 0,  'y' },
+   {"help", no_argument  , 0,  'h' },
+   {0, 0, 0, 0}
+   };
+
+   while ((c = getopt_long(argc, argv, "hf:i:y:",
+ long_options, _index)) != -1) {
+   switch (c) {
+   case 'f':
+   import_format = parse_import_format(optarg);
+   break;
+   case 'i':
+   if (is_true(optarg))
+   opts |= OPT_IMMEDIATE;
+   break;
+   case 'y':
+   if (is_true(optarg))
+   opts |= OPT_Y_INVERTED;
+   break;
+   default:
+   print_usage_and_exit();
}
}
 
-- 
2.16.1

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


[PATCH weston v3 2/3] simple-dmabuf-drm: use opt bitmask instead of is_immediate

2018-03-16 Thread Guido Günther
Signed-off-by: Guido Günther 
---
 clients/simple-dmabuf-drm.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/clients/simple-dmabuf-drm.c b/clients/simple-dmabuf-drm.c
index 1789db73..427597ab 100644
--- a/clients/simple-dmabuf-drm.c
+++ b/clients/simple-dmabuf-drm.c
@@ -62,6 +62,7 @@ struct buffer;
 
 /* Possible options that affect the displayed image */
 #define OPT_Y_INVERTED 1  /* contents has y axis inverted */
+#define OPT_IMMEDIATE  2  /* create wl_buffer immediately */
 
 
 struct display {
@@ -756,7 +757,7 @@ static const struct wl_registry_listener registry_listener 
= {
 };
 
 static struct display *
-create_display(int is_immediate, int format)
+create_display(int opts, int format)
 {
struct display *display;
const char *extensions;
@@ -769,7 +770,7 @@ create_display(int is_immediate, int format)
display->display = wl_display_connect(NULL);
assert(display->display);
 
-   display->req_dmabuf_immediate = is_immediate;
+   display->req_dmabuf_immediate = opts & OPT_IMMEDIATE;
display->req_dmabuf_modifiers = (format == DRM_FORMAT_NV12);
 
/*
@@ -874,7 +875,6 @@ main(int argc, char **argv)
struct sigaction sigint;
struct display *display;
struct window *window;
-   int is_immediate = 0;
int opts = 0;
int import_format = DRM_FORMAT_XRGB;
int ret = 0, i = 0;
@@ -886,8 +886,8 @@ main(int argc, char **argv)
for (i = 1; i < argc; i++) {
if (!strncmp(argv[i], import_mode,
 sizeof(import_mode) - 1)) {
-   is_immediate = is_true(argv[i]
-   + sizeof(import_mode) - 
1);
+   if (is_true(argv[i] + sizeof(import_mode) - 1))
+   opts |= OPT_IMMEDIATE;
}
else if (!strncmp(argv[i], format, sizeof(format) - 1)) 
{
import_format = parse_import_format(argv[i]
@@ -904,7 +904,7 @@ main(int argc, char **argv)
}
}
 
-   display = create_display(is_immediate, import_format);
+   display = create_display(opts, import_format);
window = create_window(display, 256, 256, import_format, opts);
if (!window)
return 1;
-- 
2.16.1

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


[PATCH weston v3 1/3] Allow simple-dmabuf-drm to pass y_inverted flag

2018-03-16 Thread Guido Günther
This allows to check if ZWP_LINUX_BUFFER_PARAMS_V1_FLAGS_Y_INVERT is
interpreted correctly by the compositor.

We introduce an OPT_* bitmask to hold this flag and possible future
command line flags.

Signed-off-by: Guido Günther 
---
 clients/simple-dmabuf-drm.c | 31 +++
 1 file changed, 23 insertions(+), 8 deletions(-)

diff --git a/clients/simple-dmabuf-drm.c b/clients/simple-dmabuf-drm.c
index 492c9667..1789db73 100644
--- a/clients/simple-dmabuf-drm.c
+++ b/clients/simple-dmabuf-drm.c
@@ -60,6 +60,10 @@
 extern const unsigned nv12_tiled[];
 struct buffer;
 
+/* Possible options that affect the displayed image */
+#define OPT_Y_INVERTED 1  /* contents has y axis inverted */
+
+
 struct display {
struct wl_display *display;
struct wl_registry *registry;
@@ -394,11 +398,11 @@ 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 format)
+int width, int height, int format, uint32_t opts)
 {
struct zwp_linux_buffer_params_v1 *params;
uint64_t modifier = 0;
-   uint32_t flags;
+   uint32_t flags = 0;
struct drm_device *drm_dev;
 
if (!drm_connect(buffer)) {
@@ -449,7 +453,8 @@ create_dmabuf_buffer(struct display *display, struct buffer 
*buffer,
 * correct height to the compositor.
 */
buffer->height = height;
-   flags = 0;
+   if (opts & OPT_Y_INVERTED)
+   flags |= ZWP_LINUX_BUFFER_PARAMS_V1_FLAGS_Y_INVERT;
 
params = zwp_linux_dmabuf_v1_create_params(display->dmabuf);
zwp_linux_buffer_params_v1_add(params,
@@ -532,7 +537,8 @@ static const struct zxdg_toplevel_v6_listener 
xdg_toplevel_listener = {
 };
 
 static struct window *
-create_window(struct display *display, int width, int height, int format)
+create_window(struct display *display, int width, int height, int format,
+ uint32_t opts)
 {
struct window *window;
int i;
@@ -581,7 +587,7 @@ create_window(struct display *display, int width, int 
height, int format)
 
for (i = 0; i < NUM_BUFFERS; ++i) {
ret = create_dmabuf_buffer(display, >buffers[i],
-  width, height, format);
+  width, height, format, opts);
 
if (ret < 0)
return NULL;
@@ -829,13 +835,15 @@ print_usage_and_exit(void)
printf("usage flags:\n"
"\t'--import-immediate=<>'\n\t\t0 to import dmabuf via 
roundtrip,"
"\n\t\t1 to enable import without roundtrip\n"
+   "\t'--y-inverted=<>'\n\t\t0 to not pass Y_INVERTED flag,"
+   "\n\t\t1 to pass Y_INVERTED flag\n"
"\t'--import-format=<>'\n\t\tXRGB to import dmabuf as XRGB,"
"\n\t\tNV12 to import as multi plane NV12 with tiling 
modifier\n");
exit(0);
 }
 
 static int
-is_import_mode_immediate(const char* c)
+is_true(const char* c)
 {
if (!strcmp(c, "1"))
return 1;
@@ -867,22 +875,29 @@ main(int argc, char **argv)
struct display *display;
struct window *window;
int is_immediate = 0;
+   int opts = 0;
int import_format = DRM_FORMAT_XRGB;
int ret = 0, i = 0;
 
if (argc > 1) {
static const char import_mode[] = "--import-immediate=";
static const char format[] = "--import-format=";
+   static const char y_inverted[] = "--y-inverted=";
for (i = 1; i < argc; i++) {
if (!strncmp(argv[i], import_mode,
 sizeof(import_mode) - 1)) {
-   is_immediate = is_import_mode_immediate(argv[i]
+   is_immediate = is_true(argv[i]
+ sizeof(import_mode) - 
1);
}
else if (!strncmp(argv[i], format, sizeof(format) - 1)) 
{
import_format = parse_import_format(argv[i]
+ sizeof(format) - 1);
}
+   else if (!strncmp(argv[i], y_inverted,
+ sizeof(y_inverted) - 1)) {
+   if (is_true(argv[i] + sizeof(y_inverted) - 1))
+   opts |= OPT_Y_INVERTED;
+   }
else {
print_usage_and_exit();
}
@@ -890,7 +905,7 @@ main(int argc, char **argv)
}
 
display = create_display(is_immediate, import_format);
-   window = create_window(display, 256, 256, import_format);
+   window = 

[PATCH weston 0/3] Allow simple-dmabuf-drm to pass y_inverted flag and cleanups

2018-03-16 Thread Guido Günther
Changes from v2

 - Explain OPT_* usage
 - Switch is_immediate to OPT_*
 - use getopt_long

Changes from v1

 - introduce opts as a bitmask of features that can be used to
   manipulate the displayed image

Guido Günther (3):
  Allow simple-dmabuf-drm to pass y_inverted flag
  simple-dmabuf-drm: use opt bitmask instead of is_immediate
  simple-dmabuf-drm: use getopt_long

 clients/simple-dmabuf-drm.c | 76 -
 1 file changed, 47 insertions(+), 29 deletions(-)

-- 
2.16.1

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


Re: [PATCH weston v2] configure.ac: fixup systemd/systemd-login detection

2018-03-16 Thread Emil Velikov
On 15 March 2018 at 17:23, Michael Tretter  wrote:
> On Thu, 15 Mar 2018 14:20:21 +, Emil Velikov wrote:
>> From: Emil Velikov 
>>
>> Current systemd/systemd-login integration requires dbus. Although that
>> is far from clear the way current checks are handled.
>>
>> Be explicit and clear, effectively fixing cases where the systemd
>> auto detection will trip when dbus is explicitly disabled.
>>
>> Using git show -w will make things easier to read ;-)
>>
>> v2: auto disable systemd as dbus is missing
>>
>> Cc: Michael Tretter 
>> Reported-by: Michael Tretter 
>> Signed-off-by: Emil Velikov 
>> ---
>> Thanks for the review Michael!
>>
>> You're right - the else hunk is only for consistency with surrounding
>> code.
>> ---
>>  configure.ac | 28 +---
>>  1 file changed, 17 insertions(+), 11 deletions(-)
>>
>> diff --git a/configure.ac b/configure.ac
>> index 0b326ccc..a3453d15 100644
>> --- a/configure.ac
>> +++ b/configure.ac
>> @@ -524,7 +524,12 @@ AC_ARG_ENABLE(systemd-login,
>>AS_HELP_STRING([--enable-systemd-login],
>>   [Enable logind support]),,
>>enable_systemd_login=auto)
>> -if test x$enable_systemd_login != xno -a x$have_dbus != xno; then
>> +
>> +if test x$enable_systemd_login = xyes -a x$enable_dbus = xno; then
>> +  AC_MSG_ERROR([systemd-login support explicitly requested, but dbus not 
>> available])
>> +fi
>> +
>> +if test x$enable_systemd_login = xauto -a x$enable_dbus = xno; then
>
> If systemd-login is explicitly enabled, it will not enable
> systemd-login. The second condition is also wrong, because dbus must be
> enabled (or auto). It should read
>
> if test x$enable_systemd_login != xno -a x$enable_dbus != xno; then
>
Indeed, things are fiddly and subtle.

Pekka pulled your simpler fix so this lovely patch can go in the bin.

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


[PATCH wayland] wayland-egl: set the correct path to libwayland-egl.so

2018-03-16 Thread Emil Velikov
From: Emil Velikov 

Earlier commit changed to passing the binary name as env. variable
introducing a typo.

That went unnoticed, since we do not check if the file is present or
not.

Cc: Pukka Paalanen 
Cc: Daniel Stone 
Fixes: 85cb5ed64aa ("wayland-egl-symbols-check: pass the DSO name via
the build system")
Signed-off-by: Emil Velikov 
---
 Makefile.am | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile.am b/Makefile.am
index 2731ee7..6f59c36 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -196,7 +196,7 @@ AM_TESTS_ENVIRONMENT =  
\
export WAYLAND_SCANNER='$(top_builddir)/wayland-scanner'\
TEST_DATA_DIR='$(top_srcdir)/tests/data'\
TEST_OUTPUT_DIR='$(top_builddir)/tests/output'  \
-   WAYLAND_EGL_LIB='$(top_builddir)/egl/.libs/libwayland-egl.so'   \
+   WAYLAND_EGL_LIB='$(top_builddir)/.libs/libwayland-egl.so'   \
SED=$(SED)  \
;
 
-- 
2.16.0

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


Re: [PATCH wayland v3 1/3] wayland-egl: fail the symbol check if lib is missing

2018-03-16 Thread Emil Velikov
On 16 March 2018 at 13:52, Pekka Paalanen  wrote:
> On Thu, 15 Mar 2018 14:30:27 +
> Emil Velikov  wrote:
>
>> From: Emil Velikov 
>>
>> Based on a similar patch (in Mesa) by Eric Engestrom.
>>
>> v2: Rebase on top of $NM patch
>> v3: Rebase
>>
>> Reviewed-by: Eric Engestrom  (v1)
>> Signed-off-by: Emil Velikov 
>> ---
>>  egl/wayland-egl-symbols-check | 10 +-
>>  1 file changed, 9 insertions(+), 1 deletion(-)
>>
>> diff --git a/egl/wayland-egl-symbols-check b/egl/wayland-egl-symbols-check
>> index 6ad28f3..8b3d711 100755
>> --- a/egl/wayland-egl-symbols-check
>> +++ b/egl/wayland-egl-symbols-check
>> @@ -1,6 +1,14 @@
>>  #!/bin/sh
>> +set -eu
>>
>> -FUNCS=$($NM -D --defined-only ${WAYLAND_EGL_LIB} | grep -o "T .*" | cut -c 
>> 3- | while read func; do
>> +LIB=${WAYLAND_EGL_LIB}
>> +
>> +if [ ! -f "$LIB" ]; then
>> + echo "The test binary \"$LIB\" does no exist"
>> + exit 1
>> +fi
>> +
>> +FUNCS=$($NM -D --defined-only $LIB | grep -o "T .*" | cut -c 3- | while 
>> read func; do
>>  ( grep -q "^$func$" || echo $func )  <>  wl_egl_window_resize
>>  wl_egl_window_create
>
> Hi Emil,
>
> this patch makes distcheck fail with:
>
> The test binary "./egl/.libs/libwayland-egl.so" does no exist
> FAIL egl/wayland-egl-symbols-check (exit status: 1)
>
Right - I was aiming to remove the bonkers envvar and forgot about
this preexisting bug.
Patch (to be applied before the series) coming in a second.

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


Re: [PATCH v2] xwm: Update input region on resize

2018-03-16 Thread Pekka Paalanen
On Tue, 13 Mar 2018 21:22:04 -0600
Scott Moreau  wrote:

> Commit 332d1892 introduced a bug because the window was
> shaped only when the frame was created, leaving the input
> region unchanged regardless if the window was resized.
> This patch updates the input region shape on resize,
> fixing the problem.
> 
> ---
> 
> Changed in v2:
> 
> - Bail in shape function if (window->override_redirect || !window->frame)
> - Call shape function from send_configure()
> 
>  xwayland/window-manager.c | 53 
> +--
>  1 file changed, 33 insertions(+), 20 deletions(-)

Hi,

while trying to wrap my head around this, I started feeling dizzy. For
real. So I have to keep this short.

The first decision we should make is, do we want a quick patch for an
immediate issue at hand, or do we want to make things better in the long
run. Taking in this patch as is seems to be the former to me, and given
the phase of the release cycle can be justified.

The following mind flow is for a long term solution, and the comments
inlined with the code below are for the quick patch.


Taking a step back, the aim to keep the input shape up-to-date whenever
something happens.

If we have a frame window with decorations, then we call
frame_resize_inside() to adjust its size. Would it not be logical to
set the input shape in at least all those cases?

Except it looks like we can have decorated O-R windows, and those
should be exempt? Oh, I'm told decorated O-R windows don't make sense,
but I see some code in weston that would only apply in such case...
if (window->override_redirect) { ... if (window->frame) frame_resize_inside(...)

All windows that go through map_request handler will get the frame
window (window->frame_id) and the frame (window->frame) created. The
only windows that don't get this treatment are therefore windows that
are O-R at the time of mapping them. It's somewhat complicated by the
fact that XWM does not support dynamically changing O-R flag... or
maybe it makes it easier.

Now, we have configure_request and configure_notify handlers. O-R
windows will not hit configure_request handler, and the X server
processes XWM's configure commands immediately. This sounds like
configure_request handler would be a good place to update the input
shape. 

configure_notify handler gets called for O-R as well, and it happens
after the fact, so updating there would be a tiny bit late. Would you
agree?

That leaves the XWM originated resizes, which boils down to...
send_configure(), or actually weston_wm_window_configure()?

It looks like configure_request handler is open-coding all of
weston_wm_window_configure() but it also adds some bits specific to the
configure request.

Am I making sense?

> diff --git a/xwayland/window-manager.c b/xwayland/window-manager.c
> index c307e19..cd72a59 100644
> --- a/xwayland/window-manager.c
> +++ b/xwayland/window-manager.c
> @@ -659,6 +659,33 @@ weston_wm_window_get_input_rect(struct weston_wm_window 
> *window,
>  }
>  
>  static void
> +weston_wm_window_shape(struct weston_wm_window *window)
> +{
> + struct weston_wm *wm = window->wm;
> + xcb_rectangle_t rect;
> + int x, y, width, height;
> +
> + if (window->override_redirect || !window->frame)
> + return;
> +
> + weston_wm_window_get_input_rect(window, , , , );
> +
> + rect.x = x;
> + rect.y = y;
> + rect.width = width;
> + rect.height = height;
> +
> + /* The window frame was created with position and size which include
> +  * an offset for margins and shadow. Set the input region to ignore
> +  * shadow. */
> + xcb_shape_rectangles(wm->conn,
> +  XCB_SHAPE_SO_SET,
> +  XCB_SHAPE_SK_INPUT,
> +  0, window->frame_id,
> +  0, 0, 1, );
> +}
> +
> +static void
>  weston_wm_window_send_configure_notify(struct weston_wm_window *window)
>  {
>   xcb_configure_notify_event_t configure_notify;
> @@ -789,6 +816,8 @@ weston_wm_handle_configure_notify(struct weston_wm *wm, 
> xcb_generic_event_t *eve
>   xwayland_api->set_xwayland(window->shsurf,
>  window->x, window->y);
>   }
> +
> + weston_wm_window_shape(window);

From Daniel I understood that there would have been a better place to
call this?

>  }
>  
>  static void
> @@ -983,7 +1012,6 @@ weston_wm_window_create_frame(struct weston_wm_window 
> *window)
>  {
>   struct weston_wm *wm = window->wm;
>   uint32_t values[3];
> - xcb_rectangle_t rect;
>   int x, y, width, height;
>   int buttons = FRAME_BUTTON_CLOSE;
>  
> @@ -1040,26 +1068,9 @@ weston_wm_window_create_frame(struct weston_wm_window 
> *window)
>>format_rgba,
>width, height);
>  
> - 

Re: [PATCH wayland v3 1/3] wayland-egl: fail the symbol check if lib is missing

2018-03-16 Thread Pekka Paalanen
On Thu, 15 Mar 2018 14:30:27 +
Emil Velikov  wrote:

> From: Emil Velikov 
> 
> Based on a similar patch (in Mesa) by Eric Engestrom.
> 
> v2: Rebase on top of $NM patch
> v3: Rebase
> 
> Reviewed-by: Eric Engestrom  (v1)
> Signed-off-by: Emil Velikov 
> ---
>  egl/wayland-egl-symbols-check | 10 +-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/egl/wayland-egl-symbols-check b/egl/wayland-egl-symbols-check
> index 6ad28f3..8b3d711 100755
> --- a/egl/wayland-egl-symbols-check
> +++ b/egl/wayland-egl-symbols-check
> @@ -1,6 +1,14 @@
>  #!/bin/sh
> +set -eu
>  
> -FUNCS=$($NM -D --defined-only ${WAYLAND_EGL_LIB} | grep -o "T .*" | cut -c 
> 3- | while read func; do
> +LIB=${WAYLAND_EGL_LIB}
> +
> +if [ ! -f "$LIB" ]; then
> + echo "The test binary \"$LIB\" does no exist"
> + exit 1
> +fi
> +
> +FUNCS=$($NM -D --defined-only $LIB | grep -o "T .*" | cut -c 3- | while read 
> func; do
>  ( grep -q "^$func$" || echo $func )  <  wl_egl_window_resize
>  wl_egl_window_create

Hi Emil,

this patch makes distcheck fail with:

The test binary "./egl/.libs/libwayland-egl.so" does no exist
FAIL egl/wayland-egl-symbols-check (exit status: 1)


Thanks,
pq


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


Re: [PATCH weston v2 1/1] Allow simple-dmabuf-drm to pass y_inverted flag

2018-03-16 Thread Pekka Paalanen
On Fri, 16 Mar 2018 13:18:42 +0100
Guido Günther  wrote:

> On Fri, Mar 16, 2018 at 01:55:41PM +0200, Pekka Paalanen wrote:
> > On Thu, 15 Mar 2018 17:34:55 +0100
> > Guido Günther  wrote:
> >   
> > > This allows to check if ZWP_LINUX_BUFFER_PARAMS_V1_FLAGS_Y_INVERT is
> > > interpreted correctly by the compositor.
> > > ---
> > >  clients/simple-dmabuf-drm.c | 31 +++
> > >  1 file changed, 23 insertions(+), 8 deletions(-)
> > > 
> > > diff --git a/clients/simple-dmabuf-drm.c b/clients/simple-dmabuf-drm.c
> > > index 14d716de..a6e8d870 100644
> > > --- a/clients/simple-dmabuf-drm.c
> > > +++ b/clients/simple-dmabuf-drm.c
> > > @@ -59,6 +59,10 @@
> > >  extern const unsigned nv12_tiled[];
> > >  struct buffer;
> > >  
> > > +/* Possible options that affect the displayed image */
> > > +#define OPT_Y_INVERTED 1  
> > 
> > Hi,
> > 
> > why not use ZWP_LINUX_BUFFER_PARAMS_V1_FLAGS_Y_INVERT directly?  
> 
> I had that first but then decided to use OPT_* so we can do other stuff
> like changing buffer content via options later on. We could also fold
> --import-immediate/is_immediate into that.

Ah, that's a good reason. Please do mention it in the commit message.

> > > @@ -852,22 +860,29 @@ main(int argc, char **argv)
> > >   struct display *display;
> > >   struct window *window;
> > >   int is_immediate = 0;
> > > + int opts = 0;
> > >   int import_format = DRM_FORMAT_XRGB;
> > >   int ret = 0, i = 0;
> > >  
> > >   if (argc > 1) {
> > >   static const char import_mode[] = "--import-immediate=";
> > >   static const char format[] = "--import-format=";
> > > + static const char y_inverted[] = "--y-inverted=";
> > >   for (i = 1; i < argc; i++) {
> > >   if (!strncmp(argv[i], import_mode,
> > >sizeof(import_mode) - 1)) {
> > > - is_immediate = is_import_mode_immediate(argv[i]
> > > + is_immediate = is_true(argv[i]
> > >   + sizeof(import_mode) - 
> > > 1);
> > >   }
> > >   else if (!strncmp(argv[i], format, sizeof(format) - 1)) 
> > > {
> > >   import_format = parse_import_format(argv[i]
> > >   + sizeof(format) - 1);
> > >   }
> > > + else if (!strncmp(argv[i], y_inverted,
> > > +   sizeof(y_inverted) - 1)) {
> > > + if (is_true(argv[i] + sizeof(y_inverted) - 1))
> > > + opts |= OPT_Y_INVERTED;
> > > + }  
> > 
> > Could I persuade you to change this all to use getopt_long()? :-)  
> 
> Can do. Just let me know if the above OPT_ is o.k. (in this case it
> would be a follow up).

With the justification, it's good. :-)


Thanks for bearing with me,
pq


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


Re: [PATCH weston] .gitignore weston-simple-dmabuf-drm

2018-03-16 Thread Pekka Paalanen
On Fri, 16 Mar 2018 13:12:41 +0100
Guido Günther  wrote:

> Got renamed in f9dec67990a54afe14d4d2db694bf696ae418bcd
> 
> Signed-off-by: Guido Günther 
> ---
>  .gitignore | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/.gitignore b/.gitignore
> index ac76fd9f..661f4882 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -67,7 +67,7 @@ weston-nested-client
>  weston-presentation-shm
>  weston-resizor
>  weston-scaler
> -weston-simple-dmabuf-intel
> +weston-simple-dmabuf-drm
>  weston-simple-dmabuf-v4l
>  weston-simple-egl
>  weston-simple-shm

Pushed:
   02c56977..63fcad48  master -> master


Thanks,
pq


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


Re: [PATCH wayland-protcols v3] unstable: add xdg-toplevel-decoration protocol

2018-03-16 Thread Pekka Paalanen
On Wed, 14 Mar 2018 06:41:53 -0400
Simon Ser  wrote:

> On March 14, 2018 10:22 AM, Peter Hutterer  wrote:
> > sorry about the delay, but better late than too late ;)  
> 
> No problem, thanks for your review!
> 
> > On Sun, Mar 11, 2018 at 05:53:42PM -0400, Simon Ser wrote:  
> > > This adds a new protocol to negotiate server- and client-side rendering of
> > > window decorations for xdg-toplevels. This allows compositors that want
> > > to draw decorations themselves to send their preference to clients, and
> > > clients that prefer server-side decorations to request them.
> > > 
> > > This is inspired by a protocol from KDE [1] which has been implemented in
> > > KDE and Sway and was submitted for consideration in 2017 [2]. This patch
> > > provides an updated protocol with those concerns taken into account.
> > > 
> > > Signed-off-by: Simon Ser 
> > > Reviewed-by: Drew DeVault 
> > > Reviewed-by: David Edmundson 
> > > Reviewed-by: Alan Griffiths 
> > > Reviewed-by: Tony Crisci 
> > > 
> > > [1] 
> > > https://github.com/KDE/kwayland/blob/master/src/client/protocols/server-decoration.xml
> > > [2] 
> > > https://lists.freedesktop.org/archives/wayland-devel/2017-October/035564.html
> > > ---
> > > 
> > > This was iterated on privately between representatives of Sway and wlroots
> > > (Simon Ser, Drew DeVault and Tony Crisci), KDE and Qt (David Edmundson),
> > > and Mir (Alan Griffiths).
> > > 
> > > A proof-of-concept of a client and server implementation is available at 
> > > [1].
> > > 
> > > Changes from v2 to v3: fix typos, clarify xdg_toplevel_decoration.destroy
> > > semantics, clarify that clients always need to support CSD and can receive
> > > configure events at any time.
> > > 
> > > [1] https://github.com/swaywm/wlroots/pull/638
> > > 
> > >  Makefile.am|   1 +
> > >  unstable/xdg-toplevel-decoration/README|   4 +
> > >  .../xdg-toplevel-decoration-unstable-v1.xml| 132 
> > > +
> > >  3 files changed, 137 insertions(+)
> > >  create mode 100644 unstable/xdg-toplevel-decoration/README
> > >  create mode 100644 
> > > unstable/xdg-toplevel-decoration/xdg-toplevel-decoration-unstable-v1.xml
> > > 
> > > diff --git a/Makefile.am b/Makefile.am
> > > index 4b9a901..07744e9 100644
> > > --- a/Makefile.am
> > > +++ b/Makefile.am
> > > @@ -17,6 +17,7 @@ unstable_protocols =
> > > \
> > >   
> > > unstable/keyboard-shortcuts-inhibit/keyboard-shortcuts-inhibit-unstable-v1.xml
> > >  \
> > >   unstable/xdg-output/xdg-output-unstable-v1.xml  
> > > \
> > >   unstable/input-timestamps/input-timestamps-unstable-v1.xml  \
> > > + 
> > > unstable/xdg-toplevel-decoration/xdg-toplevel-decoration-unstable-v1.xml  
> > >   \
> > >   $(NULL)
> > >  
> > >  stable_protocols =   
> > > \
> > > diff --git a/unstable/xdg-toplevel-decoration/README 
> > > b/unstable/xdg-toplevel-decoration/README
> > > new file mode 100644
> > > index 000..e927110
> > > --- /dev/null
> > > +++ b/unstable/xdg-toplevel-decoration/README
> > > @@ -0,0 +1,4 @@
> > > +xdg_toplevel_decoration protocol
> > > +
> > > +Maintainers:
> > > +Simon Ser 
> > > diff --git 
> > > a/unstable/xdg-toplevel-decoration/xdg-toplevel-decoration-unstable-v1.xml
> > >  
> > > b/unstable/xdg-toplevel-decoration/xdg-toplevel-decoration-unstable-v1.xml
> > > new file mode 100644
> > > index 000..a34cb73
> > > --- /dev/null
> > > +++ 
> > > b/unstable/xdg-toplevel-decoration/xdg-toplevel-decoration-unstable-v1.xml
> > > @@ -0,0 +1,132 @@
> > > +
> > > +
> > > +  
> > > +Copyright © 2018 Simon Ser
> > > +
> > > +Permission is hereby granted, free of charge, to any person 
> > > obtaining a
> > > +copy of this software and associated documentation files (the 
> > > "Software"),
> > > +to deal in the Software without restriction, including without 
> > > limitation
> > > +the rights to use, copy, modify, merge, publish, distribute, 
> > > sublicense,
> > > +and/or sell copies of the Software, and to permit persons to whom the
> > > +Software is furnished to do so, subject to the following conditions:
> > > +
> > > +The above copyright notice and this permission notice (including the 
> > > next
> > > +paragraph) shall be included in all copies or substantial portions 
> > > of the
> > > +Software.
> > > +
> > > +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
> > > EXPRESS OR
> > > +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
> > > MERCHANTABILITY,
> > > +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT 
> > > SHALL
> > > +THE AUTHORS OR 

Re: [PATCH wayland v3 1/3] wayland-egl: fail the symbol check if lib is missing

2018-03-16 Thread Daniel Stone
Hi Emil,

On 15 March 2018 at 14:30, Emil Velikov  wrote:
> Based on a similar patch (in Mesa) by Eric Engestrom.
>
> v2: Rebase on top of $NM patch
> v3: Rebase
>
> Reviewed-by: Eric Engestrom  (v1)
> Signed-off-by: Emil Velikov 

The series is:
Reviewed-by: Daniel Stone 

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


Re: [PATCH weston v2 1/1] Allow simple-dmabuf-drm to pass y_inverted flag

2018-03-16 Thread Guido Günther
On Fri, Mar 16, 2018 at 01:55:41PM +0200, Pekka Paalanen wrote:
> On Thu, 15 Mar 2018 17:34:55 +0100
> Guido Günther  wrote:
> 
> > This allows to check if ZWP_LINUX_BUFFER_PARAMS_V1_FLAGS_Y_INVERT is
> > interpreted correctly by the compositor.
> > ---
> >  clients/simple-dmabuf-drm.c | 31 +++
> >  1 file changed, 23 insertions(+), 8 deletions(-)
> > 
> > diff --git a/clients/simple-dmabuf-drm.c b/clients/simple-dmabuf-drm.c
> > index 14d716de..a6e8d870 100644
> > --- a/clients/simple-dmabuf-drm.c
> > +++ b/clients/simple-dmabuf-drm.c
> > @@ -59,6 +59,10 @@
> >  extern const unsigned nv12_tiled[];
> >  struct buffer;
> >  
> > +/* Possible options that affect the displayed image */
> > +#define OPT_Y_INVERTED 1
> 
> Hi,
> 
> why not use ZWP_LINUX_BUFFER_PARAMS_V1_FLAGS_Y_INVERT directly?

I had that first but then decided to use OPT_* so we can do other stuff
like changing buffer content via options later on. We could also fold
--import-immediate/is_immediate into that.

> > @@ -852,22 +860,29 @@ main(int argc, char **argv)
> > struct display *display;
> > struct window *window;
> > int is_immediate = 0;
> > +   int opts = 0;
> > int import_format = DRM_FORMAT_XRGB;
> > int ret = 0, i = 0;
> >  
> > if (argc > 1) {
> > static const char import_mode[] = "--import-immediate=";
> > static const char format[] = "--import-format=";
> > +   static const char y_inverted[] = "--y-inverted=";
> > for (i = 1; i < argc; i++) {
> > if (!strncmp(argv[i], import_mode,
> >  sizeof(import_mode) - 1)) {
> > -   is_immediate = is_import_mode_immediate(argv[i]
> > +   is_immediate = is_true(argv[i]
> > + sizeof(import_mode) - 
> > 1);
> > }
> > else if (!strncmp(argv[i], format, sizeof(format) - 1)) 
> > {
> > import_format = parse_import_format(argv[i]
> > + sizeof(format) - 1);
> > }
> > +   else if (!strncmp(argv[i], y_inverted,
> > + sizeof(y_inverted) - 1)) {
> > +   if (is_true(argv[i] + sizeof(y_inverted) - 1))
> > +   opts |= OPT_Y_INVERTED;
> > +   }
> 
> Could I persuade you to change this all to use getopt_long()? :-)

Can do. Just let me know if the above OPT_ is o.k. (in this case it
would be a follow up).
Cheers,
 -- Guido
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH weston] .gitignore weston-simple-dmabuf-drm

2018-03-16 Thread Guido Günther
Got renamed in f9dec67990a54afe14d4d2db694bf696ae418bcd

Signed-off-by: Guido Günther 
---
 .gitignore | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.gitignore b/.gitignore
index ac76fd9f..661f4882 100644
--- a/.gitignore
+++ b/.gitignore
@@ -67,7 +67,7 @@ weston-nested-client
 weston-presentation-shm
 weston-resizor
 weston-scaler
-weston-simple-dmabuf-intel
+weston-simple-dmabuf-drm
 weston-simple-dmabuf-v4l
 weston-simple-egl
 weston-simple-shm
-- 
2.16.1

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


Re: [PATCH weston] Add a help string for --xwayland

2018-03-16 Thread Pekka Paalanen
On Fri, 16 Mar 2018 00:16:29 -0400
Dima Ryazanov  wrote:

> Signed-off-by: Dima Ryazanov 
> ---
>  compositor/main.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/compositor/main.c b/compositor/main.c
> index 18810f28..1e827884 100644
> --- a/compositor/main.c
> +++ b/compositor/main.c
> @@ -469,6 +469,7 @@ usage(int error_code)
>   "  --shell=MODULE\tShell module, defaults to desktop-shell.so\n"
>   "  -S, --socket=NAME\tName of socket to listen on\n"
>   "  -i, --idle-time=SECS\tIdle time in seconds\n"
> + "  --xwayland\t\tLoad the xwayland module\n"
>   "  --modules\t\tLoad the comma-separated list of modules\n"
>   "  --log=FILE\t\tLog to the given file\n"
>   "  -c, --config=FILE\tConfig file to load, defaults to 
> weston.ini\n"

Pushed:
   4fc3a679..02c56977  master -> master


Thanks,
pq


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


Re: [PATCH weston v2 1/1] Allow simple-dmabuf-drm to pass y_inverted flag

2018-03-16 Thread Pekka Paalanen
On Thu, 15 Mar 2018 17:34:55 +0100
Guido Günther  wrote:

> This allows to check if ZWP_LINUX_BUFFER_PARAMS_V1_FLAGS_Y_INVERT is
> interpreted correctly by the compositor.
> ---
>  clients/simple-dmabuf-drm.c | 31 +++
>  1 file changed, 23 insertions(+), 8 deletions(-)
> 
> diff --git a/clients/simple-dmabuf-drm.c b/clients/simple-dmabuf-drm.c
> index 14d716de..a6e8d870 100644
> --- a/clients/simple-dmabuf-drm.c
> +++ b/clients/simple-dmabuf-drm.c
> @@ -59,6 +59,10 @@
>  extern const unsigned nv12_tiled[];
>  struct buffer;
>  
> +/* Possible options that affect the displayed image */
> +#define OPT_Y_INVERTED 1

Hi,

why not use ZWP_LINUX_BUFFER_PARAMS_V1_FLAGS_Y_INVERT directly?


> @@ -852,22 +860,29 @@ main(int argc, char **argv)
>   struct display *display;
>   struct window *window;
>   int is_immediate = 0;
> + int opts = 0;
>   int import_format = DRM_FORMAT_XRGB;
>   int ret = 0, i = 0;
>  
>   if (argc > 1) {
>   static const char import_mode[] = "--import-immediate=";
>   static const char format[] = "--import-format=";
> + static const char y_inverted[] = "--y-inverted=";
>   for (i = 1; i < argc; i++) {
>   if (!strncmp(argv[i], import_mode,
>sizeof(import_mode) - 1)) {
> - is_immediate = is_import_mode_immediate(argv[i]
> + is_immediate = is_true(argv[i]
>   + sizeof(import_mode) - 
> 1);
>   }
>   else if (!strncmp(argv[i], format, sizeof(format) - 1)) 
> {
>   import_format = parse_import_format(argv[i]
>   + sizeof(format) - 1);
>   }
> + else if (!strncmp(argv[i], y_inverted,
> +   sizeof(y_inverted) - 1)) {
> + if (is_true(argv[i] + sizeof(y_inverted) - 1))
> + opts |= OPT_Y_INVERTED;
> + }

Could I persuade you to change this all to use getopt_long()? :-)


Thanks,
pq

>   else {
>   print_usage_and_exit();
>   }
> @@ -875,7 +890,7 @@ main(int argc, char **argv)
>   }
>  
>   display = create_display(is_immediate, import_format);
> - window = create_window(display, 256, 256, import_format);
> + window = create_window(display, 256, 256, import_format, opts);
>   if (!window)
>   return 1;
>  



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


Re: [PATCH weston v2 4/4] simple-dmabuf-drm: support etnaviv drm as well

2018-03-16 Thread Pekka Paalanen
On Thu, 15 Mar 2018 17:33:21 +0100
Guido Günther  wrote:

> ---
>  Makefile.am |  1 +
>  clients/simple-dmabuf-drm.c | 73 
> +
>  configure.ac|  5 +++-
>  3 files changed, 78 insertions(+), 1 deletion(-)
> 
> diff --git a/Makefile.am b/Makefile.am
> index c2d448e7..19319fa2 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -626,6 +626,7 @@ nodist_weston_simple_dmabuf_drm_SOURCES = \
>  weston_simple_dmabuf_drm_CFLAGS = $(AM_CFLAGS) 
> $(SIMPLE_DMABUF_DRM_CLIENT_CFLAGS)
>  weston_simple_dmabuf_drm_LDADD = $(SIMPLE_DMABUF_DRM_CLIENT_LIBS) \
>   $(LIBDRM_PLATFORM_FREEDRENO_LIBS) \
> + $(LIBDRM_PLATFORM_ETNAVIV_LIBS)   \
>   $(LIBDRM_PLATFORM_INTEL_LIBS) \
>   libshared.la
>  endif
> diff --git a/clients/simple-dmabuf-drm.c b/clients/simple-dmabuf-drm.c
> index 492c9667..a445ffb2 100644
> --- a/clients/simple-dmabuf-drm.c
> +++ b/clients/simple-dmabuf-drm.c
> @@ -48,6 +48,9 @@
>  #ifdef HAVE_LIBDRM_FREEDRENO
>  #include 
>  #endif
> +#ifdef HAVE_LIBDRM_ETNAVIV
> +#include 
> +#endif
>  #include 
>  
>  #include 
> @@ -101,6 +104,10 @@ struct buffer {
>   struct fd_device *fd_dev;
>   struct fd_bo *fd_bo;
>  #endif /* HAVE_LIBDRM_FREEDRENO */
> +#if HAVE_LIBDRM_ETNAVIV
> + struct etna_device *etna_dev;
> + struct etna_bo *etna_bo;
> +#endif /* HAVE_LIBDRM_ETNAVIV */
>  
>   uint32_t gem_handle;
>   int dmabuf_fd;
> @@ -264,6 +271,62 @@ fd_device_destroy(struct buffer *buf)
>   fd_device_del(buf->fd_dev);
>  }
>  #endif /* HAVE_LIBDRM_FREEDRENO */
> +#ifdef HAVE_LIBDRM_ETNAVIV
> +#define ROUND_DOWN(v, a) ((v) & ~(a - 1))
> +
> +static int
> +etna_alloc_bo(struct buffer *buf)
> +{
> + int flags = DRM_ETNA_GEM_CACHE_WC;
> + int size = buf->width * buf->height * buf->bpp / 8;
> + buf->etna_dev = etna_device_new(buf->drm_fd);
> +
> + buf->etna_bo = etna_bo_new(buf->etna_dev, size, flags);
> +
> + if (!buf->etna_bo)
> + return 0;
> + buf->stride = ROUND_DOWN(buf->width, 32) * buf->bpp / 8;

Hi,

this still looks strange to me. You get requested to allocate for
width×height. You compute the tight size without any alignment and
allocate that. Then you return the allocated stride rounded down, which
makes it potentially smaller than the stride you use for allocating the
buffer. This means that if the caller iterates a row from x=0 to
x=width-1, it may access pixels past the end, either from the next row
or past the end of the buffer.

Rounding up seemed like the right thing to do, you just need to compute
the stride before size, and compute size from stride to include the
padding you need. Right?


Thanks,
pq

> + return 1;
> +}
> +
> +static void
> +etna_free_bo(struct buffer *buf)
> +{
> + etna_bo_del(buf->etna_bo);
> +}
> +
> +static int
> +etna_bo_export_to_prime(struct buffer *buf)
> +{
> + buf->dmabuf_fd = etna_bo_dmabuf(buf->etna_bo);
> + if (buf->dmabuf_fd > 0)
> + return 0;
> +
> + return 1;
> +}
> +
> +static int
> +etna_map_bo(struct buffer *buf)
> +{
> + buf->mmap = etna_bo_map(buf->etna_bo);
> +
> + if (buf->mmap != NULL)
> + return 1;
> +
> + return 0;
> +}
> +
> +static void
> +etna_unmap_bo(struct buffer *buf)
> +{
> +}
> +
> +static void
> +etna_device_destroy(struct buffer *buf)
> +{
> + etna_device_del(buf->etna_dev);
> +}
> +#endif /* HAVE_LIBDRM_ENTAVIV */
>  
>  static void
>  fill_content(struct buffer *my_buf)
> @@ -331,6 +394,16 @@ drm_device_init(struct buffer *buf)
>   dev->unmap_bo = fd_unmap_bo;
>   dev->device_destroy = fd_device_destroy;
>   }
> +#endif
> +#ifdef HAVE_LIBDRM_ETNAVIV
> + else if (!strcmp(dev->name, "etnaviv")) {
> + dev->alloc_bo = etna_alloc_bo;
> + dev->free_bo = etna_free_bo;
> + dev->export_bo_to_prime = etna_bo_export_to_prime;
> + dev->map_bo = etna_map_bo;
> + dev->unmap_bo = etna_unmap_bo;
> + dev->device_destroy = etna_device_destroy;
> + }
>  #endif
>   else {
>   fprintf(stderr, "Error: drm device %s unsupported.\n",
> diff --git a/configure.ac b/configure.ac
> index dc2fbe93..e86c31fa 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -393,11 +393,14 @@ if ! test "x$enable_simple_dmabuf_drm_client" = "xno"; 
> then
>PKG_CHECK_MODULES(LIBDRM_PLATFORM_INTEL, [libdrm_intel],
>AC_DEFINE([HAVE_LIBDRM_INTEL], [1], [Build intel dmabuf client]) 
> have_simple_dmabuf_drm_client=yes,
>[true])
> +  PKG_CHECK_MODULES(LIBDRM_PLATFORM_ETNAVIV, [libdrm_etnaviv],
> +  AC_DEFINE([HAVE_LIBDRM_ETNAVIV], [1], [Build etnaviv dmabuf client]) 
> have_simple_dmabuf_drm_client=yes,
> +  [have_etnaviv=no])
>  
>if test "x$have_simple_dmabuf_drm_client" != "xyes" -o \
> "x$have_simple_dmabuf_libs" = "xno" && \
> "x$enable_simple_dmabuf_drm_client" = "xyes"; then
> -

Re: [PATCH weston v2 1/4] simple-dmabuf-drm: allow multiple backends

2018-03-16 Thread Pekka Paalanen
On Thu, 15 Mar 2018 17:33:18 +0100
Guido Günther  wrote:

> This allows to enable freedreno and intel backends at the same time
> building the prerequisites for adding further ones.
> ---
>  Makefile.am |  5 -
>  clients/simple-dmabuf-drm.c | 53 
> +
>  configure.ac| 24 +++-
>  3 files changed, 47 insertions(+), 35 deletions(-)

Hi,

much better!

> @@ -278,7 +281,8 @@ drm_device_destroy(struct buffer *buf)
>  {
>  #ifdef HAVE_LIBDRM_INTEL
>   drm_intel_bufmgr_destroy(buf->bufmgr);
> -#elif HAVE_LIBDRM_FREEDRENO
> +#endif
> +#ifdef HAVE_LIBDRM_FREEDRENO
>   fd_device_del(buf->fd_dev);
>  #endif

This introduces a commit in the history, where both del functions can
be called in the same run. Usually I'd ask to reorder patches, so that
such a broken intermediate state does not exist, but this seems simple
enough to let land.

>  
> @@ -308,7 +312,8 @@ drm_device_init(struct buffer *buf)
>   dev->map_bo = intel_map_bo;
>   dev->unmap_bo = intel_unmap_bo;
>   }
> -#elif HAVE_LIBDRM_FREEDRENO
> +#endif
> +#ifdef HAVE_LIBDRM_FREEDRENO
>   else if (!strcmp(dev->name, "msm")) {
>   dev->alloc_bo = fd_alloc_bo;
>   dev->free_bo = fd_free_bo;
> diff --git a/configure.ac b/configure.ac
> index 0b326ccc..dc2fbe93 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -384,19 +384,23 @@ AC_ARG_ENABLE(simple-dmabuf-drm-client,
>   [do not build the simple dmabuf drm client]),,
>enable_simple_dmabuf_drm_client="auto")
>  if ! test "x$enable_simple_dmabuf_drm_client" = "xno"; then
> -  PKG_CHECK_MODULES(SIMPLE_DMABUF_DRM_CLIENT, [wayland-client libdrm egl],
> -[PKG_CHECK_MODULES(LIBDRM_PLATFORM, [libdrm_freedreno],
> -  AC_DEFINE([HAVE_LIBDRM_FREEDRENO], [1], [Build freedreno dmabuf 
> client]) have_simple_dmabuf_drm_client=freedreno,
> -[PKG_CHECK_MODULES(LIBDRM_PLATFORM, [libdrm_intel],
> -  AC_DEFINE([HAVE_LIBDRM_INTEL], [1], [Build intel dmabuf client]) 
> have_simple_dmabuf_drm_client=intel,
> -have_simple_dmabuf_drm_client=unsupported)])],
> -  have_simple_dmabuf_drm_client=unsupported)
> -
> -  if test "x$have_simple_dmabuf_drm_client" = "xunsupported" -a 
> "x$enable_simple_dmabuf_drm_client" = "xyes"; then
> +  PKG_CHECK_MODULES(SIMPLE_DMABUF_DRM_CLIENT, [wayland-client libdrm egl], 
> [have_simple_dmabuf_libs=yes],
> + [have_simple_dmabuf_libs=no])
> +
> +  PKG_CHECK_MODULES(LIBDRM_PLATFORM_FREEDRENO, [libdrm_freedreno],
> +  AC_DEFINE([HAVE_LIBDRM_FREEDRENO], [1], [Build freedreno dmabuf 
> client]) have_simple_dmabuf_drm_client=yes,
> +  [true])
> +  PKG_CHECK_MODULES(LIBDRM_PLATFORM_INTEL, [libdrm_intel],
> +  AC_DEFINE([HAVE_LIBDRM_INTEL], [1], [Build intel dmabuf client]) 
> have_simple_dmabuf_drm_client=yes,
> +  [true])
> +
> +  if test "x$have_simple_dmabuf_drm_client" != "xyes" -o \
> +   "x$have_simple_dmabuf_libs" = "xno" && \
> +   "x$enable_simple_dmabuf_drm_client" = "xyes"; then

This is missing a call to 'test', isn't it?

>  AC_MSG_ERROR([DRM dmabuf client explicitly enabled, but libdrm_intel or 
> libdrm_freedreno not found])
>fi
>  
> -  if test "x$have_simple_dmabuf_drm_client" = "xfreedreno" -o 
> "x$have_simple_dmabuf_drm_client" = "xintel"; then
> +  if test "x$have_simple_dmabuf_drm_client" = "xyes" -a 
> "x$have_simple_dmabuf_libs"; then

The latter expression is always true I think... forgot to compare to
"xyes".

>  enable_simple_dmabuf_drm_client="yes"
>fi
>  fi

I fixed those two issues before pushing. Thanks for correcting the
freedreno style. Please remember to add your Signed-off-by in the
future.

I still have a question about patch 4, but patches 1-3 are pushed:
   824e4995..4fc3a679  master -> master


Thanks,
pq


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


Re: [PATCH wayland-protcols v2] unstable: add xdg-toplevel-decoration protocol

2018-03-16 Thread Emil Velikov
On 15 March 2018 at 15:43, Simon Ser  wrote:
> On March 15, 2018 4:15 PM, Emil Velikov  wrote:
>> On 2 March 2018 at 15:33, Simon Ser  wrote:
>> > This adds a new protocol to negotiate server- and client-side rendering of
>> > window decorations for xdg-toplevels. This allows compositors that want
>> > to draw decorations themselves to send their preference to clients, and
>> > clients that prefer server-side decorations to request them.
>> >
>> > This is inspired by a protocol from KDE [1] which has been implemented in
>> > KDE and Sway and was submitted for consideration in 2017 [2]. This patch
>> > provides an updated protocol with those concerns taken into account.
>> >
>> > Signed-off-by: Simon Ser 
>> > Reviewed-by: Drew DeVault 
>> > Reviewed-by: David Edmundson 
>> > Reviewed-by: Alan Griffiths 
>> > Reviewed-by: Tony Crisci 
>> >
>> More of a fly-by comment.
>>
>> Having a quick look does not list any of these R-B tags making it to the 
>> list.
>> Was it done in private, or I failed at searching?
>
> Yeah, it was done prior to submission to wayland-devel. See the commentary 
> below
> the commit message:
>
>> This was iterated on privately between representatives of Sway and wlroots
>> (Simon Ser, Drew DeVault and Tony Crisci), KDE and Qt (David Edmundson), and
>> Mir (Alan Griffiths).
>
Right, this says "iterated". Even then an official "Reviewed-by" ought
to happen in the open.

Anyway it was a JFYI
-Emil
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH] configure.ac: fix have_dbus if dbus support is disabled

2018-03-16 Thread Pekka Paalanen
On Wed, 14 Mar 2018 10:07:47 +0100
Michael Tretter  wrote:

> If dbus support is explicitly disabled, $have_dbus should be no, but was
> empty. systemd-login support depends on dbus, but the check does not
> trigger correctly, if $have_dbus is empty.
> 
> Signed-off-by: Michael Tretter 
> ---
>  configure.ac | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/configure.ac b/configure.ac
> index 0b326ccc..788730cb 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -502,6 +502,7 @@ AC_ARG_ENABLE(dbus,
>AS_HELP_STRING([--disable-dbus],
>   [do not build with dbus support]),,
>enable_dbus=auto)
> +have_dbus=no
>  if test "x$enable_dbus" != "xno"; then
>  PKG_CHECK_MODULES(DBUS,
>dbus-1 >= 1.6,

Indeed, pushed:
   6dba368a..824e4995  master -> master


Thanks,
pq


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


Re: compositor: do not free output region twice in weston_output_set_transform()

2018-03-16 Thread Pekka Paalanen
On Wed, 14 Mar 2018 10:59:52 +0200
Ilia Bozhinov  wrote:

> This is already done when weston_output_init_geometry() is called.
> Actually this is a fix for 8564a0d, because without this patch, the
> compositor sometimes crashes when setting output transform
> 
> Signed-off-by: Ilia Bozhinov 
> ---
>  libweston/compositor.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/libweston/compositor.c b/libweston/compositor.c
> index aec937bb..0079c848 100644
> --- a/libweston/compositor.c
> +++ b/libweston/compositor.c
> @@ -4705,9 +4705,6 @@ weston_output_set_transform(struct weston_output 
> *output,
>   pixman_region32_init(_region);
>   pixman_region32_copy(_region, >region);
>  
> - pixman_region32_fini(>region);
> - pixman_region32_fini(>previous_damage);
> -
>   weston_output_init_geometry(output, output->x, output->y);
>  
>   output->dirty = 1;

Looks good, pushed:
   5fa19343..6dba368a  master -> master


Thanks,
pq


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


Re: [PATCH wayland] configure.ac: don't install the static libraries

2018-03-16 Thread Pekka Paalanen
On Wed, 14 Mar 2018 19:00:22 +1000
Peter Hutterer  wrote:

> On Tue, Mar 13, 2018 at 01:43:37PM +, Emil Velikov wrote:
> > From: Emil Velikov 
> > 
> > One should always be using the shared libraries.
> > 
> > Spotted while going through the Debian packaing.
> > 
> > Signed-off-by: Emil Velikov 
> > ---
> > Can we have this in the 1.5 release, please?  

Emil, I assume you meant 1.15 - sure!


> Reviewed-by: Peter Hutterer 

Definitely the right thing to do, pushed:
   371c26d..f34af17  master -> master


Thanks,
pq

> > ---
> >  configure.ac | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/configure.ac b/configure.ac
> > index a53b6cc..26e517a 100644
> > --- a/configure.ac
> > +++ b/configure.ac
> > @@ -44,7 +44,7 @@ AM_CONDITIONAL(ENABLE_CPP_TEST, test 
> > "x$have_cpp_compiler" = "xyes")
> >  
> >  # Initialize libtool
> >  LT_PREREQ([2.2])
> > -LT_INIT
> > +LT_INIT([disable-static])
> >  


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


Re: wl_buffer is not released for long time.

2018-03-16 Thread Pekka Paalanen
On Thu, 15 Mar 2018 15:44:18 +
Sichem Zhou  wrote:

> Hi,
> 
> Sorry for the trouble, I forgot to ask that is it safe to call
> `wl_display_flush` and `wl_display_dispatch` in different threads?

Hi,

if you use threads, then you need to be using the prepare_read API of
libwayland-client. See the documentation for
wl_display_prepare_read_queue():
https://wayland.freedesktop.org/docs/html/apb.html#Client-classwl__display_1a40039c1169b153269a3dc0796a54ddb0

There is an example of the code sequence you must use in every thread,
that touches the wl_display or any wl object and needs to call poll()
or equivalent manually.

Please see the documentation of wl_display_dispatch() to see if you can
use it.

For every thread that dispatches events you will also need a separate
wl_event_queue, and you need to assign the wl objects to the correct
event queue unless the inherited event queue is already correct. For
assigning to a different event queue, you need to use
wl_proxy_create_wrapper() to avoid a race.

It is safe to call wl_display_flush() from different threads, but you
still need to ensure that it is really called before you expect poll()
to return with new events. This will be a concern if you send requests
from a thread that will not poll().


Thanks,
pq


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


Re: [PATCH weston v2] build: honour libinput header location

2018-03-16 Thread Pekka Paalanen
On Thu, 15 Mar 2018 14:01:28 +
Daniel Stone  wrote:

> Hi,
> 
> On 15 March 2018 at 13:45, Emil Velikov  wrote:
> > Add the respective CFLAGS to the build, otherwise it will error out as
> > seen below.
> >
> > src/libinput-seat.c:30:22: fatal error: libinput.h: No such file or 
> > directory
> >
> > v2: add the CFLAGS only as needed, suggested by Pekka
> >
> > Cc: Pekka Paalanen 
> > Cc: Jan Engelhardt 
> > [Emil Velikov: polish commit message, v2]
> > Signed-off-by: Emil Velikov 
> > ---
> > Pekka feel free to pick whichever patch you feel more confortable with.  
> 
> I have a mild preference for this one, but either is:
> Reviewed-by: Daniel Stone 


Perfect! Pushed:
   df9278ae..5fa19343  master -> master


Thanks,
pq


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