platform/upstream/weston.git
6 years agocompositor-drm: expose global shadow flag for pixman
Pekka Paalanen [Mon, 23 Apr 2018 09:44:58 +0000 (11:44 +0200)]
compositor-drm: expose global shadow flag for pixman

Allow global control of the pixman shadow buffers. The compositor can
choose whether all output use or do not use a shadow buffer with the
pixman renderer.

The option is added to the end of struct weston_drm_backend_config to
avoid bumping WESTON_DRM_BACKEND_CONFIG_VERSION.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Fabien Lahoudere <fabien.lahoudere@collabora.com>
Reviewed-by: Ian Ray <ian.ray@ge.com>
6 years agopixman: make shadow buffer optional
Pekka Paalanen [Mon, 23 Apr 2018 09:44:57 +0000 (11:44 +0200)]
pixman: make shadow buffer optional

Add a flag to pixman-renderer for initializing the output with a shadow
framebuffer. All backends were getting the shadow implcitly, so all
backends are modified to ask for the shadow explicitly.

Using a shadow buffer is usually beneficial, because read-modify-write
cycles (blending) into a scanout-capable buffer may be very slow. The
scanout framebuffer may also have reduced color depth, making blending
and read-back produce inferior results.

In some use cases though the shadow buffer might be just an extra copy
hurting more than it helps. Whether it helps or hurts depends on the
platform and the workload. Therefore let the backends control whether
pixman-renderer uses a shadow buffer for an output or not.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Fabien Lahoudere <fabien.lahoudere@collabora.com>
Reviewed-by: Ian Ray <ian.ray@ge.com>
6 years agopixman,drm: do not composite previous damage
Pekka Paalanen [Mon, 23 Apr 2018 09:44:56 +0000 (11:44 +0200)]
pixman,drm: do not composite previous damage

Pixman-renderer uses a single internal shadow buffer. It is enough to
composite the current damage into shadow, but the copy to hw buffer
needs to include the previous damage because of double-buffering in
DRM-backend.

This patch lets pixman-renderer do exactly that without compositing also
the previous damage on DRM-renderer.

Arguably weston_output should not have field previous_damage to begin
with, because it implies double-buffering, which e.g. EGL does not
guarantee. It would be better for each backend explicitly always provide
any extra damage that should be copied to hw.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Fabien Lahoudere <fabien.lahoudere@collabora.com>
Reviewed-by: Ian Ray <ian.ray@ge.com>
6 years agolibweston: fix output destroy signal list corruption
Pekka Paalanen [Tue, 22 May 2018 10:15:58 +0000 (13:15 +0300)]
libweston: fix output destroy signal list corruption

This issue was likely introduced by "libweston: add
weston_view_set_output()" which forgot to ensure the output destroy
listener is removed when weston_view is destroyed, leading to freed
memory being left into the list.

This was quite easy to trigger by opening and closing an application
window a few times, leading various memory corruption symptoms.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
6 years agodesktop-shell: fix output destroy signal list corruption
Pekka Paalanen [Tue, 22 May 2018 09:48:35 +0000 (12:48 +0300)]
desktop-shell: fix output destroy signal list corruption

This issue was introduced by "desktop-shell: detect stale shell surface
outputs" which forgot to remove the output destroy listener when
shell_surface is destroyed, leading to memory corruption.

This was fairly easy to trigger by opening and closing an application
window a few times.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
6 years agodesktop-shell: detect stale shell surface outputs
Semi Malinen [Wed, 2 May 2018 09:10:32 +0000 (11:10 +0200)]
desktop-shell: detect stale shell surface outputs

When displays are hot (un)plugged, it may happen that
a shell surface is left with a stale pointer to an output
that has already been freed. Add an output destroy listener
to catch such situations and set the output pointer to NULL.

Signed-off-by: Semi Malinen <semi.malinen@ge.com>
Signed-off-by: Fabien Lahoudere <fabien.lahoudere@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
6 years agolibweston: add weston_view_set_output()
Semi Malinen [Thu, 26 Apr 2018 09:08:10 +0000 (11:08 +0200)]
libweston: add weston_view_set_output()

Instead of desktop shell assigning view outputs directly,
use a new method, weston_view_set_output(). The method can
set up an output destroy listener to make sure that views
do not have stale output pointers.

Without this patch it is possible to end up in a scenario
where, e.g. configure_static_view() accesses memory that
has already been freed. The scenario can be provoked by
repeatedly plugging and unplugging a display. The faulty
memory accesses are reported by valgrind.

Signed-off-by: Semi Malinen <semi.malinen@ge.com>
Signed-off-by: Fabien Lahoudere <fabien.lahoudere@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
6 years agoweston: use wet.compositor consistently in main()
Pekka Paalanen [Thu, 2 Nov 2017 13:42:51 +0000 (15:42 +0200)]
weston: use wet.compositor consistently in main()

Rename user_data to wet, because it is called wet everywhere else.

Drop the local variable ec, because that is available as wet.compositor.

This models a little better that wet_compositor owns weston_compositor,
and not the other way around.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agoweston: store weston_compositor in wet_compositor
Pekka Paalanen [Thu, 2 Nov 2017 13:38:24 +0000 (15:38 +0200)]
weston: store weston_compositor in wet_compositor

This makes it easier to just pass wet_compositor around and take the
weston_compositor from it.

It feels weird to go from weston_compositor to wet_compositor all the
time in internal functions. It's necessary in callbacks that cannot
carry wet_compositor, but otherwise it is awkward.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agocompositor-drm: allow shared-CRTC cloning
Pekka Paalanen [Mon, 20 Nov 2017 12:04:38 +0000 (14:04 +0200)]
compositor-drm: allow shared-CRTC cloning

Allow cloning up to 4 connectors from the same CRTC. All the
implementation bits support more than one head per output already.

Four is just an arbitary number, small but unlikely to ever be the
limiting factor in cloning since hardware is usually very restricted.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agocompositor-drm: head attach requires a modeset
Pekka Paalanen [Fri, 8 Dec 2017 12:45:00 +0000 (14:45 +0200)]
compositor-drm: head attach requires a modeset

For the attach on an enabled output to have an effect, we need to go
through drmModeSetCrtc or ATOMIC_ALLOW_MODESET.

v9:
- Add another XXX comment.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agocompositor-drm: head detach requires a modeset
Pekka Paalanen [Wed, 29 Nov 2017 12:33:33 +0000 (14:33 +0200)]
compositor-drm: head detach requires a modeset

When a head is detached from an enabled output, that output needs to go
through a modeset (drmModeSetCrtc() / ATOMIC_ALLOW_MODESET) so that the
connector is actually removed from the CRTC.

This has not yet been a problem, because an output could only have one
head at a time, and would be automatically disabled on detach. It would
be a problem with clone mode.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agocompositor-drm: preserve CRTC routing harder
Pekka Paalanen [Tue, 28 Nov 2017 14:11:00 +0000 (16:11 +0200)]
compositor-drm: preserve CRTC routing harder

If we are processing a connector that does not have an existing routing,
it is possible we pick a CRTC that was previously routed to a connector
we have not enabled yet. If that happens, the latter connector cannot
preserve its routing.

Check that no other connector we might enable later had this CRTC
before.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agocompositor-drm: rewrite crtc picking for clone mode
Pekka Paalanen [Mon, 20 Nov 2017 11:31:06 +0000 (13:31 +0200)]
compositor-drm: rewrite crtc picking for clone mode

To support shared-CRTC clone mode, the chosen CRTC needs to support
driving all the attached connectors. Replace the old algorithm with a
new one that takes into account all associated connectors.

Ideally it should use possible_clones mask to check which encoders (and
therefore connectors) actually can be in a cloned set. However, the DRM
documentation says about possible_clones and possible_crtcs masks both:
"In reality almost every driver gets this wrong."
- https://01.org/linuxgraphics/gfx-docs/drm/gpu/drm-kms.html#c.drm_encoder

Looking at a target device and its kernel where clone mode is desired,
possible_clones is indeed self-conflicting and would not allow cloning
at all. Therefore the implemented algorithm replaces the checking of
possible_clones with luck. It even goes out of its way to find any CRTC
for a configuration, even if not advertised by the kernel as not
supported.

Libweston would need infrastructure to allow trial-and-error CRTC
allocation: rather than picking one CRTC in advance and do or die, it
should try all available CRTCs one by one. Unfortunately that is not yet
possible, so this patch implements what it can. It is also the DRM
upstream opinion that trial-and-error with ATOMIC_TEST would be the way
to go.

Unlike the old algorithm, the new algorithm prefers routings that were
in place when Weston started instead of when enabling an output. When
you never temporarily disable an output, this makes no difference.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agolibweston: fix weston_touch_start_grab() arg name
Louis-Francis Ratté-Boulianne [Wed, 29 Nov 2017 01:42:47 +0000 (20:42 -0500)]
libweston: fix weston_touch_start_grab() arg name

compositor.c has 'touch', so use 'touch' here as well. It is not a
device to begin with.

Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
v1 Tested-by: Matt Hoosier <matt.hoosier@gmail.com>

6 years agolibweston: unexport weston_{pointer,keyboard,touch}_{create,destroy}()
Pekka Paalanen [Mon, 26 Feb 2018 12:55:32 +0000 (14:55 +0200)]
libweston: unexport weston_{pointer,keyboard,touch}_{create,destroy}()

We have weston_seat_{init,release}_{pointer,keyboard,touch}() as the
backend-facing API. There is no need to expose the create/destroy
functions which have been for internal use only for quite a long time.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
v1 Tested-by: Matt Hoosier <matt.hoosier@gmail.com>

6 years agoUpdate copyrights for Collabora and General Electric Company
Pekka Paalanen [Thu, 19 Apr 2018 11:20:01 +0000 (14:20 +0300)]
Update copyrights for Collabora and General Electric Company

Looking at the diff statistics of the changes authored by me and landed
since 4.0.0 release points out these files as having major changes.
Update the copyright holders accordingly, as both clone mode and
touchscreen calibration related patches are copyright both Collabora and
GE.

I have kept the redundant "Copyright ©" form only to keep things
consistent, even when either the word or the mark would be enough.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Acked-by: Ian Ray <ian.ray@ge.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agotests: add test_seat_release() for symmetry
Pekka Paalanen [Mon, 26 Feb 2018 12:14:14 +0000 (14:14 +0200)]
tests: add test_seat_release() for symmetry

Add test_seat_release() as the counterpart of test_seat_init() instead
of open-coding it. This helps adding more code to test_seat_release()
later.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agoman: document WESTON_LIBINPUT_LOG_PRIORITY env
Pekka Paalanen [Mon, 5 Feb 2018 14:20:51 +0000 (16:20 +0200)]
man: document WESTON_LIBINPUT_LOG_PRIORITY env

Commit c81c4241d9c9fc5f60c08177dd8a33ae4e4ddca1 added this environment
variable. Document it.

It applies also to the fbdev-backend but that has no man page.

v2:
- Rewording by Peter Hutterer.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agolibinput: do not switch output associations on disable
Pekka Paalanen [Tue, 20 Mar 2018 12:45:36 +0000 (14:45 +0200)]
libinput: do not switch output associations on disable

If an input device is associated to an output that then gets disabled,
there is no case where associating to a different output would be
correct.

The output association is used for absolute positioned input devices,
and an input device like a touchscreen cannot ever be automatically
valid for more than one possible output - the touchscreen display
device.

Therefore do not automatically reassing implicitly associated input
devices to another output. This removes some log spam on shutdown.

In fact, if there can be more than one output at any time, absolute
input devices must be explicitly configured to associate with the
correct output, or the results are essentially undefined in any case.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agolibweston: require connected heads for input devices
Pekka Paalanen [Tue, 20 Mar 2018 11:29:40 +0000 (13:29 +0200)]
libweston: require connected heads for input devices

The use case driving this change is a clone mode setup, where the user
is hotplugging or unplugging a cloned touchscreen. Even if the output
and head are force-enabled, the touch device should still follow the
connector connection status. If there is no video signal for the
touchscreen (disconnected connector), then the touch input should be
ignored as well.

When the output is force-enabled, we need to trigger
output_heads_changed from connector status changes. If the head or
output are not force-enabled, the compositor will likely attach and
detach the head as appropriate. In clone mode, the attach or detach
needs to trigger output_heads_changed directly. In other cases, it may
be handled through the output getting enabled or disabled which are
different signals.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agolibinput: use head names for output matching
Pekka Paalanen [Mon, 19 Mar 2018 12:55:41 +0000 (14:55 +0200)]
libinput: use head names for output matching

Associating input devices with weston_outputs by the output name fails
when one output has several heads. We need to match against head names
instead of output names to be able to find all names.

This fixes touchscreen output association in shared-CRTC clone mode when
outputs or input devices appear or disappear.

Even though notify_output_create() is called only when new outputs
appear, the implementation is prepared to also remove output
associations. This will be handy in the future when this function will
handle also head detaching from an output that remains enabled.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agolibinput: allow evdev_device_set_output(dev, NULL)
Pekka Paalanen [Thu, 20 Apr 2017 08:38:06 +0000 (11:38 +0300)]
libinput: allow evdev_device_set_output(dev, NULL)

Removing the output association from an evdev_device is more than just
setting the pointer to NULL, one also needs to remove the destroy
listener and flag the destroy listener as unused (notify == NULL).

evdev_device_set_output() can already remove associations, so let it
also handle an assignment to NULL output.

Fix notify_output_destroy() to handle removing an association correctly.
Previously, the listener was left "used", which would mean the next call
to evdev_device_set_output() would have wl_list_remove()'d, accessing
freed memory. This could be triggered by having a touchscreen with a
specified output association, and unplugging then re-plugging the
corresponding output.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agolibinput: make setting the same output a no-op
Pekka Paalanen [Tue, 18 Apr 2017 09:22:12 +0000 (12:22 +0300)]
libinput: make setting the same output a no-op

In the future evdev_device_set_output() will start getting called more
often, redundantly. Short-circuit the setting if the chosen output is
already set for an input device. This reduces churn in the logs.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agolibinput: log input device to output associations
Pekka Paalanen [Tue, 18 Apr 2017 09:22:12 +0000 (12:22 +0300)]
libinput: log input device to output associations

Helps admins ensure the configuration is correct.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agolibinput: deprecate WL_CALIBRATION
Pekka Paalanen [Wed, 21 Mar 2018 12:30:04 +0000 (14:30 +0200)]
libinput: deprecate WL_CALIBRATION

The udev property WL_CALIBRATION is an old way of giving Weston a
touchscreen calibration matrix. It is Weston-specific.

The recommended way of setting up a calibration is to use the udev
property LIBINPUT_CALIBRATION_MATRIX, which libinput will load
automatically and therefore applies to all libinput using display
servers and applications.

The syntax of WL_CALIBRATION and LIBINPUT_CALIBRATION_MATRIX is
different as well: WL_CALIBRATION uses pixels as the translation part
units, which makes the values depend on the output resolution.
LIBINPUT_CALIBRATION_MATRIX on the other hand uses normalized units.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agolibinput: note if calibrating without an output
Pekka Paalanen [Tue, 18 Apr 2017 09:14:32 +0000 (12:14 +0300)]
libinput: note if calibrating without an output

Print a note that calibration got skipped if the input device supports a
calibration matrix but there is no associated output to compute it from.
Helps with debugging touchscreen calibration issues.

The code is reorganized and commented a bit, but this does not change
the behaviour.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agolibinput: remove evdev_device::devnode
Pekka Paalanen [Tue, 18 Apr 2017 11:43:08 +0000 (14:43 +0300)]
libinput: remove evdev_device::devnode

Struct 'evdev_device' has field 'devnode' which is initialized to NULL,
never assigned, and finally free()'d. Therefore it is useless.

Remove the dead field.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agocompositor-drm: no need to clear inherited_mode
Pekka Paalanen [Tue, 28 Nov 2017 12:33:52 +0000 (14:33 +0200)]
compositor-drm: no need to clear inherited_mode

The head was just zalloc()'d, there is no need to memset it to zero.

If a function fails, it is preferable it leaves the output arguments
untouched.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
6 years agocompositor-drm: introduce drm_head_read_current_setup()
Pekka Paalanen [Tue, 28 Nov 2017 12:30:10 +0000 (14:30 +0200)]
compositor-drm: introduce drm_head_read_current_setup()

Rename connector_get_current_mode() because it will be useful for
storing not just the current mode on creating a head.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
6 years agocompositor-drm: update video mode printing
Pekka Paalanen [Wed, 15 Nov 2017 11:37:18 +0000 (13:37 +0200)]
compositor-drm: update video mode printing

Stop using a head for printing the mode list, because there could be
multiple heads. We already gather the mode list from all heads.

No need to print the connector id here, because it is logged with DRM
heads, and core prints the head names on output enable.

The "built-in" flag seemed dead, because it could only be printed if the
kernel provided no modes. If we want more detailed info on where modes
come from, we would need to inspect mode_info or add new flags to
drm_mode or weston_mode.

Add printing the pixel clock, because that is used by the video mode
duplicate removal code.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
6 years agocompositor-drm: backlight control for all heads
Pekka Paalanen [Wed, 15 Nov 2017 10:51:01 +0000 (12:51 +0200)]
compositor-drm: backlight control for all heads

If an output has multiple (cloned) heads, it should be enough for any
head to support backlight control for DRM-backend to expose it.

Inspect all attached heads for backlight control and improve the
logging.

Pick the initial backlight level from whatever happens to be the "first"
head, because it's simple.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
6 years agocompositor-drm: combine mode list from heads
Pekka Paalanen [Fri, 10 Nov 2017 14:34:39 +0000 (16:34 +0200)]
compositor-drm: combine mode list from heads

A single list of modes needs to be combined from the mode lists in each
attached head. We could just concatenate the lists, but that might
introduce duplicates. Try to avoid duplicates instead by using partially
fuzzy matching.

When a duplicate is found, try to figure out which is more suitable to
use in place of both. If one has the preferred flag and the other
doesn't, take the preferred one. Otherwise use the one already in the
list.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
6 years agocompositor-drm: unify head status logging
Pekka Paalanen [Thu, 9 Nov 2017 13:10:11 +0000 (15:10 +0200)]
compositor-drm: unify head status logging

Previously the log contained one line for EDID data and another line for
the head, and you just had to know they belong together. Make it more
obvious to read by putting both head and EDID info on the same line.

We no longer print EDID data every time it is parsed (on every hotplug
event), but only if it changes. I did take a shortcut here and use
weston_head::device_changed as the print condition which relies on the
compositor clearing it, but a failure to do so just means we print stuff
even if it didn't change.

Head info updates also print the head info and not just the EDID data.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
6 years agocompositor-drm: drm_set_backlight heads
Pekka Paalanen [Tue, 12 Sep 2017 13:14:31 +0000 (16:14 +0300)]
compositor-drm: drm_set_backlight heads

Fix this function to support more than one head per output.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
6 years agocompositor-drm: drm_output_apply_state_atomic heads
Pekka Paalanen [Tue, 12 Sep 2017 13:07:32 +0000 (16:07 +0300)]
compositor-drm: drm_output_apply_state_atomic heads

Fix this function to support more than one head per output.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
6 years agocompositor-drm: drm_output_apply_state_legacy heads
Pekka Paalanen [Tue, 12 Sep 2017 13:02:01 +0000 (16:02 +0300)]
compositor-drm: drm_output_apply_state_legacy heads

Fix this function to support more than one head per output.

v9:
- Change { connectors, 0 } to { NULL, 0 } in drmModeSetCrtc() args.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
6 years agocompositor-drm: remove unused_connectors array
Pekka Paalanen [Tue, 12 Sep 2017 10:43:51 +0000 (13:43 +0300)]
compositor-drm: remove unused_connectors array

Replace the unused_connectors array by iterating through the head list
instead. A head that is not enabled (attached to an enabled output) is
basically an unused connector.

All connectors regardless of their status have a drm_head. This has the
nice effect that drm_pending_state_apply_atomic() does not need to
re-query the connector properties every time, they can be simply looked
up in the drm_head.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
6 years agocompositor-drm: create heads for all connectors
Pekka Paalanen [Fri, 8 Sep 2017 12:48:07 +0000 (15:48 +0300)]
compositor-drm: create heads for all connectors

In previous patches, all the appropriate fields from drm_output have
been moved into drm_head, and resource allocation has been moved away
from drm_output creation. It is time to throw the switch: this patch
disconnects the drm_output and drm_head lifetimes.

Previously a drm_output was created for a connected connector and
destroyed on disconnection. A drm_head was tied to the drm_output
lifetime just to accommodate the head-based output configuration API
temporarily.

Now all connectors will get a head created regardless of their
connection status. Heads are created and destroyed as connectors appear
and disappear (MST), not when they get connected or disconnected. This
should allow the compositor to force-enable a disconnected connector.

An "empty" drm_output is created with weston_backend::create_output()
hook. This now follows the intent of the head-based output configuration
API.

On hotplug events, all connectors' information is updated regardless of
their connection status changes. It is theoretically possible for a
monitor to change without going through a disconnected state in between.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
6 years agocompositor-drm: move mode list to set_mode()
Pekka Paalanen [Mon, 11 Sep 2017 12:01:12 +0000 (15:01 +0300)]
compositor-drm: move mode list to set_mode()

Move the initialization of the drm_output mode list to
drm_output_set_mode() time.

Once we stop creating the drm_head with the drm_output, there will not
be a head to get the mode list from at drm_output creation time.

Furthermore, once DRM-backend starts supporting more than one head per
output, the combined mode list to be exposed to clients (and the
compositor?) must be constructed with all heads attached.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
6 years agocompositor-drm: get current mode on head discovery
Pekka Paalanen [Mon, 11 Sep 2017 11:06:11 +0000 (14:06 +0300)]
compositor-drm: get current mode on head discovery

The inherited mode is the video mode on the connector when we have not
yet reconfigured the connector, if set.

Get the inherited mode the moment we create a drm_head, not when we
determine the mode for a drm_output. This way we are sure to read all
inherited modes before we reconfigure a single CRTC. Enabling one output
may grab the CRTC from another connector, overwriting whatever mode that
connector might have had.

The inherited mode is stored in drm_head, where we can keep it for the
lifetime of the head, rather than relying on re-loading it from the
kernel at set_mode() time.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
6 years agocompositor-drm: simplify drm_output_find_special_plane()
Pekka Paalanen [Fri, 27 Oct 2017 11:06:51 +0000 (14:06 +0300)]
compositor-drm: simplify drm_output_find_special_plane()

As these planes are allocated on output enable and freed on output
disable, there cannot be a match in the pending_output_list.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
6 years agocompositor-drm: simplify drm_output_find_by_crtc()
Pekka Paalanen [Fri, 27 Oct 2017 10:52:12 +0000 (13:52 +0300)]
compositor-drm: simplify drm_output_find_by_crtc()

As CRTC is allocated on output enable and deallocated on output disable,
there cannot be any matches in find-by-crtc from the
pending_output_list.

Remove the loop over pending_output_list as never finding anything by
definition.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
6 years agocompositor-drm: allocate CRTC on enable()
Pekka Paalanen [Fri, 8 Sep 2017 10:32:40 +0000 (13:32 +0300)]
compositor-drm: allocate CRTC on enable()

A drm_output needs a CRTC only when it is in use. Allocating a CRTC on
creation of drm_output will reserve the CRTC regardless of whether the
output is actually used or not. This may cause creating other
drm_outputs to fail if there are not enough CRTCs.

Instead, allocate the CRTC on drm_output enable() time. A drm_output
will have a valid CRTC only while it is enabled.

This allows us to create drm_output objects arbitrarily and without a
head assignment, which is required by the head-based output API for the
backends. The assigned heads will be known only at enable() time.

Now drm_output_enable() has to call drmModeGetResources() to be able to
find a suitable CRTC. We might want to cache the resources somewhere,
but that is it topic for another patch.

v4: Force resetting unused CRTCs on fini.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
6 years agocompositor-drm: move connector fields into drm_head
Pekka Paalanen [Thu, 31 Aug 2017 13:18:48 +0000 (16:18 +0300)]
compositor-drm: move connector fields into drm_head

Move the connector related fields from drm_output to the drm_head. A
drm_head represents a connector for now.

The code in drm_head_create() to update connector data, monitor
information, etc. is moved into a new function. This will be useful when
DRM-backend starts creating heads for all connectors regardless of their
connection status and will need to update them on hotplug events.

While incurring the churn to move several fields into struct drm_head,
also refactor out drm_head_assign_connector_info(). This function is
needed later when drm_heads will exist regardless of connected status,
as every hotplug event will need to update the state of all connectors.
At that point we will also start handling connector changes that do not
go through an intermediate disconnected state. This refactoring is
trivial enough to be in this patch to reduce the total amount of changes
to be reviewed.

v6:
- adapt to the new places of updating unused_connectors
- free connector in create_output_for_connector() error path

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
6 years agocompositor-drm: move backlight into drm_head
Pekka Paalanen [Mon, 4 Sep 2017 09:21:24 +0000 (12:21 +0300)]
compositor-drm: move backlight into drm_head

Backlight is driven per connector, hence it belongs in struct drm_head.

weston_output::set_backlight() API is remains per output so far. There
is no UI to control backlights per head and adding one would be
difficult for an output that has multiple cloned heads.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
6 years agocompositor-drm: find disconnects from head_list
Pekka Paalanen [Thu, 31 Aug 2017 12:41:57 +0000 (15:41 +0300)]
compositor-drm: find disconnects from head_list

Instead of iterating output_list and pending_output_list, iterate
head_list to find outputs whose connectors have been disconnected.

This helps a following patch to move connector fields from drm_output to
drm_head.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
6 years agocompositor-drm: use head_find_by_connector in update_unused_outputs
Pekka Paalanen [Tue, 13 Feb 2018 13:02:44 +0000 (15:02 +0200)]
compositor-drm: use head_find_by_connector in update_unused_outputs

Making this function not depend on drm_head::output field through
drm_output_find_by_connector() will later allow to remove the
drm_head::output field before removing the unused_connectors array. This
helps keeping the commit more fine-grained.

drm_backend_update_unused_outputs() was only interested in enabled
outputs. The new code is 100% equivalent to the old code. The
difference is that weston_head::output is only set for attached heads. A
connector cannot be in use if it is not attached to an output.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
6 years agocompositor-drm: drm_output_find_by_connector from head_list
Pekka Paalanen [Thu, 31 Aug 2017 08:58:41 +0000 (11:58 +0300)]
compositor-drm: drm_output_find_by_connector from head_list

Switch drm_output_find_by_connector() to search for the output by
iterating the compositor's head_list. drm_head_find_by_connector() will
be useful later on its own.

As of "compositor-drm: start migration to head-based output API" the
head list is guaranteed to contain all created drm_outputs through the
automatically created drm_head.

This simplifies the code a little, introduces
drm_head_find_by_connector(), and works towards the eventual removal of
drm_output_find_by_connector().

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
6 years agolibweston: log head detach on enabled output
Pekka Paalanen [Fri, 8 Dec 2017 14:11:17 +0000 (16:11 +0200)]
libweston: log head detach on enabled output

Helps debugging.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
6 years agolibweston: allow attaching heads to enabled outputs
Pekka Paalanen [Fri, 8 Dec 2017 12:13:34 +0000 (14:13 +0200)]
libweston: allow attaching heads to enabled outputs

Move the responsibility of ensuring the head will work in the enabled
output to the backends.

A compositor cannot enable an output without heads, and removing the
last head from an output automatically disables the output, so attaching
a new head to an enabled output is only possible for clone mode.

Backends headless, rdp, and x11 forbid clone mode by not having an
attach_head hook implemented; fbdev and wayland explicitly deny clone
mode. Only the DRM backend is affected by this change and even that not
yet because MAX_CLONED_CONNECTORS is 1 in the DRM backend.

Also ensure a global is created for the head when attached to an enabled
output, and log it.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
6 years agolibweston: support user data on weston_output
Pekka Paalanen [Tue, 7 Nov 2017 08:15:01 +0000 (10:15 +0200)]
libweston: support user data on weston_output

Support attaching custom data to a weston_output by the traditional
destroy listener / wl_signal_get approach.

Needs a new destroy signal, because user data lifetime should be the
lifetime of the weston_output regradless of its enabled status. The old
destroy signal is for output consumers that only care about enabled
outputs in the system and gets emitted on disable, not on destroy.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
6 years agolibweston: create/find output by name
Pekka Paalanen [Thu, 2 Nov 2017 12:11:53 +0000 (14:11 +0200)]
libweston: create/find output by name

To let users pick an arbitrary name for an output, to be used as e.g. a
configuration key, add API to create an output with a given name. For
the same configuration purpose, add a search function as well.

For the search function to be predictable, forbid creating multiple
outputs with the same name. Previously, creating multiple outputs with
the same name would have needed detatching to create outputs from the
same head, now that is forbidden.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
6 years agolibweston: print head names on output enable
Pekka Paalanen [Thu, 2 Nov 2017 12:03:11 +0000 (14:03 +0200)]
libweston: print head names on output enable

This will be interesting to see when testing clone mode.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
6 years agolibweston: remove weston_output::head
Pekka Paalanen [Fri, 27 Oct 2017 09:07:49 +0000 (12:07 +0300)]
libweston: remove weston_output::head

Remove the scaffolding that allowed backends to be converted one by one
to the head-based API. Nothing is using these members anymore.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
6 years agocompositor-drm: start migration to head-based output API
Pekka Paalanen [Mon, 28 Aug 2017 13:27:20 +0000 (16:27 +0300)]
compositor-drm: start migration to head-based output API

Hook up the libweston facing head-based output API by introducing struct
drm_head, but leave it as a fake so that members can be migrated in
pieces in follow-up patches.

The DRM backend continues to create an output for each connected
connector only, and during output creation it also creates a drm_head
for it. This allows it to pretend it supports the head-based output API
as long as there is only one head per output ever attached.

create_output callback is fake, it will only look up the existing
drm_output by the head name.

Clones are not yet supported, hence max is defined to 1.

This unfortunately introduces some temporary code that will be revomed
later, but seems to be necessary to avoid a single big patch.

v6:
- add missing drm_head_destroy() call

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
6 years agocompositor-wayland: migrate to head-based output API
Pekka Paalanen [Wed, 25 Oct 2017 12:51:37 +0000 (15:51 +0300)]
compositor-wayland: migrate to head-based output API

Follow the standard pattern used in the headless and x11 backend
migration, but also cater for the two other backend modes: --sprawl or
fullscreen-shell, and --fullscreen.

Stops relying on the implicit weston_output::head.

Unlike other backends, this uses the attach_head hook to do the
required head setup that is not possible to do without an output, but
must be done before weston_output_enable(). This also requires the
detach_head hook for the one case where the user attaches a --fullscreen
head and then detaches it without enabling the output.

It is a little awkward to fully initialize heads as late as attach, but
aside from the --sprawl/fullscreen-shell case, there is not really a way
to know the head properties without creating the parent wl_surface and
configuring it.

Heads/outputs created for parent outputs now have distinct names instead
of all being called "wlparent".

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
6 years agocompositor-wayland: strict surface create/destroy
Pekka Paalanen [Thu, 26 Oct 2017 09:56:00 +0000 (12:56 +0300)]
compositor-wayland: strict surface create/destroy

Add safeguards to make it painfully obvious if we ever get the pairing
of wayland_backend_create_output_surface() and
wayland_backend_destroy_output_surface() wrong. Helps catching bugs.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
6 years agocompositor-x11: migrate to head-based output API
Pekka Paalanen [Thu, 12 Oct 2017 12:58:10 +0000 (15:58 +0300)]
compositor-x11: migrate to head-based output API

Follow the standard pattern set by the headless backend which also uses
the the window output API.

Stops relying on the implicit weston_output::head.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
6 years agocompositor-fbdev: migrate to head-based output API
Pekka Paalanen [Thu, 14 Sep 2017 13:50:44 +0000 (16:50 +0300)]
compositor-fbdev: migrate to head-based output API

Implement the head-based output API in this backend, and stop relying on
the implicit weston_output::head.

The split between fbdev_head and fbdev_output is somewhat arbitrary.
There is no hotplug or unplug, and there is always 1:1 relationship.
Struct fbdev_screeninfo could have been split as well, but it would not
have made much difference.

I chose fbdev_output to carry the mmap details (buffer_length is now
duplicated here), and fbdev_head to carry the display parameters and
device node path. The device node identifies the head, similar to a
connector.

The backend init creates a head. The compositor uses it to create an
output. Libweston core attaches the head automatically after creating
the output. The attach hook is a suitable place to set up the video
modes on the output as they are dictated by the head, it would be too
late at enable() time.

v7:
- use name argument instead of hardcoded "fbdev" in
  fbdev_output_create()

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>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
6 years agocompositor-fbdev: make re-enable less drastic
Pekka Paalanen [Wed, 13 Sep 2017 13:19:02 +0000 (16:19 +0300)]
compositor-fbdev: make re-enable less drastic

Destroying the whole output in reenable would cause list walk
corruption: the loop over output_list in session_notify() is not using
wl_list_for_each_safe so output removal would break it.

Creating a new output is also problematic as it needs the compositor to
configure it, but that probably saved us from another list walk failure:
adding the new output to be list while walking the list, possibly
causing it to be destroyed and re-created ad infinitum.

Instead of a complete destroy/create cycle, just do our internal
disable/enable cycle. That will re-open the fbdev, re-read the
parameters, re-create hw_surface, and reinitialize the renderer output.

A problem with this is if fbdev_set_screen_info() fails. We do read the
new parameters, but we don't communicate them to libweston core or old
clients.

However, it is hard to care: to trigger this path, one needs to
VT-switch to another fbdev app which changes the fbdev parameters. That
is quite difficult as VT-switching has been broken for a good while for
fbdev-backend, at least with logind. Also fbdev_set_screen_info() would
have to fail before one should be able to tell something is wrong.

The real reason behind this patch, though, is the migration to the
head-based output API. Destroying and re-creating an output really does
not fit that design. Destroying and re-creating a head would be better,
but again not testable in the current state.

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>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
6 years agocompositor-rdp: migrate to head-based output API
Pekka Paalanen [Thu, 12 Oct 2017 13:21:26 +0000 (16:21 +0300)]
compositor-rdp: migrate to head-based output API

Follow the starndard patttern as the other backends, headless and x11 in
particular, to stop relying on the implicit weston_output::head.

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>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
6 years agocompositor-headless: migrate to head-based output API
Pekka Paalanen [Thu, 24 Aug 2017 13:40:17 +0000 (16:40 +0300)]
compositor-headless: migrate to head-based output API

Implement the head-based output API in this backend, and stop relying on
the implicit weston_output::head.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
6 years agolibweston: cancel idle_repaint on output destroy
Pekka Paalanen [Thu, 26 Oct 2017 11:33:59 +0000 (14:33 +0300)]
libweston: cancel idle_repaint on output destroy

If the idle_repaint() callback has been scheduled when a weston_output
gets destroyed, the callback will hit use-after-free. I have encountered
this when migrating the wayland backend to the head-based API, using
--sprawl, and closing/disconnecting one of the parent compositor
outputs.

Store the idle_repaint callback source, and destroy it in
weston_output_release(), ensuring we don't get a stale call to
start_repaint_loop later.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
6 years agolibweston: assert current_mode in weston_output_enable()
Pekka Paalanen [Thu, 14 Sep 2017 13:17:59 +0000 (16:17 +0300)]
libweston: assert current_mode in weston_output_enable()

The functions called here, particularly
weston_output_transform_scale_init(), rely on current mode being set.
The current mode must also be found in the mode list, though we don't
explicitly check it here.

current_mode not being set is a programmer error. It could be a backend
bug, but it could also be a libweston user bug not calling a set size
function.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
6 years agolibweston: assert make/model in weston_output_enable()
Pekka Paalanen [Thu, 24 Aug 2017 13:08:49 +0000 (16:08 +0300)]
libweston: assert make/model in weston_output_enable()

Output make and model are not allowed to be NULL in the protocol, so
ensure they are not forgotten when enabling an output.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
6 years agolibweston: stop auto-adding the implicit head
Pekka Paalanen [Wed, 23 Aug 2017 13:00:21 +0000 (16:00 +0300)]
libweston: stop auto-adding the implicit head

All frontends have been converted to the new head-based output
management API, which means that
weston_compositor_create_output_with_head() is calling
weston_output_attach_head(). We will never hit the implicit attach
anymore.

Therefore we can now require that an output has at least one head when
calling weston_output_enable(). An output without heads is useless.

The auto-add code is removed as dead.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
6 years agolibweston: remove output_pending_signal
Pekka Paalanen [Thu, 17 Aug 2017 14:29:36 +0000 (17:29 +0300)]
libweston: remove output_pending_signal

The signal has been replaced with the heads_changed hook and is no
longer useful.

weston_pending_output_coldplug() is renamed to
weston_compositor_flush_heads_changed() for two reasons: it better
describes what it does now, and it serves as an obvious flag that
libweston ABI has been broken.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
6 years agolibweston: change windowed_output_api output_create to create_head
Pekka Paalanen [Thu, 12 Oct 2017 12:03:42 +0000 (15:03 +0300)]
libweston: change windowed_output_api output_create to create_head

Rename the function pointer to create_head() because that is what it
does on backends that are converted to the head-based API. Update the
documentation to match.

Surprisingly this is not an ABI break, as the function behaviour and
signature remain intact. Hence API_NAME is not bumped.

This is only an API break, and main.c is fixed accordingly.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
6 years agoweston: migrate DRM to head-based output API
Pekka Paalanen [Thu, 17 Aug 2017 14:13:08 +0000 (17:13 +0300)]
weston: migrate DRM to head-based output API

Migrate the DRM frontend to use the simple head-based output
configurator, maintaining the exact same features and semantics as
before.

This is an intermediate step. It is unoptimal to create a weston_output
just to turn it off, but the libweston implementation and the DRM
backend require it for now. In the future, the DRM frontend will get its
own configurator that does not create useless weston_outputs and
supports clone mode by attaching multiple heads to the same
weston_output. Clone mode is not yet supported by libweston/DRM.

Until we remove the need to create a weston_output just to turn it
"off", that is, disable it, we will hit simple_head_enable() for heads
we have already disabled. As long as the DRM-backend conversion to the
head-based API is not complete, attempting to create an output for a
head again would lead to a crash. This problem does not exist right now,
but it will after the patch "compositor-drm: start migration to
head-based output API". Therefore, check if the head we are about to
process is already attached, and do nothing if so. DRM outputs set to
"off" are the only ones legitimately hitting this condition.

This is the last frontend migrated, wet_set_pending_output_handler() is
deleted as dead code.

v9:
- Add the workaround in simple_head_enable().

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
v6 Reviewed-by: Ian Ray <ian.ray@ge.com>
v7 Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
6 years agoweston: migrate RDP to head-based output API
Pekka Paalanen [Thu, 17 Aug 2017 14:09:01 +0000 (17:09 +0300)]
weston: migrate RDP to head-based output API

Migrate the RDP frontend to use the new head-based output configuration
API: listen for heads_changed, and process all heads.

v7:
- remove unnecessary 'goto out' in load_rdp_backend()

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>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
6 years agoweston: migrate fbdev to head-based output API
Pekka Paalanen [Thu, 17 Aug 2017 14:05:29 +0000 (17:05 +0300)]
weston: migrate fbdev to head-based output API

Migrate the fbdev frontend to use the new head-based output
configuration API: listen for heads_changed, and process all heads.

v7:
- remove unnecessary 'goto out' in load_fbdev_backend()

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>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
6 years agoweston: migrate wayland to head-based output API
Pekka Paalanen [Thu, 17 Aug 2017 13:59:53 +0000 (16:59 +0300)]
weston: migrate wayland to head-based output API

Migrate the Wayland frontend to use the new head-based output
configuration API: listen for heads_changed, and process all heads.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
6 years agoweston: migrate x11 to head-based output API
Pekka Paalanen [Thu, 17 Aug 2017 13:54:58 +0000 (16:54 +0300)]
weston: migrate x11 to head-based output API

Migrate the x11 frontend to use the new head-based output configuration
API: listen for heads_changed, and process all heads.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
6 years agoweston: migrate headless to head-based output API
Pekka Paalanen [Thu, 17 Aug 2017 10:10:28 +0000 (13:10 +0300)]
weston: migrate headless to head-based output API

Migrate the headless frontend to use the new head-based output
configuration API: listen for heads_changed, and process all heads.

The simple_heads_changed() function is written to be able to cater for
all backends. The rest will be migrated individually.

The head destroy listeners are not exactly necessary, for headless
anyway, but this is an example excercising the API. Also
is_device_changed() check is mostly useful with DRM.

v8:
- replace weston_compositor_set_heads_changed_cb() with
  weston_compositor_add_heads_changed_listener()
- fix comment on wet_head_tracker_create()

v3: Print "Detected a monitor change" only for enabled heads.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
v6 Reviewed-by: Ian Ray <ian.ray@ge.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
6 years agoweston: move weston_output_enable() into callers
Pekka Paalanen [Thu, 17 Aug 2017 13:39:48 +0000 (16:39 +0300)]
weston: move weston_output_enable() into callers

Move the call out of wet_configure_windowed_output_from_config() and
into its callers.

This allows to migrate each frontend one by one.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
6 years agolibweston: add weston_head_is_device_changed() API
Pekka Paalanen [Mon, 28 Aug 2017 11:11:02 +0000 (14:11 +0300)]
libweston: add weston_head_is_device_changed() API

Reacting to DRM hotplug events is racy. It is theoretically possible to
get hotplug events for a quick swap from one monitor to another and
process both only after the new monitor is connected. Hence it is
possible for display device information to change without going through
a disconnected state for the head.

To support such cases, add API to allow detecting it in the compositor.

v6:
- change str_null_neq() to str_null_eq()
- rename weston_head_condition_device_changed()
- move the condition from weston_head_set_device_changed() to the
callers

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
6 years agolibweston: add weston_head destroy signal
Pekka Paalanen [Tue, 10 Oct 2017 08:21:58 +0000 (11:21 +0300)]
libweston: add weston_head destroy signal

Add support for subscribing to weston_head destruction.

The primary use case for heads being destroyed arbitrarily is the
DRM-backend with MST connectors, which may disappear on unplug. It is
not just the connector becoming disconnected, it is the connector
actually disappearing.

The compositor needs to know about disappearing heads so that it has a
chance to clean up "orphaned" outputs which do get disabled but still
need destroying at run time. Shutdown would destroy them as well.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
6 years agolibweston: new head-based output management API
Pekka Paalanen [Wed, 16 Aug 2017 07:39:17 +0000 (10:39 +0300)]
libweston: new head-based output management API

Introduce the API for users (compositors) to create an output from a
head, attach and detach heads, and destroy outputs created this way.
This also adds the backend-facing API to libweston.

In the new API design, a backend creates heads, and the compositor
chooses one or more heads (clone mode) to be driven by an output.
In the future backends will be converted to not create outputs directly
but only in the new create_output hook.

The user subscribes to a heads_changed hook and arranges heads into
outputs from there.

Adding the API this way will allow frontends (main.c) and backends to be
converted one by one. This adds compatiblity paths in
weston_compositor_create_output_with_head() and weston_output_destroy()
so that frontends can be converted first to call these, and then
backends can be converted one by one to the new design. Afterwards, the
compatibility paths will be removed along with weston_output::head.

Currently heads can be added to a disabled output only. This is less
than ideal for clone mode hotplug and should be improved on later.

v4: Remove the wl_output global on head detach if output is enabled.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
6 years agolibweston: add heads_changed_signal
Pekka Paalanen [Tue, 15 Aug 2017 10:00:02 +0000 (13:00 +0300)]
libweston: add heads_changed_signal

Add a hook for compositors to get a callback when heads are added or
their connection status changes, to which compositors likely want to
react to by enabling or disabling outputs (API for that to be added
later).

As many head changes as possible should be coalesced into a single
heads_changed call. Therefore the callback is made from an idle task.
This anticipates a future atomic output configuration API, where the
global output configuration is tested and set atomically instead of one
by one.

weston_pending_output_coldplug() needs to manually execute the
heads_changed call so that initial outputs are created before any
plugins get their start-up idle tasks ran. This is especially important
for ivi-shell which does not support output hotplug, and for tests to
guarantee the expected outputs.

v8:
- Change the callback function pointer into a wl_signal. The API is
  changed and renamed.

v6:
- fix a typo
- add comment in weston_pending_output_coldplug()

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
v6 Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
v6 Reviewed-by: Ian Ray <ian.ray@ge.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
6 years agolibweston: add compositor list of heads
Pekka Paalanen [Mon, 14 Aug 2017 13:05:35 +0000 (16:05 +0300)]
libweston: add compositor list of heads

weston_compositor needs to maintain a list of all available heads, so
that a compositor can pick and choose which heads to take into or out of
use at arbitrary times. The heads may be on or off, and connected or
disconnected.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
6 years agolibweston: add weston_head_is_enabled()
Pekka Paalanen [Thu, 15 Feb 2018 13:18:20 +0000 (15:18 +0200)]
libweston: add weston_head_is_enabled()

Enabled is orthogonal from connected. A connected head could be
disabled, or a disconnected head could in the future be enabled.

Compositors quite likely want to check if a head is already enabled
before starting to take it into use.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
6 years agolibweston: add weston_head::connected
Pekka Paalanen [Mon, 14 Aug 2017 12:45:14 +0000 (15:45 +0300)]
libweston: add weston_head::connected

Heads may be disconnected or connected and the compositor needs to be
able to know the state to know which heads to take into use.

Currently a single head is automatically created with an output, and
outputs are only ever created as connected and destroyed on
disconnection, so it suffices to set connected to true. In the future,
backends are expected to create heads for both connected and
disconnected connectors, so that a connector can be forced on without it
being actually connected.

v6:
- split weston_head_is_enabled() to a new patch

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
6 years agolibweston: add name to weston_head
Pekka Paalanen [Mon, 14 Aug 2017 11:43:13 +0000 (14:43 +0300)]
libweston: add name to weston_head

Heads need to be named, so they can be referenced in logs and
configuration sources.

When clone mode is implemented, output and head names may differ.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
6 years agocms-colord: find a good head
Pekka Paalanen [Tue, 4 Apr 2017 13:36:07 +0000 (16:36 +0300)]
cms-colord: find a good head

The 'head' member of 'struct weston_output' is going to go unused and
then disappear, so stop using it and find a head from the proper list.

However, this leaves a problem in cms-colord: if you have multiple
monitors driver with the same CRTC, what do you say to the color
management system? The monitors could be different, but all the color
LUTs etc. are in the CRTC and are shared, as is the framebuffer.

Do the simple hack here and just use whatever head happens to be the
first in the list.

The warning is printed in get_output_id(), because if heads are added or
removed while the output is enabled, the id could change.

v6:
- add weston_output_get_first_head(), at first use
- add warning message for nr. heads > 1

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
6 years agolibweston: strdup head make, model, serial_number
Pekka Paalanen [Tue, 4 Apr 2017 13:26:23 +0000 (16:26 +0300)]
libweston: strdup head make, model, serial_number

Duplicate these strings to decouple their lifetime from whatever the
backends used. This should prevent hard to catch use after frees and
such problems in the future.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
v5 Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
6 years agolibweston: properly orphan wl_output resources
Pekka Paalanen [Mon, 4 Dec 2017 13:28:13 +0000 (15:28 +0200)]
libweston: properly orphan wl_output resources

Remove the wl_resource in the head's resource list when we are
removing the wl_output global. We sent global removal events to clients,
the resources should become dummies until clients reap them. Reset user
data so that clients triying to use dummy objects don't hit e.g. a freed
head pointer.

This fixes a theoretical issue: if an enabled output is disabled and
then gets enabled again, mode changes and wl_surface.enter/leave would
still attempt to use the dummy objects. If a client destroyed a dummy
object, we don't have the destructor to remove it from the resource
list, and libweston would hit freed memory.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
v5 Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
6 years agolibweston: introduce weston_output::head_list
Pekka Paalanen [Tue, 28 Mar 2017 13:27:25 +0000 (16:27 +0300)]
libweston: introduce weston_output::head_list

The intention is that in the future backends will dynamically allocate
weston_heads based on the resources they have. The lifetime of a
weston_head will be independent of the lifetime of a weston_output it
may be attached to. Backends allocate objects derived from weston_head,
like they currently do for weston_output. Backend will choose when to
destroy a weston_head.

For clone mode, struct weston_output gains head_list member, which is
the list of attached heads that will all show the same framebuffer.
Since heads are growing out of weston_output, management functions are
added.

Detaching a head from an enabled output is allowed to accommodate
disappearing heads. Attaching a head to an enabled output is disallowed
because it may need hardware reconfiguration and testing, and so
requires a weston_output_enable() call.

As a temporary measure, we have one weston_head embedded in
weston_output, so that backends can be migrated individually to the new
allocation scheme.

v8:
- Do not send wp_presentation_feedback.sync_output events for multiple
  wl_output globals in weston_presentation_feedback_present().

v6:
- adapt to upstream changes in weston_output_set_transform()
- use wl_list_for_each_safe in weston_output_release()
- removed weston_output_get_first_head() as it's not needed yet

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
v5 Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
v7 Reviewed-by: Ian Ray <ian.ray@ge.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
6 years agolibweston: refactor weston_mode_switch_finish
Pekka Paalanen [Tue, 28 Mar 2017 12:27:10 +0000 (15:27 +0300)]
libweston: refactor weston_mode_switch_finish

Split out a new function. This is a pure refactoring, no change in
behaviour.

This helps a following patch that adds a loop over output->head_list.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
v5 Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
6 years agolibweston: make wl_output point to weston_head
Pekka Paalanen [Mon, 27 Mar 2017 13:31:25 +0000 (16:31 +0300)]
libweston: make wl_output point to weston_head

The user data of a wl_resource representing a wl_output protocol object
used to be a pointer to weston_output. Now that weston_output is being
split, wl_output more accurately refers to weston_head which is a single
monitor.

Change the wl_output user data to point to weston_head.
weston_output_from_resource() is replaced with
weston_head_from_resource().

This change is not strictly necessary, but architecturally it is the
right thing to do. In the future there might appear the need to refer to
a specific head of a cloned pair, for instance.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
v5 Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
6 years agolibweston: use head in wl_output global
Pekka Paalanen [Mon, 27 Mar 2017 09:24:34 +0000 (12:24 +0300)]
libweston: use head in wl_output global

As a wl_output represents weston_head, use a weston_head pointer as the
wl_output global's user data.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
v5 Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
6 years agolibweston: move wl_output to weston_head
Pekka Paalanen [Mon, 27 Mar 2017 09:15:38 +0000 (12:15 +0300)]
libweston: move wl_output to weston_head

The wl_output protocol interface exposes things like monitor make,
model, sub-pixel layout and physical dimensions. Obviously wl_output is
meant to represent a monitor.

The abstraction of a monitor is weston_head. Therefore move the wl_output
global and the bound resources list into weston_head.

When clone mode gets implemented in the future, this means that monitors
driven by the same CRTC will still be represented as separate wl_output
globals. This allows to accurately represent the hardware.

Clone mode that used separate, not frame-locked, CRTCs to drive two
monitors as clones would necessarily also be exposed as separate
wl_output since they have different timings.

v6:
- adapt to upstream changes in weston_output_set_transform()

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
v5 Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
6 years agolibweston: introduce weston_head
Pekka Paalanen [Fri, 24 Mar 2017 13:39:24 +0000 (15:39 +0200)]
libweston: introduce weston_head

In order to support clone modes, libweston needs the concept of a head
that is separate from weston_output. While weston_output manages buffers
and the repaint state machine, weston_head will represent a single
monitor. In the future it will be possible to have a single
weston_output drive one or more weston_heads for a clone mode that
shares the framebuffers between all cloned heads.

All the fields that are obviously properties of the monitor are moved
from weston_output into weston_head.

As moving the fields requires one to touch all the backends for all the
assingments, introduce setter functions for them while we are here. The
setters are identical to the old assignments, for now.

As a temporary measure, weston_output embeds a single head. Also the
ugly casts in weston_head_set_monitor_strings() will be removed by a
follow-up patch.

Libweston major version is bumped, because weston_output struct layout
is changed.

v7:
- Bump libweston major version.

v6:
- adapt to upstream changes in weston_output_set_transform()

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
v5 Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
v6 Reviewed-by: Ian Ray <ian.ray@ge.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
6 years agoconfigure.ac: Bump libweston version to match weston version
Derek Foreman [Mon, 9 Apr 2018 21:13:09 +0000 (16:13 -0500)]
configure.ac: Bump libweston version to match weston version

configure won't work if weston's version is higher than libweston's.

6 years agoconfigure.ac: Reopen master for regular development
Derek Foreman [Mon, 9 Apr 2018 18:13:40 +0000 (13:13 -0500)]
configure.ac: Reopen master for regular development

6 years agoconfigure.ac: bump to version 4.0.0 for the official release
Derek Foreman [Mon, 9 Apr 2018 16:55:01 +0000 (11:55 -0500)]
configure.ac: bump to version 4.0.0 for the official release

6 years agoterminal: Fix unintended fallthrough to cursor restore
Daniel Stone [Tue, 3 Apr 2018 18:38:09 +0000 (19:38 +0100)]
terminal: Fix unintended fallthrough to cursor restore

ef57a9b788 added support for window operations such as reporting the
title in escape mode. It implemented this by which-window-op case,
inside the existing which-escape-code case. Whilst it would break out of
the former window-op case, it never broke out of the latter escape-code
case. This would lead to window ops (such as reporting title) falling
through to restoring the saved cursor position.

This doesn't seem at all right, and also fixes a warning with GCC 8.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
6 years agoconfigure.ac: bump to version 3.0.93 for the RC1 release
Derek Foreman [Mon, 2 Apr 2018 18:00:01 +0000 (13:00 -0500)]
configure.ac: bump to version 3.0.93 for the RC1 release

6 years agoPartially revert "xwm: Add icon support to the frame" and friends
Derek Foreman [Fri, 30 Mar 2018 16:56:22 +0000 (11:56 -0500)]
Partially revert "xwm: Add icon support to the frame" and friends

This (partially) reverts commit bef761796c2ada6344d227142af4a0f40b9760dd.
This (partially) reverts commit 4d1cd36c9ea041688f92cd8981e43b5fe3b52409.
This (partially) reverts commit 44fc1be913ab2faad0414f50e51d58310302d065.
This (partially) reverts commit 6b58ea8c43ac81e519bd418efbf24687a5d731b8.

The new xwm icon code has proven to be leaky and incomplete, and while
we have patches under consideration to fix the rest of its known problems
they still require changes and review cycles.  Currently the known
leaks have been squashed, but it still picks wrong sized icons and
does no scaling, which can lead to very strange rendering.  At window
close time the wrong sized icon appears above the window during fade out.

This patch reverts the mostly solid bits and keeps the unfinished
bits behind in favor of a simpler revert than removing the whole
thing.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
6 years agoRevert "xwm: do not include shadow in input region"
Derek Foreman [Wed, 28 Mar 2018 14:33:56 +0000 (09:33 -0500)]
Revert "xwm: do not include shadow in input region"

This reverts commit 332d1892bbb380b32ff1c9f99d20184b447535dd.
And re-introduces the bug it was intended to fix, see:
https://lists.freedesktop.org/archives/wayland-devel/2017-December/036402.html

Reverting this because it causes harm to all xwayland clients - the
input region no longer gets adjusted when resizing windows.

start an xterm, resize it larger, you can no longer interact with the
new area of the window (including the server side decor).