platform/upstream/weston.git
6 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>

6 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>

6 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>

6 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>

6 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>

6 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>

6 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>

6 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>

6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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.

6 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

6 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>
6 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

6 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>
6 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>
6 years agoinput: Stop leaking libinput event source on session deactivation
Derek Foreman [Tue, 25 Jul 2017 21:39:20 +0000 (16:39 -0500)]
input: Stop leaking libinput event source on session deactivation

This is easily noticed as a leaked fd on every VC switch.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
6 years agocompositor-drm: reset KMS state on VT-switch in
Pekka Paalanen [Thu, 27 Jul 2017 10:44:32 +0000 (13:44 +0300)]
compositor-drm: reset KMS state on VT-switch in

Fix a regression with VT-switching away from Weston and then back
causing drmModePageFlip() to fail with ENOSPC or EINVAL, leaving one or
more outputs not updated. The regression appeared in
47224cc9312fef05c1a523ea0da0a1aae66f100d:

compositor-drm: Delete drm_backend_set_modes

Fix it by forcing a drmModeSetCrtc() on all outputs both initially
created and after VT-switch in.

Cc: Daniel Stone <daniels@collabora.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
v2: moved state_invalid=true from create_output_for_connector() to
    drm_output_enable()

Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agologind: actually close fd in launcher_logind_close
Derek Foreman [Tue, 25 Jul 2017 21:17:36 +0000 (16:17 -0500)]
logind: actually close fd in launcher_logind_close

We still need to close fds passed to us - or we leak quite a few fds
on VC switch.

Regression, originally fixed in 8f5acc2f3a29c3831af4ddd6bed57f703c98dc77
and re-broken in commit 72dea06d7952e3ce8dd8057f7106186da4fa2678
but only for the logind launcher.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
6 years agolibweston-desktop/xdg-shell: Check window geometry instead of surface size against...
Philipp Kerling [Wed, 26 Jul 2017 12:02:21 +0000 (14:02 +0200)]
libweston-desktop/xdg-shell: Check window geometry instead of surface size against configured size

Shell surfaces may have a geometry that is different to the size of
their main surface, e.g. due to subcompositing.

In states where size is strictly enforced (fullscreen and maximized),
the size that the compositor wants must be checked against the window
geometry and not just the main surface size.

Fix by calling weston_desktop_surface_get_geometry and using that size
instead of main surface size.

Signed-off-by: Philipp Kerling <pkerling@casix.org>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
6 years agodesktop-shell: Track focused shell surface by main surface
Philipp Kerling [Wed, 26 Jul 2017 10:02:15 +0000 (12:02 +0200)]
desktop-shell: Track focused shell surface by main surface

The focused surface is used for determining whether shell surfaces
are activated. They should also be considered activated when a
subsurface has focus. Inserting a call to
weston_surface_get_main_surface fixes this.

seat->focused_surface is only used for shell_surface keyboard focus
tracking.

Signed-off-by: Philipp Kerling <pkerling@casix.org>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
7 years agoconfigure.ac: bump to version 2.99.92 for the beta release
Bryce Harrington [Tue, 25 Jul 2017 23:32:20 +0000 (16:32 -0700)]
configure.ac: bump to version 2.99.92 for the beta release

7 years agolibweston: introduce weston_output_from_resource()
Pekka Paalanen [Mon, 27 Mar 2017 12:14:32 +0000 (15:14 +0300)]
libweston: introduce weston_output_from_resource()

This is a simple wrapper for casting the user data of a wl_resource into
a struct weston_output pointer. Using the wrapper clearly marks all the
places where a wl_output protocol object is used.

Replace ALL wl_output related calls to wl_resource_get_user_data() with
a call to weston_output_from_resource().

v2: add type assert in weston_output_from_resource().

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
7 years agolibweston: make weston_output::connection_internal a bool
Pekka Paalanen [Fri, 24 Mar 2017 13:46:23 +0000 (15:46 +0200)]
libweston: make weston_output::connection_internal a bool

It really is a boolean.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
7 years agolibweston: extend output->region lifetime
Pekka Paalanen [Thu, 30 Mar 2017 13:04:58 +0000 (16:04 +0300)]
libweston: extend output->region lifetime

It's a little awkward to try to keep the weston_output::region and
weston_output::previous_damage allocate exactly only when the output is
enabled. There was also a leak: weston_output_move() was calling
weston_output_init_geometry() on an already allocated regions without
fini in between.

Fix both issues by allocating the regions in weston_output_init(),
always fini/init'ing them in weston_output_init_geometry(), and fini'ing
for good in weston_output_destroy().

This nicely gets rid of weston_output_enable_undo() so I do not need to
try to figure out what to do with it later.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
7 years agolibweston: move globals to weston_compositor_add_output()
Pekka Paalanen [Thu, 30 Mar 2017 12:48:06 +0000 (15:48 +0300)]
libweston: move globals to weston_compositor_add_output()

Move the wl_output global management into weston_compositor_add_output()
and weston_compositor_remove_output().

If weston_output_enable() fails, there is no need to clean up the global
and the clients will not see a wl_output come and go.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
7 years agolibweston: move output id into add/remove_output()
Pekka Paalanen [Thu, 30 Mar 2017 12:19:45 +0000 (15:19 +0300)]
libweston: move output id into add/remove_output()

Move the output id management into weston_compositor_add_output() and
weston_compositor_remove_output(). This is a more logical place, and
works towards assimilating weston_output_enable_undo().

The output id is no longer available to the backend enable() vfuncs, but
it was not used there to begin with.

v2: moved assert earlier in weston_compositor_add_output()

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
7 years agolibweston: prevent double weston_output_enable()
Pekka Paalanen [Thu, 30 Mar 2017 12:11:25 +0000 (15:11 +0300)]
libweston: prevent double weston_output_enable()

Enabling an already enabled output is an error, at least with the
current implementation.

However, disabling an output that has not been enabled is ok.

Cope with the first and document the second.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
7 years agolibweston: specify weston_output::enabled
Pekka Paalanen [Thu, 30 Mar 2017 11:56:22 +0000 (14:56 +0300)]
libweston: specify weston_output::enabled

It was ambiguous what this flag meant - it did not mean whether the
backend is considering this output to be enabled, because
weston_output_destroy() unsets it while deliberately not calling the
backend disable() vfunc.

Perhaps the most clear definition is with respect to the output's
assignment in the pending vs. enabled output lists. There is also a whole
bunch of variables that are allocated only when enabled is true.

Since the flag is related to the list membership, set and clear the flag
only when manipulating the lists.

Assert that weston_compositor_add_output() and
weston_compositor_remove_output() are not called in a wrong state.

v2:
- talk about "list of enabled outputs"
- clear 'enabled' in weston_compositor_remove_output() earlier

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
7 years agolibweston: move asserts to add_pending_output()
Pekka Paalanen [Wed, 29 Mar 2017 14:14:00 +0000 (17:14 +0300)]
libweston: move asserts to add_pending_output()

weston_compositor_add_pending_output() is the point through which all
backends must go when creating a new output. The enable and disable
vfuns are essential for anything to be done with the output, so it makes
sense to check them here, rather than when actually enabling or
disabling.

Particularly the disable vfunc is rarely called, so this gets the check
better excercised.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
7 years agolibweston: unexport weston_output_update_matrix()
Pekka Paalanen [Wed, 29 Mar 2017 14:01:41 +0000 (17:01 +0300)]
libweston: unexport weston_output_update_matrix()

Only used internally in core. Needs to happen automatically when
something changes, so there should no need to call it from outside.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
7 years agolibweston: unexport weston_compositor_add_output()
Pekka Paalanen [Wed, 29 Mar 2017 13:58:48 +0000 (16:58 +0300)]
libweston: unexport weston_compositor_add_output()

Only used by weston_output_enable().

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
7 years agolibweston: two more weston_output docs
Pekka Paalanen [Wed, 29 Mar 2017 13:53:50 +0000 (16:53 +0300)]
libweston: two more weston_output docs

Document two more functions of the weston_output API.

Exported functions marked internal are meant for backends only.
Exported functions not marked internal are meant for libweston users.

v2: talk about "list of enabled outputs".

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
7 years agolibweston: let add/remove_output handle the lists
Pekka Paalanen [Wed, 29 Mar 2017 13:20:19 +0000 (16:20 +0300)]
libweston: let add/remove_output handle the lists

A weston_output available to the compositor should always be either in
the list of pending outputs or the list of enabled outputs. Let
weston_compositor_add_output() and weston_compositor_remove_output()
handle the moves between the lists.

This way weston_output_enable() does not need to remove and
oops-it-failed-add-it-back. weston_output_disable() does not need to
manually re-add the output back to the pending list.

To make everything nicely symmetric and fix any unbalancing caused by
this:
- weston_output_destroy() explicitly wl_list_remove()s
- weston_compositor_add_pending_output() first removes then inserts, as
we have the assumption that the link is always valid, even if empty.

Update the documentations, too.

v2:
- talk about "list of enabled outputs"
- keep wl_list_remove in weston_compositor_remove_output in its old
  place

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
7 years agolibweston: use helper var in weston_compositor_remove_output
Pekka Paalanen [Wed, 29 Mar 2017 13:16:04 +0000 (16:16 +0300)]
libweston: use helper var in weston_compositor_remove_output

To shorten lines.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
7 years agolibweston: untangle weston_compositor_remove_output doc
Pekka Paalanen [Wed, 29 Mar 2017 13:07:34 +0000 (16:07 +0300)]
libweston: untangle weston_compositor_remove_output doc

Trying to make it more readable. Things that happen in the same step are
kept in the same paragraph.

v2: talk about "list of enabled outputs"

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
7 years agoivi-shell: Fixed broken link to wiki page in ivi-layout header file
Michael Teyfel [Tue, 25 Jul 2017 09:34:33 +0000 (11:34 +0200)]
ivi-shell: Fixed broken link to wiki page in ivi-layout header file

Signed-off-by: Michael Teyfel <mteyfel@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agoivi-shell: remove orientation calculation
Ucan, Emre (ADITG/SW1) [Fri, 3 Mar 2017 14:21:32 +0000 (14:21 +0000)]
ivi-shell: remove orientation calculation

Dead code as orientation cannot be changed anymore, see patches:
ivi-shell: remove layer_set_orientation API
ivi-shell: remove surface_set_orientation API

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
[Pekka: added commit message]
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agoivi-shell: remove layer_set_orientation API
Ucan, Emre (ADITG/SW1) [Fri, 3 Mar 2017 14:21:31 +0000 (14:21 +0000)]
ivi-shell: remove layer_set_orientation API

This API is used to rotate the contents of
application's buffer, which are in the render
order list of the layer. But this API is not
needed because an application can rotate
its buffers with set_buffer_transform request
of wl_surface interface

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agoivi-shell: remove surface_set_orientation API
Ucan, Emre (ADITG/SW1) [Fri, 3 Mar 2017 14:21:28 +0000 (14:21 +0000)]
ivi-shell: remove surface_set_orientation API

This API is used to rotate the contents of
application's buffer. But it is not needed
because an application can rotate its buffers
with set_buffer_transform request of
wl_surface interface.

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agoivi-shell: add_screen_remove_layer API
Ucan, Emre (ADITG/SW1) [Thu, 2 Mar 2017 08:47:33 +0000 (08:47 +0000)]
ivi-shell: add_screen_remove_layer API

It is analagous to layer_remove_surface API.
The API removes a layer from the render order
of the screen.

v3:
add the new vfunc at the end of
the ivi_layout_interface struct.

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Eugen Friedrich <friedrix@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agoxwm: update override-redirect surface's position upon configure_notify
Ilia Bozhinov [Tue, 27 Jun 2017 21:08:40 +0000 (00:08 +0300)]
xwm: update override-redirect surface's position upon configure_notify

When we receive configure_notify we should update the surface's
position by calling xwayland_api->set_xwayland(). Otherwise some surfaces
like dnd surfaces from xwayland views are "stuck" at one place. When
setting XWAYLAND state though we should always call view_set_position(),
not just the first time we set this state.

Signed-off-by: Ilia Bozhinov <ammen99@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
7 years agolibweston-desktop/xdg-shell: Properly handle ack_configure
Quentin Glidic [Tue, 18 Jul 2017 10:59:14 +0000 (12:59 +0200)]
libweston-desktop/xdg-shell: Properly handle ack_configure

Now we keep track of serial->state association and we discard the states
that the client ignored.

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
7 years agolibweston-desktop/xdg-shell: Check surface size against acknowledged size
Quentin Glidic [Wed, 12 Jul 2017 07:45:43 +0000 (09:45 +0200)]
libweston-desktop/xdg-shell: Check surface size against acknowledged size

We were checking against the pending size, which lead some clients
(simple-egl) to crash because they sent a buffer before acknowledging
the latest configure event.

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Tested-by: Emmanuel Gil Peyrot <emmanuel.peyrot@collabora.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
7 years agolibweston-desktop/xdg-shell: Add pending/next/current structs
Quentin Glidic [Wed, 12 Jul 2017 07:42:57 +0000 (09:42 +0200)]
libweston-desktop/xdg-shell: Add pending/next/current structs

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Tested-by: Emmanuel Gil Peyrot <emmanuel.peyrot@collabora.com>
7 years agolibweston-desktop/xdg-shell: Rename requested_ to pending_
Quentin Glidic [Tue, 11 Jul 2017 11:31:36 +0000 (13:31 +0200)]
libweston-desktop/xdg-shell: Rename requested_ to pending_

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Tested-by: Emmanuel Gil Peyrot <emmanuel.peyrot@collabora.com>
7 years agoconfigure.ac: bump to version 2.99.91 for the alpha release
Bryce Harrington [Wed, 12 Jul 2017 02:16:40 +0000 (19:16 -0700)]
configure.ac: bump to version 2.99.91 for the alpha release

7 years agoconfigure: Stop printing libxkbcommon in configure results
Derek Foreman [Mon, 3 Jul 2017 19:36:50 +0000 (14:36 -0500)]
configure: Stop printing libxkbcommon in configure results

Cosmetic leftovers I missed when removing the configure
option to --disable-xkbcommon

Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agodmabuf: Don't crash clients by sending version inappropriate events
Derek Foreman [Mon, 26 Jun 2017 20:55:44 +0000 (15:55 -0500)]
dmabuf: Don't crash clients by sending version inappropriate events

We need to make sure the client bound dmabuf with a high enough
version to receive modifier events before sending them or the
client will crash.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agolinux-dmabuf: Fix crash with no valid modifiers
Derek Foreman [Mon, 26 Jun 2017 19:44:54 +0000 (14:44 -0500)]
linux-dmabuf: Fix crash with no valid modifiers

We shouldn't free &modifier_invalid because it wasn't allocated
with malloc()

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agogl-renderer: Fix some missing newlines in log messages
Derek Foreman [Mon, 26 Jun 2017 19:42:44 +0000 (14:42 -0500)]
gl-renderer: Fix some missing newlines in log messages

Some log messages weren't terminated with a newline.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoinput: Remove --disable-xkbcommon
Derek Foreman [Wed, 28 Jun 2017 16:17:23 +0000 (11:17 -0500)]
input: Remove --disable-xkbcommon

It looks like there are some code paths where this has been forgotten, so
it likely doesn't work as is.  It's probable that nobody has actually
used this in a very long time, so it's not worth the maintenance burden
of keeping xkbcommon vs raw keyboard code anymore.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agolibweston-desktop/xdg-shell: Consolidate configure event sending
Quentin Glidic [Thu, 13 Apr 2017 18:25:27 +0000 (20:25 +0200)]
libweston-desktop/xdg-shell: Consolidate configure event sending

When switching a state twice in a row, we were overwriting the old value
without setting it back, sending a wrong state to the client.

Now we update our requested state, then check if we need to schedule a
configure event, if we have one scheduled already or even if we can
cancel it.

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agolibweston-desktop/xdg_shell_v6: Send error on wrongly-sized buffer
Quentin Glidic [Fri, 10 Mar 2017 10:50:41 +0000 (11:50 +0100)]
libweston-desktop/xdg_shell_v6: Send error on wrongly-sized buffer

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoclients/simple-dmabuf-drm: import with dmabuf modifiers
Varad Gautam [Wed, 23 Nov 2016 08:33:21 +0000 (14:03 +0530)]
clients/simple-dmabuf-drm: import with dmabuf modifiers

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

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

Signed-off-by: Varad Gautam <varad.gautam@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoclients/simple-dmabuf-drm: add freedreno support alongside intel
Varad Gautam [Wed, 26 Apr 2017 13:47:18 +0000 (19:17 +0530)]
clients/simple-dmabuf-drm: add freedreno support alongside intel

abstract drm specific bits to struct drm_device and support running on
freedreno. introduce 'modifier' event.

v2: rebase to master, deprecate 'format' event.

Signed-off-by: Varad Gautam <varad.gautam@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoclients/simple-dmabuf-intel: rename to simple-dmabuf-drm
Varad Gautam [Thu, 17 Nov 2016 11:55:59 +0000 (17:25 +0530)]
clients/simple-dmabuf-intel: rename to simple-dmabuf-drm

this will allow adding other drm backends later.

Signed-off-by: Varad Gautam <varad.gautam@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agogl-renderer: allow importing fourth dmabuf plane
Varad Gautam [Wed, 23 Nov 2016 08:33:19 +0000 (14:03 +0530)]
gl-renderer: allow importing fourth dmabuf plane

EGL_EXT_image_dma_buf_import_modifiers supports importing upto four dmabuf
planes into an EGLImage.

v2: correct PLANE3_PITCH token (Daniel Stone)

Signed-off-by: Varad Gautam <varad.gautam@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agogl-renderer: allow importing dmabufs with format modifiers
Varad Gautam [Wed, 23 Nov 2016 08:33:18 +0000 (14:03 +0530)]
gl-renderer: allow importing dmabufs with format modifiers

pass over the modifier attributes to EGL.

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

Signed-off-by: Varad Gautam <varad.gautam@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agolinux-dmabuf: advertise supported formats and modifiers
Varad Gautam [Wed, 26 Apr 2017 13:47:17 +0000 (19:17 +0530)]
linux-dmabuf: advertise supported formats and modifiers

implement 'modifier' event to communicate available formats and modifiers
to the client and support zwp_linux_dmabuf_v1 interface version 3.

v2: handle zero modifiers case, deprecate 'format' event.

Signed-off-by: Varad Gautam <varad.gautam@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agogl-renderer: support format and modifier queries
Varad Gautam [Wed, 23 Nov 2016 08:33:20 +0000 (14:03 +0530)]
gl-renderer: support format and modifier queries

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

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

Signed-off-by: Varad Gautam <varad.gautam@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoclients/simple-dmabuf-intel: request no-roundtrip dmabuf import
Varad Gautam [Wed, 26 Apr 2017 13:46:00 +0000 (19:16 +0530)]
clients/simple-dmabuf-intel: request no-roundtrip dmabuf import

request immediate dmabuf import when run with "immed" arg.

Signed-off-by: Varad Gautam <varad.gautam@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agolinux-dmabuf: implement immediate dmabuf import
Varad Gautam [Wed, 26 Apr 2017 13:45:59 +0000 (19:15 +0530)]
linux-dmabuf: implement immediate dmabuf import

handle create_immed() dmabuf import requests and support
zwp_linux_dmabuf_v1_interface version 2.

v2: terminate client with INVALID_WL_BUFFER when reason
    for create_immed failure is unknown.

[daniels: Bump wayland-protocols dependency.]

Signed-off-by: Varad Gautam <varad.gautam@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agocompositor-fbdev: Instead of less than 1 Hz use default refresh rate
Oliver Smith [Mon, 17 Apr 2017 11:11:00 +0000 (11:11 +0000)]
compositor-fbdev: Instead of less than 1 Hz use default refresh rate

I ran Weston on a Nexus 4 mobile phone, with a native GNU/Linux userland,
and the latest Android kernel for that device from LineageOS [1].

calculate_refresh_rate() returned 1 (mHz), which gets rounded to 0 Hz later
and results in nothing being drawn to the screen.

This patch makes sure, that there is at least a refresh rate of 1 Hz, because
it returns the default refresh rate of 60 Hz otherwise.

[1]: https://github.com/LineageOS/lge-kernel-mako

Signed-off-by: Oliver Smith <ollieparanoid@bitmessage.ch>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
7 years agoweston: Add support for "--foo bar" style options
Lyude Paul [Mon, 8 May 2017 16:47:55 +0000 (12:47 -0400)]
weston: Add support for "--foo bar" style options

A little earlier today I ended up spending a lot of time trying to
figure out why weston wasn't managing to launch over SSH and telling me
that I did not have a --tty option specified, despite me passing the
option strings ["--tty", "3"]. Turns out weston just doesn't support
that.

So, add support for this kind of format in addition to "--foo=bar" to
save others from making the same mistake I did.

Changes since v1:
 - Add comment about unreachable boolean check in long_option_with_arg()
 - Convert boolean check in long_option_with_arg() to assert

Signed-off-by: Lyude <lyude@redhat.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
7 years agolibweston: Allow compositor-wayland to use wl_surface_damage_buffer
Derek Foreman [Fri, 19 May 2017 15:42:07 +0000 (10:42 -0500)]
libweston: Allow compositor-wayland to use wl_surface_damage_buffer

wl_surface_damage_buffer landed ages ago, but in order for GL to
use it the client must bind a wl_compositor version >= 4 (the
version where damage_buffer was introduced).

This patch updates the bind version and allows
eglSwapBuffersWithDamage to actually use the provided damage
rectangles instead of performing full surface damage.

Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoclients: Allow simple-egl to use wl_surface_damage_buffer
Derek Foreman [Fri, 19 May 2017 14:39:06 +0000 (09:39 -0500)]
clients: Allow simple-egl to use wl_surface_damage_buffer

wl_surface_damage_buffer landed ages ago, but in order for GL to
use it the client must bind a wl_compositor version >= 4 (the
version where damage_buffer was introduced).

This patch updates the bind version and allows
eglSwapBuffersWithDamage to actually use the provided damage
rectangles instead of performing full surface damage.

This log is much longer than the patch.

Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoxwm: Don't change focus on focus events from grabs
Olivier Fourdan [Mon, 15 May 2017 11:32:01 +0000 (13:32 +0200)]
xwm: Don't change focus on focus events from grabs

xwm would not let X clients change the focus behind the compositor's
back, reverting focus where it's supposed to be when this occurs.

However, X11 grab also issue focus in events, on which some clients
rely and reverting focus in this case braks the client logic (e.g.
combobox menu in gtk+ using the X11 backend).

Check if the focus event is actually coming from a grab or ungrab and
do not revert focus in this case, to avoid breaking clients logic.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Tested-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Acked-by: Daniel Stone <daniels@collabora.com>
Acked-by: Quentin Glidic <sardemff7+git@sardemff7.net>
7 years agoAccount for very large repaint window misses
Daniel Stone [Tue, 28 Feb 2017 21:53:51 +0000 (21:53 +0000)]
Account for very large repaint window misses

At the bottom of weston_output_finish_frame(), code exists to account
for flips which have missed the repaint window, by shifting them to lock
on to the next repaint window rather than repainting immediately.

This code only accounted for flips which missed their target by one
repaint window. If they miss by multiples of the repaint window, adjust
them until the next repaint timestamp is in the future. This will only
happen in fairly extreme situations, such as Weston being scheduled out
for a punitively long period of time. Nevertheless, try to help recovery
by still aiming for more predictable timings.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agodesktop-shell: Enable per-output fade animations
Bryce Harrington [Fri, 9 Sep 2016 20:16:02 +0000 (13:16 -0700)]
desktop-shell: Enable per-output fade animations

Instead of creating a single global fade surface across all outputs,
create a separate surface for each output.  This will permit
e.g. individual fades for each output (or blocking the fade-outs if
inhibiting idling as will come in a later patch.)

This also fixes a potential issue if on multihead layout spanning a
desktop wider than 8096 (or higher than 8096), the fade animation may
not completely cover all surfaces.

This assumes the output geometry doesn't change to become larger during
the course of the fade animation.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
7 years agocompositor-drm: Fix disabling cursor plane
Derek Foreman [Thu, 13 Apr 2017 18:48:48 +0000 (13:48 -0500)]
compositor-drm: Fix disabling cursor plane

commit a7cba1d4cd4c9013c3ac6cb074fcb7842fb39283 changed the way
the cursor plane is setup.  Previously it was pre-emptively set
disabled for the next frame, and that would be changed at next
frame time if the cursor plane was to be used.  It was changed
to be disabled at plane assignment time.

We disable the use of planes entirely by setting disable_planes to
a non-zero value, which bypasses all calls to assign_planes - so
if the plane was set-up in the previous frame it will retain its
state post-disable.

This leads to desktop zoom leaving the cursor plane in place when
it sets disable_planes.

This patch clears any stale cursor plane state from the redraw
handler if disable_planes is set so drm_output_set_cursor()
will do the right thing.

Reviewed-by: Daniel Stone <daniels@collabora.com>
Reported-by: Emmanuel Gil Peyrot <emmanuel.peyrot@collabora.com>