platform/upstream/weston.git
6 years agocompositor-drm: fix z-order inversion in plane assignment
Matt Hoosier [Thu, 24 Aug 2017 14:24:20 +0000 (09:24 -0500)]
compositor-drm: fix z-order inversion in plane assignment

As discussed in the following thread:

https://lists.freedesktop.org/archives/wayland-devel/2017-August/034755.html

the existing plane assignment in the DRM backend is vulnerable to
accidental masking of the intended fullscreen surface. This change
adds a simple stateful memory to the plane assignment algorithm
to prevent that.

Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agoweston: added missing header time.h
Valery Kartel [Wed, 9 Aug 2017 11:27:29 +0000 (14:27 +0300)]
weston: added missing header time.h

without it I can't built weston on alpinelinux

Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agotests: Fix integer overflows on 32-bit systems
Alexandros Frantzis [Fri, 1 Dec 2017 17:28:52 +0000 (19:28 +0200)]
tests: Fix integer overflows on 32-bit systems

Ensure that the integer type used in expressions involving
multiplication with NSEC_PER_SEC is large enough to avoid overflows on
32-bit systems. In the expressions fixed by this patch a 64-bit type
(long long) is required.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agodnd: Abort with an error message if compositor doesn't support drag and drop
Derek Foreman [Thu, 20 Apr 2017 19:31:37 +0000 (14:31 -0500)]
dnd: Abort with an error message if compositor doesn't support drag and drop

This test isn't particularly useful when the compositor doesn't support
drag and drop - so bail if we fail to create a data source.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agoclients: Don't crash when compositor doesn't support drag and drop
Derek Foreman [Thu, 20 Apr 2017 19:31:36 +0000 (14:31 -0500)]
clients: Don't crash when compositor doesn't support drag and drop

display_create_data_source() can return NULL when there's no data device
manager present.  Instead of carrying on blindly, test its return value.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agoweston-info: Add support for zwp_linux_dmabuf_v1
Emmanuel Gil Peyrot [Tue, 3 Oct 2017 13:36:21 +0000 (14:36 +0100)]
weston-info: Add support for zwp_linux_dmabuf_v1

This now prints each (format, modifier) tuple, to show which ones the
compositor sends to its clients.  It is only implemented for version 3+,
since I didn’t have any compositor implementing previous versions, and
the old `format` event is deprecated anyway.

Signed-off-by: Emmanuel Gil Peyrot <emmanuel.peyrot@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agotests: Mark tests as used so they don’t get removed at link time
Emmanuel Gil Peyrot [Fri, 14 Apr 2017 18:48:07 +0000 (19:48 +0100)]
tests: Mark tests as used so they don’t get removed at link time

Without this attribute, the test macros were making Weston fail to
build with LTO enabled.

Signed-off-by: Markus Trippelsdorf <markus@trippelsdorf.de>
Signed-off-by: Emmanuel Gil Peyrot <emmanuel.peyrot@collabora.com>
Tested-by: Emmanuel Gil Peyrot <emmanuel.peyrot@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agotests: Add one more indentation level to some macros
Emmanuel Gil Peyrot [Fri, 14 Apr 2017 18:48:06 +0000 (19:48 +0100)]
tests: Add one more indentation level to some macros

This is a preparatory patch for the next one.

Signed-off-by: Emmanuel Gil Peyrot <emmanuel.peyrot@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agogl-renderer: Set pitch correctly for subsampled textures
Daniel Stone [Thu, 5 Oct 2017 14:31:26 +0000 (15:31 +0100)]
gl-renderer: Set pitch correctly for subsampled textures

zwp_linux_dmabuf_v1 allows clients to pass an explicit pitch for each
plane, but wl_shm only takes a single pitch parameter; the pitch for
secondary planes must be inferred.

Multi-plane sub-sampled textures have partial width/height, e.g.
YUV420/I420 has a full-size Y plane, followed by a half-width/height U
plane, and a half-width/height V plane.

GStreamer's waylandsink - the only user of wl_shm YUV formats - expects
the implementation to follow the example of Xv and implicitly divide the
pitch for secondary planes by the subsampling factor. gl-renderer was
not doing this, and instead just using the (larger) stride provided by
the client for all planes in the buffer.

Fix gl-renderer to divide pitch by the subsampling factor when uploading
from subsampled SHM buffers into GL textures, also dividing co-ordinates
when doing offset partial uploads.

Tested with:
  $ gst-launch-1.0 videotestsrc ! waylandsink

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reported-by: Fabien Lahoudere <fabien.lahoudere@collabora.co.uk>
Tested-by: Fabien Lahoudere <fabien.lahoudere@collabora.co.uk>
Reviewed-by: Arnaud Vrac <avrac@freebox.fr>
Acked-by: Vincent ABRIOU <vincent.abriou@st.com>
Acked-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Fixes: fdeefe42418 ("gl-renderer: add support of WL_SHM_FORMAT_YUV420")
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103063

6 years agoclients/editor: Toggle panel visibility on click
Joshua Watt [Sat, 24 Jun 2017 21:03:42 +0000 (16:03 -0500)]
clients/editor: Toggle panel visibility on click

If the --click-to-show option is specified, clicking an input field will toggle
the input panel visiblity

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Tested-by: Silvan Jegen <s.jegen@gmail.com>
Reviewed-by: Jan Arne Petersen <janarne@gmail.com>
6 years agotext-backend: Allow client hiding of input panel
Joshua Watt [Sat, 24 Jun 2017 21:03:41 +0000 (16:03 -0500)]
text-backend: Allow client hiding of input panel

Previously, the hide_input_panel and show_input_panel messages for the text
input protocol were limited to specific cases, such as showing the panel on
activation, or making the panel visible after activation. Now, clients are
allowed to toggle the panel visiblity at will as long as they are the currently
active client

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Tested-by: Silvan Jegen <s.jegen@gmail.com>
Reviewed-by: Jan Arne Petersen <janarne@gmail.com>
6 years agoman: mention logind for launching
Pekka Paalanen [Tue, 31 Oct 2017 09:29:25 +0000 (11:29 +0200)]
man: mention logind for launching

Logind has been long supported as means to launch Weston without
weston-launch. It's good to note it in the manual.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
6 years agocompositor-drm, compositor-fbdev: stop suggesting root
Pekka Paalanen [Tue, 31 Oct 2017 08:19:48 +0000 (10:19 +0200)]
compositor-drm, compositor-fbdev: stop suggesting root

Stop suggesting to run Weston as root, it is only meant for debugging.
Instead, mention the two supported ways to run Weston on DRM and fbdev:
weston-launch helper and logind service.

Cc: "Ucan, Emre (ADITG/ESB)" <eucan@de.adit-jv.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
[Pekka: added forgotten "using" word.]

6 years agoweston-launch: improve help text for -u and -t
Pekka Paalanen [Wed, 1 Nov 2017 10:20:24 +0000 (12:20 +0200)]
weston-launch: improve help text for -u and -t

Explain that -u requires root and -t requires -u. Most importantly,
document in what format does -t expect the tty to be given.

It has been confusing, because Weston's --tty option takes an integer,
weston-launch takes a full device path.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
6 years agoweston-launch: fix -t option parsing
Pekka Paalanen [Wed, 1 Nov 2017 11:20:03 +0000 (13:20 +0200)]
weston-launch: fix -t option parsing

Fix an issue introduced in:

 commit ab4999492ce630e6bb1c93215fc052c2c29913bd
 Author: Kristian Høgsberg <krh@bitplanet.net>
 Date:   Fri Jul 19 21:26:24 2013 -0700

     weston-launch: Drop sleep_fork option

where the option string accidentally became "t::". That causes

$ weston-lauch -t /dev/tty4

to be parsed incorrectly, as if -t option had no argument and the tty
path gets passed to weston which errors out because of it.

This patch fixes the above to work as expected.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
6 years agoweston-launch: quit if -t without -u
Pekka Paalanen [Wed, 1 Nov 2017 10:12:17 +0000 (12:12 +0200)]
weston-launch: quit if -t without -u

setup_tty() function uses the tty argument for choosing the tty/VT only
if wl->new_user (the -u option) is given. If the tty option is given
without -u, it will only be used for misleading error messages.

To make it clear to the user that -t without -u does not work the way
one might think, let weston-launch exit with an error in that case.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
6 years agoweston: add wait-for-debugger option
Pekka Paalanen [Wed, 1 Nov 2017 08:26:46 +0000 (10:26 +0200)]
weston: add wait-for-debugger option

When you need to start Weston via weston-launch, systemd unit, or any
other runner, it is annoying to try to get in with a debugger,
especially if the thing you are interested in happens at start-up. To
make it easy, a new option is introduced.

The new option, implemented both as a command line option and a
weston.ini option, raises SIGSTOP early in the start-up, before the
weston_compositor has been created. This allows one to attach a debugger
at a known point in execution, and resume execution with SIGCONT.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Ian Ray <ian.ray@ge.com>
6 years agoweston: arm SEGV handler earlier
Pekka Paalanen [Wed, 11 Oct 2017 12:17:47 +0000 (15:17 +0300)]
weston: arm SEGV handler earlier

It is useful to print the backtrace regardless of whether we have a
compositor and a backend initialized yet. Move catch_signals() to the
earliest point in main() and protect the SEGV handler from dereferencing
NULL when we don't yet have a compositor or a backend.

The SEGV handler uses weston_log(), so cannot move catch_signals() any
earlier.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agolibweston: Use struct timespec for compositor time
Alexandros Frantzis [Thu, 16 Nov 2017 16:21:01 +0000 (18:21 +0200)]
libweston: Use struct timespec for compositor time

Change weston_compositor_get_time to return the current compositor time
as a struct timespec. Also, use clock_gettime (with CLOCK_REALTIME) to
get the time, since it's equivalent to the currently used gettimeofday
call, but returns the data directly in a struct timespec.

This commit is part of a larger effort to transition the Weston codebase
to struct timespec.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
6 years agolibweston: Use struct timespec for touch motion events
Alexandros Frantzis [Thu, 16 Nov 2017 16:21:00 +0000 (18:21 +0200)]
libweston: Use struct timespec for touch motion events

Change code related to touch motion events to use struct timespec to
represent time.

This commit is part of a larger effort to transition the Weston codebase
to struct timespec.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
6 years agolibweston: Use struct timespec for touch up events
Alexandros Frantzis [Thu, 16 Nov 2017 16:20:59 +0000 (18:20 +0200)]
libweston: Use struct timespec for touch up events

Change code related to touch up events to use struct timespec to represent
time.

This commit is part of a larger effort to transition the Weston codebase
to struct timespec.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
6 years agolibweston: Use struct timespec for touch down events
Alexandros Frantzis [Thu, 16 Nov 2017 16:20:58 +0000 (18:20 +0200)]
libweston: Use struct timespec for touch down events

Change code related to touch down events to use struct timespec to
represent time.

This commit is part of a larger effort to transition the Weston codebase
to struct timespec.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
6 years agolibweston: Use struct timespec for key events
Alexandros Frantzis [Thu, 16 Nov 2017 16:20:57 +0000 (18:20 +0200)]
libweston: Use struct timespec for key events

Change code related to key events to use struct timespec to represent
time.

This commit is part of a larger effort to transition the Weston codebase
to struct timespec.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
6 years agolibweston: Use struct timespec for axis events
Alexandros Frantzis [Thu, 16 Nov 2017 16:20:56 +0000 (18:20 +0200)]
libweston: Use struct timespec for axis events

Change code related to axis events to use struct timespec to represent
time.

This commit is part of a larger effort to transition the Weston codebase
to struct timespec.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
6 years agolibweston: Use struct timespec for button events
Alexandros Frantzis [Thu, 16 Nov 2017 16:20:55 +0000 (18:20 +0200)]
libweston: Use struct timespec for button events

Change code related to button events to use struct timespec to represent
time.

This commit is part of a larger effort to transition the Weston codebase
to struct timespec.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
6 years agolibweston: Use struct timespec for motion events
Alexandros Frantzis [Fri, 24 Nov 2017 16:01:46 +0000 (18:01 +0200)]
libweston: Use struct timespec for motion events

Change code related to motion events to use struct timespec to represent
time.

This commit is part of a larger effort to transition the Weston codebase
to struct timespec.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
6 years agolibweston: Use struct timespec for the output presentation timestamp
Alexandros Frantzis [Thu, 16 Nov 2017 16:20:53 +0000 (18:20 +0200)]
libweston: Use struct timespec for the output presentation timestamp

Store the output presentation timestamp as struct timespec.

This commit is part of a larger effort to transition the Weston codebase
to struct timespec.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
6 years agobuild,libweston: Use struct timespec for animations
Alexandros Frantzis [Thu, 16 Nov 2017 16:20:52 +0000 (18:20 +0200)]
build,libweston: Use struct timespec for animations

Change code related to animations to use struct timespec to represent
time.

This commit is part of a larger effort to transition the Weston codebase
to struct timespec.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
This bumps the libweston major version due to breakage in the animation
ABI. The commits following this one break more ABI in other parts.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
6 years agoshared: Add helpers to convert between various time units and timespec
Alexandros Frantzis [Thu, 16 Nov 2017 16:20:51 +0000 (18:20 +0200)]
shared: Add helpers to convert between various time units and timespec

Add helper functions to make it easy and less error-prone to convert
between values in various time units (nsec, usec, msec) and struct
timespec. These helpers are going to be used in the upcoming commits to
transition the Weston codebase to struct timespec.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
6 years agoshared: Add timespec_is_zero helper
Alexandros Frantzis [Mon, 27 Nov 2017 08:54:49 +0000 (10:54 +0200)]
shared: Add timespec_is_zero helper

Add a helper function to check if a struct timespec is zero. This helper
will be used in the upcoming commits to transition the Weston codebase
to struct timespec.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
6 years agoivi-shell: Fix incorrect use of logical instead of bitwise operator
Alexandros Frantzis [Fri, 17 Nov 2017 11:39:06 +0000 (13:39 +0200)]
ivi-shell: Fix incorrect use of logical instead of bitwise operator

Fix the code to use the correct bitwise AND operator '&', instead of the
currently used logical AND operator '&&', to check the value of a bit
flag in a bit mask.

This problem was reported as a warning when building with clang.

Reviewed-by: Emre Ucan <eucan@de.adit-jv.com>
7 years agobuildsystem: add missing pkg-config stub for libweston uninstalled
Reynaldo H. Verdejo Pinochet [Fri, 3 Nov 2017 19:48:31 +0000 (12:48 -0700)]
buildsystem: add missing pkg-config stub for libweston uninstalled

-uninstalled.pc files are a pkg-config facility for working with
uninstalled libraries.

With pkg-config, foo-uninstalled.pc overrides foo.pc. foo-uninstalled.pc
should never be installed, and will be generated with references to the
build directory.

If you set up your environment so pkg-config looks for .pc files in your
build directories, you can use this to build and link against libraries
you haven't installed with "make install".

This can save time and space over installing with a prefix.

Signed-off-by: Reynaldo H. Verdejo Pinochet <reynaldo@osg.samsung.com>
Acked-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
7 years agocompositor-wayland: fix shm_buffer damage init
Pekka Paalanen [Tue, 24 Oct 2017 07:28:43 +0000 (10:28 +0300)]
compositor-wayland: fix shm_buffer damage init

It appears that wayland_shm_buffer::damage is in the global coordinate
space. Therefore initializing it to width x height at 0,0 is not correct
for any output not positioned at 0,0. That is, all outputs after the
first one get it wrong.

Initialize it from the output region, which is in the global coordinate
space.

While at it, add a comment to note that damage is in global coordinate
space. As I can see, this was the last confusion about it.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Acked-by: Daniel Stone <daniels@collabora.com>
7 years agocompositor-wayland: fix damage coordinates with pixman renderer
Armin Krezović [Mon, 23 Oct 2017 14:10:01 +0000 (16:10 +0200)]
compositor-wayland: fix damage coordinates with pixman renderer

Damage coordinates are in global coordinate space, and they need to
be translated to local coordinate space so multiple outputs can work.

This path now matches the similar path in the X11 backend.

This patch fixes the appearance of multiple windows in the parent
compositor. Previously, all windows except the one with nested output
position 0,0 would have their damage for the parent wl_surface always
fall outside of the wl_surface, save the decorations which were handled
separately. If the parent compositor was Weston/GL, this would lead to
the output area remaining black as partial GL texture uploads would
practically never update the texture. If the parent compositor was
Weston/pixman, the parent windows would not update on screen unless
something else caused the area to be repainted.

[Pekka: adjusted commit message]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Acked-by: Daniel Stone <daniels@collabora.com>
7 years agocompositor-wayland: clarify wl_display_connect() error
Pekka Paalanen [Mon, 23 Oct 2017 09:03:38 +0000 (12:03 +0300)]
compositor-wayland: clarify wl_display_connect() error

Clarify the error message to explicitly say one was trying to connect to
a parent Wayland compositor. This hopefully is a good enough hint on
what using the wayland-backend is trying to do.

Add the command line display option value and WAYLAND_DISPLAY values for
good measure. WAYLAND_SOCKET is not shown as libwayland-client removes
it.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Acked-by: Daniel Stone <daniels@collabora.com>
7 years agocompositor-wayland: windowed/fullscreen not on fullscreen-shell
Pekka Paalanen [Wed, 18 Oct 2017 09:31:40 +0000 (12:31 +0300)]
compositor-wayland: windowed/fullscreen not on fullscreen-shell

The set_windowed and set_fullscreen functions are only useful on a
desktop shell, and never called on fullscreen-shell.

Remove the confusing dead code, and ensure we notice if these functions
get called in the wrong environment.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Acked-by: Daniel Stone <daniels@collabora.com>
7 years agocompositor-wayland: allow to unset fullscreen
Pekka Paalanen [Wed, 18 Oct 2017 09:18:39 +0000 (12:18 +0300)]
compositor-wayland: allow to unset fullscreen

To be more symmetric with wayland_output_set_fullscreen(), implement the
xdg-shell path in wayland_output_set_windowed(). This should make it
possible to use the fullscreen key binding to toggle between a floating
window and fullscreen also under xdg-shell.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Acked-by: Daniel Stone <daniels@collabora.com>
7 years agocompositor-wayland: actually free parent_output
Pekka Paalanen [Thu, 19 Oct 2017 07:26:27 +0000 (10:26 +0300)]
compositor-wayland: actually free parent_output

I could not find anywhere where struct parent_output was freed, so
apparently we were leaking it.

Check against wayland_backend_register_output() and add the missing
clean-up: removal from the parent output list, and free().

registry_handle_global_remove() also needs fixing to use a safer loop,
because now we are actually removing the list item.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Acked-by: Daniel Stone <daniels@collabora.com>
7 years agocompositor-wayland: fix mode_list corruption on --sprawl
Pekka Paalanen [Thu, 19 Oct 2017 10:19:50 +0000 (13:19 +0300)]
compositor-wayland: fix mode_list corruption on --sprawl

The wayland-backend with --sprawl is one way to trigger
wayland_output_create_for_parent_output(), which intends to find a mode
from the parent mode list and use it. Calling wayland_output_set_size()
initialized an embedded struct weston_mode and inserts that into the
mode list. Then the assignment output->mode = *mode; corrupts the
mode_list by overwriting the link entry. This leads to an endless loop
in bind_output() in compositor.c.

Fix this by manually doing the setup that wayland_output_set_size() did
and do not call it.

As a side effect, it now relays the parent compositor's physical output
size to our own clients. It no longer smashes the refresh rate either.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Acked-by: Daniel Stone <daniels@collabora.com>
7 years agocompositor-wayland: remove unused 'scale'
Pekka Paalanen [Thu, 19 Oct 2017 10:18:14 +0000 (13:18 +0300)]
compositor-wayland: remove unused 'scale'

This member is only ever set and never read, therefore it is dead.

Delete dead code.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Acked-by: Daniel Stone <daniels@collabora.com>
7 years agocompositor-wayland: avoid recursive dispatch with wl_outputs
Pekka Paalanen [Thu, 19 Oct 2017 09:03:06 +0000 (12:03 +0300)]
compositor-wayland: avoid recursive dispatch with wl_outputs

Calling wl_display_roundtrip() from within a Wayland event handler means
we will re-enter event dispatch, that is, it will lead to recursive
dispatch. Even if libwayland-client was safe, this would lead to
unexpected code paths: the first event handler function has not returned
when other event handler functions may get called. In this particular
case it maybe didn't hurt, but it's still a fragile pattern to use.

Replace the wl_display_roundtrip() with a manual sync callback to do the
work.

This does not break the wayland-backend initialization sequence, because
sprawl_across_outputs was set only after the roundtrip to ensure
wl_registry globals have been received so the code would not have been
hit anyway, and weston_backend_init() also has a second roundtrip that
ensures the per wl_output events have been received before continuing.

For wayland-backend output hotplug the change is insignificant because
it will only delay the output creation a bit, and the parent outputs are
not processed anywhere in between.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Acked-by: Daniel Stone <daniels@collabora.com>
7 years agoweston: fix boolean wayland backend options
Pekka Paalanen [Fri, 20 Oct 2017 13:22:44 +0000 (16:22 +0300)]
weston: fix boolean wayland backend options

Surprisingly, WESTON_OPTION_BOOLEAN uses the type int32_t, not bool.
Passing in a pointer bool does not end well. Fix this to pass in
pointers as parse_options() expects.

This fixes a bug where 'weston --use-pixman --sprawl' would work but
'weston --sprawl --use-pixman' would ignore the --sprawl option.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Acked-by: Daniel Stone <daniels@collabora.com>
7 years agolibweston-desktop/xdg-shell-v6: Actually send same-as-current configure if needed
Quentin Glidic [Tue, 17 Oct 2017 14:14:49 +0000 (16:14 +0200)]
libweston-desktop/xdg-shell-v6: Actually send same-as-current configure if needed

If a surface is in state A, and we just sent a configure for state B,
setting back state A would be ignored, because state B has not been
committed yet.
Now, we check against the latest configured state (which is current
state if configure list is empty).

Reported on wlroots https://github.com/swaywm/wlroots/pull/280

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
7 years agocompositor-wayland: Don't use two different presentation methods for fs shell
Armin Krezović [Tue, 7 Feb 2017 20:03:40 +0000 (21:03 +0100)]
compositor-wayland: Don't use two different presentation methods for fs shell

This patch fixes the wayland backend to not use two different
presentation methods when running on fullscreen-shell.

See also: https://patchwork.freedesktop.org/patch/114534/

v2:

 - Add missing wayland_output_resize_surface() call
 - Start repaint loop after initial frame has been drawn

v3:

 - Redraw the initial frame if present for mode fails

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93514
Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Tested-by: nerdopolis <bluescreen_avenger@verizon.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agocompositor-wayland: destroy the appropriate output instead of exiting when receiving...
Sergi Granell [Wed, 27 Sep 2017 14:06:37 +0000 (16:06 +0200)]
compositor-wayland: destroy the appropriate output instead of exiting when receiving an xdg_toplevel::close event

v2: Fix use after free spotted by Daniel Stone

Signed-off-by: Sergi Granell <xerpi.g.12@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agocompositor-wayland: use input region instead of opaque region to zxdg_shell_v6::set_w...
Sergi Granell [Mon, 25 Sep 2017 09:57:37 +0000 (11:57 +0200)]
compositor-wayland: use input region instead of opaque region to zxdg_shell_v6::set_window_geometry

The opaque region is a few pixels off due to the rounded corners
of the frame decorations, and, therefore, the input region
matches the window's geometry more closely.

Signed-off-by: Sergi Granell <xerpi.g.12@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agocompositor-drm: Allow disabling universal planes
Daniel Stone [Wed, 6 Sep 2017 16:29:57 +0000 (17:29 +0100)]
compositor-drm: Allow disabling universal planes

Add a test environment variable to allow disabling universal planes.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agogl-renderer: Ignore INVALID modifier
Daniel Stone [Tue, 3 Oct 2017 11:58:53 +0000 (12:58 +0100)]
gl-renderer: Ignore INVALID modifier

If the user has passed an INVALID modifier, it's because there is no
applicable modifier, and the buffer layout should be determined by a
magic side-channel call (e.g. bo_get_tiling). If the modifier is
INVALID, don't try to pass it through to EGL, but just drop it.

On the other hand, if a modifier _is_ explicitly specified and we don't
have the modifiers extension, then refuse to import the buffer.

Signed-off-by: Daniel Stone <daniels@collabora.com>
7 years agocompositor-fbdev: fix finish_frame_timer leak
Pekka Paalanen [Thu, 14 Sep 2017 08:43:29 +0000 (11:43 +0300)]
compositor-fbdev: fix finish_frame_timer leak

The timer was never removed anywhere. Remove it in disable() to match
what happens in enable().

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Acked-by Daniel Stone <daniels@collabora.com>

7 years agocompositor-fbdev: rename fbdev_output_disable_handler()
Pekka Paalanen [Wed, 13 Sep 2017 14:25:41 +0000 (17:25 +0300)]
compositor-fbdev: rename fbdev_output_disable_handler()

This is a more logical name for the function, matching the pattern used
in other backends and the hook names.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Acked-by Daniel Stone <daniels@collabora.com>

7 years agocompositor-fbdev: always destroy renderer-output on disable
Pekka Paalanen [Wed, 13 Sep 2017 14:22:38 +0000 (17:22 +0300)]
compositor-fbdev: always destroy renderer-output on disable

If we pass the base->enabled test, then the renderer output is
guaranteed to be there, so we can just destroy it.

Destroying it before unmap makes the sequence match better the enable
path.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Acked-by Daniel Stone <daniels@collabora.com>

7 years agocompositor-fbdev: simplify FB destroy/unmap/disable
Pekka Paalanen [Wed, 13 Sep 2017 14:14:19 +0000 (17:14 +0300)]
compositor-fbdev: simplify FB destroy/unmap/disable

Rename fbdev_frame_buffer_destroy() to fbdev_frame_buffer_unmap()
because that is what it does. Adding the destruction of hw_surface in it
makes it the perfect counterpart to fbdev_frame_buffer_map() which
simplifies the code.

fbdev_frame_buffer_map() can no longer call that, so just open-code the
munmap() there. It is an error path, we don't really care about
failures in an error path.

The error path of fbdev_output_enable() is converted to call
buffer_unmap() since that is exactly what it did.

fbdev_output_disable() became redundant, being identical to
fbdev_frame_buffer_unmap().

Invariant: output->hw_surface cannot be non-NULL without output->fb
being non-NULL. hw_surface wraps the mmapped memory so cannot exist
without the mmap.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Acked-by Daniel Stone <daniels@collabora.com>

7 years agocompositor-fbdev: remove unused output arguments
Pekka Paalanen [Tue, 12 Sep 2017 14:15:42 +0000 (17:15 +0300)]
compositor-fbdev: remove unused output arguments

A few functions had argument 'output' which was not used at all. Remove
such unused arguments.

The coming migration to the head-based output API would have made it
awkward to come up with the output argument for these, but luckily they
are not actually needed.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Sergi Granell <xerpi.g.12@gmail.com>
Acked-by Daniel Stone <daniels@collabora.com>

7 years agolibweston: set backend pointer earlier
Pekka Paalanen [Wed, 30 Aug 2017 08:29:49 +0000 (11:29 +0300)]
libweston: set backend pointer earlier

Change all backends to set the core backend pointer early.

This is necessary for libweston core to be able to access the backend
vfuncs before the backend init function returns. Particularly,
weston_output_init() will be needing to inspect the backend vfuncs to
see if the backend has been converted to a new API. Backends that create
outputs as part of their init would fail without setting the pointer
earlier.

For consistency, all backends are modified instead of just those that
could hit an issue.

Libweston core will take care of resetting the backend pointer to NULL
in case of error since "libweston: ensure backend is not loaded twice".

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Acked-by Daniel Stone <daniels@collabora.com>

7 years agolibweston: ensure backend is not loaded twice
Pekka Paalanen [Tue, 29 Aug 2017 14:04:12 +0000 (17:04 +0300)]
libweston: ensure backend is not loaded twice

Check and ensure that a compositor can only load one backend
successfully. If a backend fails to load, it is theoretically possible
to try another backend. Once loading succeeds, only destroying the
compositor would allow "unloading" a backend.

If backend init fail, ensure the backend pointer remains NULL to avoid
calling into a half-loaded backend on e.g. compositor destruction.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Acked-by Daniel Stone <daniels@collabora.com>

7 years agolibweston: rename weston_output_destroy() to weston_output_release()
Pekka Paalanen [Wed, 16 Aug 2017 09:07:14 +0000 (12:07 +0300)]
libweston: rename weston_output_destroy() to weston_output_release()

'release' is a more appropriate name because the function does not free
the underlying memory. The main reason for this is that we need the name
weston_output_destroy() for new API that actually will free also the
underlying memory.

Since the function is only used in backends and external backends are
not a thing, this does not cause libweston major version bump, even
though it does change the ABI. There is no way external users could have
successfully used this function.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Acked-by Daniel Stone <daniels@collabora.com>

7 years agolibweston: send more wl_surface.enter/leave events
Pekka Paalanen [Fri, 24 Mar 2017 14:21:06 +0000 (16:21 +0200)]
libweston: send more wl_surface.enter/leave events

A client may have bound the same wl_output multiple times, for who knows
what reason. As the server cannot know which wl_output resource to use
for which wl_surface, send enter/leave events for all of them.

This is a protocol correctness fix.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Acked-by Daniel Stone <daniels@collabora.com>

7 years agocompositor-drm: set all properties in create_output_for_connector
Pekka Paalanen [Mon, 3 Apr 2017 11:42:51 +0000 (14:42 +0300)]
compositor-drm: set all properties in create_output_for_connector

Move the remaining scattered setup of the fixed properties into
create_output_for_connector(). All these are already known and they
cannot change.

This helps future refactoring.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Acked-by Daniel Stone <daniels@collabora.com>

7 years agocompositor-drm: set output make/model/serial once
Pekka Paalanen [Mon, 3 Apr 2017 11:22:51 +0000 (14:22 +0300)]
compositor-drm: set output make/model/serial once

This fixes a regression where monitor make and model would always be
advertised as "unknown" to Wayland clients. The EDID strings were parsed
at create_output_for_connector() time, but the fallback "unknown" values
were set in weston_drm_output_api::set_mode vfunc later. This made the
correct monitor info be shown in the log, but not sent to clients.

The purpose of the "unknown" assignments is to give fallback values in
case EDID is not providing them.

Fix all that by moving all setting of the make, model and serial into
create_output_for_connector(). These values cannot change afterwards
anyway. While at it, document find_and_parse_output_edid().

The ugly casts in create_output_for_connector() are required to silence
compositor warnings from ignoring const attribute. This is temporary,
and a future refactoring will get rid of the casts.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Acked-by Daniel Stone <daniels@collabora.com>

7 years agocompositor-wayland: move output init into common, fix error path
Pekka Paalanen [Fri, 11 Aug 2017 13:05:41 +0000 (16:05 +0300)]
compositor-wayland: move output init into common, fix error path

Move the weston_output_init() call into wayland_output_create_common().
This avoids passing the name twice to different functions, and follows
the precedent set in "libweston: weston_output_init(..., +name)" for
calling init before accessing fields.

Since the error paths in wayland_output_create_for_parent_output() and
wayland_output_create_fullscreen() are now guaranteed to have
weston_output init'd, call weston_output_destroy() appropriately. There
might be more to free than just the name.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Acked-by Daniel Stone <daniels@collabora.com>

7 years agolibweston: weston_output_init(..., +name)
Pekka Paalanen [Mon, 3 Apr 2017 10:18:13 +0000 (13:18 +0300)]
libweston: weston_output_init(..., +name)

Add 'name' argument to weston_output_init(). This is much more obvious
than the assert inside weston_output_init() to ensure the caller has set
a field in weston_output first.

Now weston_output_init() will strdup() the name itself, which means we
can drop a whole bunch of strdup()s in the backends. This matches
weston_output_destroy() which was already calling free() on the name.

All backends are slightly reordered to call weston_output_init() before
accessing any fields of weston_output, except the Wayland backend which
would make it a little awkward to do it in this patch. Mind, that
weston_output_init() still does not reset the struct to zero - it is
presumed the caller has done it, since weston_output is embedded in the
backend output structs.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Reviewed-by: David Fort <contact@hardening-consulting.com>
[Daniel: document name copying]
Acked-by Daniel Stone <daniels@collabora.com>

7 years agotests: ensure output dependent IVI tests run
Pekka Paalanen [Thu, 17 Aug 2017 10:30:11 +0000 (13:30 +0300)]
tests: ensure output dependent IVI tests run

There are IVI tests that require an output. Previously these tests would
silently skip if no outputs were present. However, a test setup should
always have outputs with these tests. Skipping could easily leave the
tests dead without notice.

Make these tests fail instead of skip if there are no outputs.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Reviewed-by: Emre Ucan <eucan@de.adit-jv.com>
Acked-by Daniel Stone <daniels@collabora.com>

7 years agolibweston: move weston_output::mode_list init to core
Pekka Paalanen [Wed, 6 Sep 2017 13:47:52 +0000 (16:47 +0300)]
libweston: move weston_output::mode_list init to core

Initialize the list in weston_output_init() instead of doing it
separately in each backend.

One would expect weston_output_init() to initialize all weston_output
members, at least those that are not NULL.

We rely on the set_size() functions to be called only once, as is
assert()'d. If set_size() becomes callable multiple times, this patch
will force them to be fixed to properly manage the mode list instead of
losing all members.

compositor-wayland.c is strange in
wayland_output_create_for_parent_output(): it first called
wayland_output_set_size() that initialized the mode list with a single
mode manufactured from width and height and set that mode as current.
Then it continued to reset the mode list and adding the list of modes
from the parent output, leaving the current mode left to point to a mode
struct that is no longer in the mode list and with a broken 'link'
element. This patch changes things such that the manufactured mode is
left in the list, and the parent mode list is added. This is probably
not quite right either.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Acked-by Daniel Stone <daniels@collabora.com>

7 years agoFix API troubles with FreeRDP 2.0 v2
David Fort [Wed, 27 Sep 2017 10:01:10 +0000 (12:01 +0200)]
Fix API troubles with FreeRDP 2.0 v2

With FreeRDP 2.0 the crypto needs to be initialized or we fail as soon as we try to
compute a md5. The API also changed for the suppress output callback.

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agoshared: struct timespec is in time.h
Yann E. MORIN [Sun, 1 Oct 2017 12:31:10 +0000 (14:31 +0200)]
shared: struct timespec is in time.h

On the musl C library, tests/timespec-text.c does not build, with the
following error:

    In file included from tests/timespec-test.c:36:0:
    ./shared/timespec-util.h:41:21: warning: ‘struct timespec’ declared
    inside parameter list will not be visible outside of this definition
    or declaration
     timespec_sub(struct timespec *r,
                         ^~~~~~~~
   [...]

Indeed, struct timespec is defined in time.h, so we must include it.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agogl-renderer: Emit GPU rendering begin and end timeline timepoints
Alexandros Frantzis [Wed, 27 Sep 2017 12:09:16 +0000 (15:09 +0300)]
gl-renderer: Emit GPU rendering begin and end timeline timepoints

Use EGL fence sync objects to emit timepoints for the beginning and the
end of rendering on the GPU. The timepoints are emitted asynchronously
using the sync file fds associated with the fence sync objects. The sync
file fds are acquired using the facilities provided by the
EGL_ANDROID_native_fence_sync extension.

The asynchronous timepoint submissions are stored in a list in
gl_output_state until they are executed, and any pending submissions
that remain at output destruction time are cleaned up.

If timelining is inactive or the required EGL extensions are not
present, then GPU timepoint processing and emission are skipped.

Note that the GPU timestamps returned by sync files are in the
CLOCK_MONOTONIC clock domain, and are thus compatible with the
timeline timestamps (which also are in the CLOCK_MONOTONIC domain).

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agolibweston: Add check and fallback for linux/sync_file.h
Alexandros Frantzis [Wed, 27 Sep 2017 12:09:15 +0000 (15:09 +0300)]
libweston: Add check and fallback for linux/sync_file.h

The sync file functionality is required by the upcoming GPU render
timeline work, but it's only available in relatively new linux kernel
versions (4.7 and above).

This commit provides a "sanitized" version of the required sync file
definitions.  On systems that don't have the sync file header (due to
having an older kernel), we will be able to fall back to our own
definitions when building.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agogl-renderer: Add support for fence sync extensions
Alexandros Frantzis [Wed, 27 Sep 2017 12:09:14 +0000 (15:09 +0300)]
gl-renderer: Add support for fence sync extensions

Check for the EGL_KHR_fence_sync and EGL_ANDROID_native_fence_sync
extensions and get pointers to required extension functions.

These extensions allow us to acquire GPU timestamp information
asynchronously, and are required by the upcoming work to add
rendering begin/end timepoints to the weston timeline.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agotimeline: Add GPU timestamp timepoint argument
Alexandros Frantzis [Wed, 27 Sep 2017 12:09:13 +0000 (15:09 +0300)]
timeline: Add GPU timestamp timepoint argument

The purpose of this argument is to hold timestamp information about
events that occurred on the GPU. This argument allows us to include GPU
timestamps in timepoints such as the beginning and end of frame
rendering.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agocompositor: fix starvation of wl_buffer::release
Matt Hoosier [Tue, 26 Sep 2017 13:09:40 +0000 (08:09 -0500)]
compositor: fix starvation of wl_buffer::release

This change replaces a queued emission of buffer-release events (which
is prone to starvation) with a regular event emission. This means that
client programs no longer need to secretly install surface frame
listeners just to guarantee that they get correctly notified of buffer
lifecycle events.

v2:

More information about the historical reasons why this change hadn't
happened yet, and the consensus to finally move ahead with it can be
found at the discussion terminating in this message:

https://lists.freedesktop.org/archives/wayland-devel/2017-September/035147.html

Signed-off-by: Matt Hoosier <matt.hoosier@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
7 years agocompositor-drm: unref udev on backend destruction
Pekka Paalanen [Wed, 13 Sep 2017 13:48:01 +0000 (16:48 +0300)]
compositor-drm: unref udev on backend destruction

Fixes a small memory leak, spotted with Valgrind.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
7 years agocompositor-fbdev: unref udev on backend destruction
Pekka Paalanen [Wed, 13 Sep 2017 13:49:02 +0000 (16:49 +0300)]
compositor-fbdev: unref udev on backend destruction

Fixes a small memory leak, spotted with Valgrind.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
7 years agocompositor-fbdev: remove unused field 'depth'
Pekka Paalanen [Thu, 14 Sep 2017 11:41:48 +0000 (14:41 +0300)]
compositor-fbdev: remove unused field 'depth'

Not referenced anywhere ever, has been there since the introduction of
fbdev-backend.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
7 years agocompositor-fbdev: MAP_FAILED is not NULL
Pekka Paalanen [Wed, 13 Sep 2017 08:58:00 +0000 (11:58 +0300)]
compositor-fbdev: MAP_FAILED is not NULL

Fix the assumption that MAP_FAILED would be equal to NULL. It is not.
Set 'fb' explicitly to NULL on mmap failure so that comparisons to NULL
would produce the expected result.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agocompositor-wayland: use asprintf for output title
Pekka Paalanen [Fri, 11 Aug 2017 12:55:32 +0000 (15:55 +0300)]
compositor-wayland: use asprintf for output title

Simplifies the code, and makes moving weston_output_init() into
wayland_output_create_common() a little easier.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
7 years agocompositor-drm: use asprintf in make_connector_name()
Pekka Paalanen [Mon, 3 Apr 2017 10:33:26 +0000 (13:33 +0300)]
compositor-drm: use asprintf in make_connector_name()

Gets rid of the constant size char array.

While here, document the function.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
7 years agodesktop-shell: disable opacity binding when modifier is none
Ian Ray [Mon, 18 Sep 2017 12:22:01 +0000 (15:22 +0300)]
desktop-shell: disable opacity binding when modifier is none

This patch disables the opacity binding when the modifier is configured
to `none' in weston.ini, and thus supports use cases where one does not
want to have this binding.

Signed-off-by: Ian Ray <ian.ray@ge.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agodesktop-shell: use binding_modifier for zoom
Ian Ray [Mon, 18 Sep 2017 12:22:00 +0000 (15:22 +0300)]
desktop-shell: use binding_modifier for zoom

This patch changes the zoom binding to use the modifier configured in
weston.ini instead of hardcoding MODIFIER_SUPER.

Signed-off-by: Ian Ray <ian.ray@ge.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agocalibrator: Make mouse button optional
Fabien Lahoudere [Thu, 7 Sep 2017 13:11:58 +0000 (15:11 +0200)]
calibrator: Make mouse button optional

When calibrating touchscreen with weston-calibrator, you can use the mouse to
click on the cross which is recorded as a touch event. This event is used to
compute the final calibration of the touchscreen which results in invalid
touchscreen calibration and broken touchscreen behaviour.

In order to avoid to use the mouse in weston-calibrator, we disable mouse
operation by default and add a parameter "--enable-mouse" to enable it.

Signed-off-by: Fabien Lahoudere <fabien.lahoudere@collabora.co.uk>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agoclients/nested: fix boolean test
Eric Engestrom [Mon, 11 Sep 2017 12:52:28 +0000 (13:52 +0100)]
clients/nested: fix boolean test

weston_check_egl_extension() returns a bool, not a pointer.

Fixes: ce5b614c80b4dfe8e899 "clients/nested: use weston_check_egl_extension
                             over strstr"
Cc: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agocompositor-drm: remove connector option
Ucan, Emre (ADITG/SW1) [Wed, 8 Mar 2017 15:43:18 +0000 (15:43 +0000)]
compositor-drm: remove connector option

Remove the option, because it is hard to use.
Drm connector ids are hard to reach for users,
and they can change when kernel or device tree
is modified.

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
[Pekka: bump WESTON_DRM_BACKEND_CONFIG_VERSION]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agoivi-shell: Added tests for screen-remove-layer API
Michael Teyfel [Wed, 26 Jul 2017 12:22:49 +0000 (14:22 +0200)]
ivi-shell: Added tests for screen-remove-layer API

Two cases are tested: success and fail case of the screen-remove-layer API.

Signed-off-by: Michael Teyfel <mteyfel@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agolibweston-desktop/xdg-shell-v6: Ensure first configure is sent
Quentin Glidic [Mon, 28 Aug 2017 18:12:01 +0000 (20:12 +0200)]
libweston-desktop/xdg-shell-v6: Ensure first configure is sent

The old code for scheduling configure events on idle looked like:
if (configure_scheduled) {
    if (this_event_is_the_same) {
        remove_timer();
return;
    }
}

If we queued one new event (either changed, or the client had never
received any configure event), followed immediately by one event which
was the same as the first, we would delete the scheduled send of the
first event.

Fix this by treating unconfigured surface as never the same.

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agocompositor-drm: Introduce drm_pending_state structure
Daniel Stone [Fri, 10 Feb 2017 18:06:04 +0000 (18:06 +0000)]
compositor-drm: Introduce drm_pending_state structure

drm_pending_state is currently skeletal, but will be used to retain
data through begin_repaint -> assign_planes -> repaint -> repaint_flush.

The flush and cancel functions are currently identical, only freeing the
state, but they will be used for different purposes in later patches.
Specifically, the intent is to apply any pending output changes (through
PageFlip/SetCrtc, or the atomic ioctls) in flush, and only free the
state in cancel.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agocompositor-drm: Track all plane types
Daniel Stone [Wed, 20 May 2015 23:00:57 +0000 (00:00 +0100)]
compositor-drm: Track all plane types

Retain drm_plane tracking objects for all actual DRM planes when using
universal planes, not just overlay planes. Rename uses of 'sprite' to
'plane' to make it clear that it can now be any kind of plane, not just
an overlay/sprite.

These are currently unused.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agocompositor-drm: Add universal plane awareness
Pekka Paalanen [Wed, 20 May 2015 22:01:44 +0000 (23:01 +0100)]
compositor-drm: Add universal plane awareness

Add awareness of, rather than support for, universal planes. Activate
the client cap when we start if possible, and if this is activated,
studiously ignore non-overlay planes. For now.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Co-authored-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Co-authored-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agocompositor-drm: Add DRM property cache
Daniel Stone [Fri, 3 Mar 2017 16:19:39 +0000 (16:19 +0000)]
compositor-drm: Add DRM property cache

Add a cache for DRM property IDs and values, and use it for the two
connector properties we currently update: DPMS and EDID.

As DRM property ID values are not stable, we need to do a name -> ID
lookup each run in order to discover the property IDs and enum values to
use for those properties. Rather than open-coding this, add a property
cache which we can use across multiple different object types.

This patch takes substantial work from the universal planes support
originally authored by Pekka Paalanen, though it has been heavily
reworked.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Co-authored-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agocompositor-drm: Rename fb_plane to scanout_plane
Daniel Stone [Mon, 24 Oct 2016 12:26:42 +0000 (13:26 +0100)]
compositor-drm: Rename fb_plane to scanout_plane

All planes being displayed have a framebuffer. What makes 'fb_plane'
special is that it's being displayed as the primary plane by KMS.

Previous patchsets renamed this to 'primary_plane' to match the KMS
terminology, namely the CRTC's base plane, which is controlled by
drmModeSetCrtc in the legacy API, and identified by PLANE_TYPE ==
"Primary" in the universal-plane API.

However, Weston uses 'primary_plane' internally to refer to the case
where client content is _not_ directly displayed on a plane, but
composited via the renderer, with the result of the compositing then
shown.

Rename to 'scanout_plane' as our least-ambiguous name, and document it a
bit.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Emre Ucan <eucan@de.adit-jv.com>
7 years agocompositor-drm: Refactor sprite create/destroy into helpers
Pekka Paalanen [Thu, 5 Jun 2014 08:22:25 +0000 (11:22 +0300)]
compositor-drm: Refactor sprite create/destroy into helpers

This moves the single sprite creation code from create_sprites() into a
new function. The readability clean-up is small, but my intention is to
write an alternate version of create_sprites(), and sharing the single
sprite creation code is useful.

The removal code now actually removes the plane from the list.

In doing this, the gymnastics required to exact the CRTC ID the plane
was last on when making a disabling drmModeSetPlane call have been
removed; specifying the CRTC is not necessary when disabling a plane.
(The atomic API goes a step further, mandating it be zero.)

[daniels: Genericised from drm_sprite to drm_plane, moving some of the
          logic back into create_sprites(), also symmetrical
          drm_plane_destroy.]

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Emre Ucan <eucan@de.adit-jv.com>
7 years agocompositor-fbdev: fix start-up assertion
Pekka Paalanen [Tue, 15 Aug 2017 07:35:09 +0000 (10:35 +0300)]
compositor-fbdev: fix start-up assertion

Fixes the failure to start with fbdev-backend:

weston: /home/pq/git/weston/libweston/compositor.c:4733: weston_compositor_add_pending_output: Assertion `output->disable' failed.

The disable hook was completely unimplemented, and the regression was
caused by e952a01c3b42c7c870091e71488e9469bd897153
"libweston: move asserts to add_pending_output()".
It used to work because Weston never tried to explicitly disable the
fbdev output, but now it is hitting the assert.

Fix it by tentatively implementing a disable hook. It has not been
tested to work for explicit disabling, but it does solve the regression.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=102208
Cc: bluescreen_avenger@verizon.net
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
Tested-by: n3rdopolis <bluescreen_avenger@verizon.net>
7 years agoconfigure.ac: remove dependency on mtdev
Arnaud Vrac [Sat, 5 Aug 2017 11:59:00 +0000 (13:59 +0200)]
configure.ac: remove dependency on mtdev

It's been unused since the legacy (non-libinput) input backends have
been removed.

Signed-off-by: Arnaud Vrac <rawoul@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
7 years agoconfigure.ac: fix linking when using compiler sanitizers
Arnaud Vrac [Sat, 5 Aug 2017 11:58:59 +0000 (13:58 +0200)]
configure.ac: fix linking when using compiler sanitizers

The GCC address sanitizer overrides dlopen and dlclose, so the configure
test does not detect libdl as a needed dependency for linking. It is
still needed though, as dlsym is not exported by the sanitizer. The
result is that linking fails in the end.

Fix this by checking for dlsym instead of dlopen.

This can be reproduced by configuring the build with:
CFLAGS="-fsanitize=address -fsanitize=undefined"
LDFLAGS="-fsanitize=address -fsanitize=undefined"

Signed-off-by: Arnaud Vrac <rawoul@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
7 years agogl-renderer: fix leak on dmabuf image destroy
Arnaud Vrac [Sat, 5 Aug 2017 11:58:58 +0000 (13:58 +0200)]
gl-renderer: fix leak on dmabuf image destroy

Signed-off-by: Arnaud Vrac <rawoul@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
7 years agoconfigure: fix version number
Pekka Paalanen [Fri, 11 Aug 2017 07:44:57 +0000 (10:44 +0300)]
configure: fix version number

Fixes "configure: error: Weston version is greater than libweston."

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=102143
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agoReopen master for regular development
Bryce Harrington [Tue, 8 Aug 2017 19:01:55 +0000 (12:01 -0700)]
Reopen master for regular development

A 3.0 branch has been established for stable release work.

7 years agoconfigure.ac: bump to version 3.0.0 for the official release
Bryce Harrington [Tue, 8 Aug 2017 18:46:14 +0000 (11:46 -0700)]
configure.ac: bump to version 3.0.0 for the official release

7 years agolibweston-desktop/xdg-shell-v5: initialize configure list
Arnaud Vrac [Sat, 5 Aug 2017 11:59:01 +0000 (13:59 +0200)]
libweston-desktop/xdg-shell-v5: initialize configure list

Without this weston crashes when a client using xdg-shell-v5 is run.

Signed-off-by: Arnaud Vrac <rawoul@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
7 years agoconfigure.ac: bump to version 2.99.93 for the RC1 release
Bryce Harrington [Tue, 1 Aug 2017 18:19:30 +0000 (11:19 -0700)]
configure.ac: bump to version 2.99.93 for the RC1 release

7 years agodesktop-shell: Set surface resizing state during interactive resize
Philipp Kerling [Fri, 28 Jul 2017 12:11:58 +0000 (14:11 +0200)]
desktop-shell: Set surface resizing state during interactive resize

xdg_shell requires this information to be shared with the client in
order to conform with the specification.

The code to forward this to the client by way of a configure() event
is already in place and works fine, it was just never being used until
now.

Signed-off-by: Philipp Kerling <pkerling@casix.org>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
7 years agolibweston-desktop/xdg-shell: Properly properly handle ack_configure
Derek Foreman [Wed, 26 Jul 2017 19:35:58 +0000 (14:35 -0500)]
libweston-desktop/xdg-shell: Properly properly handle ack_configure

commit 749637a8a306588964885fe6b25fda6087a84ccd
introduced this feature, but the break is outside of any conditional
so only the first item in the list is ever tested.

If a client skips a few configures and then acks the most recent
it's still operating within spec, so the break should only occur
when a match is found.

This version also adds a break after we miss the target, as a tiny
optimization (the list will be cleaned up on disconnect anyway),
as it makes the code no more difficult to read or maintain.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>