[PATCH v7 0/6] Make Weston multiseat aware

2018-06-27 Thread nerdopolis


These patches make Weston handle multiple seats. Fixes from the last 
attempt include updating fbdev_set_screen_info , updating some fuzz,
and making the selection of the framebuffer device similar to 
compositor-drm.c by favoring the boot_vga device, and making
requested changes. These now address some memory leaks, and other 
changes requested.


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


[PATCH v8 6/6] main: don't configure /dev/fb0 by default

2018-06-27 Thread nerdopolis
The framebuffer backend now detects the framebuffer device
dynamically. Don't assume that the framebuffer device is /dev/fb0
---
 compositor/main.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/compositor/main.c b/compositor/main.c
index 068cdd8f..f1ee02b4 100644
--- a/compositor/main.c
+++ b/compositor/main.c
@@ -1599,9 +1599,6 @@ load_fbdev_backend(struct weston_compositor *c,
 
parse_options(fbdev_options, ARRAY_LENGTH(fbdev_options), argc, argv);
 
-   if (!config.device)
-   config.device = strdup("/dev/fb0");
-
config.base.struct_version = WESTON_FBDEV_BACKEND_CONFIG_VERSION;
config.base.struct_size = sizeof(struct weston_fbdev_backend_config);
config.configure_device = configure_input_device;
-- 
2.17.1

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


[PATCH v8 3/6] launcher-logind: only get a VT on seat0, as only seat0 supports VTs

2018-06-27 Thread nerdopolis
As only seat0 supports TTYs, this changes the logind launcher where
it detects a TTY, only if the seat is seat0. This has only been
tested for logind
---
 libweston/launcher-logind.c | 23 +--
 libweston/launcher-util.c   |  4 
 2 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/libweston/launcher-logind.c b/libweston/launcher-logind.c
index d0559c8f..34e6e5ca 100644
--- a/libweston/launcher-logind.c
+++ b/libweston/launcher-logind.c
@@ -762,17 +762,20 @@ launcher_logind_connect(struct weston_launcher **out, 
struct weston_compositor *
free(t);
goto err_session;
}
-   free(t);
 
-   r = weston_sd_session_get_vt(wl->sid, >vtnr);
-   if (r < 0) {
-   weston_log("logind: session not running on a VT\n");
-   goto err_session;
-   } else if (tty > 0 && wl->vtnr != (unsigned int )tty) {
-   weston_log("logind: requested VT --tty=%d differs from real 
session VT %u\n",
-  tty, wl->vtnr);
-   r = -EINVAL;
-   goto err_session;
+   r = strcmp(t, "seat0");
+   free(t);
+   if (r == 0) {
+   r = weston_sd_session_get_vt(wl->sid, >vtnr);
+   if (r < 0) {
+   weston_log("logind: session not running on a VT\n");
+   goto err_session;
+   } else if (tty > 0 && wl->vtnr != (unsigned int )tty) {
+   weston_log("logind: requested VT --tty=%d differs from 
real session VT %u\n",
+  tty, wl->vtnr);
+   r = -EINVAL;
+   goto err_session;
+   }
}
 
loop = wl_display_get_event_loop(compositor->wl_display);
diff --git a/libweston/launcher-util.c b/libweston/launcher-util.c
index 03f3219b..41ac7950 100644
--- a/libweston/launcher-util.c
+++ b/libweston/launcher-util.c
@@ -104,6 +104,10 @@ WL_EXPORT void
 weston_setup_vt_switch_bindings(struct weston_compositor *compositor)
 {
uint32_t key;
+   struct weston_launcher *launcher = compositor->launcher;
+
+   if (launcher->iface->get_vt(launcher) <= 0)
+   return;
 
if (compositor->vt_switching == false)
return;
-- 
2.17.1

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


[PATCH v8 5/6] compositor-fbdev: detect the first fb device in the seat

2018-06-27 Thread nerdopolis
This adds a function to detect the first framebuffer device in the
current seat. Instead of hardcoding /dev/fb0, detect the device
with udev, favoring the boot_vga device, and falling back to the
first framebuffer device in the seat if there is none. This is very
similar to what compositor-drm does to find display devices
---
 libweston/compositor-fbdev.c | 83 ++--
 1 file changed, 80 insertions(+), 3 deletions(-)

diff --git a/libweston/compositor-fbdev.c b/libweston/compositor-fbdev.c
index e3777495..616300dc 100644
--- a/libweston/compositor-fbdev.c
+++ b/libweston/compositor-fbdev.c
@@ -777,6 +777,77 @@ session_notify(struct wl_listener *listener, void *data)
}
 }
 
+static char *
+find_framebuffer_device(struct fbdev_backend *b, const char *seat)
+{
+   struct udev_enumerate *e;
+   struct udev_list_entry *entry;
+   const char *path, *device_seat, *id, *fb_device_path;
+   struct udev_device *device, *fb_device, *pci;
+
+   e = udev_enumerate_new(b->udev);
+   udev_enumerate_add_match_subsystem(e, "graphics");
+   udev_enumerate_add_match_sysname(e, "fb[0-9]*");
+
+   udev_enumerate_scan_devices(e);
+   fb_device = NULL;
+   udev_list_entry_foreach(entry, udev_enumerate_get_list_entry(e)) {
+   bool is_boot_vga = false;
+
+   path = udev_list_entry_get_name(entry);
+   device = udev_device_new_from_syspath(b->udev, path);
+   if (!device)
+   continue;
+   device_seat = udev_device_get_property_value(device, "ID_SEAT");
+   if (!device_seat)
+   device_seat = default_seat;
+   if (strcmp(device_seat, seat)) {
+   udev_device_unref(device);
+   continue;
+   }
+
+   pci = udev_device_get_parent_with_subsystem_devtype(device,
+   "pci", NULL);
+   if (pci) {
+   id = udev_device_get_sysattr_value(pci, "boot_vga");
+   if (id && !strcmp(id, "1"))
+   is_boot_vga = true;
+   }
+
+   /* If a framebuffer device was found, and this device isn't
+* the boot-VGA device, don't use it. */
+   if (!is_boot_vga && fb_device) {
+   udev_device_unref(device);
+   continue;
+   }
+
+   /* There can only be one boot_vga device. Try to use it
+* at all costs. */
+   if (is_boot_vga) {
+   if (fb_device)
+   udev_device_unref(fb_device);
+   fb_device = device;
+   break;
+   }
+
+   /* Per the (!is_boot_vga && fb_device) test above, only
+* trump existing saved devices with boot-VGA devices, so if
+* the test ends up here, this must be the first device seen. */
+   assert(!fb_device);
+   fb_device = device;
+   }
+
+   udev_enumerate_unref(e);
+
+   if (fb_device)
+   {
+   fb_device_path=strdup(udev_device_get_devnode(fb_device));
+   udev_device_unref(fb_device);
+   }
+
+   return fb_device_path;
+}
+
 static struct fbdev_backend *
 fbdev_backend_create(struct weston_compositor *compositor,
  struct weston_fbdev_backend_config *param)
@@ -809,6 +880,11 @@ fbdev_backend_create(struct weston_compositor *compositor,
goto out_compositor;
}
 
+   if (!param->device)
+   param->device = find_framebuffer_device(backend, seat_id);
+   if (!param->device)
+   param->device = strdup("/dev/fb0");
+
/* Set up the TTY. */
backend->session_listener.notify = session_notify;
wl_signal_add(>session_signal,
@@ -835,12 +911,15 @@ fbdev_backend_create(struct weston_compositor *compositor,
if (!fbdev_head_create(backend, param->device))
goto out_launcher;
 
+   free(param->device);
+
udev_input_init(>input, compositor, backend->udev,
seat_id, param->configure_device);
 
return backend;
 
 out_launcher:
+   free(param->device);
weston_launcher_destroy(compositor->launcher);
 
 out_udev:
@@ -856,10 +935,8 @@ out_compositor:
 static void
 config_init_to_defaults(struct weston_fbdev_backend_config *config)
 {
-   /* TODO: Ideally, available frame buffers should be enumerated using
-* udev, rather than passing a device node in as a parameter. */
config->tty = 0; /* default to current tty */
-   config->device = "/dev/fb0"; /* default frame buffer */
+   config->device = NULL;
config->seat_id = NULL;
 }
 
-- 
2.17.1

___

[PATCH v8 1/6] libweston: set the seat automatically based on the XDG_SEAT environment variable

2018-06-27 Thread nerdopolis
This will allow the seat to be set by the environment as pam_systemd typically
sets the XDG_SEAT variable
---
 compositor/main.c  |  2 +-
 libweston/compositor-drm.c | 11 ---
 libweston/compositor-drm.h |  3 ++-
 man/weston-drm.man |  7 +--
 4 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/compositor/main.c b/compositor/main.c
index 2cb50c19..7bfe0a33 100644
--- a/compositor/main.c
+++ b/compositor/main.c
@@ -482,7 +482,7 @@ usage(int error_code)
 #if defined(BUILD_DRM_COMPOSITOR)
fprintf(out,
"Options for drm-backend.so:\n\n"
-   "  --seat=SEAT\t\tThe seat that weston should run on\n"
+   "  --seat=SEAT\t\tThe seat that weston should run on, instead 
of the seat defined in XDG_SEAT\n"
"  --tty=TTY\t\tThe tty to use\n"
"  --drm-device=CARD\tThe DRM device to use, e.g. \"card0\".\n"
"  --use-pixman\t\tUse the pixman (CPU) renderer\n"
diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
index 8b1ea66d..4a352132 100644
--- a/libweston/compositor-drm.c
+++ b/libweston/compositor-drm.c
@@ -6029,8 +6029,16 @@ drm_backend_create(struct weston_compositor *compositor,
struct udev_device *drm_device;
struct wl_event_loop *loop;
const char *seat_id = default_seat;
+   const char *session_seat;
int ret;
 
+   session_seat = getenv("XDG_SEAT");
+   if (session_seat)
+   seat_id = session_seat;
+
+   if (config->seat_id)
+   seat_id = config->seat_id;
+
weston_log("initializing drm backend\n");
 
b = zalloc(sizeof *b);
@@ -6062,9 +6070,6 @@ drm_backend_create(struct weston_compositor *compositor,
if (parse_gbm_format(config->gbm_format, GBM_FORMAT_XRGB, 
>gbm_format) < 0)
goto err_compositor;
 
-   if (config->seat_id)
-   seat_id = config->seat_id;
-
/* Check if we run drm-backend using weston-launch */
compositor->launcher = weston_launcher_connect(compositor, config->tty,
   seat_id, true);
diff --git a/libweston/compositor-drm.h b/libweston/compositor-drm.h
index 5393..edf4b8e6 100644
--- a/libweston/compositor-drm.h
+++ b/libweston/compositor-drm.h
@@ -106,7 +106,8 @@ struct weston_drm_backend_config {
 
/** The seat to be used for input and output.
 *
-* If NULL the default "seat0" will be used.  The backend will
+* Set first by the XDG_SEAT variable, and overridable by the --seat 
option.
+* If none are specified, the default "seat0" is assumed. The backend 
will
 * take ownership of the seat_id pointer and will free it on
 * backend destruction.
 */
diff --git a/man/weston-drm.man b/man/weston-drm.man
index d4cb75a7..7ebfadf7 100644
--- a/man/weston-drm.man
+++ b/man/weston-drm.man
@@ -105,8 +105,8 @@ status. For example, use
 \fB\-\-seat\fR=\fIseatid\fR
 Use graphics and input devices designated for seat
 .I seatid
-instead of the default seat
-.BR seat0 .
+instead of the seat defined in the environment variable
+. BR XDG_SEAT ". If neither is specifed, seat0 will be assumed."
 .TP
 \fB\-\-tty\fR=\fIx\fR
 Launch Weston on tty
@@ -133,6 +133,9 @@ The file descriptor (integer) where
 .B weston-launch
 is listening. Automatically set by
 .BR weston-launch .
+.TP
+.B XDG_SEAT
+The seat Weston will start on, unless overridden on the command line.
 .
 .\" ***
 .SH "SEE ALSO"
-- 
2.17.1

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


[PATCH v8 4/6] compositor-fbdev: set fb device info upon the first run.

2018-06-27 Thread nerdopolis
This attempts to wake up secondary framebuffer devices
(/dev/fb1 and up) as usually these devices start powered off, and
the FBIOPUT_VSCREENINFO ioctl turns it on. This was tested on a
qemu system with the options:

-vga none -device VGA,id=video0 -device secondary-vga,id=video1 \
-device secondary-vga,id=video2
---
 libweston/compositor-fbdev.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/libweston/compositor-fbdev.c b/libweston/compositor-fbdev.c
index 09a2eb39..e3777495 100644
--- a/libweston/compositor-fbdev.c
+++ b/libweston/compositor-fbdev.c
@@ -384,6 +384,13 @@ fbdev_frame_buffer_open(const char *fb_dev,
return -1;
}
 
+   /* Attempt to correct the framebuffer settings */
+   if (fbdev_set_screen_info(fd, screen_info) < 0) {
+   weston_log("Failed to set mode settings. "
+  "Attempting to open output anyway.\n");
+   }
+
+
return fd;
 }
 
-- 
2.17.1

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


[PATCH v8 2/6] compositor-fbdev: support the --seat option, (and XDG_SEAT variable)

2018-06-27 Thread nerdopolis
This allows the fbdev backend to run on, and use devices from the
specified seat, similar to the drm backend.
---
 compositor/main.c|  2 ++
 libweston/compositor-fbdev.c | 10 +-
 libweston/compositor-fbdev.h |  9 +
 3 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/compositor/main.c b/compositor/main.c
index 7bfe0a33..068cdd8f 100644
--- a/compositor/main.c
+++ b/compositor/main.c
@@ -494,6 +494,7 @@ usage(int error_code)
"Options for fbdev-backend.so:\n\n"
"  --tty=TTY\t\tThe tty to use\n"
"  --device=DEVICE\tThe framebuffer device to use\n"
+   "  --seat=SEAT\t\tThe seat that weston should run on, instead 
of the seat defined in XDG_SEAT\n"
"\n");
 #endif
 
@@ -1593,6 +1594,7 @@ load_fbdev_backend(struct weston_compositor *c,
const struct weston_option fbdev_options[] = {
{ WESTON_OPTION_INTEGER, "tty", 0,  },
{ WESTON_OPTION_STRING, "device", 0,  },
+   { WESTON_OPTION_STRING, "seat", 0, _id },
};
 
parse_options(fbdev_options, ARRAY_LENGTH(fbdev_options), argc, argv);
diff --git a/libweston/compositor-fbdev.c b/libweston/compositor-fbdev.c
index a78f6fab..09a2eb39 100644
--- a/libweston/compositor-fbdev.c
+++ b/libweston/compositor-fbdev.c
@@ -776,6 +776,13 @@ fbdev_backend_create(struct weston_compositor *compositor,
 {
struct fbdev_backend *backend;
const char *seat_id = default_seat;
+   const char *session_seat;
+
+   session_seat = getenv("XDG_SEAT");
+   if (session_seat)
+   seat_id = session_seat;
+   if (param->seat_id)
+   seat_id = param->seat_id;
 
weston_log("initializing fbdev backend\n");
 
@@ -800,7 +807,7 @@ fbdev_backend_create(struct weston_compositor *compositor,
wl_signal_add(>session_signal,
  >session_listener);
compositor->launcher =
-   weston_launcher_connect(compositor, param->tty, "seat0", false);
+   weston_launcher_connect(compositor, param->tty, seat_id, false);
if (!compositor->launcher) {
weston_log("fatal: fbdev backend should be run using "
   "weston-launch binary, or your system should "
@@ -846,6 +853,7 @@ config_init_to_defaults(struct weston_fbdev_backend_config 
*config)
 * udev, rather than passing a device node in as a parameter. */
config->tty = 0; /* default to current tty */
config->device = "/dev/fb0"; /* default frame buffer */
+   config->seat_id = NULL;
 }
 
 WL_EXPORT int
diff --git a/libweston/compositor-fbdev.h b/libweston/compositor-fbdev.h
index 8b7d900e..540120a4 100644
--- a/libweston/compositor-fbdev.h
+++ b/libweston/compositor-fbdev.h
@@ -52,6 +52,15 @@ struct weston_fbdev_backend_config {
 */
void (*configure_device)(struct weston_compositor *compositor,
 struct libinput_device *device);
+
+   /** The seat to be used for input and output.
+*
+* Set first by the XDG_SEAT variable, and overridable by the --seat 
option.
+* If none are specified, the default "seat0" is assumed. The backend 
will
+* take ownership of the seat_id pointer and will free it on
+* backend destruction.
+*/
+   char *seat_id;
 };
 
 #ifdef  __cplusplus
-- 
2.17.1

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


[PATCH libinput 3/5] tools: rely on the libinput and quirks tool to pick the right directories

2018-06-27 Thread Peter Hutterer
Don't use a custom hack here, just make sure the tool ends up in the builddir
so it's picked up by the libinput main tool.

This means the PATH isn't set up correctly when called directly
(./builddir/libinput-measure-touchpad-pressure) but the workaround is to
always use the libinput tool - just as we expect from users.

To make it more obvious that we're not supposed to run this directly, rename
the source file to .py

Signed-off-by: Peter Hutterer 
---
 meson.build   | 25 +++
 ...ch-size => libinput-measure-touch-size.py} | 10 +---
 ... => libinput-measure-touchpad-pressure.py} | 10 +---
 3 files changed, 11 insertions(+), 34 deletions(-)
 rename tools/{libinput-measure-touch-size => libinput-measure-touch-size.py} 
(96%)
 rename tools/{libinput-measure-touchpad-pressure => 
libinput-measure-touchpad-pressure.py} (95%)

diff --git a/meson.build b/meson.build
index 5580086f..842770e4 100644
--- a/meson.build
+++ b/meson.build
@@ -555,16 +555,12 @@ configure_file(input : 
'tools/libinput-measure-touchpad-tap.man',
   install_dir : join_paths(get_option('mandir'), 'man1')
   )
 
-config_builddir = configuration_data()
-config_builddir.set('BUILDDIR', meson.build_root())
-# libinput-measure-touchpad-pressure gets built but we install_data the
-# source instead. The built file is the one that uses the local quirks
-# and should be used for debugging.
-install_data('tools/libinput-measure-touchpad-pressure',
-install_dir : libinput_tool_path)
-configure_file(input: 'tools/libinput-measure-touchpad-pressure',
+config_noop = configuration_data()
+configure_file(input: 'tools/libinput-measure-touchpad-pressure.py',
   output: 'libinput-measure-touchpad-pressure',
-  configuration : config_builddir
+  configuration : config_noop,
+  install : true,
+  install_dir : libinput_tool_path
   )
 
 configure_file(input : 'tools/libinput-measure-touchpad-pressure.man',
@@ -573,14 +569,11 @@ configure_file(input : 
'tools/libinput-measure-touchpad-pressure.man',
   install : true,
   install_dir : join_paths(get_option('mandir'), 'man1')
   )
-# libinput-measure-touch-size gets built but we install_data the source
-# instead. The built file is the one that uses the local quirks and
-# should be used for debugging.
-install_data('tools/libinput-measure-touch-size',
-install_dir : libinput_tool_path)
-configure_file(input: 'tools/libinput-measure-touch-size',
+configure_file(input: 'tools/libinput-measure-touch-size.py',
   output: 'libinput-measure-touch-size',
-  configuration : config_builddir
+  configuration : config_noop,
+  install : true,
+  install_dir : libinput_tool_path
   )
 
 configure_file(input : 'tools/libinput-measure-touch-size.man',
diff --git a/tools/libinput-measure-touch-size 
b/tools/libinput-measure-touch-size.py
similarity index 96%
rename from tools/libinput-measure-touch-size
rename to tools/libinput-measure-touch-size.py
index a2624354..9687e0bd 100755
--- a/tools/libinput-measure-touch-size
+++ b/tools/libinput-measure-touch-size.py
@@ -222,15 +222,7 @@ class Device(object):
 sys.exit(1)
 
 def _init_thresholds_from_quirks(self):
-# This is replaced for the version in builddir but left as-is for
-# the installed version. For the builddir one we need to run the
-# builddir quirks list
-builddir = '@BUILDDIR@'
-if builddir != '@' + 'BUILDDIR' + '@':
-command = [os.path.join(builddir, 'libinput-quirks'), 'list']
-else:
-command = ['libinput', 'quirks', 'list']
-command.append(self.path)
+command = ['libinput', 'quirks', 'list', self.path]
 cmd = subprocess.run(command, stdout=subprocess.PIPE, 
stderr=subprocess.PIPE)
 if cmd.returncode != 0:
 print("Error querying quirks: 
{}".format(cmd.stderr.decode('utf-8')), file=sys.stderr)
diff --git a/tools/libinput-measure-touchpad-pressure 
b/tools/libinput-measure-touchpad-pressure.py
similarity index 95%
rename from tools/libinput-measure-touchpad-pressure
rename to tools/libinput-measure-touchpad-pressure.py
index b842cbd2..5d30a8b2 100755
--- a/tools/libinput-measure-touchpad-pressure
+++ b/tools/libinput-measure-touchpad-pressure.py
@@ -200,15 +200,7 @@ class Device(object):
 sys.exit(1)
 
 def _init_thresholds_from_quirks(self):
-# This is replaced for the version in builddir but left as-is for
-# the installed version. For the builddir one we need to run the
-# builddir quirks list
-builddir = '@BUILDDIR@'
-if builddir != '@' + 'BUILDDIR' + '@':
-command = [os.path.join(builddir, 'libinput-quirks'), 'list']
-else:
-command = ['libinput', 'quirks', 'list']
-  

[PATCH libinput 5/5] tools: don't add the debug behavior for release builds

2018-06-27 Thread Peter Hutterer
When the meson build type is something other than the debug types, we don't
need the special behavior where we adjust executable paths and data dir
lookup for tools run directly from the builddir.

This avoids leaking the build dir into the final executables.

Signed-off-by: Peter Hutterer 
---
 meson.build | 4 +++-
 tools/libinput-quirks.c | 5 -
 tools/shared.c  | 6 +-
 3 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/meson.build b/meson.build
index e10a0bc3..826b4fd0 100644
--- a/meson.build
+++ b/meson.build
@@ -31,7 +31,9 @@ add_project_arguments(cppflags, language : 'cpp')
 
 config_h = configuration_data()
 config_h.set('_GNU_SOURCE', '1')
-config_h.set_quoted('MESON_BUILD_ROOT', meson.build_root())
+if get_option('buildtype') == 'debug' or get_option('buildtype') == 
'debugoptimized'
+   config_h.set_quoted('MESON_BUILD_ROOT', meson.build_root())
+endif
 
 prefix = '''#define _GNU_SOURCE 1
 #include 
diff --git a/tools/libinput-quirks.c b/tools/libinput-quirks.c
index 862bb0ae..fbb97dbf 100644
--- a/tools/libinput-quirks.c
+++ b/tools/libinput-quirks.c
@@ -162,13 +162,16 @@ main(int argc, char **argv)
 
/* Overriding the data dir means no custom override file */
if (!data_path) {
+#ifdef MESON_BUILD_ROOT
char *builddir;
 
builddir = tools_execdir_is_builddir();
if (builddir) {
data_path = LIBINPUT_DATA_SRCDIR;
free(builddir);
-   } else {
+   } else
+#endif
+   {
data_path = LIBINPUT_DATA_DIR;
override_file = LIBINPUT_DATA_OVERRIDE_FILE;
}
diff --git a/tools/shared.c b/tools/shared.c
index 776b3d3e..eef625ed 100644
--- a/tools/shared.c
+++ b/tools/shared.c
@@ -473,6 +473,8 @@ out:
 char *
 tools_execdir_is_builddir(void)
 {
+   char *dir = NULL;
+#ifdef MESON_BUILD_ROOT
char execdir[PATH_MAX];
char *pathsep;
ssize_t sz;
@@ -489,7 +491,9 @@ tools_execdir_is_builddir(void)
if (!streq(execdir, MESON_BUILD_ROOT))
return NULL;
 
-   return safe_strdup(execdir);
+   dir = safe_strdup(execdir);
+#endif
+   return dir;
 }
 
 static inline void
-- 
2.17.1

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


[PATCH libinput 2/5] tools: quirks: if we're executing from the builddir, use the git datadir

2018-06-27 Thread Peter Hutterer
Signed-off-by: Peter Hutterer 
---
 tools/libinput-quirks.c | 12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/tools/libinput-quirks.c b/tools/libinput-quirks.c
index 88c860e4..862bb0ae 100644
--- a/tools/libinput-quirks.c
+++ b/tools/libinput-quirks.c
@@ -162,8 +162,16 @@ main(int argc, char **argv)
 
/* Overriding the data dir means no custom override file */
if (!data_path) {
-   data_path = LIBINPUT_DATA_DIR;
-   override_file = LIBINPUT_DATA_OVERRIDE_FILE;
+   char *builddir;
+
+   builddir = tools_execdir_is_builddir();
+   if (builddir) {
+   data_path = LIBINPUT_DATA_SRCDIR;
+   free(builddir);
+   } else {
+   data_path = LIBINPUT_DATA_DIR;
+   override_file = LIBINPUT_DATA_OVERRIDE_FILE;
+   }
}
 
quirks = quirks_init_subsystem(data_path,
-- 
2.17.1

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


[PATCH libinput 4/5] tools: fake-build the other tools the same way as measure touchpad-tap

2018-06-27 Thread Peter Hutterer
Doesn't actually do anything but this way they end up in the builddir and can
be picked up by ./builddir/libinput measure fuzz, etc.

And rename the source files to .py to signal that they are not supposed to be
directly executed.

Signed-off-by: Peter Hutterer 
---
 meson.build   | 26 ++-
 ...-measure-fuzz => libinput-measure-fuzz.py} |  0
 ...d-tap => libinput-measure-touchpad-tap.py} |  0
 ...e => libinput-measure-trackpoint-range.py} |  0
 4 files changed, 19 insertions(+), 7 deletions(-)
 rename tools/{libinput-measure-fuzz => libinput-measure-fuzz.py} (100%)
 rename tools/{libinput-measure-touchpad-tap => 
libinput-measure-touchpad-tap.py} (100%)
 rename tools/{libinput-measure-trackpoint-range => 
libinput-measure-trackpoint-range.py} (100%)

diff --git a/meson.build b/meson.build
index 842770e4..e10a0bc3 100644
--- a/meson.build
+++ b/meson.build
@@ -537,8 +537,13 @@ configure_file(input : 'tools/libinput-measure.man',
   install_dir : join_paths(get_option('mandir'), 'man1')
   )
 
-install_data('tools/libinput-measure-fuzz',
-install_dir : libinput_tool_path)
+config_noop = configuration_data()
+configure_file(input: 'tools/libinput-measure-fuzz.py',
+  output: 'libinput-measure-fuzz',
+  configuration : config_noop,
+  install : true,
+  install_dir : libinput_tool_path
+  )
 configure_file(input : 'tools/libinput-measure-fuzz.man',
   output : 'libinput-measure-fuzz.1',
   configuration : man_config,
@@ -546,8 +551,12 @@ configure_file(input : 'tools/libinput-measure-fuzz.man',
   install_dir : join_paths(get_option('mandir'), 'man1')
   )
 
-install_data('tools/libinput-measure-touchpad-tap',
-install_dir : libinput_tool_path)
+configure_file(input: 'tools/libinput-measure-touchpad-tap.py',
+  output: 'libinput-measure-touchpad_tap',
+  configuration : config_noop,
+  install : true,
+  install_dir : libinput_tool_path
+  )
 configure_file(input : 'tools/libinput-measure-touchpad-tap.man',
   output : 'libinput-measure-touchpad-tap.1',
   configuration : man_config,
@@ -555,7 +564,6 @@ configure_file(input : 
'tools/libinput-measure-touchpad-tap.man',
   install_dir : join_paths(get_option('mandir'), 'man1')
   )
 
-config_noop = configuration_data()
 configure_file(input: 'tools/libinput-measure-touchpad-pressure.py',
   output: 'libinput-measure-touchpad-pressure',
   configuration : config_noop,
@@ -583,8 +591,12 @@ configure_file(input : 
'tools/libinput-measure-touch-size.man',
   install_dir : join_paths(get_option('mandir'), 'man1')
   )
 
-install_data('tools/libinput-measure-trackpoint-range',
-install_dir : libinput_tool_path)
+configure_file(input: 'tools/libinput-measure-trackpoint-range.py',
+  output: 'libinput-measure-trackpoint-range',
+  configuration : config_noop,
+  install : true,
+  install_dir : libinput_tool_path
+  )
 configure_file(input : 'tools/libinput-measure-trackpoint-range.man',
   output : 'libinput-measure-trackpoint-range.1',
   configuration : man_config,
diff --git a/tools/libinput-measure-fuzz b/tools/libinput-measure-fuzz.py
similarity index 100%
rename from tools/libinput-measure-fuzz
rename to tools/libinput-measure-fuzz.py
diff --git a/tools/libinput-measure-touchpad-tap 
b/tools/libinput-measure-touchpad-tap.py
similarity index 100%
rename from tools/libinput-measure-touchpad-tap
rename to tools/libinput-measure-touchpad-tap.py
diff --git a/tools/libinput-measure-trackpoint-range 
b/tools/libinput-measure-trackpoint-range.py
similarity index 100%
rename from tools/libinput-measure-trackpoint-range
rename to tools/libinput-measure-trackpoint-range.py
-- 
2.17.1

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


[PATCH libinput 1/5] tools: if the execdir is the builddir, add it to the path

2018-06-27 Thread Peter Hutterer
When running libinput tools from the builddir, look up the subtools in the
builddir as well. Otherwise, add the install prefix to the list of lookup
locations.

This ensures that a) we're running builddir stuff against builddir stuff, but
also b) that we're not running builddir stuff against installed stuff because
that may give us false positives.

Signed-off-by: Peter Hutterer 
---
Similar-ish to the git approach Emil suggested in [1] but git is a lot more
involved here. Since we only need this for debugging tools, we can pick the
simpler approach here and simply ignore most of the corner cases.

[1] https://lists.freedesktop.org/archives/wayland-devel/2018-June/038658.html

 meson.build|  1 +
 tools/shared.c | 31 ++-
 tools/shared.h |  3 +++
 3 files changed, 34 insertions(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index 58e909b6..5580086f 100644
--- a/meson.build
+++ b/meson.build
@@ -31,6 +31,7 @@ add_project_arguments(cppflags, language : 'cpp')
 
 config_h = configuration_data()
 config_h.set('_GNU_SOURCE', '1')
+config_h.set_quoted('MESON_BUILD_ROOT', meson.build_root())
 
 prefix = '''#define _GNU_SOURCE 1
 #include 
diff --git a/tools/shared.c b/tools/shared.c
index f2ed1fd0..776b3d3e 100644
--- a/tools/shared.c
+++ b/tools/shared.c
@@ -467,18 +467,47 @@ out:
return is_touchpad;
 }
 
+/* Try to read the directory we're executing from and if it matches the
+ * builddir, return it as path. Otherwise, return NULL.
+ */
+char *
+tools_execdir_is_builddir(void)
+{
+   char execdir[PATH_MAX];
+   char *pathsep;
+   ssize_t sz;
+
+   sz = readlink("/proc/self/exe", execdir, sizeof(execdir));
+   if (sz <= 0 || sz == sizeof(execdir))
+   return NULL;
+
+   pathsep = strrchr(execdir, '/');
+   if (!pathsep)
+   return NULL;
+
+   *pathsep = '\0';
+   if (!streq(execdir, MESON_BUILD_ROOT))
+   return NULL;
+
+   return safe_strdup(execdir);
+}
+
 static inline void
 setup_path(void)
 {
const char *path = getenv("PATH");
char new_path[PATH_MAX];
+   char *builddir;
+
+   builddir = tools_execdir_is_builddir();
 
snprintf(new_path,
 sizeof(new_path),
 "%s:%s",
-LIBINPUT_TOOL_PATH,
+builddir ? builddir : LIBINPUT_TOOL_PATH,
 path ? path : "");
setenv("PATH", new_path, 1);
+   free(builddir);
 }
 
 int
diff --git a/tools/shared.h b/tools/shared.h
index e30bc39f..364babe6 100644
--- a/tools/shared.h
+++ b/tools/shared.h
@@ -119,4 +119,7 @@ tools_list_device_quirks(struct quirks_context *ctx,
 void (*callback)(void *userdata, const char *str),
 void *userdata);
 
+char *
+tools_execdir_is_builddir(void);
+
 #endif
-- 
2.17.1

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


[PATCH libinput] tools: rename list-quirks to the more generic "quirks list"

2018-06-27 Thread Peter Hutterer
Enables us to easily add more tools where needed and it is
more consistent with the existing tools.

The commands are now:
   libinput quirks list
   libinput quirks validate

Fixes https://gitlab.freedesktop.org/libinput/libinput/issues/66

Signed-off-by: Peter Hutterer 
---
 doc/device-quirks.dox | 14 +++---
 meson.build   | 41 --
 tools/libinput-list-quirks.man| 36 
 tools/libinput-measure-touch-size |  6 +--
 tools/libinput-measure-touchpad-pressure  |  6 +--
 ...binput-list-quirks.c => libinput-quirks.c} | 29 +
 tools/libinput-quirks.man | 43 +++
 7 files changed, 105 insertions(+), 70 deletions(-)
 delete mode 100644 tools/libinput-list-quirks.man
 rename tools/{libinput-list-quirks.c => libinput-quirks.c} (90%)
 create mode 100644 tools/libinput-quirks.man

diff --git a/doc/device-quirks.dox b/doc/device-quirks.dox
index 35e78215..d4368664 100644
--- a/doc/device-quirks.dox
+++ b/doc/device-quirks.dox
@@ -54,21 +54,23 @@ Once the required section has been added, use the 
information from section
 
 @section device-quirks-debugging Debugging device quirks
 
-libinput provides the `libinput list-quirks` tool to list and debug model
-quirks that apply to one or more local devices.
+libinput provides the `libinput quirks` tool to debug the quirks database.
+This tool takes an action as first argument, the most common invocation is
+`libinput quirks list` to list model quirks that apply to one or more local
+devices.
 
 @verbatim
-$ libinput list-quirks /dev/input/event19
+$ libinput quirks list /dev/input/event19
 Device has no quirks defined
-$ libinput list-quirks /dev/input/event0
+$ libinput quirks list /dev/input/event0
 AttrLidSwitchReliability
 @endverbatim
 
-When called with the `--verbose` argument, `libinput list-quirks` prints
+When called with the `--verbose` argument, `libinput quirks list` prints
 information about all files and its attempts to match the device:
 
 @verbatim
-$ libinput list-quirks --verbose /dev/input/event0
+$ libinput quirks list --verbose /dev/input/event0
 quirks debug: /usr/share/share/libinput is data root
 quirks debug: /usr/share/share/libinput/10-generic-keyboard.quirks
 quirks debug: /usr/share/share/libinput/10-generic-lid.quirks
diff --git a/meson.build b/meson.build
index d01c4af9..58e909b6 100644
--- a/meson.build
+++ b/meson.build
@@ -471,21 +471,34 @@ configure_file(input : 'tools/libinput-debug-events.man',
   install_dir : join_paths(get_option('mandir'), 'man1')
   )
 
-libinput_list_quirks_sources = [ 'tools/libinput-list-quirks.c' ]
-libinput_list_quirks = executable('libinput-list-quirks',
- libinput_list_quirks_sources,
- dependencies : [dep_libquirks, 
dep_tools_shared, dep_libinput],
- include_directories : [includes_src, 
includes_include],
- install_dir : libinput_tool_path,
- install : true
-)
+libinput_quirks_sources = [ 'tools/libinput-quirks.c' ]
+libinput_quirks = executable('libinput-quirks',
+libinput_quirks_sources,
+dependencies : [dep_libquirks, dep_tools_shared, 
dep_libinput],
+include_directories : [includes_src, 
includes_include],
+install_dir : libinput_tool_path,
+install : true
+   )
 test('validate-quirks',
- libinput_list_quirks,
- args: ['--validate-only', 
'--data-dir=@0@'.format(join_paths(meson.source_root(), 'data'))]
+ libinput_quirks,
+ args: ['validate', 
'--data-dir=@0@'.format(join_paths(meson.source_root(), 'data'))]
  )
 
-configure_file(input : 'tools/libinput-list-quirks.man',
-  output : 'libinput-list-quirks.1',
+configure_file(input : 'tools/libinput-quirks.man',
+  output : 'libinput-quirks.1',
+  configuration : man_config,
+  install : true,
+  install_dir : join_paths(get_option('mandir'), 'man1')
+  )
+# Same man page for the subtools to stay consistent with the other tools
+configure_file(input : 'tools/libinput-quirks.man',
+  output : 'libinput-quirks-list.1',
+  configuration : man_config,
+  install : true,
+  install_dir : join_paths(get_option('mandir'), 'man1')
+  )
+configure_file(input : 'tools/libinput-quirks.man',
+  output : 'libinput-quirks-validate.1',
   configuration : man_config,
   install : true,
   install_dir : join_paths(get_option('mandir'), 'man1')
@@ -544,7 +557,7 @@ configure_file(input : 
'tools/libinput-measure-touchpad-tap.man',
 

Re: [PATCH wayland] contributing: review rules for bugs

2018-06-27 Thread Emil Velikov
Hi Pekka,

A couple small ideas come to mind:

On 27 June 2018 at 14:47, Pekka Paalanen  wrote:
> From: Pekka Paalanen 
>
> Half of the ideas came from Daniel but most of them are reworded, the
> rest are my thoughts.
>
> Mention compiler warnings specifically, and be more explicit on what
> kind of code or bugs or bug fixes are acceptable or not. Clarify commit
> scope.
>
> Cc: Daniel Stone 
> Signed-off-by: Pekka Paalanen 
> ---
>  CONTRIBUTING.md | 19 ---
>  1 file changed, 16 insertions(+), 3 deletions(-)
>
> diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
> index 70d0eca..51bef89 100644
> --- a/CONTRIBUTING.md
> +++ b/CONTRIBUTING.md
> @@ -223,11 +223,24 @@ include tests excercising the additions in the test 
> suite.
>  - The code fits the existing software architecture, e.g. no layering
>  violations.
>
> -- The code is correct and does not ignore corner-cases.
> +- The code is correct and does not introduce new failures for existing users,
> +does not add new corner-case bugs, and does not introduce new compiler
> +warnings.
Compiler warnings vary greatly on the compiler and it's version. It
does become a nuisance when committer/reviewer is using a newer
version which flags dozens of warnings.
That aside, worth loosening this for patches where existing code is
copied or moved?

>
> -- In a patch series, every intermediate step produces correct code as well.
> +- In a patch series, every intermediate step produces correct and 
> warning-free
> +code as well.
>
It makes sense to move this as the final bullet-point and let it refer
to the whole section.
Namely:

- In a patch series, every intermediate step adheres to the guidelines above.

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


Re: [PATCH wayland-protocols v7] unstable: add xdg-decoration protocol

2018-06-27 Thread Simon Ser
Hi Jonas,

What do you think of this new version? Wording suggestions and other comments
welcome :)

Thanks,

Simon

On June 18, 2018 11:16 AM, Simon Ser  wrote:
> This adds a new protocol to negotiate server-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 
>
> [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
> ---
>
> (Sorry, I somehow managed to send the old version and not the v7 one in my
> previous email)
>
> 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 v6 to v7:
> - Move errors in xdg_toplevel_decoration
> - Add errors descriptions
> - Add an error when toplevel is destroyed before decoration
> - State that objects created with the manager are still valid after
>   destroying the manager
> - Compositors can no longer ignore set_mode requests, but they can
>   disregard the client's preference
> - Describe how clients whose preference depend on the window state
>   should behave to prevent frames with unwanted state
>
> [1] https://github.com/swaywm/wlroots/pull/1053
>
>  Makefile.am   |   1 +
>  unstable/xdg-decoration/README|   4 +
>  .../xdg-decoration-unstable-v1.xml| 156 ++
>  3 files changed, 161 insertions(+)
>  create mode 100644 unstable/xdg-decoration/README
>  create mode 100644 unstable/xdg-decoration/xdg-decoration-unstable-v1.xml
>
> diff --git a/Makefile.am b/Makefile.am
> index 4b9a901..71909d8 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-decoration/xdg-decoration-unstable-v1.xml  \
>   $(NULL)
>
>  stable_protocols =   
> \
> diff --git a/unstable/xdg-decoration/README b/unstable/xdg-decoration/README
> new file mode 100644
> index 000..73f0c52
> --- /dev/null
> +++ b/unstable/xdg-decoration/README
> @@ -0,0 +1,4 @@
> +xdg_decoration protocol
> +
> +Maintainers:
> +Simon Ser 
> diff --git a/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml 
> b/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml
> new file mode 100644
> index 000..378e8ff
> --- /dev/null
> +++ b/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml
> @@ -0,0 +1,156 @@
> +
> +
> +  
> +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 COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 
> OTHER
> +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
> +DEALINGS IN THE SOFTWARE.
> +  
> +
> +  
> +
> +  This interface allows a compositor to announce support for server-side
> +  decorations.
> +
> +  A window decoration is a set of window controls as deemed appropriate 
> by
> +  the party managing them, such as user interface components used to 
> move,
> +  resize and change a window's state.
> +
> +  A client can use this protocol to request being decorated by a 
> supporting
> 

Re: [PATCH wayland] contributing: review rules for bugs

2018-06-27 Thread Pekka Paalanen
On Wed, 27 Jun 2018 16:47:09 +0300
Pekka Paalanen  wrote:

> From: Pekka Paalanen 
> 
> Half of the ideas came from Daniel but most of them are reworded, the
> rest are my thoughts.
> 
> Mention compiler warnings specifically, and be more explicit on what
> kind of code or bugs or bug fixes are acceptable or not. Clarify commit
> scope.
> 
> Cc: Daniel Stone 
> Signed-off-by: Pekka Paalanen 
> ---
>  CONTRIBUTING.md | 19 ---
>  1 file changed, 16 insertions(+), 3 deletions(-)
> 

Hi,

this is a bit more than already discussed. Questions below.

> diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
> index 70d0eca..51bef89 100644
> --- a/CONTRIBUTING.md
> +++ b/CONTRIBUTING.md
> @@ -223,11 +223,24 @@ include tests excercising the additions in the test 
> suite.
>  - The code fits the existing software architecture, e.g. no layering
>  violations.
>  
> -- The code is correct and does not ignore corner-cases.
> +- The code is correct and does not introduce new failures for existing users,
> +does not add new corner-case bugs, and does not introduce new compiler
> +warnings.
>  
> -- In a patch series, every intermediate step produces correct code as well.
> +- In a patch series, every intermediate step produces correct and 
> warning-free
> +code as well.
>  
> -- The code does what it says in the commit message and changes nothing else.
> +- The patch does what it says in the commit message and changes nothing else.
> +
> +- The patch is a single logical change. If the commit message addresses
> +multiple points, it is a hint that the commit might need splitting up.
> +
> +- A bug fix should target the underlying root cause instead of hiding 
> symptoms.
> +If a complete fix is not practical, partial fixes are acceptable if they come
> +with code comments and filed Gitlab issues for the remaining bugs.
> +
> +- The bug root cause rule applies to external software components as well, 
> e.g.
> +do not work around kernel driver issues in userspace.

This last item is written with Weston in mind. We definitely do not
want to collect a pile of per-driver workarounds or features. However,
sometimes a workaround has its place, drm_output_pick_crtc() works
around bad possible_crtcs and possible_clones, for instance.

https://gitlab.freedesktop.org/wayland/weston/blob/78a42116ae92f93a01539a785ce95cc478189608/libweston/compositor-drm.c#L4809

Is there a better wording to allow that?

Or does this workaround have its place?

Seeing that Ville Syrjälä went on a journey to actually fix the
possible_*, I have filed an issue to remind us about it:
https://gitlab.freedesktop.org/wayland/weston/issues/120


Thanks,
pq


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


[PATCH wayland] contributing: review rules for bugs

2018-06-27 Thread Pekka Paalanen
From: Pekka Paalanen 

Half of the ideas came from Daniel but most of them are reworded, the
rest are my thoughts.

Mention compiler warnings specifically, and be more explicit on what
kind of code or bugs or bug fixes are acceptable or not. Clarify commit
scope.

Cc: Daniel Stone 
Signed-off-by: Pekka Paalanen 
---
 CONTRIBUTING.md | 19 ---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 70d0eca..51bef89 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -223,11 +223,24 @@ include tests excercising the additions in the test suite.
 - The code fits the existing software architecture, e.g. no layering
 violations.
 
-- The code is correct and does not ignore corner-cases.
+- The code is correct and does not introduce new failures for existing users,
+does not add new corner-case bugs, and does not introduce new compiler
+warnings.
 
-- In a patch series, every intermediate step produces correct code as well.
+- In a patch series, every intermediate step produces correct and warning-free
+code as well.
 
-- The code does what it says in the commit message and changes nothing else.
+- The patch does what it says in the commit message and changes nothing else.
+
+- The patch is a single logical change. If the commit message addresses
+multiple points, it is a hint that the commit might need splitting up.
+
+- A bug fix should target the underlying root cause instead of hiding symptoms.
+If a complete fix is not practical, partial fixes are acceptable if they come
+with code comments and filed Gitlab issues for the remaining bugs.
+
+- The bug root cause rule applies to external software components as well, e.g.
+do not work around kernel driver issues in userspace.
 
 - The test suite passes.
 
-- 
2.16.4

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


[PATCH weston] build: don't manually parse the weston.ini.in templates

2018-06-27 Thread Emil Velikov
From: Emil Velikov 

Adding those to configure.ac ensures that:
 - the weston.ini files are {re,}generated only when needed
 - the .in files are shipped in the tarball
 - all the manual handling of the above can be removed ;-)

Note: the abs_top_builddir for weston-flower was swapped with the correct
bindir. Squashed in here since it was never worked correctly :-\

Signed-off-by: Emil Velikov 
---
Shout if you feel strongly about splitting the weston-flower fix.

Based on top of Emre's "ivi-shell: use install paths in example config"
patch.
---
 Makefile.am   | 22 ++
 configure.ac  |  2 +-
 weston.ini.in |  2 +-
 3 files changed, 4 insertions(+), 22 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 637dd239..2095aa5a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -12,23 +12,7 @@ BUILT_SOURCES =
 
 AM_DISTCHECK_CONFIGURE_FLAGS = --disable-setuid-install
 
-EXTRA_DIST = weston.ini.in ivi-shell/weston.ini.in
-
-weston.ini : $(srcdir)/weston.ini.in
-   $(AM_V_GEN)$(SED) \
-   -e 's|@bindir[@]|$(bindir)|g' \
-   -e 's|@abs_top_builddir[@]|$(abs_top_builddir)|g' \
-   -e 's|@libexecdir[@]|$(libexecdir)|g' \
-   $< > $@
-
-ivi-shell/weston.ini : $(srcdir)/ivi-shell/weston.ini.in
-   $(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(SED) \
-   -e 's|@bindir[@]|$(bindir)|g' \
-   -e 's|@libexecdir[@]|$(libexecdir)|g' \
-   -e 's|@westondatadir[@]|$(westondatadir)|g' \
-   $< > $@
-
-all-local : weston.ini ivi-shell/weston.ini
+EXTRA_DIST =
 
 AM_CFLAGS = $(GCC_CFLAGS)
 
@@ -43,9 +27,7 @@ AM_CPPFLAGS = \
-DLIBEXECDIR='"$(libexecdir)"'  \
-DBINDIR='"$(bindir)"'
 
-CLEANFILES = weston.ini\
-   ivi-shell/weston.ini\
-   internal-screenshot-00.png  \
+CLEANFILES = internal-screenshot-00.png\
$(BUILT_SOURCES)
 
 # Libtool race fix
diff --git a/configure.ac b/configure.ac
index 2a62b62a..9b7071e7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -680,7 +680,7 @@ if test "x$enable_systemd_notify" = "xyes"; then
   PKG_CHECK_MODULES(SYSTEMD_DAEMON, [libsystemd])
 fi
 
-AC_CONFIG_FILES([Makefile libweston/version.h compositor/weston.pc])
+AC_CONFIG_FILES([Makefile weston.ini ivi-shell/weston.ini libweston/version.h 
compositor/weston.pc])
 
 # AC_CONFIG_FILES needs the full name when running autoconf, so we need to use
 # libweston_abi_version here, and outside [] because of m4 quoting rules
diff --git a/weston.ini.in b/weston.ini.in
index 257c4ec4..e743cc49 100644
--- a/weston.ini.in
+++ b/weston.ini.in
@@ -38,7 +38,7 @@ path=/usr/bin/google-chrome
 
 [launcher]
 icon=/usr/share/icons/gnome/24x24/apps/arts.png
-path=@abs_top_builddir@/weston-flower
+path=@bindir@/weston-flower
 
 [input-method]
 path=@libexecdir@/weston-keyboard
-- 
2.18.0

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


Re: [PATCH wayland 0/2] Document review and commit access requirements

2018-06-27 Thread Pekka Paalanen
On Mon, 25 Jun 2018 16:53:12 -0500
Derek Foreman  wrote:

> On 2018-06-18 08:42 AM, Pekka Paalanen wrote:
> > From: Pekka Paalanen 
> > 
> > Hi,
> > 
> > for years we have relied on unwritten traditions on how to review
> > patches. Gaining commit access has been a secret rite no-one really knew
> > what was required for to ask or grant it. I would dare claim that this
> > has been partially the reason for why there are so few people who
> > routinely review and land patches. At least I hope so, because
> > "unwritten" is something we can fix.
> > 
> > Let's try to write down the existing conventions and criteria we use to
> > review patches. These will not be rules to be followed to the letter but
> > to the spirit.
> > 
> > Once we have documented guidelines for quality assurance on patch
> > review, we can set up rules for granting commit rights. The movement to
> > document commit rights requirements started in the kernel DRM commmunity
> > as a tool to give out commits rights to more people and get more people
> > involved and reviewing patches. I believe we would certainly want more
> > people involved with Wayland and Weston, but it won't work if we don't
> > also get more reviewers and committers.
> > 
> > So here goes. Documenting what is expected from reviewers and commmit
> > rights holders should make everyone's lives easier. These patches are my
> > first take on it, and build on others' as referenced. I want to ensure
> > that I am replaceable. That everyone is.
> > 
> > The guidelines will not be perfect from the start. They should we honed
> > over time.
> > 
> > 
> > Thanks,
> > pq
> > 
> > 
> > Pekka Paalanen (2):
> >   contributing: add review guidelines
> >   contributing: commit rights  
> 
> Really like these, and both are:
> Reviewed-by: Derek Foreman 
> 
> I like Daniel's suggestions too, but am fine with those being follow up
> work.

Both pushed as is:
   35d0425..bb1a8ca  master -> master

I will prepare follow-up for the raised thoughts and some more.


Thanks,
pq


pgpPvLnrTw9hH.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] ivi-shell: use install paths in example config

2018-06-27 Thread Emil Velikov
On 27 June 2018 at 12:12, Emil Velikov  wrote:
> On 27 June 2018 at 12:01, Michael Tretter  wrote:
>> Hi,
>>
>> On Fri, 25 May 2018 08:46:16 +0200, Michael Tretter wrote:
>>> On Thu, 24 May 2018 17:08:47 +0200, Emre Ucan wrote:
>>> > The example weston.ini file uses source and build
>>> > directory paths. Therefore, it is only useful when
>>> > used on the same system that is used to build Weston.
>>> >
>>> > We can use install paths instead of build/source paths
>>> > to fix this problem.
>>> >
>>> > v2 changes:
>>> > - use $(westondatadir) instead of $(datadir)
>>> >
>>> > Reported-by: Michael Tretter 
>>> > Signed-off-by: Emre Ucan 
>>>
>>> Reviewed-by: Michael Tretter 
>>
>> Some variables that this patch touches have already been removed, but I
>> think it would still make change to rename 'abs_top_builddir' and
>> 'abs_top_srcdir'. Is there anything preventing this patch from being
>> applied?
>>
> Is this still required with the recently landed builddir changes by Dan/Pekka?
> I'll give it a look after lunch and can offer some feedback, after
> lunch. Gut feeling atm is that this breaks make check.
>
My gut feeling and coffee deprived brain were miles off.
Patch is spot on and is
Reviewed-by: Emil Velikov 

An extra cool cleanup incoming ;-)
-Emil
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston] parse_modeline: Ignore case of {h,v}sync flags

2018-06-27 Thread Emil Velikov
On 27 June 2018 at 12:42, Guido Günther  wrote:
> Hi,
> On Wed, Jun 27, 2018 at 11:30:40AM +0100, Emil Velikov wrote:
>> On 26 June 2018 at 19:40, Guido Günther  wrote:
>> > Some modeline generators put out e.g. +HSync instead of +hsync. Accept
>> > that too since it's not ambigous.
>> >
>> Hmm which generator is that? The cvt one, given as an example seems to
>> produce lowercase ones.
>
> The xorg.conf manpage uses +HSync and a calculator generating just that is
>
>   https://arachnoid.com/modelines/
>
You are right, xorg.conf does list the camelcase instances. At the
same time nearly anything in that file is case insensitive.

> and I don't see why doing this case insensitive would hurt anyone and
> make things less error prone for users.
Yes it is trivial and more importantly it's not my call to make [as I
mentioned earlier].

Having "modeline" and "less error prone" in the same context is an
interesting oxymoron.
Instead of having a per display server modelines, a more consistent
and robust solution is to utilise the kernel command line [1] or via a
custom edid blob [2].

HTH
Emil

[1] video=... see the format
https://gitlab.freedesktop.org/lima/linux/blob/a01c47737a9ca118ab75c6fd6e75739b824de830/drivers/gpu/drm/drm_modes.c#L1350

[2] drm_kms_helper.edid_firmware=...
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston] parse_modeline: Ignore case of {h,v}sync flags

2018-06-27 Thread Guido Günther
Hi,
On Wed, Jun 27, 2018 at 11:30:40AM +0100, Emil Velikov wrote:
> On 26 June 2018 at 19:40, Guido Günther  wrote:
> > Some modeline generators put out e.g. +HSync instead of +hsync. Accept
> > that too since it's not ambigous.
> >
> Hmm which generator is that? The cvt one, given as an example seems to
> produce lowercase ones.

The xorg.conf manpage uses +HSync and a calculator generating just that is

  https://arachnoid.com/modelines/

and I don't see why doing this case insensitive would hurt anyone and
make things less error prone for users.
Cheers,
 -- Guido
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston v2] ivi-shell: use install paths in example config

2018-06-27 Thread Emil Velikov
On 27 June 2018 at 12:01, Michael Tretter  wrote:
> Hi,
>
> On Fri, 25 May 2018 08:46:16 +0200, Michael Tretter wrote:
>> On Thu, 24 May 2018 17:08:47 +0200, Emre Ucan wrote:
>> > The example weston.ini file uses source and build
>> > directory paths. Therefore, it is only useful when
>> > used on the same system that is used to build Weston.
>> >
>> > We can use install paths instead of build/source paths
>> > to fix this problem.
>> >
>> > v2 changes:
>> > - use $(westondatadir) instead of $(datadir)
>> >
>> > Reported-by: Michael Tretter 
>> > Signed-off-by: Emre Ucan 
>>
>> Reviewed-by: Michael Tretter 
>
> Some variables that this patch touches have already been removed, but I
> think it would still make change to rename 'abs_top_builddir' and
> 'abs_top_srcdir'. Is there anything preventing this patch from being
> applied?
>
Is this still required with the recently landed builddir changes by Dan/Pekka?
I'll give it a look after lunch and can offer some feedback, after
lunch. Gut feeling atm is that this breaks make check.

Do check the in-flight "commit access" patches from Pekka.

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


Re: [PATCH weston v2] ivi-shell: use install paths in example config

2018-06-27 Thread Michael Tretter
Hi,

On Fri, 25 May 2018 08:46:16 +0200, Michael Tretter wrote:
> On Thu, 24 May 2018 17:08:47 +0200, Emre Ucan wrote:
> > The example weston.ini file uses source and build
> > directory paths. Therefore, it is only useful when
> > used on the same system that is used to build Weston.
> > 
> > We can use install paths instead of build/source paths
> > to fix this problem.
> > 
> > v2 changes:
> > - use $(westondatadir) instead of $(datadir)
> > 
> > Reported-by: Michael Tretter 
> > Signed-off-by: Emre Ucan   
> 
> Reviewed-by: Michael Tretter 

Some variables that this patch touches have already been removed, but I
think it would still make change to rename 'abs_top_builddir' and
'abs_top_srcdir'. Is there anything preventing this patch from being
applied?

Michael

> 
> Thanks
> 
> Michael
> 
> > ---
> >  Makefile.am |  4 +---
> >  ivi-shell/weston.ini.in | 60 
> > -
> >  2 files changed, 31 insertions(+), 33 deletions(-)
> > 
> > diff --git a/Makefile.am b/Makefile.am
> > index 69ca6cb..819c9c9 100644
> > --- a/Makefile.am
> > +++ b/Makefile.am
> > @@ -24,10 +24,8 @@ weston.ini : $(srcdir)/weston.ini.in
> >  ivi-shell/weston.ini : $(srcdir)/ivi-shell/weston.ini.in
> > $(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(SED) \
> > -e 's|@bindir[@]|$(bindir)|g' \
> > -   -e 's|@abs_top_builddir[@]|$(abs_top_builddir)|g' \
> > -   -e 's|@abs_top_srcdir[@]|$(abs_top_srcdir)|g' \
> > -e 's|@libexecdir[@]|$(libexecdir)|g' \
> > -   -e 's|@plugin_prefix[@]||g' \
> > +   -e 's|@westondatadir[@]|$(westondatadir)|g' \
> > $< > $@
> >  
> >  all-local : weston.ini ivi-shell/weston.ini
> > diff --git a/ivi-shell/weston.ini.in b/ivi-shell/weston.ini.in
> > index 3f11e1c..58cba54 100644
> > --- a/ivi-shell/weston.ini.in
> > +++ b/ivi-shell/weston.ini.in
> > @@ -1,9 +1,9 @@
> >  [core]
> > -shell=@plugin_pre...@ivi-shell.so
> > -modules=@plugin_pre...@hmi-controller.so
> > +shell=ivi-shell.so
> > +modules=hmi-controller.so
> >  
> >  [ivi-shell]
> > -ivi-shell-user-interface=@abs_top_builddir@/weston-ivi-shell-user-interface
> > +ivi-shell-user-interface=@libexecdir@/weston-ivi-shell-user-interface
> >  
> >  #developermode=true
> >  
> > @@ -19,20 +19,20 @@ application-layer-id=4000
> >  
> >  transition-duration=300
> >  
> > -background-image=@abs_top_srcdir@/data/background.png
> > +background-image=@westondatadir@/background.png
> >  background-id=1001
> > -panel-image=@abs_top_srcdir@/data/panel.png
> > +panel-image=@westondatadir@/panel.png
> >  panel-id=1002
> >  surface-id-offset=10
> > -tiling-image=@abs_top_srcdir@/data/tiling.png
> > +tiling-image=@westondatadir@/tiling.png
> >  tiling-id=1003
> > -sidebyside-image=@abs_top_srcdir@/data/sidebyside.png
> > +sidebyside-image=@westondatadir@/sidebyside.png
> >  sidebyside-id=1004
> > -fullscreen-image=@abs_top_srcdir@/data/fullscreen.png
> > +fullscreen-image=@westondatadir@/fullscreen.png
> >  fullscreen-id=1005
> > -random-image=@abs_top_srcdir@/data/random.png
> > +random-image=@westondatadir@/random.png
> >  random-id=1006
> > -home-image=@abs_top_srcdir@/data/home.png
> > +home-image=@westondatadir@/home.png
> >  home-id=1007
> >  workspace-background-color=0x9900
> >  workspace-background-id=2001
> > @@ -43,59 +43,59 @@ path=@libexecdir@/weston-keyboard
> >  [ivi-launcher]
> >  workspace-id=0
> >  icon-id=4001
> > -icon=@abs_top_srcdir@/data/icon_ivi_flower.png
> > -path=@abs_top_builddir@/weston-flower
> > +icon=@westondatadir@/icon_ivi_flower.png
> > +path=@bindir@/weston-flower
> >  
> >  [ivi-launcher]
> >  workspace-id=0
> >  icon-id=4002
> > -icon=@abs_top_srcdir@/data/icon_ivi_clickdot.png
> > -path=@abs_top_builddir@/weston-clickdot
> > +icon=@westondatadir@/icon_ivi_clickdot.png
> > +path=@bindir@/weston-clickdot
> >  
> >  [ivi-launcher]
> >  workspace-id=1
> >  icon-id=4003
> > -icon=@abs_top_srcdir@/data/icon_ivi_simple-egl.png
> > -path=@abs_top_builddir@/weston-simple-egl
> > +icon=@westondatadir@/icon_ivi_simple-egl.png
> > +path=@bindir@/weston-simple-egl
> >  
> >  [ivi-launcher]
> >  workspace-id=1
> >  icon-id=4004
> > -icon=@abs_top_srcdir@/data/icon_ivi_simple-shm.png
> > -path=@abs_top_builddir@/weston-simple-shm
> > +icon=@westondatadir@/icon_ivi_simple-shm.png
> > +path=@bindir@/weston-simple-shm
> >  
> >  [ivi-launcher]
> >  workspace-id=2
> >  icon-id=4005
> > -icon=@abs_top_srcdir@/data/icon_ivi_smoke.png
> > -path=@abs_top_builddir@/weston-smoke
> > +icon=@westondatadir@/icon_ivi_smoke.png
> > +path=@bindir@/weston-smoke
> >  
> >  [ivi-launcher]
> >  workspace-id=3
> >  icon-id=4006
> > -icon=@abs_top_srcdir@/data/icon_ivi_flower.png
> > -path=@abs_top_builddir@/weston-flower
> > +icon=@westondatadir@/icon_ivi_flower.png
> > +path=@bindir@/weston-flower
> >  
> >  [ivi-launcher]
> >  workspace-id=3
> >  icon-id=4007
> > -icon=@abs_top_srcdir@/data/icon_ivi_clickdot.png
> > 

Re: [PATCH v7 5/6] compositor-fbdev: detect the first fb device in the seat

2018-06-27 Thread Emil Velikov
On 27 June 2018 at 00:39, nerdopolis  wrote:
> This adds a function to detect the first framebuffer device in the
> current seat. Instead of hardcoding /dev/fb0, detect the device
> with udev, favoring the boot_vga device, and falling back to the
> first framebuffer device in the seat if there is none. This is very
> similar to what compositor-drm does to find display devices
> ---
>  libweston/compositor-fbdev.c | 83 ++--
>  1 file changed, 80 insertions(+), 3 deletions(-)
>
> diff --git a/libweston/compositor-fbdev.c b/libweston/compositor-fbdev.c
> index e3777495..616300dc 100644
> --- a/libweston/compositor-fbdev.c
> +++ b/libweston/compositor-fbdev.c
> @@ -777,6 +777,77 @@ session_notify(struct wl_listener *listener, void *data)
> }
>  }
>
> +static char *
> +find_framebuffer_device(struct fbdev_backend *b, const char *seat)
> +{
> +   struct udev_enumerate *e;
> +   struct udev_list_entry *entry;
> +   const char *path, *device_seat, *id, *fb_device_path;
> +   struct udev_device *device, *fb_device, *pci;
> +
> +   e = udev_enumerate_new(b->udev);
> +   udev_enumerate_add_match_subsystem(e, "graphics");
> +   udev_enumerate_add_match_sysname(e, "fb[0-9]*");
> +
> +   udev_enumerate_scan_devices(e);
> +   fb_device = NULL;
> +   udev_list_entry_foreach(entry, udev_enumerate_get_list_entry(e)) {
> +   bool is_boot_vga = false;
> +
> +   path = udev_list_entry_get_name(entry);
> +   device = udev_device_new_from_syspath(b->udev, path);
> +   if (!device)
> +   continue;
> +   device_seat = udev_device_get_property_value(device, 
> "ID_SEAT");
> +   if (!device_seat)
> +   device_seat = default_seat;
> +   if (strcmp(device_seat, seat)) {
> +   udev_device_unref(device);
> +   continue;
> +   }
> +
> +   pci = udev_device_get_parent_with_subsystem_devtype(device,
> +   "pci", NULL);
> +   if (pci) {
> +   id = udev_device_get_sysattr_value(pci, "boot_vga");
> +   if (id && !strcmp(id, "1"))
> +   is_boot_vga = true;
> +   }
> +
> +   /* If a framebuffer device was found, and this device isn't
> +* the boot-VGA device, don't use it. */
> +   if (!is_boot_vga && fb_device) {
> +   udev_device_unref(device);
> +   continue;
> +   }
> +
> +   /* There can only be one boot_vga device. Try to use it
> +* at all costs. */
> +   if (is_boot_vga) {
> +   if (fb_device)
> +   udev_device_unref(fb_device);
> +   fb_device = device;
> +   break;
> +   }
> +
> +   /* Per the (!is_boot_vga && fb_device) test above, only
> +* trump existing saved devices with boot-VGA devices, so if
> +* the test ends up here, this must be the first device seen. 
> */
> +   assert(!fb_device);
> +   fb_device = device;
> +   }
> +
> +   udev_enumerate_unref(e);
> +
This function (barring the if bellow) seems mostly identical to the
one in compositor-drm.c
Might be a good idea to make it a helper vaguely alike

struct udev_device *
foo(struct backend *b, const char *seat, const char *subsys, const
char *sysname,
  int (*predicate)(struct backend b*, struct udev_device *d))

The callers will be as trivial as
foo(b, seat, "drm", "card[0-9]*", drm_device_is_kms);
foo(b, seat, "graphics", "fb[0-9]*", NULL);

You'd want to do this at some point, since close to nobody tests
fbdev. I think that people porting any drm fixes to fbdev is even less
;-)

> +   if (fb_device)
> +   {
> +   fb_device_path=strdup(udev_device_get_devnode(fb_device));
> +   udev_device_unref(fb_device);
> +   }
> +
Obviously this trivial hunk will have to stay in fbdev.

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


Re: [PATCH v7 0/6] Make Weston multiseat aware

2018-06-27 Thread Emil Velikov
On 27 June 2018 at 00:39, nerdopolis  wrote:
> These patches make Weston handle multiple seats. Fixes from the last
> attempt include updating fbdev_set_screen_info , updating some fuzz,
> and making the selection of the framebuffer device similar to
> compositor-drm.c by favoring the boot_vga device, and making
> requested changes
>
With the leak plugged the series is
Reviewed-by: Emil Velikov 

I would strongly recommend the boot_vga refactor as well, but I don't
think it's worth blocking on it.

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


Re: [PATCH v7 3/6] launcher-logind: only get a VT on seat0, as only seat0 supports VTs

2018-06-27 Thread Emil Velikov
On 27 June 2018 at 00:39, nerdopolis  wrote:
> As only seat0 supports TTYs, this changes the logind launcher where
> it detects a TTY, only if the seat is seat0. This has only been
> tested for logind
> ---
>  libweston/launcher-logind.c | 22 --
>  libweston/launcher-util.c   |  4 
>  2 files changed, 16 insertions(+), 10 deletions(-)
>
> diff --git a/libweston/launcher-logind.c b/libweston/launcher-logind.c
> index d0559c8f..36a4e642 100644
> --- a/libweston/launcher-logind.c
> +++ b/libweston/launcher-logind.c
> @@ -762,18 +762,20 @@ launcher_logind_connect(struct weston_launcher **out, 
> struct weston_compositor *
> free(t);
> goto err_session;
> }
> -   free(t);
>
> -   r = weston_sd_session_get_vt(wl->sid, >vtnr);
> -   if (r < 0) {
> -   weston_log("logind: session not running on a VT\n");
> -   goto err_session;
> -   } else if (tty > 0 && wl->vtnr != (unsigned int )tty) {
> -   weston_log("logind: requested VT --tty=%d differs from real 
> session VT %u\n",
> -  tty, wl->vtnr);
> -   r = -EINVAL;
> -   goto err_session;
> +   if (!strcmp(t, "seat0")) {
> +   r = weston_sd_session_get_vt(wl->sid, >vtnr);
> +   if (r < 0) {
> +   weston_log("logind: session not running on a VT\n");
> +   goto err_session;
> +   } else if (tty > 0 && wl->vtnr != (unsigned int )tty) {
> +   weston_log("logind: requested VT --tty=%d differs 
> from real session VT %u\n",
> +  tty, wl->vtnr);
> +   r = -EINVAL;
> +   goto err_session;
> +   }
> }
> +   free(t);
>
t is leaked in the error paths. The briefest way to handle is
  r = strcmp(...);
  free(t);
  if (r == 0) {
existing_get_vt_code
  }

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


Re: [PATCH weston] parse_modeline: Ignore case of {h,v}sync flags

2018-06-27 Thread Emil Velikov
On 26 June 2018 at 19:40, Guido Günther  wrote:
> Some modeline generators put out e.g. +HSync instead of +hsync. Accept
> that too since it's not ambigous.
>
Hmm which generator is that? The cvt one, given as an example seems to
produce lowercase ones.
Personally I'm inclined to suggest fixing the generator or using cvt,
instead of working around it here.

That said, more experienced developers should make the call.

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


Re: [PATCH weston 1/2] desktop-shell: fix output removal for background/panel

2018-06-27 Thread Pekka Paalanen
On Tue, 26 Jun 2018 09:28:42 +
Marius-cristian Vlad  wrote:

> On Thu, 2018-06-21 at 15:53 +0300, Pekka Paalanen wrote:
> > From: Pekka Paalanen 
> > 
> > When the compositor has multiple outputs (not clones) and one of them
> > is
> > removed, the ones remaining to the right will be moved to close the
> > gap.
> > Because reflowing the remaining outputs happens before removing the
> > wl_output global, we get the new output x,y before the removal. This
> > causes us to consider the remaining output immediately to the right
> > of
> > the removed output to be a clone of the removed output whose x,y
> > don't
> > get updated. That will then hit the two assertions this patch
> > removes.
> > 
> > The reason the assertions were not actually hit is because of a
> > compositor bug which moved the remaining outputs in the wrong
> > direction.
> > The next patch will fix the reflow, so we need this patch first to
> > avoid
> > the asserts.
> > 
> > Remove the assertions and hand over the background and panel if the
> > "clone" does not already have them. If the clone already has them, we
> > destroy the unnecessary background and panel.
> > 
> > Signed-off-by: Pekka Paalanen 
> > ---
> >  clients/desktop-shell.c | 37 -
> >  1 file changed, 24 insertions(+), 13 deletions(-)
> > 
> > diff --git a/clients/desktop-shell.c b/clients/desktop-shell.c
> > index 6d19d029..fcc0b657 100644
> > --- a/clients/desktop-shell.c
> > +++ b/clients/desktop-shell.c
> > @@ -1337,19 +1337,30 @@ output_remove(struct desktop *desktop, struct
> > output *output)
> >     }
> >  
> >     if (rep) {
> > -   /* If found, hand over the background and panel so
> > they don't
> > -    * get destroyed. */
> > -   assert(!rep->background);
> > -   assert(!rep->panel);
> > -
> > -   rep->background = output->background;
> > -   output->background = NULL;
> > -   rep->background->owner = rep;
> > -
> > -   rep->panel = output->panel;
> > -   output->panel = NULL;
> > -   if (rep->panel)
> > -   rep->panel->owner = rep;
> > +   /* If found and it does not already have a
> > background or panel,
> > +    * hand over the background and panel so they don't
> > get
> > +    * destroyed.
> > +    *
> > +    * We never create multiple backgrounds or panels
> > for clones,
> > +    * but if the compositor moves outputs, a pair of
> > wl_outputs
> > +    * might become "clones". This may happen
> > temporarily when
> > +    * an output is about to be removed and the rest are
> > reflowed.
> > +    * In this case it is correct to let the
> > background/panel be
> > +    * destroyed.
> > +    */
> > +
> > +   if (!rep->background) {
> > +   rep->background = output->background;
> > +   output->background = NULL;
> > +   rep->background->owner = rep;
> > +   }
> > +
> > +   if (!rep->panel) {
> > +   rep->panel = output->panel;
> > +   output->panel = NULL;
> > +   if (rep->panel)  
> Guess copy-pasta from above, but is the test necessary? 

A background is mandatory, but a panel is optional: output->panel can
be NULL. Therefore the test is not needed for the background but it is
needed for the panel. This is the same as in the old code.

> 
> Reviewed-by: Marius Vlad 

Thanks,
pq


> 
> > +   rep->panel->owner = rep;
> > +   }
> >     }
> >  
> >     output_destroy(output)  



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