platform/upstream/weston.git
4 years agobuild: bump to version 9.0.0 for the official release upstream upstream/9.0.0
Simon Ser [Fri, 4 Sep 2020 10:20:00 +0000 (12:20 +0200)]
build: bump to version 9.0.0 for the official release

4 years agobuild: bump to version 8.0.93 for the RC1 release
Simon Ser [Thu, 27 Aug 2020 20:58:53 +0000 (22:58 +0200)]
build: bump to version 8.0.93 for the RC1 release

4 years agoremoting, pipewire: Install pipewire and remoting plug-ins headers
Marius Vlad [Thu, 27 Aug 2020 11:32:26 +0000 (14:32 +0300)]
remoting, pipewire: Install pipewire and remoting plug-ins headers

Required for other users of libweston.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
4 years agoremoting: Add DPMS support in remoting pluging
Marius Vlad [Thu, 27 Aug 2020 11:14:27 +0000 (14:14 +0300)]
remoting: Add DPMS support in remoting pluging

Just like pipewire, add DPMS support in remoting plug-in. Mechanical
change mimicking a24a326bb19ec5.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
4 years agoexposay: delete outer padding from struct exposay_output
Leandro Ribeiro [Sat, 25 Jan 2020 20:49:07 +0000 (17:49 -0300)]
exposay: delete outer padding from struct exposay_output

After some changes in the exposay layout, the outer padding makes
no sense anymore. It was used to avoid the panel to get overlapped
by the exposay surfaces and to keep distance from the borders
of the window.

Currently, the exposay is centralized and the panel cannot get
overlapped. The outer padding just creates unnecessary unused
space, what makes exposay's surfaces smaller.

Delete outer padding from struct exposay_output.

Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net>
4 years agoexposay: centralize surfaces of the last row when we don't have enough surfaces
Leandro Ribeiro [Fri, 24 Jan 2020 22:57:39 +0000 (19:57 -0300)]
exposay: centralize surfaces of the last row when we don't have enough surfaces

The exposay grid is square, but we don't always have enough surfaces
to fill all the columns of the last row. The code to centralize
the surfaces of the last row is not working.

Fix the code that centralizes the surfaces in the last row, making
it more visually pleasant.

Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net>
4 years agoexposay: centralize exposay's surfaces in their own square
Leandro Ribeiro [Sat, 25 Jan 2020 17:40:49 +0000 (14:40 -0300)]
exposay: centralize exposay's surfaces in their own square

Commit "exposay: add margins to centralize exposay" has centralized
the whole exposay, but that's not enough. The internal surfaces of
exposay are not centralized.

Each internal surface of exposay is a square, but most of the windows
are rectangular. Add margin to centralize exposay's surfaces in their
own square.

Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net>
4 years agoexposay: add margins to centralize exposay
Leandro Ribeiro [Fri, 24 Jan 2020 22:50:34 +0000 (19:50 -0300)]
exposay: add margins to centralize exposay

The exposay is being rendered in the top-left corner of the
screen. Add margins to render it in the center, making it
more visually pleasant.

Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net>
4 years agoexposay: make inner border dependent of exposay's surfaces size
Leandro Ribeiro [Fri, 24 Jan 2020 21:10:59 +0000 (18:10 -0300)]
exposay: make inner border dependent of exposay's surfaces size

We've been using an inner border of fixed size (80px), but this
is dangerous. If you have too many open applications or a small
window, the surface size computed will be negative, crashing
the exposay: "error: weston_view transformation not invertible".

Also, it creates a lot of unnecessary space, making the exposay
unusable when we have a small window or many applications open.

Make inner border to be 10% of surface size and surface size to
be 90% of its original size, avoiding the crashes and making it
more visually pleasant.

Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net>
4 years agoexposay: do not account panel size to compute exposay area
Leandro Ribeiro [Fri, 24 Jan 2020 21:02:27 +0000 (18:02 -0300)]
exposay: do not account panel size to compute exposay area

Commit "desktop-shell: make get_output_work_area() global" allowed
the usage of get_output_work_area() in exposay. This is necessary to
avoid overlapping the panel when rendering exposay's surfaces.

Use get_output_work_area() to not take into account the panel size,
instead of considering that the whole screen is available to
render exposay's surfaces.

Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net>
4 years agodesktop-shell: make get_output_work_area() global
Leandro Ribeiro [Fri, 24 Jan 2020 20:53:44 +0000 (17:53 -0300)]
desktop-shell: make get_output_work_area() global

get_output_work_area() can be used by exposay to know the free space
where it can render its surfaces, what avoids overlapping the panel.

Currently this function is declared as static in
desktop-shell/shell.c, so it cannot be used by exposay.

Remove static from get_output_work_area() and add it to shell.h
so it can be used by exposay as well.

Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net>
4 years agoexposay: move constant value calculation out of loop
Leandro Ribeiro [Mon, 30 Dec 2019 22:11:51 +0000 (19:11 -0300)]
exposay: move constant value calculation out of loop

In exposay_layout(), int pad is being calculated within the
loop. This is unnecessary, as its value is constant. Move it
out of the loop.

Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net>
4 years agocompositor: Avoid using weston_log() in weston_view_is_opaque()
Marius Vlad [Fri, 21 Aug 2020 10:57:54 +0000 (13:57 +0300)]
compositor: Avoid using weston_log() in weston_view_is_opaque()

As from commit b7e5f10bf47, weston_view_is_opaque() is called from
debug_scene_graph_cb(), which on its own represents a (different)
scope. By default, we already have a subscriber for the 'log' scope,
which will cause a harmless, yet spurious, message.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
4 years agopipewire: implement DPMS
Michael Olbrich [Wed, 19 Aug 2020 06:43:15 +0000 (08:43 +0200)]
pipewire: implement DPMS

Pipewire doesn't need to wait for any hardware. The finish_frame() callback is
just artifically delayed to generate the desired framerate.

So when the DPMS level changes, we can just call finish_frame() immediately if
necessary and cancel the timer.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
4 years agodrm: always check the repaint_status in update_complete
Michael Olbrich [Thu, 6 Aug 2020 07:57:54 +0000 (09:57 +0200)]
drm: always check the repaint_status in update_complete

Initially finish_frame() was never called in drm_output_update_complete() for
'dpms_off_pending = true'. This is wrong for repaint_status ==
REPAINT_AWAITING_COMPLETION and that was fixed in
68d49d772cfba6c53033cb009b0f490fd38f24ad ("compositor-drm: run finish_frame when
dpms is turned off in update_complete").
However finish_frame() may now be called for repaint_status !=
REPAINT_AWAITING_COMPLETION, which is not allowed and results in a failed
assertion.

Fix this by checking dpms and repaint_status unconditionally.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
4 years agobackend-drm: Correctly tear down the DRM backend
Marius Vlad [Thu, 30 Jul 2020 11:47:32 +0000 (14:47 +0300)]
backend-drm: Correctly tear down the DRM backend

It seem that we skipped to put back in TEXT mode the tty, in case a DRM
device node wasn't present at that time, or it isn't present at all. This
orders the destroy part correctly as to handle that case as well.

As a side effect, as the tty will still be set to GRAPHICS mode we will
require a manual change of the tty number, which might be not possible
on all systems. Properly putting back the tty to TEXT mode should avoid
that, and allows to re-use the same tty no in case the DRM device has
been created at a later point in time.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
4 years agolibweston/launcher-direct.c: do not fail if already in graphics mode
Andreas Heynig [Wed, 22 Jan 2020 18:36:57 +0000 (19:36 +0100)]
libweston/launcher-direct.c: do not fail if already in graphics mode

In case of a crash tty remains in graphic mode. This change allows to restart weston without
taking care of the actual tty mode.

Signed-off-by: ahe <Andreas.Heynig@meetwise.com>
4 years agobackend-drm: allow to disable GBM modifiers
Stefan Agner [Wed, 17 Jun 2020 21:36:44 +0000 (23:36 +0200)]
backend-drm: allow to disable GBM modifiers

Allow to disable GBM modifiers at runtime using the environment variable
WESTON_DISABLE_GBM_MODIFIERS.

This can be useful for debugging or when modifiers cause issues, e.g. in
case modifiers use higher memory bandwidth and hence impose a lower
resolution limit as it is the case with Intel Kaby Lake graphics.

Related to: https://gitlab.freedesktop.org/wayland/weston/-/issues/404
Signed-off-by: Stefan Agner <stefan@agner.ch>
4 years agobackend-drm: the GL renderer is a hard requirement for DRM virtual outputs
Michael Olbrich [Wed, 15 Jul 2020 09:54:47 +0000 (11:54 +0200)]
backend-drm: the GL renderer is a hard requirement for DRM virtual outputs

Building fails without it. So don't just warn about it but fail immediately.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
4 years agobackend-drm: build DRM virtual support when the pipewire plugin is enabled
Michael Olbrich [Wed, 15 Jul 2020 09:01:04 +0000 (11:01 +0200)]
backend-drm: build DRM virtual support when the pipewire plugin is enabled

The pipewire plugin uses this API as well, not just the remoting plugin. So
enable it if either is enabled.

And disable pipewire in the no-gl-renderer CI build. The virtual outputs don't
work without it.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
4 years agoivi-shell: Avoid unnecessary scaling of the view transformation matrix
Rajendraprasad K J [Wed, 29 Jul 2020 14:50:59 +0000 (16:50 +0200)]
ivi-shell: Avoid unnecessary scaling of the view transformation matrix

The opaque region of a weston view is updated only if the alpha value is 1
and the transform matrix is of type WESTON_MATRIX_TRANSFORM_TRANSLATE.

While using ivi-shell, opaque region is never updated, as we are performing
scaling operations to the view transform matrix, even when the scaling
factor is 1 and thereby changing the type to WESTON_MATRIX_TRANSFORM_SCALE.

Perform scaling of the view transformation matrix only when the scaling
factor is non-zero.

Signed-off-by: Rajendraprasad K J <KarammelJayakumar.Rajendraprasad@in.bosch.com>
4 years agobackend-drm: reorder plane checks to avoid unnecessary rendering
Michael Olbrich [Tue, 14 Jul 2020 09:18:54 +0000 (11:18 +0200)]
backend-drm: reorder plane checks to avoid unnecessary rendering

If a surface is not visible, then is does not matter if the view is on multiple
outputs. It will be skipped anyways when the output is rendered.

So check first if the surface is acually visible on the output before doing any
checks that might force rendering. This avoids unnecessary rendering.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
4 years agodrm: Reset associated universal plane states when finalizing a crtc
Alexandros Frantzis [Mon, 18 May 2020 12:26:01 +0000 (15:26 +0300)]
drm: Reset associated universal plane states when finalizing a crtc

When dissociating a universal plane from a crtc, we currently don't
reset the current state of the plane (plane->state_cur). When attempting
to use this plane in the future, we can run into invalid memory accesses
due to left over associations with potentially freed drm backend
objects. This commit resets the state of the scanout and cursor
universal planes associated with a crtc.

The following scenario exhibits the problem:

1. Start a (fullscreen) client that is suitable for and assigned to
   the scanout plane. The plane's state_cur->output value is set.
2. Unplug the monitor: the scanout plane is "released" but still
   maintains the state_cur->output association.
3. Replug the monitor: the plane is deemed unavailable due to an
   existing, albeit invalid, state_cur->output value. Note the memory
   errors trying to access the drm_output which was freed at step (2).

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
4 years agodrm: Introduce drm_plane_reset_state() helper function
Alexandros Frantzis [Mon, 18 May 2020 12:22:49 +0000 (15:22 +0300)]
drm: Introduce drm_plane_reset_state() helper function

Introduce a helper function to reset the current state of a drm_plane.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
4 years agoclients: deprecate weston-info
Olivier Fourdan [Mon, 3 Aug 2020 11:53:50 +0000 (13:53 +0200)]
clients: deprecate weston-info

weston-info is now deprecated in favor of wayland-info which is part of
wayland-utils.

Add a note to weston-info to inform users that weston-info is deprecated
and will be removed soon.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
4 years agodesktop-shell: check memory allocation in switcher_binding
ganjing [Tue, 28 Jul 2020 07:28:45 +0000 (15:28 +0800)]
desktop-shell: check memory allocation in switcher_binding

after calling malloc() , be sure to determine whether the allocating for memory space is successful

Signed-off-by: ganjing <ganjing@uniontech.com>
4 years agobuild: bump to version 8.0.92 for the beta release
Simon Ser [Thu, 13 Aug 2020 19:09:40 +0000 (21:09 +0200)]
build: bump to version 8.0.92 for the beta release

4 years agogl-renderer: remove incorrect assertion
Michael Olbrich [Tue, 14 Jul 2020 14:14:50 +0000 (16:14 +0200)]
gl-renderer: remove incorrect assertion

The refcount is not zero if the corresponding buffer is attached to multiple
surfaces.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
4 years agocompositor: ignore views on other outputs during compositor_accumulate_damage()
Michael Olbrich [Tue, 11 Aug 2020 10:42:35 +0000 (12:42 +0200)]
compositor: ignore views on other outputs during compositor_accumulate_damage()

compositor_accumulate_damage() is called for each output during repaint.
The DRM backend will only set keep_buffer for the surfaces that are visible on
the current output. So a buffer_ref is released that may still be needed. When
the output that shows the surface is repainted, the buffer_ref is gone and the
surface cannot be put on a plane.

Ignore all surfaces that are not visible on the current output to avoid this.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
4 years agocompositor: use weston_view_is_opaque() to check for opacity in debug_scene_view_print()
Michael Olbrich [Tue, 11 Aug 2020 14:33:35 +0000 (16:33 +0200)]
compositor: use weston_view_is_opaque() to check for opacity in debug_scene_view_print()

Currently the debug output for 'drm-backend' can be confusing. In the output of
debug_scene_view_print() views may be listed as 'not opaque' but later, during
plane assignment, other views underneath such a view is reported as 'occluded on
our output'.
This happens because weston_view_is_opaque() has some extra checks to determine
if a view is fully opaque, such as 'is_opaque' provided by the renderer for
formats that have no alpha channel.

Use weston_view_is_opaque() in debug_scene_view_print() as well to get more
accurate results.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
4 years agodrm: remove duplicate function declarations
Michael Olbrich [Thu, 6 Aug 2020 08:07:41 +0000 (10:07 +0200)]
drm: remove duplicate function declarations

These functions are all declared twice in the same file. Remove on of the two
declarations.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
4 years agobuild: bump to version 9.0.91 for the alpha release
Simon Ser [Thu, 30 Jul 2020 20:56:04 +0000 (22:56 +0200)]
build: bump to version 9.0.91 for the alpha release

4 years agokiosk-shell: Introduce kiosk/fullscreen shell for desktop apps
Alexandros Frantzis [Tue, 21 Apr 2020 15:23:37 +0000 (18:23 +0300)]
kiosk-shell: Introduce kiosk/fullscreen shell for desktop apps

kiosk-shell is fullscreen shell for apps that use the xdg-shell
protocol. The goal is to make life easier for people shipping embedded
devices with simple fullscreen shell requirements, and reduce the
proliferation of desktop-shell hacks.

Top level surfaces are made fullscreen, whereas dialogs are placed on
top in the center of the output and retain their natural sizes. Dialogs
can be moved and (un)maximized, but resizing is currently not supported.

An app can be directed to a particular output by populating the
"app-ids" field with the app's XDG app id, in the relevant
"[output]" section in the weston config file.

Fixes: #277

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
4 years agodrm-backend: remove log that advertises universal planes support
Leandro Ribeiro [Tue, 28 Jul 2020 14:08:12 +0000 (11:08 -0300)]
drm-backend: remove log that advertises universal planes support

There's a log that advertises support for universal planes. That
can make users think there's something wrong with Weston or their
systems when universal planes are not supported, but that's not
the case. Remove this log from the code.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
4 years agolibweston: Send wl_keyboard.modifiers after wl_keyboard.enter
Kirill Chibisov [Tue, 16 Jun 2020 22:43:57 +0000 (01:43 +0300)]
libweston: Send wl_keyboard.modifiers after wl_keyboard.enter

The core Wayland protocol explicitly states that wl_keyboard.modifiers
must be send after wl_keyboard.enter.

This commit also changes the behavior of `seat_get_keyboard` to not
send `wl_keyboard.modifiers` in case where seat had pointer focus,
but not keyboard one.

Signed-off-by: Kirill Chibisov <contact@kchibisov.com>
4 years agoxwayland/window-manager: add a NULL check to fail when frame_create fails
Jimmy Ohn [Wed, 1 Jul 2020 10:11:52 +0000 (19:11 +0900)]
xwayland/window-manager: add a NULL check to fail when frame_create fails

This adds a NULL check to fail when frame_create fails. This can happen
crash in frame_resize_inside function if frame is NULL.

4 years agoscreen-share: don't get weston_config object before zalloc
Jimmy Ohn [Wed, 1 Jul 2020 09:54:12 +0000 (18:54 +0900)]
screen-share: don't get weston_config object before zalloc

we don't need to get the weston_config object before zalloc success.

4 years agogitlab CI: add support for DRM-backend tests
Leandro Ribeiro [Wed, 3 Jun 2020 13:02:34 +0000 (10:02 -0300)]
gitlab CI: add support for DRM-backend tests

In order to run DRM-backend tests, a DRM-device is needed. As we
do not necessarily have control of the hardware that is going to
run our tests in GitLab CI, DRM-backend tests were being skipped.
This patch add support to run the tests using VKMS (virtual KMS).
To achieve this, virtualization is needed, as we need to run a
custom kernel during the CI job. We've decided to go with virtme,
as it is simpler to setup and works good for our use case.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
4 years agolauncher: do not touch VT/tty while using non-default seat
Leandro Ribeiro [Wed, 3 Jun 2020 13:01:06 +0000 (10:01 -0300)]
launcher: do not touch VT/tty while using non-default seat

Launcher-direct does not allow us to run using a different
seat from the default seat0. This happens because VTs are
only exposed to the default seat, and users that are on
non-default seat should not touch VTs.

Add check in launcher-direct to skip VT/tty management if user
is running on a non-default seat.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
4 years agoshared: fix unused variable warning
Frank Binns [Wed, 24 Jun 2020 10:07:42 +0000 (11:07 +0100)]
shared: fix unused variable warning

Fix the following build warning by moving the 'seals' declaration inside the
HAVE_MEMFD_CREATE guard:

  ../shared/os-compatibility.c: In function â€˜os_ro_anonymous_file_get_fd’:
  ../shared/os-compatibility.c:341:6: warning: unused variable â€˜seals’ [-Wunused-variable]
    int seals, fd;
        ^

Signed-off-by: Frank Binns <frank.binns@imgtec.com>
4 years agodesktop-shell: Avoid retrieving output's width/height if none present
Marius Vlad [Fri, 27 Mar 2020 22:23:14 +0000 (00:23 +0200)]
desktop-shell: Avoid retrieving output's width/height if none present

As in some circumstances there could be no output connected, avoid
retrieving the width/height of the output if none was found/connected.

Fixes: #384

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
4 years agolibweston: don't clean up surface role
James Hilliard [Wed, 10 Jun 2020 20:40:04 +0000 (14:40 -0600)]
libweston: don't clean up surface role

Surface roles are permanent, so it should not be cleaned up.

Fixes: #409
weston: ../libweston/compositor.c:4094: weston_surface_set_role: Assertion `role_name' failed.

Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
4 years agogl-renderer: fix pbuffer surface creation
Tomek Bury [Thu, 4 Jun 2020 13:59:55 +0000 (14:59 +0100)]
gl-renderer: fix pbuffer surface creation

When there's neither configless nor surfaceless EGL extension
(i.e. not a Mesa driver), Weston falls back to a dummy pbuffer surface.

Weston attempts to find for that surface an EGL config but uses a NULL
array of pixel formats. This fails with the following messages:

 EGL_KHR_surfaceless_context unavailable. Trying PbufferSurface
 Found an EGLConfig matching { pbf;  } but it is not usable because
    neither EGL_KHR_no_config_context nor EGL_MESA_configless_context
    are supported by EGL.
 failed to choose EGL config for PbufferSurface
 EGL error state: EGL_SUCCESS (0x3000)
 Failed to initialise the GL renderer;

Signed-off-by: Tomek Bury <tomek.bury@broadcom.com>
4 years agodrm: Fix leak of damage blob id
Scott Anderson [Tue, 2 Jun 2020 05:39:43 +0000 (17:39 +1200)]
drm: Fix leak of damage blob id

This moves the creation of the blob to be earlier, to when the damage is
calculated. It replaces the damage tracked inside of the plane state
with the blob id itself.

This should stop creating new blob ids for TEST_ONLY commits, and them
being leaked in general, as the blob ids are now freed with the plane
state.

The FB_DAMAGE_CLIPS property is now always set if it's supported, and
will be 0 in the case that we have no damage information, which
signifies full damage to the kernel.

Signed-off-by: Scott Anderson <scott.anderson@collabora.com>
4 years agomeson: enable undefined functions errors for colord
Guillaume Champagne [Tue, 2 Jun 2020 02:07:20 +0000 (22:07 -0400)]
meson: enable undefined functions errors for colord

The missing build dependency was added. The override to disable this
check can be removed.

Signed-off-by: Guillaume Champagne <champagne.guillaume.c@gmail.com>
4 years agomeson: add lcms2 dependency to cms-colord
Guillaume Champagne [Tue, 2 Jun 2020 01:59:12 +0000 (21:59 -0400)]
meson: add lcms2 dependency to cms-colord

cms-colord uses cms-helper functions which require lcms2. Therefore,
lcms2 must be added as a build dependency.

Signed-off-by: Guillaume Champagne <champagne.guillaume.c@gmail.com>
4 years agotests: add drm-backend smoke test
Leandro Ribeiro [Wed, 6 May 2020 14:21:54 +0000 (11:21 -0300)]
tests: add drm-backend smoke test

This adds the first DRM-backend test. It is very simple
and was made in order to make easier to add more complex
DRM-backend tests in the future.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
4 years agotests: add support to run drm-backend tests locally
Leandro Ribeiro [Wed, 6 May 2020 14:21:03 +0000 (11:21 -0300)]
tests: add support to run drm-backend tests locally

With this patch we add support to run DRM-backend tests locally
in the test suite. For now this won't work in the CI, as there
are no cards available. But the plan is to achieve this by using
VKMS (virtual KMS) in the future.

To run DRM-backend tests locally, first of all the user has to
set the environment variable WESTON_TEST_SUITE_DRM_DEVICE to
'card0', 'card1' or any other device where he wants to run
the tests. Also, for now it only works if it is run as root,
but in the future this problem will be solved.

The tests will run on a non-default seat. The reason for that
is that we want to avoid opening input devices unnecessarily.
Also, since DRM-backend usage requires gaining DRM master status
on a DRM KMS device, nothing else must be using the device at
the same time. To achieve this we use a lock to run the
DRM-backend tests sequentially.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
4 years agodrm-backend: add --continue-without-input command line option to DRM-backend
Leandro Ribeiro [Wed, 6 May 2020 21:10:19 +0000 (18:10 -0300)]
drm-backend: add --continue-without-input command line option to DRM-backend

In the test suite we may want to run a DRM-backend test on a
non-default seat, which may not have a input device associated.
Weston's default behavior is to not open if input devices are
not found, as it may cause troubles. For instance, Weston can
open but if no input device is set than the user can not
interact or leave it.

Add flag --continue-without-input to DRM-backend so we can run
these types of tests with no input. Notice that this won't force
the compositor to skip opening a input device if it finds it on
the non-default seat.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
4 years agotests: properly select renderer for DRM-backend
Leandro Ribeiro [Tue, 5 May 2020 21:14:25 +0000 (18:14 -0300)]
tests: properly select renderer for DRM-backend

The test suite is dealing only with headless-backend tests.
In order to make it able to run DRM-backend tests, we have
to properly select the renderer that it will use.

This patch add the command line option --use-pixman if the test
defines the DRM-backend renderer as RENDERER_PIXMAN, and it will
add nothing to the command line if it defines RENDERER_GL (the
DRM-backend default renderer is already GL). Also, if the user
defines the DRM-backend renderer as RENDERER_NOOP, the test will
fail (as it should, since DRM-backend does not implement it).

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
4 years agotests: don't use width and height for drm/fbdev backend tests
Leandro Ribeiro [Tue, 5 May 2020 19:09:03 +0000 (16:09 -0300)]
tests: don't use width and height for drm/fbdev backend tests

In the test suite we have some default options which
are command line arguments used by most of the tests.
Two of these are width==320 and height==240. But
when we have DRM or fbdev backends, width and height
are not possible command line arguments. This makes
impossible to run tests that uses one of these types
of backends, as the compositor won't open if the
command line string is wrong.

Fix this by not passing command line arguments width
and height if the backend is DRM or fbdev.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
4 years agocompositor: Quit when failing to open log file
Antonio Caggiano [Thu, 28 May 2020 15:45:57 +0000 (17:45 +0200)]
compositor: Quit when failing to open log file

If users ask explicitly to log to a file, it makes sense to quit
when we fail opening that file. Continuing execution would mean
wasting users' time if they expect to find the log file at the
end of the session.

Signed-off-by: Antonio Caggiano <antonio.caggiano@collabora.com>
Suggested-by: Pekka Paalanen <pekka.paalanen@collabora.com>
4 years agocompositor: Print error opening log file
Antonio Caggiano [Thu, 28 May 2020 14:28:08 +0000 (16:28 +0200)]
compositor: Print error opening log file

When failing to open the log file nothing is reported to the user,
therefore we print a message on stderr when that happens.

Signed-off-by: Antonio Caggiano <antonio.caggiano@collabora.com>
Suggested-by: Pekka Paalanen <pekka.paalanen@collabora.com>
4 years agotimeline: convert vblank timestamp to MONOTONIC
Pekka Paalanen [Thu, 28 May 2020 08:34:04 +0000 (11:34 +0300)]
timeline: convert vblank timestamp to MONOTONIC

All timeline event timestamps are in CLOCK_MONOTONIC already. DRM KMS
timestamps are practically guaranteed to be CLOCK_MONOTONIC too, even though
presentation clock could theoretically be something else. For other backends,
the presentation clock is likely CLOCK_MONOTONIC_RAW due to
weston_compositor_set_presentation_clock_software().

This patch ensures that the recorded vblank timestamp is in CLOCK_MONOTONIC.
Otherwise interpreting the timeline traces might be difficult to do accurately,
since it would be hard to recover the relationship between the presentation
clock and timeline event timestamps.

The time conversion routine is the simplest possible, I don't think we need any
more accurate conversion for timeline purposes. Besides, DRM-backend is the
only backend where the timings actually matter, the other backends are
software-timed anyway.

Since the clock domain of the "vblank" attribute potentially changes, the
attribute is renamed. Wesgr never used this attribute.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
4 years agogl-renderer: query EGL to determine if GL_TEXTURE_EXTERNAL_OES should be used
Michael Olbrich [Wed, 27 Nov 2019 13:11:05 +0000 (14:11 +0100)]
gl-renderer: query EGL to determine if GL_TEXTURE_EXTERNAL_OES should be used

Using the number of planes to determine if GL_TEXTURE_EXTERNAL_OES should be
used is incorrect with some modifiers: For example RGBA with a
I915_FORMAT_MOD_Y_TILED_CCS modifier has two planes.

Use eglQueryDmaBufModifiersEXT() to query if the current format/modifier only
supports GL_TEXTURE_EXTERNAL_OES.

Use the current code as fallback of modifiers are not supported.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
4 years agoxdg-shell: Allow fullscreen surfaces to not cover the whole screen
Alexandros Frantzis [Wed, 13 May 2020 13:33:03 +0000 (16:33 +0300)]
xdg-shell: Allow fullscreen surfaces to not cover the whole screen

The wording of the xdg-shell protocol allows surfaces to not cover the
whole screen when they are made fullscreen. From the description of the
fullscreen state in xdg-shell:

  The window geometry specified in the configure event is a maximum; the
  client cannot resize beyond it. For a surface to cover the whole
  fullscreened area, the geometry dimensions must be obeyed by the
  client.

The last sentence is the condition for fullscreen coverage, not a
requirement.

This commit updates the code to not flag size mismatches for fullscreen
surfaces as a protocol error when the surface fits within the screen. In
such cases, the shell is responsible for centering surfaces
appropriately and also for obscuring other screen content as described
in the xdg_toplevel.set_fullscreen request description (and, indeed,
desktop-shell does all this).

For reference, contrast with the corresponding, stricter wording in the
obsolete xdg-shell-unstable-v6 protocol for the fullscreen state:

  The window geometry specified in the configure event must be obeyed by
  the client.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
4 years agolibweston: replace 0 with the enum value for the xkb init flags
Peter Hutterer [Wed, 13 May 2020 05:24:27 +0000 (15:24 +1000)]
libweston: replace 0 with the enum value for the xkb init flags

No functional changes, this is cosmetics only.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
4 years agoset SURFACE_BITS_COMMAND cmdType explicitly
Ken C [Sat, 11 Apr 2020 22:05:59 +0000 (15:05 -0700)]
set SURFACE_BITS_COMMAND cmdType explicitly

4 years agogitlab CI: update to recent fdo ci-templates
Peter Hutterer [Thu, 7 May 2020 21:33:57 +0000 (07:33 +1000)]
gitlab CI: update to recent fdo ci-templates

Make use of the templating structure the templates provide. No
functional changes in the end, container-build's default behavior is the
previously called container-if-not-exists template.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
4 years agogitlab ci: switch to freedesktop ci-templates
Peter Hutterer [Thu, 7 May 2020 21:25:48 +0000 (07:25 +1000)]
gitlab ci: switch to freedesktop ci-templates

The project was moved a while ago to make it look less waylandy. Same
sha, so no actual changes here.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
4 years agocompositor: fix endless recursion in scene-graph printing
Michael Olbrich [Wed, 29 Apr 2020 07:03:15 +0000 (09:03 +0200)]
compositor: fix endless recursion in scene-graph printing

If a surface has subsurfaces then the surface itself is in the subsurface
list. To avoid printing it again there is a check to skip the child view,
if it is the same as the current view.

However, this fails when a surface with subsurfaces has two (or more) views:
The check to skip the parent fails for the other view and the two views are
printed again and again until a stack overflow occurs.

So instead check if the parent view of the subsurface view is the current
view. This way, any view that does not belong to a real subsurface is
skipped.

As a side effect, this ensures that each view of the subsurfaces is only
printed once at the correct place in the hierarchy.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
4 years agoman/weston-drm: Use third person singular conjugation
Paul Menzel [Sun, 5 Apr 2020 20:19:49 +0000 (22:19 +0200)]
man/weston-drm: Use third person singular conjugation

Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>
4 years agodrm: change timing to set color format for primary plane without universal plane
Tomohito Esaki [Mon, 30 Mar 2020 08:10:54 +0000 (17:10 +0900)]
drm: change timing to set color format for primary plane without universal plane

Without universal plane, the weston crashes with null pointer access in
set_gbm_format function because that function called before output
enable function. By changing timing to set color format for primary
plane in this case, this issue fixes.

Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
4 years agopixman-renderer: Replace output-create flags with struct
Daniel Stone [Fri, 6 Mar 2020 12:46:30 +0000 (12:46 +0000)]
pixman-renderer: Replace output-create flags with struct

pixman_renderer_output_create currently takes a flags enum bitmask for
its options. Switch this to using a structure, so we can introduce other
non-boolean options.

Signed-off-by: Daniel Stone <daniels@collabora.com>
4 years agogl-renderer: Replace pbuffer-create args with struct
Daniel Stone [Fri, 6 Mar 2020 13:04:18 +0000 (13:04 +0000)]
gl-renderer: Replace pbuffer-create args with struct

gl_rendererer's output_pbuffer_create has a lot of arguments now. Add a
structure for the options to make it more clear what is what.
This is in preparation for adding bare-integer arguments which are ripe
for confusion when passing positional arguments.

Signed-off-by: Daniel Stone <daniels@collabora.com>
4 years agogl-renderer: Replace window-create args with struct
Daniel Stone [Fri, 6 Mar 2020 13:04:18 +0000 (13:04 +0000)]
gl-renderer: Replace window-create args with struct

gl_rendererer's output_window_create has a lot of arguments now. Add a
structure for the options to make it more clear what is what.
This is in preparation for adding bare-integer arguments which are ripe
for confusion when passing positional arguments.

Signed-off-by: Daniel Stone <daniels@collabora.com>
4 years agogl-renderer: Replace display-create args with struct
Daniel Stone [Fri, 6 Mar 2020 13:04:18 +0000 (13:04 +0000)]
gl-renderer: Replace display-create args with struct

gl_rendererer's output_create has a lot of arguments now. Add a
structure for the options to make it more clear what is what.
This is in preparation for adding bare-integer arguments which are ripe
for confusion when passing positional arguments.

Signed-off-by: Daniel Stone <daniels@collabora.com>
4 years agodrm: Get renderer buffer size from drm_fb
Daniel Stone [Fri, 6 Mar 2020 11:07:15 +0000 (11:07 +0000)]
drm: Get renderer buffer size from drm_fb

The renderer buffer size is usually the same size as the current mode,
so we were taking the dimensions from the currently-set mode. However,
using current_mode is quite confusing in places when it comes to scale,
and it also hampers our ability to do mode switches, as well as to
introduce a future option which will let the renderer use a smaller
buffer than the output and display scaled.

Simply take the dimensions of the renderer's output buffer from the
buffer itself.

Signed-off-by: Daniel Stone <daniels@collabora.com>
4 years agodrm: Remove unnecessary condition in drm_output_render reuse
Daniel Stone [Fri, 6 Mar 2020 11:03:14 +0000 (11:03 +0000)]
drm: Remove unnecessary condition in drm_output_render reuse

This condition inside drm_output_render() checks if we can reuse the
existing renderer buffer for the primary plane; this occurs in
mixed-mode composition where a client buffer promoted to a plane has
changed, but the primary plane is unchanged.

We accomplish this by checking if there is no damage on the
primary/renderer plane, and then if there is already a renderer buffer
active on the primary plane: in that case, we can reuse the buffer we
already have.

There was a further condition checking if the width and height were
identical. This was designed to prevent against issues on mode changes.
However, runtime mode changes are already quite broken, and a mode
change will also cause damage on the full plane. We can simply remove
this condition.

Signed-off-by: Daniel Stone <daniels@collabora.com>
4 years agodrm: Remove trailing whitespace
Daniel Stone [Fri, 6 Mar 2020 11:03:01 +0000 (11:03 +0000)]
drm: Remove trailing whitespace

Signed-off-by: Daniel Stone <daniels@collabora.com>
4 years agox11: Remove unnecessary NULL checks
Daniel Stone [Fri, 6 Mar 2020 13:11:41 +0000 (13:11 +0000)]
x11: Remove unnecessary NULL checks

Output and mode can never be NULL.

Signed-off-by: Daniel Stone <daniels@collabora.com>
4 years agoxdg-shell: More helpful surface-state-mismatch error
Daniel Stone [Fri, 20 Mar 2020 14:50:52 +0000 (14:50 +0000)]
xdg-shell: More helpful surface-state-mismatch error

When libweston-desktop kills an xdg-shell client because it has failed
to configure its surface as demanded, be more helpful by explaining
exactly what the error is.

Signed-off-by: Daniel Stone <daniels@collabora.com>
4 years agowayland-backend: Fully damage initial SHM buffer
Daniel Stone [Tue, 17 Mar 2020 21:52:28 +0000 (21:52 +0000)]
wayland-backend: Fully damage initial SHM buffer

In order to start the repaint loop, the Wayland backend tries to damage
the full SHM buffer, but doesn't actually damage the full area if we
have a frame.

Store the buffer's width and height alongside the buffer itself, so we
can damage the full area when required.

Signed-off-by: Daniel Stone <daniels@collabora.com>
4 years agotests: add viewport test for repeat mode
Pekka Paalanen [Wed, 11 Mar 2020 15:43:44 +0000 (17:43 +0200)]
tests: add viewport test for repeat mode

This test ensures that
"pixman-renderer: half-fix bilinear sampling on edges"
keeps on working.

Unlike in the original report
https://gitlab.freedesktop.org/wayland/weston/issues/373, here we use buffer
scale 2 instead of output scale 2 to trigger bilinear filter. The effect is the
same, the actual resulting image in the failing case is just a little
different. This is so that it will be easy to add more viewport screenshooting
tests in this program in the future.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
4 years agotests: move fill_color into helpers
Pekka Paalanen [Wed, 11 Mar 2020 15:24:47 +0000 (17:24 +0200)]
tests: move fill_color into helpers

There will be a new test program that wants to share this code.

No behavioral changes.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
4 years agotests: move viewport creation into helpers
Pekka Paalanen [Wed, 11 Mar 2020 15:11:03 +0000 (17:11 +0200)]
tests: move viewport creation into helpers

There will be a new test program using viewports and would like to share this
bit of code.

There are two behavioral changes:
- Compositor wp_viewporter interface version is no longer checked.
- client_create_viewport() does not leak the viewporter object.

test_viewporter_double_create needs to call bind_to_singleton_global() itself
so that the viewporter object still exists when the error event arrives.
Otherwise error verification fails.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
4 years agopixman-renderer: half-fix bilinear sampling on edges
Pekka Paalanen [Wed, 11 Mar 2020 13:21:04 +0000 (15:21 +0200)]
pixman-renderer: half-fix bilinear sampling on edges

When weston-desktop-shell uses a solid color for the wallpaper, it creates a
1x1 buffer and uses wp_viewport to scale that up to fullscreen. It's a very
nice memory saving optimization.

If you also have output scale != buffer scale, it means pixman-renderer chooses
bilinear filter. Arguably pixman-renderer should choose bilinear filter also
when wp_viewport implies scaling, but it does not. As w-d-s always sets buffer
scale from output scale, triggering the bilinear filter needs some effort.

What happens when you sample with bilinear filter from a 1x1 buffer, stretching
it to cover a big area? Depends on the repeat mode. The default repeat mode is
NONE, which means that samples outside of the buffer come out as (0,0,0,0).
Bilinear filter makes it so that every sampling point on the 1x1 buffer except
the very center is actually a mixture of the pixel value and (0,0,0,0). The
resulting color is no longer opaque, but the renderer and damage tracking
assume it is. This leads to the issue 373.

Fix half of the issue by using repeat mode PAD which corresponds to OpenGL
CLAMP_TO_EDGE. GL-renderer already uses CLAMP_TO_EDGE always.

This is only a half-fix, because composite_clipped() cannot actually be fixed.
It relies on repeat mode NONE to work. It would need a whole different approach
to rendering potentially non-axis-aligned regions exactly like GL-renderer.

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

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
4 years agocompositor: Fail on invalid transform for headless
Daniel Stone [Mon, 9 Mar 2020 16:26:34 +0000 (16:26 +0000)]
compositor: Fail on invalid transform for headless

As in aaf35586f471, we want to fail when we are passed an invalid
transform name, not just blindly configure on using the normal
transform. The previous commit missed the callsite from the headless
backend's command-line parsing.

Fix this so that headless fails when an invalid transform is specified
on the command line.

Signed-off-by: Daniel Stone <daniels@collabora.com>
4 years agotests: print image difference statistics
Pekka Paalanen [Thu, 5 Mar 2020 14:11:33 +0000 (16:11 +0200)]
tests: print image difference statistics

When a test fails and it produces a difference image, also compute the min/max
per-channel signed difference statistics. These numbers can be used to adjust
the fuzz needed for fuzzy_match_pixels() to pass. Otherwise one would have to
manually inspect the reference and result images and figure out the values.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
4 years agocompositor: Use weston_head transform for output default
Daniel Stone [Mon, 25 Nov 2019 23:41:04 +0000 (23:41 +0000)]
compositor: Use weston_head transform for output default

If the output only has a single weston_head attached to it, take its
declared transform as the default transform.

With the previous patches, this allows a device declaring the KMS 'panel
orientation' property (e.g. through DeviceTree) to autoconfigure to the
correct display rotation when running Weston.

Signed-off-by: Daniel Stone <daniels@collabora.com>
4 years agobackend-drm: Parse KMS panel orientation property, apply to weston_head
Lucas Stach [Mon, 25 Nov 2019 23:31:57 +0000 (23:31 +0000)]
backend-drm: Parse KMS panel orientation property, apply to weston_head

The KMS 'panel orientation' property allows the driver to statically
declare a fixed rotation of an output device. Now that weston_head has a
transform member, plumb the KMS property through to weston_head so the
compositor can make a smarter choice out of the box.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
[daniels: Extracted from one of Lucas's patches]
Signed-off-by: Daniel Stone <daniels@collabora.com>
4 years agolibweston: Add transform to weston_head
Lucas Stach [Mon, 25 Nov 2019 23:29:31 +0000 (23:29 +0000)]
libweston: Add transform to weston_head

Like physical size, subpixel arrangement, etc, transform advises of a
physical transform of a head, if present.

This commit adds the transform member and setter to weston_head, however
it is currently unused.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
[daniels: Extracted from one of Lucas's patches.]
Signed-off-by: Daniel Stone <daniels@collabora.com>
4 years agocompositor: Fail output configuration on invalid transform
Daniel Stone [Fri, 6 Mar 2020 21:45:50 +0000 (21:45 +0000)]
compositor: Fail output configuration on invalid transform

If an invalid transformation is provided for an output, fail the output
configuration rather than continuing on using whatever we chose as the
default transform.

After !383, this will result in configurations using the old definition
failing and exiting, rather than continuing on the wrong way around.

Signed-off-by: Daniel Stone <daniels@collabora.com>
4 years agocompositor: Fix default transforms when output section declared
Daniel Stone [Mon, 25 Nov 2019 23:35:36 +0000 (23:35 +0000)]
compositor: Fix default transforms when output section declared

Regardless of the default transform passed in, weston_parse_transform
would always return 'normal' if there was an output section. This is
because, if a section was declared for that output, it would ask
weston_config for the transform, with the default being 'normal'.

Fix it so we return the passed-in default transform when we have a
matching output section without a transform key. If the transform is
declared but invalid, we can remove the line resetting to the default
transform, because we've already set the default transform up top.

Signed-off-by: Daniel Stone <daniels@collabora.com>
4 years agobackend-rdp: enable undefined functions errors.
Guillaume Champagne [Mon, 10 Feb 2020 16:35:21 +0000 (11:35 -0500)]
backend-rdp: enable undefined functions errors.

b_lundef was overriden for the RDP backend since it triggered linking
errors due to functions that were defined in a missing dependency. This
issue was fixed, so the override is removed. The global project's
linker parameters are now applied to the RDP backend.

Signed-off-by: Guillaume Champagne <champagne.guillaume.c@gmail.com>
4 years agobackend-rdp: fix unresolved symbols errors
Guillaume Champagne [Mon, 10 Feb 2020 16:34:25 +0000 (11:34 -0500)]
backend-rdp: fix unresolved symbols errors

The RDP backend uses functions defined by the Windows Portable Runtime
library (WinPR). The library's code is contained within FreeRDP
repository, but it is packaged as its own library (seperate pkg-config
file).

WinPR is added as a dependency to the RDP backend. The version 2.0 is
choosen as the version to on since the backend depends on FreeRDP 2.0.

Signed-off-by: Guillaume Champagne <champagne.guillaume.c@gmail.com>
4 years agotests: add buffer transform tests
Pekka Paalanen [Thu, 27 Feb 2020 15:04:45 +0000 (17:04 +0200)]
tests: add buffer transform tests

This patch continues the buffer and output transforms testing by iterating
through a representative selection of buffer transforms and scales.

For more details, see the previous patch "tests: add output transform tests".

https://gitlab.freedesktop.org/wayland/weston/issues/52

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
4 years agotests: add output transform tests
Pekka Paalanen [Tue, 21 Jan 2020 10:00:28 +0000 (12:00 +0200)]
tests: add output transform tests

This goes through all output transforms with two different buffer transforms
and verifies the visual output against reference images.

This commit introduces a new test input image 'basic-test-card.png'. It is a
small image with deliberately odd and indivisible dimensions to provoke bad
assumptions about image sizes. It contains red, green and blue areas which are
actually text that makes it very obvious if you have e.g. color channels
swapped. It has a white thick circle to highlight aspect ratio issues, and an
orange cross to show a mixed color. The white border is for contrast and a 1px
wide detail. The whole design makes it clear if the image happens to be rotated
or flipped in any way.

The image has one pixel wide transparent border so that bilinear sampling
filter near the edges of the image would produce the same colors with both
Pixman- and GL-renderers which handle the out-of-image samples fundamentally
differently: Pixman assumes (0, 0, 0, 0) samples outside of the image, while
GL-renderer clamps sample coordinates to the edge essentially repeating the
edge pixels.

It would have been "easy" to create a full matrix of
every output scale & transform x every buffer scale & transform, but that
would have resulted in 2 renderers * 8 output transforms * 3 output scales *
8 buffer transforms * 3 buffer scales = 1152 test cases that would have all
ran strictly serially because our test harness has no parallelism inside one
test program. That would have been slow to run, and need a lot more reference
images too.

Instead, I chose to iterate separately through all output scales & transforms
(this patch) and all buffer scales & transforms (next patch). This limits the
number of test cases in this patch to 56, and allows the two test programs to
run in parallel.

I did not even pick all possible scale & transform combinations here, but just
what I think is a representative sub-set to hopefully exercise all the code
paths.

https://gitlab.freedesktop.org/wayland/weston/issues/52

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
4 years agotests: expand allowed pixel fuzz for GL
Pekka Paalanen [Wed, 19 Feb 2020 14:18:22 +0000 (16:18 +0200)]
tests: expand allowed pixel fuzz for GL

Running with Mesa 20.1.0-devel (git-c7617d8908) GL renderer:
Radeon RX 550 Series (POLARIS11, DRM 3.27.0, 4.19.0-2-amd64, LLVM 8.0.1)

I found output-tranform test (a future patch) to produce exactly this much more
difference between Pixman and GL rendererers.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
4 years agotests: implement client_destroy()
Pekka Paalanen [Fri, 24 Jan 2020 11:14:27 +0000 (13:14 +0200)]
tests: implement client_destroy()

It turns out that if the client is not explicitly destroyed, it will remain
connected until the compositor shuts down because there is no more a client
process that would terminate.

Usually this is not a problem, but if a test file has multiple screenshooting
tests, the windows from earlier tests in the file will remain on screen. That
is not wanted, hence implement client destruction.

To properly destroy a client, we also need a list of outputs. They used to be
simply leaked. This does not fix wl_registry.global_remove for wl_outputs, that
is left for a time when a test will actually need that.

This patch makes only ivi-shell-app test use the new client_destroy() to show
that it actually works. The added log scopes prove it: destroy requests get
sent. Sprinkling client_destroy() around in all other tests is left for a time
when it is actually necessary.

ivi-shell-app is a nicely simple test doing little else, hence I picked it.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
4 years agotests: re-order test naming pattern
Pekka Paalanen [Wed, 26 Feb 2020 11:04:48 +0000 (13:04 +0200)]
tests: re-order test naming pattern

The string from get_test_name() can be used for writing screenshot files and
others. Starting the name with the fixture number makes an alphabetized listing
of output files look unorganized.

Let's change the test name to begin with the test (source) name with fixture
and element numbers as suffixes. That makes a file listing easier to look
through, when you have multiple tests each saving multiple screenshot files.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
4 years agotests: add get_test_fixture_index()
Pekka Paalanen [Wed, 22 Jan 2020 11:37:20 +0000 (13:37 +0200)]
tests: add get_test_fixture_index()

A future test wants to access the fixture data array for the currently running
fixture index to log the test description. This patch provides access to the
array index.

Rather than adding more gloabl variables, I changed the type of the existing
one which feels slightly cleaner.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
4 years agotests: add scale and transform compositor options
Pekka Paalanen [Wed, 22 Jan 2020 09:53:12 +0000 (11:53 +0200)]
tests: add scale and transform compositor options

With these, a test can initialize the headless-backend with non-default scale
and transform which allows testing output scales and transforms.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
4 years agocompositor: add scale cmdline option for headless
Pekka Paalanen [Wed, 22 Jan 2020 09:33:34 +0000 (11:33 +0200)]
compositor: add scale cmdline option for headless

The test suite wants to start using different output scales, and this is the
easiest API to configure it.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
4 years agotests: allow verify_screen_content() w/o ref image
Pekka Paalanen [Wed, 22 Jan 2020 12:20:46 +0000 (14:20 +0200)]
tests: allow verify_screen_content() w/o ref image

Allow the reference image to be NULL or missing so that it does not even
attempt to load a reference image or compare it. You cannot just point the
reference image to an arbitrary image because the comparison functions can
abort due to size mismatch. This makes bootstrapping new tests easier when you
do not yet have a reference image.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
4 years agotests: rename check_screen() to verify_screen_content() + doc
Pekka Paalanen [Tue, 21 Jan 2020 13:37:14 +0000 (15:37 +0200)]
tests: rename check_screen() to verify_screen_content() + doc

The old name felt too... short.

The return type is changed to bool; fits better for a success/failure.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
4 years agotests: move check_screen() into client helpers
Pekka Paalanen [Wed, 22 Jan 2020 14:34:01 +0000 (16:34 +0200)]
tests: move check_screen() into client helpers

This will be useful in more tests.

No changes to the code, aside from dropping one 'static'.

Copyright 2017 is taken from git-blame of the moved code.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
4 years agoRedefine output rotations
Pekka Paalanen [Thu, 6 Feb 2020 13:27:54 +0000 (15:27 +0200)]
Redefine output rotations

It was discovered in issue #99 that the implementations of the 90 and 270
degree rotations were actually the inverse of what the Wayland specification
spelled out. This patch fixes the libweston implementation to follow the
specification.

As a result, the behaviour of the the weston.ini transform key also changes. To
force all users to re-think their configuration, the transform key values are
also changed. Since Weston and libweston change their behaviour, the handling
of clients' buffer transform changes too.

All the functions had their 90/270 cases simply swapped, probably due to
confusion of whether WL_OUTPUT_TRANSFORM_* refers to rotating the monitor or
the content.

Hint: a key to understanding weston_matrix_rotate_xy(m, c, s) is that the
rotation matrix is formed as

  c -s
  s  c

that is, it's column-major. This fooled me at first.

Fixing window.c fixes weston-terminal and weston-transformed.

In simple-damage, window_get_transformed_ball() is fixed to follow the proper
transform definitions, but the fix to the viewport path in redraw() is purely
mechanical.  The viewport path looks broken to me in the presence of any
transform, but it is not this patch's job to fix it.

Screen-share fix just repeats the general code fix pattern, I did not even try
to understand that bit.

https://gitlab.freedesktop.org/wayland/weston/issues/99

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
4 years agolibweston: document weston_transformed_*()
Pekka Paalanen [Fri, 14 Feb 2020 12:50:03 +0000 (14:50 +0200)]
libweston: document weston_transformed_*()

Clarifies which direction the transformation happens. All exported function
need documentation.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
4 years agoclients: transformed does not recognize -d
Pekka Paalanen [Fri, 14 Feb 2020 12:20:05 +0000 (14:20 +0200)]
clients: transformed does not recognize -d

It has no such command line option.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>