Commit graph

468 commits

Author SHA1 Message Date
Pekka Paalanen 8e7f9501e4 Link Weston plugins to libexec-weston.so
All these plugins use symbols that were exported by the weston executable and
are now exported by libexec-weston.so. Linking these to libexec-weston.so fixes
unresolved symbols.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-10-24 13:40:51 +03:00
Pekka Paalanen 71ff95a544 build: separate deps for int and ext libweston users
We have two kinds of libweston users: internal and external. Weston, the
frontend, counts as an external user, and should not have access to libweston
private headers. The shell plugins are external users as well, because we
intend people to be able to write them. Renderers, backends, and some plugins
are internal users who will need access to private headers.

Create two different Meson dependency objects, one for each kind.

This makes it less likely to accidentally use a private header.

Screen-share is a Weston plugin and therefore counts as an external user, but
it needs the backend API to deliver input. Until we are comfortable exposing
public API for that purpose, let it use internal headers.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-10-24 13:29:33 +03:00
Emmanuel Gil Peyrot deae98ef45 shared: Use memfd_create() when available
This (so-far) Linux-only API lets users create file descriptors purely
in memory, without any backing file on the filesystem and the race
condition which could ensue when unlink()ing it.

It also allows seals to be placed on the file, ensuring to every other
process that we won’t be allowed to shrink the contents, potentially
causing a SIGBUS when they try reading it.

This patch is best viewed with the -w option of git log -p.

It is an almost exact copy of Wayland commit
6908c8c85a2e33e5654f64a55cd4f847bf385cae, see
https://gitlab.freedesktop.org/wayland/wayland/merge_requests/4

Signed-off-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
2019-10-24 07:32:17 +00:00
Adam Jackson 3cfd297f2c tests: Fix undefined left shift in internal-screenshot-test
../tests/internal-screenshot-test.c:60:18: runtime error: left shift of 255 by 24 places cannot be represented in type 'int'
2019-10-16 16:07:47 -04:00
Pekka Paalanen 4f5e360180 build: simplify include_directories
Define common_inc which includes both public_inc and the project root directory.
The project root directory will allow access to config.h and all the shared/
headers.

Replacing all custom '.', '..', '../..', '../shared' etc. include paths with
common_inc reduces clutter in the target definitions and enforces the common
 #include directive style, as e.g. including shared/ headers without the
subdirectory name no longer works.

Unfortunately this does not prevent one from using private libweston headers
with the usual include pattern for public headers.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-10-04 17:14:22 +03:00
Pekka Paalanen c232f8d934 Unify the include style of shared/ headers
When all shared/ headers are included in the same way, we can drop unnecessary
include seach paths from the compiler.

This include style was chosen because it is prevalent in the code base. Doing
anything different would have been a bigger patch.

This also means that we need to keep the project root directory in the include
search path, which means that one could accidentally include private headers
with

	#include "libweston/dbus.h"

or even

	#include <libweston/dbus.h>

IMO such problem is smaller than the churn caused by any of the alternatives,
and we should be able to catch those in review. We might even be able to catch
those with grep in CI if necessary.

The "bad" include style was found with:
$ for h in shared/*.h; do git grep -F $(basename $h); done | grep -vF '"shared/'

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-10-04 16:04:48 +03:00
Pekka Paalanen b6c7a3020c build: use dependency for matrix.c
matrix.c needs to be built differently for a test program vs. everything else,
so it cannot be in a helper lib. Instead, make a dependency object for it for
easy use which always gets all the paths correct automatically.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-10-04 15:55:55 +03:00
Ankit Nautiyal 93dde245ee libweston: Add functions to modify disable_planes counter for an output
The member disable_planes of weston_output signifies the recording
status of the output, and is incremented and decremented from various
places. This patch provides helper functions to increment and decrement
the counter. These functions can then be used to do processing, before
and after the recording has started or stopped.

Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
2019-08-26 16:18:22 +05:30
Alexandros Frantzis 3802241c46 libweston: Advertise minor version 2 of zwp_linux_explicit_synchronization_v1
Although we already supported minor version 2 of the explicit sync
protocol, we couldn't advertise it previously, since it was not in any
released version of wayland-protocols. With the release of
wayland-protocols 1.18, which includes minor version 2 of this protocol,
and the recent update in weston to require 1.18, we can now safely
advertise minor version 2.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
2019-08-02 15:00:08 +00:00
Marius Vlad 5d649b611a libweston: Migrate functions that operate on 'weston_seat'
All 'notify_()*' belong in the private backend header file.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-07-18 06:43:38 +00:00
Marius Vlad 7e4f58faa3 libweston: Migrate functions that operate on 'weston_view'
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-07-18 06:43:38 +00:00
Marius Vlad 0bf3f5ac2c libweston: Migrate functions that operate on 'weston_seat'
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-07-18 06:43:38 +00:00
Marius Vlad 56f3a68a01 libweston: Migrate functions that operate on 'weston_compositor'
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-07-18 06:43:38 +00:00
Pekka Paalanen 644eb64a5d tests: build setbacklight
Was missed in the Meson migration.

This is built only if DRM-backend is built, because it exercises a sub-feature
of the DRM-backend.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-05-16 13:32:34 +01:00
Antonio Borneo 3957863667 log: remove "%m" from format strings by using strerror(errno)
The printf() format specifier "%m" is a glibc extension to print
the string returned by strerror(errno). While supported by other
libraries (e.g. uClibc and musl), it is not widely portable.

In Weston code the format string is often passed to a logging
function that calls other syscalls before the conversion of "%m"
takes place. If one of such syscall modifies the value in errno,
the conversion of "%m" will incorrectly report the error string
corresponding to the new value of errno.

Remove all the occurrences of the specifier "%m" in Weston code
by using directly the string returned by strerror(errno).
While there, fix some minor indentation issue.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2019-05-02 22:10:30 +02:00
Pekka Paalanen 4e952328ca build: turn vertex-clipping.c into a dependency
Making this into a dependency object not only carries the .c files with it, but
it also brings the include directories as well, which means the users can
simply use the object without guessing the paths.

This should help with moving GL-renderer into a new subdirectory.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-04-18 12:50:55 +03:00
Pekka Paalanen 8ebd9817e7 Move libweston-desktop.h
This too is a public installed header.

The public headers are moved under a new top-level directory include/ to make
them clearly stand out as special (public API).

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-04-18 12:31:46 +03:00
Pekka Paalanen ecbdcfd373 Rename zalloc.h to libweston/zalloc.h
It is a public installed header used by libweston.h.

See "Rename compositor.h to libweston/libweston.h" for rationale.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-04-18 12:31:46 +03:00
Pekka Paalanen 91b1010de9 Rename config-parser.h to libweston/config-parser.h
It is a public installed header used by libweston.h.

See "Rename compositor.h to libweston/libweston.h" for rationale.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-04-18 12:31:46 +03:00
Pekka Paalanen 96dc449259 Rename matrix.h to libweston/matrix.h
matrix.h is a public installed header and even used by libweston.h.

See "Rename compositor.h to libweston/libweston.h" for rationale.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-04-18 12:31:46 +03:00
Pekka Paalanen 27b377f51f Rename plugin-registry.h to libweston/plugin-registry.h
See "Rename compositor.h to libweston/libweston.h" for rationale.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-04-18 12:31:46 +03:00
Pekka Paalanen 3d5d9476e3 Rename compositor.h to libweston/libweston.h
The main idea is to make libweston users use the form

 #include <libweston/libweston.h>

instead of the plain

 #include <compositor.h>

which is prone to name conflicts. This is reflected both in the installed
files, and the internal header search paths so that Weston would use the exact
same form as an external project using libweston would.

The public headers are moved under a new top-level directory include/ to make
them clearly stand out as special (public API).

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-04-18 12:31:46 +03:00
Pekka Paalanen be61a1ff50 tests: fix references to automake
There is no automake anymore, I suppose it is ninja that handles it now.

There are still a couple references to automake left to point out where the
conventions originated, e.g. the exit code 77.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-03-28 13:56:45 +02:00
Pekka Paalanen 5dc2ddf9c6 Clean up .gitignore after autotools removal
There is no such thing as building in-tree anymore, so no need to ignore build
artifacts.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-03-28 13:56:45 +02:00
Pekka Paalanen fc76388fa1 Remove autotools build
Weston 6.0.0 was released with both autotools and Meson build systems. That
should be enough for downstream to migrate to Meson build on their on pace.

Maintaining two build systems is a hassle, keep the one that is easier to work
with and let the other one go.

doc/dozygen/tool*.doxygen.in are not deleted, because they have not been
integrated with Meson yet.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-03-28 13:56:44 +02:00
Riku Viitanen 57875cd018 Optimize PNGs with zopflipng 2019-03-28 10:09:52 +00:00
Pekka Paalanen c58648b0df meson: IVI plugin tests do not use config
If Weston is not installed, running ivi-layout test would fail on lots of image
files not found which presumably causes the creation of some ivi surfaces to
fail, leading to an assert failure.

Looking at the test setup in weston-tests-env, these IVI plugin tests are
supposed to run with --no-config instead.

Fixes: https://gitlab.freedesktop.org/wayland/weston/issues/195

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-02-15 19:21:26 +00:00
Pekka Paalanen fcd9f67467 meson: set WESTON_DATA_DIR for tests
It seems WESTON_DATA_DIR was missed. If you have already installed Weston, then
the files will be found in the install location, but if not, they were not
found at all.

This caused the xwayland test to SEGV the compositor in
weston_wm_window_create_frame() when frame_crate() returned NULL.

This patch fixes the test suite only.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-02-15 19:21:26 +00:00
Alexandros Frantzis c715c750f6 tests: Add tests for per commit zwp_buffer_release_v1 behavior
Add tests to check that the zwp_buffer_release_v1 events are emitted per
surface commit.

To be able to test this we need to use a renderer that holds the buffer
until the next buffer is committed, hence we use the pixman renderer.

Changes in v7:
  - Remove references to obsolete noop-hold renderer.

Changes in v5:
  - Meson support.

Changes in v4:
  - Use the pixman renderer instead of the (now gone) noop-hold
    renderer.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
2019-02-06 12:21:56 +00:00
Alexandros Frantzis 676296749a libweston: Support zwp_surface_synchronization_v1.get_release
Implement the get_release request of the zwp_surface_synchronization_v1
interface.

This commit implements the zwp_buffer_release_v1 interface. It supports
the zwp_buffer_release_v1.fenced_release event for surfaces rendered by
the GL renderer, and the zwp_buffer_release_v1.immediate_release event
for other cases.

Note that the immediate_release event is safe to be used for surface
buffers used as planes in the DRM backend, since the backend releases
them only after the next page flip that doesn't use the buffers has
finished.

Changes in v7:
  - Remove "partial" from commit title and description.
  - Fix inverted check when clearing used_in_output_repaint flag.

Changes in v5:
  - Use the new, generic explicit sync server error reporting function.
  - Introduce and use weston_buffer_release_move.
  - Introduce internally and use weston_buffer_release_destroy.

Changes in v4:
  - Support the zwp_buffer_release_v1.fenced_release event.
  - Support release fences in the GL renderer.
  - Assert that pending state buffer_release is always NULL after a
    commit.
  - Simplify weston_buffer_release_reference.
  - Move removal of destroy listener before resource destruction to
    avoid concerns about use-after-free in
    weston_buffer_release_reference
  - Rename weston_buffer_release_reference.busy_count to ref_count.
  - Add documentation for weston_buffer_release and ..._reference.

Changes in v3:
  - Raise NO_BUFFER for get_release if no buffer has been committed,
    don't raise UNSUPPORTED_BUFFER for non-dmabuf buffers,
    so get_release works for all valid buffers.
  - Destroy the buffer_release object after sending an event.
  - Track lifetime of buffer_release objects per commit, independently
    of any buffers.
  - Use updated protocol interface names.
  - Use correct format specifier for resource ids.

Changes in v2:
  - Raise UNSUPPORTED_BUFFER at commit if client has requested a
    buffer_release, but the committed buffer is not a valid linux_dmabuf.
  - Remove tests that are not viable anymore due to our inability to
    create dmabuf buffers and fences in a unit-test environment.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
2019-02-06 12:21:56 +00:00
Alexandros Frantzis acff29b3b3 libweston: Support zwp_surface_synchronization_v1.set_acquire_fence
Implement the set_acquire_fence request of the
zwp_surface_synchronization_v1 interface.

The implementation uses the acquire fence in two ways:

1. If the associated buffer is used as GL render source, an
   EGLSyncKHR is created from the fence and used to synchronize
   access.
2. If the associated buffer is used as a plane framebuffer,
   the acquire fence is treated as an in-fence for the atomic
   commit operation. If in-fences are not supported and the buffer
   has an acquire fence, we don't consider it for plane placement.

If the used compositor/renderer doesn't support explicit
synchronization, we don't advertise the protocol at all. Currently only
the DRM and X11 backends when using the GL renderer advertise the
protocol for production use.

Issues for discussion
---------------------

a. Currently, a server-side wait of EGLSyncKHR is performed before
   using the EGLImage/texture during rendering. Unfortunately, it's not clear
   from the specs whether this is generally safe to do, or we need to
   sync before glEGLImageTargetTexture2DOES. The exception is
   TEXTURE_EXTERNAL_OES where the spec mentions it's enough to sync
   and then glBindTexture for any changes to take effect.

Changes in v5:
  - Meson support.
  - Make explicit sync server error reporting more generic, supporting
    all explicit sync related interfaces not just
    wp_linux_surface_synchronization.
  - Fix typo in warning for missing EGL_KHR_wait_sync extension.
  - Support minor version 2 of the explicit sync protocol (i.e., support
    fences for opaque EGL buffers).

Changes in v4:
  - Introduce and use fd_clear and and fd_move helpers.
  - Don't check for a valid buffer when updating surface acquire fence fd
    from state.
  - Assert that pending state acquire fence fd is always clear
    after a commit.
  - Clarify that WESTON_CAP_EXPLICIT_SYNC applies to just the
    renderer.
  - Check for EGL_KHR_wait_sync before using eglWaitSyncKHR.
  - Dup the acquire fence before passing to EGL.

Changes in v3:
  - Keep acquire_fence_fd in surface instead of buffer.
  - Clarify that WESTON_CAP_EXPLICIT_SYNC applies to both backend and
    renderer.
  - Move comment about non-ownership of in_fence_fd to struct
    drm_plane_state definition.
  - Assert that we don't try to use planes with in-fences when using the
    legacy KMS API.
  - Remove unnecessary info from wayland error messages.
  - Handle acquire fence for subsurface commits.
  - Guard against self-update in fd_update.
  - Disconnect the client if acquire fence EGLSyncKHR creation or wait
    fails.
  - Use updated protocol interface names.
  - User correct format specifier for resource ids.
  - Advertise protocol for X11 backend with GL renderer.

Changes in v2:
  - Remove sync file wait fallbacks.
  - Raise UNSUPPORTED_BUFFER error at commit if we have an acquire
    fence, but the committed buffer is not a valid linux_dmabuf.
  - Don't put buffers with in-fences on planes that don't support
    in-fences.
  - Don't advertise explicit sync protocol if backend does not
    support explicit sync.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
2019-02-06 12:21:56 +00:00
Alexandros Frantzis 27d7c395c7 libweston: Introduce zwp_linux_explicit_synchronization_v1
Introduce support for the zwp_linux_explicit_synchronization_unstable_v1
protocol with an implementation of the zwp_linux_explicit_synchronization_v1
interface.

Explicit synchronization provides a more versatile notification
mechanism for buffer readiness and availability, and can be used to
improve efficiency by integrating with related functionality in display
and graphics APIs.

In addition, the per-commit nature of the release events provided by
this protocol potentially offers a solution to a deficiency of the
wl_buffer.release event (see
https://gitlab.freedesktop.org/wayland/wayland/issues/46).

Support for this protocol depends on the capabilities of the backend, so
we don't register it by default but provide a function which each
backend will need to call. In this commit only the headless backend when
using the noop renderer supports this to enable testing.

Note that the zwp_surface_synchronization_v1 interface, which contains
the core functionality of the protocol, is not implemented in this
commit. Support for it will be added in future commits.

Changes in v7:
  - Added some information in the commit message about the benefits of
    the explicit sync protocol.

Changes in v6:
  - Fall back to advertising minor version 1 of the explicit sync protocol,
    although we support minor version 2 features, until the new
    wayland-protocols version is released.

Changes in v5:
  - Meson support.
  - Advertise minor version 2 of the explicit sync protocol.

Changes in v4:
  - Enable explicit sync support in the headless backend for all
    renderers.

Changes in v3:
  - Use wl_resource_get_version() instead of hardcoding version 1.
  - Use updated protocol interface names.
  - Use correct format specifier for resource id.
  - Change test name to 'linux-explicit-synchronization.weston'
    (s/_/-/g).

Changes in v2:
  - Move implementation to separate file so protocol can be registered
    on demand by backends.
  - Register protocol in headless+noop backend for testing purposes.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
2019-02-06 12:21:56 +00:00
Pekka Paalanen a37920e77c tests: use weston_compositor_exit
Use the proper function to exit instead of the libwayland one, to allow main
handle_exit() to be called.

This is just to unify the exit paths.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-02-06 10:58:22 +00:00
Pekka Paalanen 917ecfcb04 meson: better error for test-junit-xml dep
Helps people avoid libxml if they... want to?

Signed-off-by: Pekka Paalanen <pq@iki.fi>
2019-01-09 10:52:10 +00:00
Pekka Paalanen 5605b72e00 meson: better error for tests missing libX11
Helps people avoid libX11 at the cost of disabling Xwayland support.

Signed-off-by: Pekka Paalanen <pq@iki.fi>
2019-01-09 10:52:10 +00:00
Pekka Paalanen 91bf16be7d tests: remove remnants of buffer-count test
The buffer-count test was added in
40c0c3f91e and removed in
4938f93f57, but the removal left around
the dependency to EGL headers in weston-test.c.

Removal of those unneeded includes allows us to drop the EGL dependency
completely from weston-test.c build.

For the Meson build this means that there are no dependency('egl')
directives anymore without the user friendly error message.

Signed-off-by: Pekka Paalanen <pq@iki.fi>
2019-01-07 15:04:21 +02:00
Greg V 0f0409835d build: add missing wayland-client dep in meson
Tests library requires Wayland headers to build.

Signed-off-by: Greg V <greg@unrelenting.technology>
2018-12-20 18:37:34 +00:00
Daniel Stone 8011b0fa03 Add Meson build system
Meson is a build system, currently implemented in Python, with multiple
output backends, including Ninja and Make. The build file syntax is
clean and easy to read unlike autotools. In practise, configuring and
building with Meson and Ninja has been observed to be much faster than
with autotools. Also cross-building support is excellent.

More information at http://mesonbuild.com

Since moving to Meson requires some changes from users in any case, we
took this opportunity to revamp build options. Most of the build options
still exist, some have changed names or more, and a few have been
dropped. The option to choose the Cairo flavour is not implemented since
for the longest time the Cairo image backend has been the only
recommended one.

This Meson build should be fully functional and it installs everything
an all-enabled autotools build does. Installed pkg-config files have
some minor differences that should be insignificant. Building of some
developer documentation that was never installed with autotools is
missing.

It is expected that the autotools build system will be removed soon
after the next Weston release.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Co-authored-by: Pekka Paalanen <pq@iki.fi>
Signed-off-by: Pekka Paalanen <pq@iki.fi>
2018-12-09 14:50:54 +02:00
Daniel Stone ed75c89fd5 tests: fix include in input-timestamps-helper.c
No need to use the protocol directory prefix. This may even be necessary
for the Meson build.

Signed-off-by: Daniel Stone <daniels@collabora.com>

Extracted from the patch adding the Meson build system.

Signed-off-by: Pekka Paalanen <pq@iki.fi>
2018-12-09 14:49:07 +02:00
Daniel Stone 51c9b0e2c4 tests: Rename surface-screenshot
Give it a more regular name, matching all the other test plugins.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2018-12-09 12:13:36 +02:00
Daniel Stone 11f91bbd36 helpers: Move static_assert definition to shared
Collect the fallback definitions of static_assert() from desktop-shell
and the test shell, and move them to helpers.h. This allows code
throughout the tree to use static_assert() for build-time assertions,
where it is supported by the compiler.

As GCC goes out of its way to only add static_assert() when C11 has been
explicitly requested - which we don't do - make sure to use the more
widely available _Static_assert() if that is provided.

This will be used in future patches to ensure two array lengths don't go
out of sync.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-07-09 15:39:20 +01:00
Daniel Stone 78a42116ae tests: Reshuffle IVI layout tests
Rename the IVI tests to be more consistent with the others, and invert
the naming of plugin/client to make it slightly more clear what's going
to happen. Handle the renaming by using wet_get_binary_path to rewrite
the local binaries.

As a side-effect, weston.ini ivi-shell-user-interface no longer needs to
be given as an absolute path.

Signed-off-by: Daniel Stone <daniels@collabora.com>

v2:

Call ivi-layout.ivi as ivi-layout-test-client.ivi to keep the same name
in both the file and the lookup, so that the module map does not need to
change the name.

Update code comments to reflect the new names.

Rename ivi_layout-test-plugin.c to ivi-layout-test-plugin.c.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2018-06-20 16:10:12 +03:00
Pekka Paalanen f5c96467e3 tests: remove WESTON_BUILD_DIR from env
There are no users left.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Emre Ucan <eucan@de.adit-jv.com>
2018-06-20 16:10:12 +03:00
Daniel Stone e03c111e4e tests: Don't rely on build directory layout
Rather than having a hardcoded dependency on the build-directory layout,
use an explicit module-map environment variable, which rewrites requests
for modules and helper/libexec binaries to specific paths.

Pekka: This will help with migration to Meson where setting up the paths
according to autotools would be painful and unnecessary.

Emre: This should also help setting up the test suite after a
cross-compile.

Pekka: A caveat here is that this patch makes it slightly easier to load
external backends by abusing the module map. External backends are
specifically not supported in libweston.

Signed-off-by: Daniel Stone <daniels@collabora.com>

v2:

Fixed ivi_layout-test-plugin.c:wet_module_init().
Do not change the lookup name of ivi-layout.ivi.

Improved documentation of weston_module_path_from_env() and made it cope
with map strings that a) do not end with a semicolon, and b) have
multiple consecutive semicolons.

Let WESTON_MODULE_MAP be printed into the test log so that it is easier
to run tests manually.

Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Emre Ucan <eucan@de.adit-jv.com>

Suggested by Emil: Use a variable for strlen(name).

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2018-06-20 14:36:52 +03:00
Pekka Paalanen bcbce33000 libweston: notify_touch API to use weston_touch_device
Relay touch input events into libweston core through the
weston_touch_device, so that the core can tell which individual physical
device they come from.

This is necessary for supporting touchscreen calibration, where one
needs to process a single physical device at a time instead of the
aggregate of all touch devices on the weston_seat.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
v1 Tested-by: Matt Hoosier <matt.hoosier@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-05-30 14:45:58 +03:00
Louis-Francis Ratté-Boulianne 6ef59c9843 input: introduce weston_touch_device
Introduce weston_touch_device for libweston core to track individual
touchscreen input devices. A weston_seat/weston_touch may be an
aggregation of several physical touchscreen input devices. Separating
the physical devices will be required for implementing touchscreen
calibration. One can only calibrate one device at a time, and we want to
make sure to handle the right one.

Both backends that support touch devices are updated to create
weston_touch_devices. Wayland-backend provides touch devices that cannot
be calibrated, because we have no access to raw touch coordinates from
the device - calibration is the responsibility of the parent display
server. Libinput backend provides touch devices that can be calibrated,
hence implementing the set and get calibration hooks.

Backends need to maintain an output pointer in any case, so we have a
get_output() hook instead of having to maintain an identical field in
weston_touch_device. The same justification applies to
get_calibration_head_name.

Also update the test plugin to manage weston_touch_device objects.

Co-developed by Louis-Francis and Pekka.

v2:
- Consistently use 'cal' instead of 'calb' or 'matrix'.
- change devpath into syspath
- update copyrights

Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
v1 Tested-by: Matt Hoosier <matt.hoosier@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-05-30 14:42:13 +03:00
Pekka Paalanen f39249ad58 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>
2018-04-20 15:27:54 +03:00
Pekka Paalanen 055c1137ae 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>
2018-04-10 14:33:59 +03:00
Alexandros Frantzis d715784734 libweston: Implement touch timestamps for input_timestamps_unstable_v1
Implement the zwp_input_timestamps_manager_v1.get_touch_timestamps
request to subscribe to timestamp events for wl_touch resources. Ensure
that the request handling code can gracefully handle inert touch
resources.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-02-20 15:09:53 +02:00
Alexandros Frantzis db907b7188 libweston: Implement pointer timestamps for input_timestamps_unstable_v1
Implement the zwp_input_timestamps_manager_v1.get_pointer_timestamps
request to subscribe to timestamp events for wl_pointer resources.
Ensure that the request handling code can gracefully handle inert
pointer resources.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-02-20 15:09:53 +02:00
Alexandros Frantzis 2b44248f60 libweston: Implement keyboard timestamps for input_timestamps_unstable_v1
Implement the zwp_input_timestamps_manager_v1.get_keyboard_timestamps
request to subscribe to timestamp events for wl_keyboard resources.
Ensure that the request handling code can gracefully handle inert
keyboard resources.

This commit introduces a few internal helper functions which will also
be useful in the implementation of the remaining
zwp_input_timestamps_manager_v1 requests.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-02-20 15:09:53 +02:00
Alexandros Frantzis c3b5d78c1d tests: Introduce input timestamps helper
Introduce helper test code to implement the client side of the
input_timestamps_unstable_v1 protocol. This helper will be used in
upcoming commits to test the server side implementation of the protocol
in libweston.

The input_timestamps_unstable_v1 protocol was introduced in version 1.13
of wayland-protocols, so this commit updates the version dependency in
configure.ac accordingly.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-02-20 10:20:29 +02:00
Alexandros Frantzis 7a93bb2f17 shared: Add timespec_eq helper function
Add a helper function to check if two struct timespec values are equal.
This helper function will be used in upcoming commits that implement the
input_timestamps_unstable_v1 protocol.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-02-20 10:20:29 +02:00
Alexandros Frantzis 8b964bca50 tests: Add test for seat destruction and creation
Add a test to check that we can destroy and create the test seat. Since
after test seat destruction the test client releases any associated
input resources, this test also checks that libweston properly handles
release requests for inert input resources.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-02-15 13:14:57 +02:00
Alexandros Frantzis 849b333133 tests: Run devices tests using the test desktop shell
Use the weston-test-desktop-shell to run the devices tests, instead of
the currently used desktop-shell. The test desktop shell doesn't
interact with temporary globals (e.g. wl_seat), thus avoiding an
inherent race in the current wayland protocol when removing globals.
This will allow us to safely add tests which add/remove such globals in
upcoming commits.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-02-15 13:14:53 +02:00
Alexandros Frantzis 468bd0b9c8 tests: Support setting the test client input dynamically
The current test client code waits for all wl_seat globals to arrive
before checking them and deciding which one is the test seat global to
use for the input object. Test code that needs to add/remove test seats
would have to call the client_set_input() function for any seat changes
to take effect. Although we could allow this by making
client_set_input() public, we would be exposing unecessary
implementation details.

This commit applies any seat changes immediately upon arrival of the
seat name, freeing test code from needing to call extra functions like
client_set_input(). To achieve this the call to input_data_devices() is
moved from client_set_input() to the seat name event handler.

This commit also moves the check that all seats have names to an
explicit test. To support this test, inputs corresponding to non-test
seats are not destroyed (unless their seat global is removed), as
was previously the case.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-02-15 13:14:48 +02:00
Alexandros Frantzis c1937971fb tests: Handle removal of seat global in test clients
The current test client code completely ignores removal of globals.
This commit updates the code to properly handle removal of globals in
general, and of seat globals in particular. This ensures that the test
client objects are in sync with the server and any relevant resources
are released accordingly.

This update will be used by upcoming tests to check that seat removal
and re-addition is working properly.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-02-15 13:14:44 +02:00
Emre Ucan c6e2942fab tests: fix a race condition in ivi-shell tests
ivi-shell tests load their own controller plugin
for testing purposes. Tests also uses the generated
weston-ivi.in config file, which causes weston to
load hmi-controller and its helper client.
Existence of hmi-controller and its helper client
confuses test plugins. Because they are creating
surfaces and layers which are not expected by
test plugins.

We can start ivi-shell tests without config file
to solve this problem. Then, weston will not load
hmi-controller plugin.

Reported-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
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>
2018-02-14 13:14:54 +02:00
Aleksander Morgado 72032accbf file-util: allow specifying path separately in file_create_dated()
Instead of assuming the file prefix contains the path and filename
prefix, give these two items separately.

A NULL or empty string path may still be given to refer to the current
directory.

Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2018-02-09 15:16:07 +00:00
Emre Ucan 0707b0e5d4 tests: load ivi-shell test plugins as weston module
It is better to load ivi controller modules as a
generic weston module. Then, we do not need to
have a specific ivi way of loading modules.

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-02-07 11:54:53 +02:00
Derek Foreman b7e3db6a76 tests: Set WESTON_DATA_DIR for tests
Set the env var to override the system data directory so we can run
tests with uninstalled icons.

We don't yet use the code that checks this env var, so make distcheck
will still fail.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-02-07 11:38:37 +02:00
Alexandros Frantzis 85f8432911 tests: Support weston_test request for adding a test seat
Support adding a test seat using the weston_test.device_add request.
This will be used in tests in upcoming commits where we will need to
re-add the seat after having it removed.

We only support one test seat at the moment, so this commit also
introduces checks to ensure the client doesn't try to create multiple
test seats or try to remove an already removed test seat.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-02-01 12:54:48 +02:00
Alexandros Frantzis b0341ae972 tests: Add test for pointer axis events
Add test to verify the server correctly emits pointer axis events.  This
requires updating the weston-test protocol with a new request for
pointer axis events.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-12-18 13:18:00 +02:00
Alexandros Frantzis c20b580b52 tests: Add test for touch event timestamps
Add test to verify that the server correctly sets the timestamps of
touch events. This requires updating the weston-test protocol with a new
request for touch events.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-12-18 11:46:28 +02:00
Alexandros Frantzis dae224c6dc tests: Add test for keyboard key event timestamps
Add test to verify that the server correctly sets the timestamps of
keyboard key events. This requires updating the weston-test protocol to
support passing key event timestamps.

simple_keyboard_test now uses the create_client_with_keyboard_focus()
helper function which changes the initial state of the surface to be
focused. This leads to one additional iteration of the test loop when
starting, during which the surface is deactivated, i.e., loses focus.
After this initial iteration the test continues as before.

Furthermore, simple_keyboard_test now uses the send_key() helper
function which performs a roundtrip internally. To account for this, the
client_roundtrip() function is now directly called in the loop only when
it is still required, i.e., when deactivating the surface.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-12-18 11:46:25 +02:00
Alexandros Frantzis 2180858592 tests: Add checks for pointer motion and button event timestamps
Enhance the existing pointer motion and button event tests to
additionally verify the event timestamps. This requires updating the
weston-test protocol to support passing motion and button event
timestamps.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-12-18 11:27:43 +02:00
Alexandros Frantzis 10d708d268 shared: Add timespec_to_proto helper function
Add helper function to convert from struct timespec values to tv_sec_hi,
tv_sec_lo, tv_nsec triplets used for sending high-resolution timestamp
data over the wayland protocol. Replace existing conversion code with
the helper function.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-12-18 11:27:43 +02:00
Alexandros Frantzis 787fa611de shared: Add timespec_from_proto helper function
Add helper function to convert tv_sec_hi, tv_sec_lo, tv_nsec triplets,
used for sending high-resolution timestamp data over the wayland
protocol, to struct timespec values. Replace existing conversion code
with the helper function.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-12-18 11:27:43 +02:00
Alexandros Frantzis 903e4450a2 tests: Use separate test cases for pointer motion and button tests
Split pointer motion and pointer button tests so that each test case is
more focused and self-contained.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-12-12 13:43:06 +02:00
Alexandros Frantzis 5d6acf8568 tests: Move wl_pointer tests to their own file
Move wl_pointer tests from event-test.c to their own pointer-test.c
file. This move makes the test organization clearer and more consistent,
and will make addition of further pointer tests easier.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-12-12 12:17:08 +02:00
Emilio Pozuelo Monfort 5c3f3575d5 tests: add a create_test_surface function
This doesn't attach a buffer to the surface. This is needed for the
next commit, where we have a test case with a surface that doesn't
have a buffer attached.

Signed-off-by: Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2017-12-04 21:58:00 +00:00
Valery Kartel d4512f6aa1 weston: added missing header time.h
without it I can't built weston on alpinelinux

Reviewed-by: Daniel Stone <daniels@collabora.com>
2017-12-04 19:08:50 +00:00
Alexandros Frantzis 8c919b488c tests: Fix integer overflows on 32-bit systems
Ensure that the integer type used in expressions involving
multiplication with NSEC_PER_SEC is large enough to avoid overflows on
32-bit systems. In the expressions fixed by this patch a 64-bit type
(long long) is required.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2017-12-04 19:06:02 +00:00
Emmanuel Gil Peyrot 7092090de9 tests: Mark tests as used so they don’t get removed at link time
Without this attribute, the test macros were making Weston fail to
build with LTO enabled.

Signed-off-by: Markus Trippelsdorf <markus@trippelsdorf.de>
Signed-off-by: Emmanuel Gil Peyrot <emmanuel.peyrot@collabora.com>
Tested-by: Emmanuel Gil Peyrot <emmanuel.peyrot@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2017-12-01 16:53:53 +00:00
Emmanuel Gil Peyrot 0f4dbe72d3 tests: Add one more indentation level to some macros
This is a preparatory patch for the next one.

Signed-off-by: Emmanuel Gil Peyrot <emmanuel.peyrot@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2017-12-01 16:53:45 +00:00
Alexandros Frantzis 47e79c860b libweston: Use struct timespec for key events
Change code related to key events to use struct timespec to represent
time.

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

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-11-27 11:42:07 +02:00
Alexandros Frantzis 215bedc88b libweston: Use struct timespec for button events
Change code related to button events to use struct timespec to represent
time.

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

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-11-27 11:42:07 +02:00
Alexandros Frantzis 84b31f8956 libweston: Use struct timespec for motion events
Change code related to motion events to use struct timespec to represent
time.

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

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-11-27 11:42:07 +02:00
Alexandros Frantzis 6c2752a863 shared: Add helpers to convert between various time units and timespec
Add helper functions to make it easy and less error-prone to convert
between values in various time units (nsec, usec, msec) and struct
timespec. These helpers are going to be used in the upcoming commits to
transition the Weston codebase to struct timespec.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-11-27 11:18:25 +02:00
Alexandros Frantzis e2a5f9e02d shared: Add timespec_is_zero helper
Add a helper function to check if a struct timespec is zero. This helper
will be used in the upcoming commits to transition the Weston codebase
to struct timespec.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-11-27 11:18:25 +02:00
Pekka Paalanen d05a819252 tests: ensure output dependent IVI tests run
There are IVI tests that require an output. Previously these tests would
silently skip if no outputs were present. However, a test setup should
always have outputs with these tests. Skipping could easily leave the
tests dead without notice.

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

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Reviewed-by: Emre Ucan <eucan@de.adit-jv.com>
Acked-by Daniel Stone <daniels@collabora.com>
2017-10-04 15:03:56 +03:00
Michael Teyfel 156bd065c9 ivi-shell: Added tests for screen-remove-layer API
Two cases are tested: success and fail case of the screen-remove-layer API.

Signed-off-by: Michael Teyfel <mteyfel@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-09-04 11:59:08 +03:00
Pekka Paalanen 9ffb25009c libweston: introduce weston_output_from_resource()
This is a simple wrapper for casting the user data of a wl_resource into
a struct weston_output pointer. Using the wrapper clearly marks all the
places where a wl_output protocol object is used.

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

v2: add type assert in weston_output_from_resource().

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
2017-07-25 16:08:48 +03:00
Ucan, Emre (ADITG/SW1) 6e423ed996 ivi-shell: remove layer_set_orientation API
This API is used to rotate the contents of
application's buffer, which are in the render
order list of the layer. But this API is not
needed because an application can rotate
its buffers with set_buffer_transform request
of wl_surface interface

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-07-24 13:33:00 +03:00
Ucan, Emre (ADITG/SW1) 9337197f82 ivi-shell: remove surface_set_orientation API
This API is used to rotate the contents of
application's buffer. But it is not needed
because an application can rotate its buffers
with set_buffer_transform request of
wl_surface interface.

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-07-24 13:32:48 +03:00
Daniel Stone 2ef9b1a3c4 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>
2017-03-13 17:56:07 +00:00
Daniel Stone 839b63546d 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>
2017-03-13 14:20:06 +02:00
Daniel Stone 37ad7e3bae 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>
2017-03-13 14:19:46 +02:00
Daniel Stone 61f6d7d372 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>
2017-03-08 11:57:34 +02:00
Daniel Stone 5ae7e84c6b 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>
2017-03-08 11:57:34 +02:00
Pekka Paalanen 19222b4c89 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>
2017-02-07 14:25:27 +02:00
Emilio Pozuelo Monfort 4f3cad7828 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>
2017-02-07 14:25:27 +02:00
Pekka Paalanen e7c6aa6af4 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>
2017-02-07 14:25:27 +02:00
Pekka Paalanen 50b7b70835 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>
2017-02-07 14:25:27 +02:00
Pekka Paalanen b581783b79 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>
2017-02-07 14:25:12 +02:00
Pekka Paalanen a21b5ebf85 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>
2017-02-07 13:26:26 +02:00
Pekka Paalanen 7bcec20cc3 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]
2017-02-07 13:26:06 +02:00
Quentin Glidic 642bcaf387 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]
2017-02-07 12:10:50 +02:00
Daniel Stone 4938f93f57 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>
2017-01-30 18:56:50 +00:00
Ucan, Emre (ADITG/SW1) fbce2f5dd9 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>
2017-01-27 16:43:47 +02:00