platform/upstream/weston.git
7 years agoSwitch to global output repaint timer
Daniel Stone [Wed, 1 Mar 2017 11:34:08 +0000 (11:34 +0000)]
Switch to global output repaint timer

In preparation for grouping output repaint together where possible,
switch the per-output repaint timer, to a global timer which iterates
across all outputs.

This is implemented by storing the absolute time for the next repaint
for each output locally, and maintaining a global timer which iterates
all of them, scheduling the repaint for the first available time.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Cc: Mario Kleiner <mario.kleiner.de@gmail.com>
Cc: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
[Pekka: The comment about 1 ms delay.]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agolauncher: Add sysmacros.h include for major()
Daniel Stone [Mon, 13 Mar 2017 16:32:18 +0000 (16:32 +0000)]
launcher: Add sysmacros.h include for major()

glibc 2.25 produces a warning when sysmacros.h is not directly included
but major() is used, as it is intended to be moved to sysmacros.h and
only there. Include it to keep the build happy.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
7 years agoFix 'implicit fallthrough' warning with new GCC
Daniel Stone [Mon, 13 Mar 2017 16:31:36 +0000 (16:31 +0000)]
Fix 'implicit fallthrough' warning with new GCC

GCC 7 now warns on case statements falling through without an explicit
comment that falling through is OK. Insert some to make it happy.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
7 years agoChange boolean repaint_scheduled to quad-state enum
Daniel Stone [Fri, 3 Mar 2017 16:59:42 +0000 (16:59 +0000)]
Change boolean repaint_scheduled to quad-state enum

repaint_scheduled is actually cleverly a quad-state, disguised as a
boolean. There are four possible conditions for the repaint loop to be
in at any time:
  - loop idle; no repaint will occur until specifically requested, which
    may be never (repaint_scheduled == 0)
  - loop schedule to begin: the loop was previously idle, but due to a
    repaint-schedule request, we will call the start_repaint_loop hook
    in the next idle task
  - repaint scheduled: the compositor has definitively scheduled a
    repaint request for this output, which will occur in fixed time
  - awaiting repaint completion: the backend has not yet signaled
    completion of the last repaint request, and the compositor will not
    schedule another until it does so

All but the first condition were previously conflated as
repaint_scheduled == 1, but break them out into separate conditions to
aid clarity, backed up by some asserts.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agoChange repaint_needed to bool
Daniel Stone [Wed, 1 Mar 2017 11:34:06 +0000 (11:34 +0000)]
Change repaint_needed to bool

It is only used as a binary value.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agoDon't delay initial output paint
Daniel Stone [Wed, 1 Mar 2017 11:34:05 +0000 (11:34 +0000)]
Don't delay initial output paint

On startup, we cannot lock on to the repaint timer because it is unknown
to us. We deal with this by claiming that the moment of entry into the
repaint loop is the moment a frame returned, causing finish_frame to
delay our initial repaint to (refresh_time - repaint_delay), typically
around 9ms of utterly wasted time.

Add an explicit stamp == NULL, to determine that we are just beginning
our repaint loop, that the timings are in fact totally invalid, and that
it would be beneficial to repaint the output immediately. This will only
trigger when the display had previously been disabled or the previous
state is unknown, e.g. at startup, or coming back from DPMS off.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agoCalculate next-frame target time in absolute space
Daniel Stone [Wed, 1 Mar 2017 11:34:04 +0000 (11:34 +0000)]
Calculate next-frame target time in absolute space

Rather than determining the time until next-frame repaint in relative
space (time until repaint), determine it first in absolute space, and
then later convert this to relative.

This will later allow us to store these per-output, so we can have a
single idle timer which will allow us to aggregate multiple repaints
together when timing allows.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agotimespec: Add timespec subtraction helpers
Daniel Stone [Wed, 1 Mar 2017 11:34:03 +0000 (11:34 +0000)]
timespec: Add timespec subtraction helpers

Add helpers to subtract two timespecs, then return the difference in
either milliseconds or nanoseconds. These will be used to compare
timestamps during the repaint cycle.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Suggested-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agotimespec: Add timespec_to_msec helper
Daniel Stone [Wed, 1 Mar 2017 11:34:02 +0000 (11:34 +0000)]
timespec: Add timespec_to_msec helper

Paralleling timespec_to_nsec, converts to milliseconds.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
[Pekka: added doc about flooring]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agotimespec: Add timespec_add_msec helper
Daniel Stone [Wed, 1 Mar 2017 11:34:01 +0000 (11:34 +0000)]
timespec: Add timespec_add_msec helper

Add a (timespec) = (timespec) + (msec) helper, to save intermediate
conversions in its users.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agotimespec: Add timespec_add_nsec helper
Daniel Stone [Wed, 1 Mar 2017 11:34:00 +0000 (11:34 +0000)]
timespec: Add timespec_add_nsec helper

Add a (timespec) = (timespec) + (nsec) helper, to save intermediate
conversions to nanoseconds in its users.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agocompositor-drm: pageflip timeout implementation
Emmanuel Gil Peyrot [Tue, 7 Mar 2017 13:27:54 +0000 (13:27 +0000)]
compositor-drm: pageflip timeout implementation

Weston will not repaint until previous update has been acked by a
pageflip event coming from the drm driver. However, some buggy drivers
won’t return those events or will stop sending them at some point and
Weston output repaints will completely freeze. To ease developers’ task
in testing their drivers, this patch makes compositor-drm use a timer
to detect cases where those pageflip events stop coming.

This timeout implementation is software only and includes basic
features usually found in a watchdog. We simply exit Weston gracefully
with a log message and an exit code when the timout is reached.

The timeout value can be set via weston.ini by adding a
pageflip-timeout=<MILLISECONDS> entry under [core]
section. Setting it to 0 disables the timeout feature.

v2:
- Made sure we would get both the pageflip and the vblank events before
  stopping the timer.
- Reordered the error and success cases in
  drm_output_pageflip_timer_create() to be more in line with the rest
  of the code.

v3:
- Reordered (de)arming of the timer with the code around it to avoid it
  being rearmed before the current dearming.
- Return the proper value for the dispatcher in the pageflip_timeout
  callback.
- Also display the output name in case the timer fires.

v4:
- Reordered a forgotten timer rearming after its drmModePageFlip().

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=83884
Signed-off-by: Frederic Plourde <frederic.plourde at collabora.co.uk>
Signed-off-by: Emmanuel Gil Peyrot <emmanuel.peyrot@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agoclients/simple-egl: add delay option
Eero Tamminen [Mon, 20 Feb 2017 13:14:49 +0000 (15:14 +0200)]
clients/simple-egl: add delay option

This emulates extra drawing work by usleep().

This is an enhancement to reproduce the problem in the bug report.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=98833
[Pekka: reordered the help text]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
7 years agoclients/weston-info: print unknown formats better
Pekka Paalanen [Mon, 13 Feb 2017 14:35:00 +0000 (16:35 +0200)]
clients/weston-info: print unknown formats better

Don't just dump the raw 32-bit values, try to interpret it as a DRM
fourcc too.

This prints properly the formats YUYV, NV12 and YU12 supported by
Weston.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
7 years agolibweston/launcher: use C99 initializers for the iface(s)
Emil Velikov [Fri, 10 Feb 2017 20:14:23 +0000 (20:14 +0000)]
libweston/launcher: use C99 initializers for the iface(s)

Makes the code easier to read and browse through.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agolibweston/launcher: annotate iface(s) as constant data
Emil Velikov [Fri, 10 Feb 2017 20:14:22 +0000 (20:14 +0000)]
libweston/launcher: annotate iface(s) as constant data

Already considered and handled as such.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agocompositor-drm: Make scanout view preparation more stringent
Daniel Stone [Fri, 21 Oct 2016 17:08:37 +0000 (18:08 +0100)]
compositor-drm: Make scanout view preparation more stringent

Don't import buffers which span multiple outputs, short-cut any attempt
to import SHM buffers, and ignore buffers with a global alpha set.

I'm not convinced all of these conditions entirely make sense, but this
at least makes them equally nonsensical.

Differential Revision: https://phabricator.freedesktop.org/D1414

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
7 years agocompositor-drm: Construct mode list in create_output_for_connector
Armin Krezović [Sun, 9 Oct 2016 21:48:16 +0000 (23:48 +0200)]
compositor-drm: Construct mode list in create_output_for_connector

And properly deconstruct it in drm_output_destroy.

Might be useful for finding out which modes are supported
before even setting them, in case we want to extend the
modesetting API.

Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agocompositor-drm: Try to preserve existing output routing
Daniel Stone [Mon, 16 Jan 2017 14:33:38 +0000 (14:33 +0000)]
compositor-drm: Try to preserve existing output routing

Previously in picking CRTC -> encoder -> connecting routing, we went for
the first triplet we found which claimed to work.

Preserving the existing routing means that startup will be faster: on a
multi-head system, changing the routing implies disabling both CRTCs,
then re-enabling them with a new configuration, which may involve
retraining links etc.

Furthermore, the existing routing may be set for a reason; each
CRTC/encoder is not necessarily as capable as the other, so the routing
may be configured to stay within such device limits.

Try where possible to respect the routing we pick up, rather than
blithely configuring our own.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agocompositor-drm: Ignore non-KMS devices
Daniel Stone [Mon, 19 Dec 2016 16:48:20 +0000 (16:48 +0000)]
compositor-drm: Ignore non-KMS devices

Given that we can have render-only devices, or vgem in a class of its
own, ignore any non-KMS devices in compositor-drm's device selection.
For x86 platforms, this is mostly a non-issue since we look at the udev
boot_vga issue, but other architectures which lack this, and have
multiple KMS devices present, will hit this.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reported-by: Thierry Reding <treding@nvidia.com>
Reported-by: Daniel Vetter <daniel.vetter@intel.com>
7 years agoconfigure.ac: Bump to 2.0.90 for open development
Bryce Harrington [Mon, 27 Feb 2017 18:52:35 +0000 (10:52 -0800)]
configure.ac: Bump to 2.0.90 for open development

7 years agoconfigure.ac: bump to version 2.0.0 for the official release
Bryce Harrington [Sat, 25 Feb 2017 00:19:03 +0000 (16:19 -0800)]
configure.ac: bump to version 2.0.0 for the official release

7 years agoreleasing: Should only publish publican docs for actual releases
Bryce Harrington [Tue, 21 Feb 2017 22:34:10 +0000 (14:34 -0800)]
releasing: Should only publish publican docs for actual releases

7 years agoconfigure.ac: bump to version 1.99.94 for the RC2 release
Bryce Harrington [Tue, 21 Feb 2017 20:56:48 +0000 (12:56 -0800)]
configure.ac: bump to version 1.99.94 for the RC2 release

7 years agoconfig-parser: Export weston_config_next_section
Emmanuel Gil Peyrot [Tue, 21 Feb 2017 11:58:20 +0000 (11:58 +0000)]
config-parser: Export weston_config_next_section

This symbol wasn’t exported from the weston binary, most likely due to
an oversight in 6e2c12496bbef3cc913cfe9d5f0aeb4d8b23b368, and because
internal modules can link against libshared.la directly it hasn’t been
found ever since.

This commit makes it possible for external modules to iterate over the
configuration file.

Signed-off-by: Emmanuel Gil Peyrot <emmanuel.peyrot@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Acked-by: Bryce Harrington <bryce@osg.samsung.com>
7 years agoclients: Fix build without Cairo/GLES2
Daniel Stone [Thu, 16 Feb 2017 21:52:23 +0000 (21:52 +0000)]
clients: Fix build without Cairo/GLES2

If we're building with EGL support generally, but without Cairo/GLESv2,
building the clients fail, because window.c defines the EGL native
types, however platform.h also brings these in.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Cc: Emil Velikov <emil.velikov@collabora.com>
Cc: Bryce Harrington <brycef@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Tested-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Acked-by: Bryce Harrington <bryce@osg.samsung.com>
7 years agoscreen-share: Use wl_list_for_each_safe on destroy
Daniel Stone [Thu, 16 Feb 2017 19:59:51 +0000 (19:59 +0000)]
screen-share: Use wl_list_for_each_safe on destroy

Destroying the shared seat removes the link from so->seat_list.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Acked-by: Bryce Harrington <bryce@osg.samsung.com>
7 years agoscreen-share: Avoid NULL dereference
Daniel Stone [Thu, 16 Feb 2017 19:59:50 +0000 (19:59 +0000)]
screen-share: Avoid NULL dereference

Don't try to dereference the seat if it's NULL.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
7 years agoconfigure.ac: bump to version 1.99.93 for the RC1 release
Bryce Harrington [Tue, 14 Feb 2017 21:02:45 +0000 (13:02 -0800)]
configure.ac: bump to version 1.99.93 for the RC1 release

7 years ago(multiple): Use standard permission notice
Yong Bakos [Mon, 23 Jan 2017 14:17:44 +0000 (06:17 -0800)]
(multiple): Use standard permission notice

A handful of source files were not using the MIT Expat text in
COPYING. Update these files to bring them inline with the rest,
standardizing on the MIT Expat text.

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agocompositor-drm: Mark eDP connection as internal
Armin Krezović [Wed, 8 Feb 2017 12:55:26 +0000 (13:55 +0100)]
compositor-drm: Mark eDP connection as internal

Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agocompositor: Improve xwayland warning message
Armin Krezović [Thu, 9 Feb 2017 20:28:32 +0000 (21:28 +0100)]
compositor: Improve xwayland warning message

And fix formatting.

Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
7 years agocompositor-drm: Remove connector_allocator
Daniel Stone [Thu, 9 Feb 2017 14:06:31 +0000 (14:06 +0000)]
compositor-drm: Remove connector_allocator

Remove the last usage of connector_allocator, which was to check for
displays which have been hot-unplugged, and replace it with an array
which doesn't rely on the connector IDs remaining below 32 (or 64).

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reported-by: Peter Senna Tschudin <peter.senna@collabora.com>
7 years agocompositor-drm: Avoid connector_allocator for hotplugs
Daniel Stone [Thu, 9 Feb 2017 13:58:35 +0000 (13:58 +0000)]
compositor-drm: Avoid connector_allocator for hotplugs

Rather than using connector_allocator to determine whether an output is
newly connected or not, use a list walk across all outputs instead.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reported-by: Peter Senna Tschudin <peter.senna@collabora.com>
7 years agocompositor-drm: Remove crtc_allocator
Daniel Stone [Thu, 9 Feb 2017 13:49:15 +0000 (13:49 +0000)]
compositor-drm: Remove crtc_allocator

crtc_allocator was used as a bitmask of CRTC IDs, so we didn't try to
use the same CRTC for multiple outputs. Unfortunately, this only works
to the extent that CRTC object IDs fit within the bitmask; though they
were previously, they are not guaranteed to be under 32 or even 64.

Replace the only use of crtc_allocator with a list walk across outputs.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reported-by: Peter Senna Tschudin <peter.senna@collabora.com>
7 years agoconfigure.ac: bump to version 1.99.92 for the beta release
Bryce Harrington [Wed, 8 Feb 2017 19:45:13 +0000 (11:45 -0800)]
configure.ac: bump to version 1.99.92 for the beta release

7 years agoRevert "clients: teach simple-dmabuf-v4l to deal with flipped input"
Daniel Stone [Wed, 8 Feb 2017 12:02:03 +0000 (12:02 +0000)]
Revert "clients: teach simple-dmabuf-v4l to deal with flipped input"

This reverts commit 0fee977c46423e496a6eda6418c31bfe09a1f27b.

This commit introduces a requirement on v4l2_query_ext_ctrl and
VIDIOC_QUERY_EXT_CTRL, which were introduced in kernel 3.17. Some Ubuntu
LTS releases ship with much older kernels (and, significantly, UAPI),
which don't have these.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
7 years agolauncher: don't try to switch to weston's vt
Giulio Camuffo [Mon, 5 Dec 2016 13:50:36 +0000 (14:50 +0100)]
launcher: don't try to switch to weston's vt

Signed-off-by: Giulio Camuffo <giuliocamuffo@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agoivi-shell: Damage view below after unmapping
Ucan, Emre (ADITG/SW1) [Tue, 7 Feb 2017 12:55:59 +0000 (12:55 +0000)]
ivi-shell: Damage view below after unmapping

If ivilayer or ivisurf of ivi_view is made invisible in the
commit_changes call, we have to damage the weston_view below this
ivi_view. Otherwise content of this ivi_view will stay visible.

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agotests: doc iterating in the runner
Pekka Paalanen [Tue, 7 Feb 2017 12:18:01 +0000 (14:18 +0200)]
tests: doc iterating in the runner

The iteration counter cannot be used to detect non-iterated tests
defined with TEST and FAIL_TEST.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
7 years agocompositor: damage pending subsurfaces when committing them
Emilio Pozuelo Monfort [Fri, 27 Jan 2017 16:30:29 +0000 (17:30 +0100)]
compositor: damage pending subsurfaces when committing them

When a client changes the subsurfaces state, we need to damage
them so the result is visible. We do that by flagging the surfaces
when the state changes and causing damage when committing the
state. This prevents normal repaints from considering these changes
until a commit has happened, and allows the client to atomically
schedule several changes.

This fixes the subsurface_z_order test, which is now marked as expected
to succeed.

Signed-off-by: Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Micah Fedke <micah.fedke@collabora.co.uk>
7 years agotests: add subsurface-shot test
Pekka Paalanen [Fri, 27 Jan 2017 16:30:28 +0000 (17:30 +0100)]
tests: add subsurface-shot test

This is marked as a FAIL_TEST, because the last image comparison fails
due to a bug in Weston.

Jointly authored by Pekka and Emilio.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
Reviewed-by: Micah Fedke <micah.fedke@collabora.co.uk>
[Pekka: move weston-tests-env as terminator to EXTRA_DIST, change
ok/FAIL to PASS/FAIL, write diff image only on fail.]
Acked-by: Quentin Glidic <sardemff7+git@sardemff7.net>
7 years agotests: put screenshots to ./logs by default
Pekka Paalanen [Fri, 27 Jan 2017 16:30:27 +0000 (17:30 +0100)]
tests: put screenshots to ./logs by default

Logs is where we write all our custom test logs, let's also put the
screenshots in the same place by default from cluttering the base
directory.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
Reviewed-by: Micah Fedke <micah.fedke@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
7 years agotests: implement get_test_name()
Pekka Paalanen [Fri, 27 Jan 2017 16:30:26 +0000 (17:30 +0100)]
tests: implement get_test_name()

Screenshot tests often want to use the test name for writing out images.
This is a helper to get the test name without writing it multiple times
in the source.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
Reviewed-by: Micah Fedke <micah.fedke@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
7 years agotests/shell: change background color
Pekka Paalanen [Fri, 27 Jan 2017 16:30:25 +0000 (17:30 +0100)]
tests/shell: change background color

Pick the color 0xCC336699 as AARRGGBB, as if blended on black. This is
the color used with developing the sub-surface shot tests.

No other big reason than it should not be black to have better chances
of catching blending problems.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Micah Fedke <micah.fedke@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
7 years agotests/shell: get rid of static variables
Pekka Paalanen [Fri, 27 Jan 2017 16:30:24 +0000 (17:30 +0100)]
tests/shell: get rid of static variables

Stop using static variables and clean up when we're done.

[Emilio: update to latest weston_layer API]

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
Reviewed-by: Micah Fedke <micah.fedke@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
[Pekka: fix build after previous commit's fix]

7 years agotests: add test-desktop-shell
Quentin Glidic [Fri, 27 Jan 2017 16:30:23 +0000 (17:30 +0100)]
tests: add test-desktop-shell

This is a new desktop shell plugin, specifically written for tests. It
implements the bare minimum of a WM with predictable window positioning.
It offers a known static background without forking any helper clients
and therefore avoids any races with executing screenshot-based tests.
Not forking unused helper clients also reduces the load during a test
run.

The code was written by Quentin as a part of a much larger private
patch. Pekka, following Emilio's example, extracted just the shell
plugin parts as a stand-alone patch and wrote the commit message.

[Emilio: update to latest weston_layer and shell_init API]

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Signed-off-by: Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Micah Fedke <micah.fedke@collabora.co.uk>
[Pekka: fix build]

7 years agoclients: teach simple-dmabuf-v4l to deal with flipped input
Micah Fedke [Mon, 6 Feb 2017 17:57:41 +0000 (12:57 -0500)]
clients: teach simple-dmabuf-v4l to deal with flipped input

The v4l2 API can be queried to detect if the input video image is
horizontally or vertically flipped. If the image is y-flipped, we can
set the ZWP_LINUX_BUFFER_PARAMS_V1_FLAGS_Y_INVERT flag to notify the
compositor.  If the image is h-flipped, we can only print a warning
since linux_buffer_params_v1 does not support horizontal flipping.

Signed-off-by: Micah Fedke <micah.fedke@collabora.co.uk>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agocompositor-drm: don't pass option_connector to create_outputs
Ucan, Emre (ADITG/SW1) [Thu, 2 Feb 2017 14:06:56 +0000 (14:06 +0000)]
compositor-drm: don't pass option_connector to create_outputs

The connector option is a part of drm_backend struct.
Therefore, it is not needed to pass it as an argument
to create_outputs function.

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Acked-by: Daniel Stone <daniels@collabora.com>
7 years agocompositor-drm: update connectors with connector config
Ucan, Emre (ADITG/SW1) [Thu, 2 Feb 2017 14:06:55 +0000 (14:06 +0000)]
compositor-drm: update connectors with connector config

weston can be started with --connector option to be initialized
with a particular output. But in the update_outputs this option
is not considered and output is created for all the available
connectors. This patch fixes this issue by considering
the option for connectors in the update_outputs.

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Acked-by: Daniel Stone <daniels@collabora.com>
7 years agocompositor-drm: don't put y-inverted / interlaced / bottom-first dmabufs on overlays
Micah Fedke [Wed, 1 Feb 2017 20:28:23 +0000 (15:28 -0500)]
compositor-drm: don't put y-inverted / interlaced / bottom-first dmabufs on overlays

This patch checks the attribute flags on incoming dmabufs and refuses to
put them overlays if they have any of the flags set (currently:
ZWP_LINUX_BUFFER_PARAMS_V1_FLAGS_Y_INVERT,
ZWP_LINUX_BUFFER_PARAMS_V1_FLAGS_INTERLACED and
ZWP_LINUX_BUFFER_PARAMS_V1_FLAGS_BOTTOM_FIRST), instead defaulting to
the gl-renderer which can handle some of the flags.

This check should be superceded by buffer transforms, when they become
available.

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agoivi-shell: simplify commit_changes function
Ucan, Emre (ADITG/SW1) [Mon, 30 Jan 2017 13:36:07 +0000 (13:36 +0000)]
ivi-shell: simplify commit_changes function

It is a better idea to use one for loop instead
of using three nested for loops.

We do not need to update the transformation of
views according to the scenegraph. The important
thing is that every visible view is updated before
commit_changes function returns.

The first if statement checks, if the view is on
the currently rendered scenegraph. The second if
statement checks, if the view's layer or surface
is visible. These checks ensure that we do not
update the transformation matrix of a view, which
is not visible on the screen.

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
[Pekka: minor whitespace fix]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agoivi-shell: pass only ivi_view to update_prop
Ucan, Emre (ADITG/SW1) [Mon, 30 Jan 2017 13:36:05 +0000 (13:36 +0000)]
ivi-shell: pass only ivi_view to update_prop

We can get ivisurf, ivilayer and iviscreen
easily from ivi_view. Then, we do not need
to check, if ivi_view's layer is the same
as the given ivilayer.

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agoreleasing: Copyedits
Bryce Harrington [Sat, 4 Feb 2017 01:23:24 +0000 (17:23 -0800)]
releasing: Copyedits

7 years agolibweston: grammar fix to recent comment
Bryce Harrington [Sat, 4 Feb 2017 01:01:59 +0000 (17:01 -0800)]
libweston: grammar fix to recent comment

7 years agotests: Remove buffer-count
Daniel Stone [Tue, 17 Jan 2017 15:00:42 +0000 (15:00 +0000)]
tests: Remove buffer-count

buffer-count was introduced in line with a Mesa change which forced
an earlier block on frame events to try to enforce double-buffering
where available.

The Mesa change has since been reverted (Mesa commit 9ca6711faa), as
this had unpleasant interactions with buffer_age in particular, so this
test is no longer valid.

Additionally, it only worked on backends which initialised EGL (not
headless-backend, where tests generally run), which can be flaky due to
initialisation races. Not only that, but on the DRM backend, we can
legitimately enter triple-buffering due to promoting the surface to a
hardware plane, skipping GPU composition.

In light of all this, just remove the test.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
7 years agoMove weston-egl-ext.h to shared
Daniel Stone [Thu, 24 Nov 2016 19:14:20 +0000 (19:14 +0000)]
Move weston-egl-ext.h to shared

Given that it's used by clients, it's really the very definition of
shared.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
7 years agoAdd comments and whitespace to repaint machinery
Daniel Stone [Mon, 16 Jan 2017 15:38:54 +0000 (15:38 +0000)]
Add comments and whitespace to repaint machinery

repaint_needed / repaint_scheduled are surprisingly subtle. Explode the
conditional with side-effects into more obvious separate calls, and
document what they do.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agosystemd: fix Wincompatible-pointer-type
Ucan, Emre (ADITG/SW1) [Mon, 23 Jan 2017 12:42:43 +0000 (12:42 +0000)]
systemd: fix Wincompatible-pointer-type

The parameter is passed in safe_strtoint function.
The function expects its parameters in int32_t
data type. Therefore, c compiler throws a
-Wincompatible-pointer-type warning.

This patch changes data type of the parameter
to int32_t.

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_add_layers test
Ucan, Emre (ADITG/SW1) [Wed, 18 Jan 2017 15:25:36 +0000 (15:25 +0000)]
ivi-shell: add screen_add_layers test

Test adds 3 layers in a screen's render order list.
First, it adds in the order which layers are created.
Later, test cleans the render order list,
and adds layers in reverse order.

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agoivi-shell: add layer_add_surfaces test
Ucan, Emre (ADITG/SW1) [Wed, 18 Jan 2017 15:25:35 +0000 (15:25 +0000)]
ivi-shell: add layer_add_surfaces test

Test adds 3 surfaces in a layer's render order list.
First, it adds in the order which surfaces are created.
Later, test cleans the render order list, and adds surfaces in reverse
order.

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agoivi-shell: don't check layer is already on the screen
Ucan, Emre (ADITG/SW1) [Wed, 18 Jan 2017 15:25:31 +0000 (15:25 +0000)]
ivi-shell: don't check layer is already on the screen

If a layer is removed from a screen's render order list, but the
changes are not commited. Then, the layer could not be added to the
same screen. Because on_screen property of the layer is only changed
in ivi_layout_commit_changes API, when active render order of the screen
is changed.

It is not possible to change the order of layers in a screen without
clearing and commiting the changes before. This patch fixes this issue.

After this patch, the pending render order list of a screen is always
modified regardless of its active render order list.

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agoivi-shell: don't check view is rendered before adding surface
Ucan, Emre (ADITG/SW1) [Wed, 18 Jan 2017 15:25:28 +0000 (15:25 +0000)]
ivi-shell: don't check view is rendered before adding surface

If a surface is removed from a layer's render order list, but the
changes are not commited. Then, the surface could not be added to the
same layer. Because ivi_view of the surface is still in the render order
list of the layer.

It is not possible to change the order of surfaces in a layer without
clearing and commiting the changes before. This patch fixes this issue.

After this patch, the pending render order list of a layer is always
modified regardless of its active render order list.

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agoivi-shell: fix typo in layer_destroy API
Ucan, Emre (ADITG/SW1) [Tue, 17 Jan 2017 12:35:20 +0000 (12:35 +0000)]
ivi-shell: fix typo in layer_destroy API

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agocompositor-rdp: Fix build with freerdp2, take 2
Daniel Stone [Mon, 23 Jan 2017 15:45:30 +0000 (15:45 +0000)]
compositor-rdp: Fix build with freerdp2, take 2

Hi Pekka,

On 23 January 2017 at 14:15, Pekka Paalanen <ppaalanen@gmail.com> wrote:
> On Fri, 20 Jan 2017 11:31:08 +0100
> Emilio Pozuelo Monfort <pochu@debian.org> wrote:
>> This version works for me...
>
> Hi guys,
>
> I found another guest to the party. Using net-misc/freerdp-2.0.0_pre20160722
> Weston master fails to build with:
>
>
> In file included from /usr/include/freerdp2/freerdp/codecs.h:25:0,
>                  from /usr/include/freerdp2/freerdp/freerdp.h:46,
>                  from /home/pq/git/weston/libweston/compositor-rdp.c:69:
> /home/pq/git/weston/libweston/compositor-rdp.c: In function ‘rdp_peer_context_new’:
> /usr/include/freerdp2/freerdp/codec/color.h:85:72: error: ‘FREERDP_PIXEL_FORMAT_TYPE_BGRA’ undeclared (first use in this function)
> [... snip ...]
>
> However, updating to net-misc/freerdp-2.0.0_pre20161219 allows things
> to build for me again. There is just one warning:

How about this fixup?

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agocompositor-drm: Restore use-current-mode functionality
Armin Krezović [Sun, 9 Oct 2016 21:48:17 +0000 (23:48 +0200)]
compositor-drm: Restore use-current-mode functionality

It got lost during the porting to the config API.

Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoreleasing: Drop extraneous word in docs
Bryce Harrington [Wed, 25 Jan 2017 05:54:41 +0000 (21:54 -0800)]
releasing: Drop extraneous word in docs

7 years agoconfigure.ac: bump to version 1.99.91 for the alpha release
Bryce Harrington [Wed, 25 Jan 2017 02:13:28 +0000 (18:13 -0800)]
configure.ac: bump to version 1.99.91 for the alpha release

7 years agotests: add missing include
Yann E. MORIN [Sun, 22 Jan 2017 13:50:42 +0000 (14:50 +0100)]
tests: add missing include

The int32_t type is defined in stdint.h.

The musl C library is very conservative in the headers that it
internally includes, and stdint.h is not included by any other header,
unlike with glibc or uClibc, which breaks the build.

Add the missing header.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agogitignore: version headers are in libweston/
Pekka Paalanen [Mon, 23 Jan 2017 12:06:49 +0000 (14:06 +0200)]
gitignore: version headers are in libweston/

Switching back and forth to e.g. weston 1.11 branch can leave
these files in src/. Fix the gitignores to not hide them from
git-status.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agocompositor-rdp: Fix build with freerdp2
Emilio Pozuelo Monfort [Fri, 20 Jan 2017 11:53:34 +0000 (11:53 +0000)]
compositor-rdp: Fix build with freerdp2

Based on a patch from John Moser <john.r.moser@gmail.com>

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=850658

Signed-off-by: Emilio Pozuelo Monfort <pochu@debian.org>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoclients: fix errno handling
Peter Hutterer [Wed, 18 Jan 2017 22:21:45 +0000 (08:21 +1000)]
clients: fix errno handling

clients/editor.c: In function ‘read_file’:
clients/editor.c:1578:16: warning: logical ‘or’ applied to non-boolean
constant [-Wlogical-op]
  errno = errsv || EINVAL;

This works in the shell, but not in C. Introduced in 411ffabbb56b

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Emilio Pozuelo Monfort <pochu@debian.org>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
7 years agoxwm: explain the read_properties() in xserver_map_shell_surface()
Pekka Paalanen [Wed, 21 Dec 2016 11:41:34 +0000 (13:41 +0200)]
xwm: explain the read_properties() in xserver_map_shell_surface()

To me it was not obvious that this call is necessary, so provide some
rationale.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoxwm: schedule repaint from MapRequest
Pekka Paalanen [Tue, 20 Dec 2016 13:31:15 +0000 (15:31 +0200)]
xwm: schedule repaint from MapRequest

When we as the WM tell the X server to map a window, it gets mapped. We
can start drawing into it immediately. There is no reason to wait for
any other events before drawing the decorations.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoRemove dbus-launch from weston.desktop
Ben [Thu, 22 Dec 2016 08:56:29 +0000 (03:56 -0500)]
Remove dbus-launch from weston.desktop

Most display managers handle starting a dbus session daemon for you, so
it does not make sense to start our own. Without this patch, if you run
weston from gdm, programs cannot connect to the dbus session daemon.

Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoxwm: debug when weston_surface gets created
Pekka Paalanen [Tue, 20 Dec 2016 14:15:02 +0000 (16:15 +0200)]
xwm: debug when weston_surface gets created

This comes via Wayland, WL_SURFACE_ID comes via X11. They race. Nice to
get both printed.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoxwm: split out weston_wm_window_set_pending_state_OR()
Pekka Paalanen [Tue, 20 Dec 2016 12:05:03 +0000 (14:05 +0200)]
xwm: split out weston_wm_window_set_pending_state_OR()

Having it in a separate function makes it more clear what it is, and
allows it to be called from elsewhere.

This really is the set_pending_state() alternative for override-redirect
windows, because OR windows do not get a frame window created. Also OR
windows will never hit the normal set_pending_state() because
weston_wm_window_schedule_repaint() special-cased windows without a
frame window and returned early without scheduling.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoxwm: move fini near init in set_pending_state
Pekka Paalanen [Tue, 20 Dec 2016 12:01:42 +0000 (14:01 +0200)]
xwm: move fini near init in set_pending_state

Move the region fini just above the region init. They are a pair and
belong togeether. Split a long line.

Reads better this way. No functional changes.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoxwm: split weston_wm_window_draw_decoration()
Pekka Paalanen [Mon, 19 Dec 2016 15:10:25 +0000 (17:10 +0200)]
xwm: split weston_wm_window_draw_decoration()

Split the function into two:
- weston_wm_window_draw_decoration() that only draws the decorations
with Cairo, and
- weston_wm_window_set_pending_state() which sets up the surface state
to be latches into use on the next commit from Xwayland.

The new weston_wm_window_do_repaint() is the equivalent of the old
weston_wm_window_draw_decorations(), everything still happens the same
way as it was. Just some debug messages have been reworded.

weston_wm_window_read_properties() is moved into
weston_wm_window_do_repaint() because it is not strictly a part of
drawing decorations. The same with resetting repaint_source.

draw_decorations does not need the child position nor xwayland
interface. Also some convenience variables have been eliminated.

set_pending_state code has been un-indented by one level, so the change
is best viewed with whitespace changes ignored.

This patch makes the code more readable, and prepares for calling the
draw_decorations and set_pending_state from different places.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoshell: implement set_xwayland_position
Pekka Paalanen [Wed, 16 Nov 2016 13:17:14 +0000 (15:17 +0200)]
shell: implement set_xwayland_position

Store the initial xwayland position explicitly in struct shell_surface.
New variables are needed, because e.g. saved_x, saved_y are the view
position, and to compute that we need the window geometry, which is not
available before the first commit, so it's not available at
set_xwayland_position() time.

Regression: kcachegrind (Qt 4, X11), the first menu invocation will
slightly misplace the menu if the window has not been manually moved.

Problem: geometry is not taken into account due to a race between XWM
drawing decorations and Xwayland committing the first buffer.

Use the same debugging guard as XWM.

v3: merged with "desktop-shell: debug set_position_from_xwayland"

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoxwayland: detect initially positioned X11 windows
Pekka Paalanen [Wed, 16 Nov 2016 12:15:18 +0000 (14:15 +0200)]
xwayland: detect initially positioned X11 windows

X11 applications expect -geometry command line option to work for
setting the initial window position, but currently this does not work.

During map, detect X11 windows that set an explicit position. This works
by heuristics: if window position is not 0,0 then it is explicitly
positioned. Legacy fullscreen windows are also at 0,0 but these are
detected earlier.

Explicitly store the window position at map request time to detect
client-positioned windows, and use it as the suggested initial position.
weston_wm_window::x and y have been overwritten due to reparenting when
we eventually need the initial position.

This patch requires that the new set_toplevel_with_position() hook is
implemented in the shell.

Note that this patch is about positioning xwayland toplevels, not
override-redirect windows which are already handled.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agolibweston-desktop: add set_xwayland_position API
Pekka Paalanen [Wed, 16 Nov 2016 12:03:31 +0000 (14:03 +0200)]
libweston-desktop: add set_xwayland_position API

X11 applications expect -geometry command line option to work for
setting the initial window position, but currently this does not work.

Add provision to relay the initial position through libweston-desktop:
- weston_desktop_api gains a new entry set_xwayland_position
- implement set_toplevel_with_position() in xwayland internal interface

Once xwayland plugin starts calling set_toplevel_with_position(),
libweston-desktop can relay that information to a shell if the shell
wants to hear it.

If a shell does not implement the set_xwayland_position hook, the
old behaviour remains: the shell positions xwayland toplevels like any
other.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoxwayland: add set_toplevel_with_position to internal API
Pekka Paalanen [Wed, 16 Nov 2016 12:12:11 +0000 (14:12 +0200)]
xwayland: add set_toplevel_with_position to internal API

Add a new entry to the internal interface between the xwayland plugin
and libweston-desktop (or any other desktop protocol implementation).
The new entry is identical to set_toplevel except it carries an absolute
position for the toplevel window.

Following patches will implement this new entry in
libweston-desktop and start using it in XWM.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoxwm: fix intermittent half-drawn decorations problem
Pekka Paalanen [Mon, 16 Jan 2017 15:01:11 +0000 (17:01 +0200)]
xwm: fix intermittent half-drawn decorations problem

To reproduce the problem:
- start weston (x11 backend worked, glamor in Xwayland makes no
  difference)
- start xterm
- very very slowly move the pointer in the xterm decorations onto or
  away from a button
- the moment the decorations are updated, they will appear incomplete,
  e.g. completely without buttons and title text
- if you cause just one more pointer motion event, the decorations will
  update to completely drawn appearance

Another way to reproduce the problem is to have an xterm and change its
window title. This is easy if you use a shell prompt that updates the
terminal window title. When the title updates, decorations will be
half-drawn until something happens in XWM.

The fix: flush.

Apparently the drawing commands did not get flushed to the X server
until any other X11 action pushed them through.

xcb_flush() is the real fix here. cairo_surface_flush() is added just
for good measure, because documentation indicates it would be better
used, however it was not strictly necessary to fix the problem in my
experiments.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Tested-by: Emmanuel Gil Peyrot <emmanuel.peyrot@collabora.com>
Reviewed-by: Emmanuel Gil Peyrot <emmanuel.peyrot@collabora.com>
7 years agoweston: Add a specific option to load XWayland
Quentin Glidic [Mon, 4 Jul 2016 12:34:48 +0000 (14:34 +0200)]
weston: Add a specific option to load XWayland

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoweston: Make the shell entrypoint specific
Quentin Glidic [Fri, 2 Dec 2016 13:17:08 +0000 (14:17 +0100)]
weston: Make the shell entrypoint specific

This avoids loading a shell as a module, so we are sure to have only one
shell loaded at a time.

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoweston: Properly namespace modules entrypoint
Quentin Glidic [Fri, 2 Dec 2016 13:21:46 +0000 (14:21 +0100)]
weston: Properly namespace modules entrypoint

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agolibweston: Properly namespace modules entrypoint
Quentin Glidic [Fri, 2 Dec 2016 13:20:35 +0000 (14:20 +0100)]
libweston: Properly namespace modules entrypoint

Use different functions so we cannot load a libweston common module in
weston directly or the other way around.

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agolibweston: Properly namespace backends entrypoint
Quentin Glidic [Fri, 2 Dec 2016 13:08:44 +0000 (14:08 +0100)]
libweston: Properly namespace backends entrypoint

This prevents loading a backend as a simple module. This will avoid
messing up with backends when we will introduce libweston common
modules.

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoMakefile.am: Link modules to libweston.la
Quentin Glidic [Thu, 18 Aug 2016 08:58:58 +0000 (10:58 +0200)]
Makefile.am: Link modules to libweston.la

Modules are using libweston symbols (at least weston_log) and should
explicitly link to it.

This patch also reorders some flags.

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agocompositor-drm: allow mode frequency selection
Fabien Dessenne [Tue, 17 Jan 2017 16:17:21 +0000 (17:17 +0100)]
compositor-drm: allow mode frequency selection

As an option, allow to specify a mode (from the configuration file) by
its refresh rate.
Example of valid syntax:
- "mode=1920x1080"    Select a 1920x1080 mode, refresh rate undefined.
- "mode=1920x1080@60" Select the (or one of the) 1920x1080 60 Hz mode.

Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agolibweston: Position layers in an absolute way
Quentin Glidic [Sat, 17 Dec 2016 12:40:51 +0000 (13:40 +0100)]
libweston: Position layers in an absolute way

Currently, layers’ order depends on the module loading order and it does
not survive runtime modifications (like shell locking/unlocking).
With this patch, modules can safely add their own layer at the expected
position in the stack, with runtime persistence.

v4 Reviewed-by: Giulio Camuffo <giuliocamuffo@gmail.com>
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Acked-by: Daniel Stone <daniels@collabora.com>
[Pekka: fix three whitespace issues]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agoxwm: delete dead flags from weston_wm_window_draw_decorations()
Pekka Paalanen [Mon, 19 Dec 2016 14:33:40 +0000 (16:33 +0200)]
xwm: delete dead flags from weston_wm_window_draw_decorations()

Obviously unused. Looks like weston_wm_window_activate() is doing that
job.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
7 years agoxwm: postpone geometry dirtying from pending.opaque
Pekka Paalanen [Mon, 19 Dec 2016 13:51:12 +0000 (15:51 +0200)]
xwm: postpone geometry dirtying from pending.opaque

Changing the opaque region has no immediate effect, therefore there is
no need to mark the view geometry dirty.

The view geometry will be invalidated automatically by the next commit
from Xwayland, in weston_surface_commit_state(). The dirtying did not
apply pending state.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
7 years agoxwm: debug print deleted property name
Pekka Paalanen [Mon, 19 Dec 2016 13:18:45 +0000 (15:18 +0200)]
xwm: debug print deleted property name

Use wm_log_continue() to avoid printing the timestamp in the middle of a
message.

Print the name of the property that got deleted.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
7 years agoxwm: debug changes to override-redirect flag
Pekka Paalanen [Mon, 19 Dec 2016 13:10:01 +0000 (15:10 +0200)]
xwm: debug changes to override-redirect flag

For every event we handle and that delivers the override-redirect flag,
print it to debug log.

Add a comment to one code path explaining when it gets hit, because it
is unobvious. It also serves as a reminder that we do not handle changes
to the OR flag after Window creation.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
7 years agoxwm: move set_title and set_pid
Pekka Paalanen [Thu, 15 Dec 2016 14:04:14 +0000 (16:04 +0200)]
xwm: move set_title and set_pid

Move the calls to set_title() and set_pid() out of
weston_wm_window_read_properties() and into the three callers, each
slightly different.

xserver_map_shell_surface(): already calls these functions after
creating the shell surface, so no need to add calls.

weston_wm_handle_map_request(): can be called only on unmapped (in X11)
Windows, so no need to add calls.

weston_wm_window_draw_decoration(): window->shsurf and window->surface
are either both set or both NULL, so the check for window->shsurf is
removed when moving the set_title() and set_pid() calls under a
window->surface check.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
7 years agoxwm: move frame_set_title() into draw_decoration()
Pekka Paalanen [Thu, 15 Dec 2016 13:37:24 +0000 (15:37 +0200)]
xwm: move frame_set_title() into draw_decoration()

The only thing using the frame title is frame_repaint(). Move the call
to frame_set_title() from weston_wm_window_read_properties() into
weston_wm_window_draw_decoration() where the only call to
frame_repaint() is.

Do not check for window->name == NULL, because frame_set_title() handles
NULL just fine. Also, once window->name becomes set, it cannot become
NULL again unless strndup() fails. The name string can be reset to
the empty string in any case.

This change is prompted by future refactoring where at
weston_wm_window_read_properties() time the frame might not have been
created yet.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
7 years agoxwm: clarify props[] in weston_wm_window_read_properties()
Pekka Paalanen [Thu, 1 Dec 2016 15:07:12 +0000 (17:07 +0200)]
xwm: clarify props[] in weston_wm_window_read_properties()

The props array contained offsets to struct members. It is convenient
for writing static const arrays as you only store a constant offset and
compute the pointer later. However, the array was not static to begin
with, the atoms are not build time constants. We can as well just store
the pointer directly in the array.

Entries that did not use the offset had bogus offsets, producing
pointers to arbitrary fields. They are changed to have a NULL pointer.
If the code unintentionally used the pointer, it will now explode rather
than corrupt memory.

Also explain the use of the #defined constants and #undef them when they
get out of scope. This clearly documents that they are just a convenient
hack to avoid lots of special cases in the function.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
7 years agoxwm: detect legacy fullscreen on MapRequest
Pekka Paalanen [Thu, 1 Dec 2016 13:41:11 +0000 (15:41 +0200)]
xwm: detect legacy fullscreen on MapRequest

The legacy fullscreen state needs to be detected at MapRequest time,
because that is when the X11 client has alredy set up the initial window
state.

Doing it at xserver_map_shell_surface() meant that it would be done as a
response to Xwayland creating the wl_surface and XWM receiving the
WL_SURFACE_ID ClientMessage, whichever came later. At that point the X11
client might still be setting things up in theory, though in practice
most of the X11 communication has already happened when
xserver_map_shell_surface() gets called.

The real reason for this is to clean up xserver_map_shell_surface() from
everything that would affect drawing the decorations. This patch is one
part of that clean-up.

The weston_output_weak_ref logic is not put into compositor.h, because
there are no other users for it at this time. We need to protect against
the output going away.

A side-effect of this patch is that saved_width and saved_height will
now get overwritten also for legacy fullscreen windows. Previously, they
were left to zero as far as I could tell.

NOTE: This stops override-redirect legacy fullscreen windows from being
detected as fullscreen. MapRequest processing does not happen for OR
windows. These windows get detected as type XWAYLAND instead.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>