Commit graph

7679 commits

Author SHA1 Message Date
Sebastian Krzyszkowiak ce2fa93a6e
xdg-shell: Rephrase the "geometry larger than fullscreen state" error
It's the geometry size that gets checked, not the buffer size.

Signed-off-by: Sebastian Krzyszkowiak <sebastian.krzyszkowiak@puri.sm>
2021-08-02 13:31:20 +02:00
Marius Vlad 2ab08d8698 libweston/data-device: Don't crash when doing dnd operations w/o a keyboard
pointer/touch drag-n-drop operations could happen if there's no keyboard
hooked up or when it is unplugged.

Fixes: #235

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2021-07-31 17:19:15 +00:00
Jonas Ådahl 10c072b3f5 ci: Use ci-fairy to check for Signed-off-by
[daniels: Only run on MRs.]

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2021-07-31 16:28:22 +00:00
Daniel Stone 0bef636b04 ci: Switch to using new rules syntax
The rules syntax is more clear and explicit than the previous
only/except. Switch to using that.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2021-07-31 16:28:22 +00:00
Jonas Ådahl 4fc87f8316 ci: Update ci-templates to newer version
[daniels: Extracted from previous patch, updated to even-newer version.]

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2021-07-31 16:28:22 +00:00
Nicholas Niro a11bc63ddd clients/desktop-shell: Add 24H support to the clock format. 2021-07-31 15:53:56 +00:00
James Hilliard d6dcd9bcd9 Update gitlab-ci pipewire to version 0.3.31
Updating PipeWire to the latest version lets us check that everything
still works well, and shows users that they are able to use it.

[daniels: Updated to 0.3.31, use symbolic ref tags rather than SHAs.
          0.3.32 is released, but doesn't build in our Debian
          environment; this is fixed upstream but there is no release
	  for it yet.]

Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
2021-07-31 15:49:09 +00:00
Jonas Ådahl a76d2053d0 xdg-shell: Add support for popup repositioning
This adds support for xdg-shell v3, which adds support for repositioning
popups. This adds support for explicit popup repositioning, as weston
doesn't yet apply any constraining to popups, thus cannot implicitly
reposition.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Tested-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
2021-07-31 15:34:05 +00:00
Emmanuel Gil Peyrot eff793ab46 Fix indentation all through the project
Fixes a “regression” from 04918f3b0b, but
also other missed pieces.
2021-07-31 15:28:20 +00:00
Link Mauve 48cd15ed44 renderer-gl: Allocate buffer on the stack
This avoids an extra heap allocation for each view.
2021-07-31 17:08:59 +02:00
Erik Kurzinger 04918f3b0b desktop-shell: don't run fade animation if compositor is inactive
When a window is closed, Weston will, by default, run a fade out animation and
defer destroying the underlying surface until it completes. However, if the
compositor is sleeping, and therefore not rendering any frames, this animation
will *never* complete. Therefore, if windows are repeatedly created and
destroyed while in sleep mode, these surfaces will keep accumulating, and since
the buffers attached to them may be backed by an fd, eventually the ulimit will
be reached resulting in a potential crash or other errors.

This can be demonstrated repeatedly launching and killing an X11 application
with Xwayland running.

while true; do xterm & pid=$!; sleep 0.5; kill $pid; done

As soon as the compositor goes to sleep, one can observe a steadily growing
list of dmabufs in the output of lsof.

As a fix, desktop_surface_removed should check whether the compositor is active
before kicking off the fade animation. If it is not, it should instead drop the
extra reference taken in desktop_surface_committed and then destroy the surface
immediately.

Signed-off-by: Erik Kurzinger <ekurzinger@nvidia.com>
2021-07-31 13:47:45 +00:00
Marius Vlad eb34f827dd input: Handle correctly failure to compile XKB keymaps
And ultimately, fail to start when there are no input devices on the
system. Patchs adds consistency to touch/pointer initialization to
return -1 in case same thing happens.

Further more, when the device is not created we can't assume to retrieve
a valid one from a libinput_device so guard against it. This takes care of
hot-plugging situations when we couldn't create the (keyboard) device,
or when removing it.

Fixes: #117, #402, #485

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Suggested-by: Daniel Stone <daniel.stone@collabora.com>
2021-07-31 13:44:47 +00:00
Derek Foreman 74bdb35c85 drm: Ignore timestamp for monitor shut-off
Some graphics drivers (currently at least VMware and AMD) will give a 0
timestamp for the atomic mode flip completion event when turning off
the display. This causes us to trip an assertion in
weston_output_frame_finish() because the clock jumps backwards, which
isn't a condition the presentation feedback code should be dealing with.

This is a good assertion and we'd like to keep it. And there's some
expectation that this is buggy behaviour in the graphics drivers that will
be fixed at some point.

Pragmatically speaking though, there's nothing productive we can do with a
correct timestamp for the display shutdown.  So let's just flag the
event sent for DPMS off as invalid so presentation feedback doesn't have
to worry about it, and the assert doesn't fire.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2021-07-31 13:39:27 +00:00
Vlad Zahorodnii c2b9747812 libweston/compositor: Drop weston_frame_callback
weston_frame_callback is needed primarily to store the doubly-linked list link,
but it can be also retrieved by using the wl_resource_get_link() function.

This removes an extra heap allocation per every wl_callback object.

Signed-off-by: Vlad Zahorodnii <vlad.zahorodnii@kde.org>
2021-07-29 15:33:19 +03:00
Marius Vlad 25296db20a gitlab-ci.yml: Use same container source as the docs
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2021-07-28 21:42:52 +03:00
Derek Foreman f09710bd25 ci: Fix pull rate limit errors
Pull the container from a source without a rate limit

Suggested by Daniel Stone <daniels@collabora.com>

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2021-07-28 10:55:48 -05:00
John Good f33ddd0839 Allow programmatically closing xwayland window 2021-07-23 19:40:00 +00:00
Simon Ser b46d0e3304 tests/roles: switch to xdg-shell
Stop using wl_shell for the roles tests, since it'll get disabled
and removed eventually.

Signed-off-by: Simon Ser <contact@emersion.fr>
2021-07-23 17:26:02 +01:00
Simon Ser 413d210422 libweston-desktop: introduce a deprecated-wl-shell option
This is the first step towards removing wl_shell support.

Add an option so that users can toggle support for the deprecated
wl_shell protocol. This lets users test their clients to make sure
they work fine without wl_shell.

The option is set to false by default.

Signed-off-by: Simon Ser <contact@emersion.fr>
2021-07-23 17:22:22 +01:00
Daniel Stone 80e9482292 xdg-shell: Fail xdg_surface creation when surface has role
If a given wl_surface already has a role (e.g. cursor or subsurface),
there is nothing you can do with an xdg_surface which won't raise an
error, apart from destroying it.

As of wayland/wayland-protocols@11fecf0808 this is now explicitly
specified to be illegal, so disallow it within libweston-desktop. This
avoids us tying ourselves in knots with surface-private ownership.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2021-07-23 17:17:16 +01:00
Daniel Stone baa8f6b1af xdg-shell: Move check for surface having buffer earlier
It's illegal to create an xdg_surface for a surface which already has a
buffer attached to it. We check for this, but only after we've created
our weston_desktop_surface; this simply avoids creating the internal
tracking structure when we're only going to destroy it after posting the
error.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2021-07-23 16:11:31 +00:00
Marius Vlad 6f6fd2686d pixel-formats: Add human readable format modifier
Conditionally build support when libdrm is at least 2.4.107 to make use
of it.  Plug it in when printing out the buffer information.

With this in, we add a hard dependecy for libweston to link against
libdrm.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2021-07-22 22:19:17 +00:00
Pekka Paalanen bc3c37840c shared: add str_printf()
asprintf() has the problem that it leaves *strp undefined when it
fails. Here is a simple wrapper that ensures NULL if asprintf() fails,
which is much more convenient to use.

This will be useful in future patches, where one needs to return error
messages from maybe failing functions, and more.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-07-22 22:19:17 +00:00
Marius Vlad 63fc73d1cc gl-renderer: Assume num images the same as the no of planes
Potential failures when creating the EGL image could cause an incorrect
number of num images (num_planes > num_images). With this change
egl_image_unref() requires an additional check to avoid any potential NULL
derefs when cleaning up. We do it straight in egl_image_unref() instead
of adding guards all over the necessary parts.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2021-07-22 11:33:22 +03:00
Marius Vlad 2a6ea687ba gl-renderer: Avoid destroying an egl image if known import failed
As observed on some platforms, importing known DMA buffers can cause
failures, leading to an attempt of destroyng an EGL image not set. This patch
resets the num_images such that loop becomes inert when destroying the
DMA buffer, and avoids passing an egl image to it.

The initial import doesn't have this issue as it sets the num_images in
case it succeeds.  This also corrects the assumption that the num_images
were 0 at that point which, if the initial import succeded, was actually set
to 1.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2021-07-19 13:56:27 +03:00
Chen Qi 2f2e5da4c3 backend-wayland: fix incorrect header
The wayland.c actually include 'xdg-shell-client-protocol.h' instead of
the server one, so fix it. Otherwise, it's possible to get build failure
due to race condition.

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Daniel Stone <daniels@collabora.com>
[daniels: Found in OpenEmbedded/Yocto source.]
2021-07-13 18:26:38 +01:00
Alvarito050506 60855b1569 compositor: Added autolaunch support.
The value of the `path` parameter is executed right before
wl_display_run.

The `watch` parameter is meant for things like tests using
the headless backend and the kiosk shell.

Fixes https://gitlab.freedesktop.org/wayland/weston/-/issues/171

Signed-off-by: Alvarito050506 <donfrutosgomez@gmail.com>
2021-07-06 18:46:09 +00:00
Alvarito050506 1f57a1f998 compositor: Move child_process_list from global to wet_compositor.
Removes a global variable and makes it easier to avoid adding more
global variables in the next commit.

See https://gitlab.freedesktop.org/wayland/weston/-/merge_requests/652#note_975222

Signed-off-by: Alvarito050506 <donfrutosgomez@gmail.com>
2021-07-06 18:46:09 +00:00
Alvarito050506 7ae8a89a8b gitignore: Ignore the build/ directory.
Do this because the README uses it to demonstrate the build process.

Signed-off-by: Alvarito050506 <donfrutosgomez@gmail.com>
2021-07-06 18:46:09 +00:00
Pekka Paalanen 365bc163c2 doc: fix doxygen warnings
warning: Tag 'TCL_SUBST' at line 250 of file '/home/pq/build/weston-meson/doc/sphinx/doxygen.ini' has become obsolete.
         To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
warning: Tag 'COLS_IN_ALPHA_INDEX' at line 1094 of file '/home/pq/build/weston-meson/doc/sphinx/doxygen.ini' has become obsolete.
         To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
warning: Tag 'PERL_PATH' at line 2159 of file '/home/pq/build/weston-meson/doc/sphinx/doxygen.ini' has become obsolete.
         To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
warning: Tag 'MSCGEN_PATH' at line 2181 of file '/home/pq/build/weston-meson/doc/sphinx/doxygen.ini' has become obsolete.
         To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"

Observed with Doxygen 1.9.1 in Debian Bullseye.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-07-02 16:50:35 +03:00
Marius Vlad 7a44ee7f37 backend-drm: Clean-up minor leak when destroying the DRM-backend
Fixes a minor leak due to launcher-libseatd:

Direct leak of 32 byte(s) in 1 object(s) allocated from:
    #0 0x7f15664e5037 in calloc (/usr/lib/x86_64-linux-gnu/libasan.so.6+0xaa037)
    #1 0x7f156305c59f in zalloc ../include/libweston/zalloc.h:38
    #2 0x7f156305c99b in seat_open_device ../libweston/launcher-libseat.c:114
    #3 0x7f1563056341 in weston_launcher_open ../libweston/launcher-util.c:79
    #4 0x7f156302f1e2 in drm_device_is_kms ../libweston/backend-drm/drm.c:2616
    #5 0x7f156302f751 in find_primary_gpu ../libweston/backend-drm/drm.c:2715
    #6 0x7f15630309a5 in drm_backend_create ../libweston/backend-drm/drm.c:2970
    #7 0x7f15630317ab in weston_backend_init ../libweston/backend-drm/drm.c:3162
    #8 0x7f1566025b61 in weston_compositor_load_backend ../libweston/compositor.c:8201
    #9 0x7f156640cb9e in load_drm_backend ../compositor/main.c:2596
    #10 0x7f156641193c in load_backend ../compositor/main.c:3079
    #11 0x7f1566413cc3 in wet_main ../compositor/main.c:3356
    #12 0x562ba484b179 in main ../compositor/executable.c:33
    #13 0x7f156624fcc9 in __libc_start_main ../csu/libc-start.c:308

But also use the launcher interface to actually close the DRM fd, in
mirror to what weston_launcher_open() does.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2021-06-28 11:44:52 +00:00
Pekka Paalanen 591fa3b95b tests: fix all leaks in devices-test
This fixes all ASan reported leaks in this test.

This test program has several tests named *_multiple that just run
another test function 30 times. Previously without cleanup all the
created clients would be left lingering, but now they are torn down. Ths
might cause a change in test behaviour, although that was never the
intention:

> It is intentional to run it so many times, but it is not intentional
> to run a hundred clients at a time.  The problem is that currently we
> have no destroy function for client.  However, the clients do not run
> simultaneously but serially, so the effect should be the same as if
> we'd destroy them (after the client finishes its body, it just 'is'
> and does nothing until the process exits)

- the original review discussion in
https://lists.freedesktop.org/archives/wayland-devel/2015-March/020957.html

The intention for the repeat testing is that as the Weston instance
remains from test to another, each test needs to undo its changes to the
devices. Failing to correcntly undo would accumulate devices.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-06-28 14:21:43 +03:00
Pekka Paalanen f6acdc5db0 tests: free pixman image in yuv-buffer-test
Fixes all ASan reported leaks in this test when using AMD Mesa driver.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-06-28 14:21:27 +03:00
Pekka Paalanen a01299a5b8 tests: fix all leaks in touch-test
Fixes all ASan reported leaks.

The manual touch release is slightly awkward as we need to open-code a
part of input_destroy() to avoid double-freeing pointer->wl_touch.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-06-28 14:21:27 +03:00
Pekka Paalanen 56a8d69b0e tests: fix all leaks in text-test
Fix all ASan reported leaks.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-06-28 14:21:27 +03:00
Pekka Paalanen 54ea691b99 tests: fix all leaks in surface-global-test
Fix all ASan reported leaks.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-06-28 14:21:27 +03:00
Pekka Paalanen b982676213 tests: fix all leaks in surface-test
Fixes all ASan reported leaks.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-06-28 14:21:27 +03:00
Pekka Paalanen 4f515a1da7 tests: fix all leaks in linux-explicit-synchronization-test
Fix all ASan reported leaks in this test.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-06-28 14:21:27 +03:00
Pekka Paalanen 9cf9121b73 tests: fix some leaks in subsurface-shot-test
Fix all ASan reported leaks in this test when running on AMD Mesa
driver.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-06-28 14:20:27 +03:00
Pekka Paalanen c021e2f9eb tests: reduce subsurface-test verbosity
Not printing these will drop 7980 lines or roughly 350 kB from the test
logs. Now I don't have scroll through them all, and I don't have to
watch them if I run this test manually.

These prints were useful when developing the test, but we don't need
them printed in CI all the time. Printing the final count should be
enough.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-06-23 15:20:25 +03:00
Pekka Paalanen ecbf1dba43 tests: fix all leaks in subsurface-test
Fix all ASan reported leaks in this test.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-06-23 15:20:25 +03:00
Pekka Paalanen fc26bdb2fb tests: clean up in roles-test
This fixes all ASan reported leaks in this test.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-06-23 15:20:25 +03:00
Pekka Paalanen 35cae567d6 tests/alpha-blending: add sRGB linear light case
Now that GL-renderer and color manager implement linear light blending
for sRGB EOTF, add a test case to verify the result is expected.

As noted in test comments, this new tests is quite powerful in ensuring
the whole linear light pipeline is working correctly with 1D LUTs in
GL-renderer. This test will even catch smashing source_lut.scale = 1.0f
and source_lut.offset = 0.0f which would result in wrong texture sample
positions for LUT data.

As the assumption is that by default content and outputs are in sRGB
color space, this test should not need fix-ups or become stale when more
color management features are implemented.

The sRGB EOTF can be found in:
http://www.color.org/sRGB.pdf (beware, typos)
https://www.w3.org/Graphics/Color/srgb
https://www.khronos.org/registry/DataFormat/specs/1.3/dataformat.1.3.html#TRANSFER_SRGB

Note on AMD Polaris 11 error threshold: this is quite likely due to
using fp16 format shadow framebuffer and GCN fp32 to fp16 conversion
instruction rounding mode. When using fp32 shadow framebuffer, the error
glitch is not present and the threshold could be significantly lower.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-06-21 14:36:33 +00:00
Pekka Paalanen e70aa1fde2 tests/alpha-blending: reference blending
Instead of checking just the monotonicity of the blending results, this
changes the alpha-blending test to compute the reference blend result
itself and then comparing to the compositor result. This way we can be
sure that the compositor implements the exact correct formula and not
something that just looks nice, as verifying the reference images are
actually correct is hard.

The reference image is renamed to follow the fact that this is not
primarily a monotonicity test anymore. The reference image is also
redundant, but I think it has documentary value.

The #if 0'd block of code was very useful in figuring out blending
errors in a future test case, so it is included here. I have a feeling
we are going to need it again.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-06-21 14:36:33 +00:00
Pekka Paalanen 129bef50db tests/alpha-blending: refactor into get_middle_row()
Refactor the alpha-blending test to allow using all three images
foreground, background, and screenshot in a future new verification
function.

This is a pure refactoring, no change in behavior.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-06-21 14:36:33 +00:00
Pekka Paalanen 7c13c4a476 color-lcms: use sRGB EOTF
Initialize LittleCMS and use it to generate the sRGB EOTF and inverse
curves. Use these curves to define the blending color space as optical
(linear) sRGB by assuming that both content and output color spaces are
sRGB.

As a consequence, this causes Weston to do "gamma correct blending", as
in, blend in light linear space which should avoid distorting colors in
alpha gradients, when color-lcms is active.

This makes use of the 3x1D LUT support added in gl-renderer earlier, and
shows how the color manager is responsible for re-using existing color
transformation objects.

Co-authored-by: Vitaly Prosyak <vitaly.prosyak@amd.com>
Signed-off-by: Vitaly Prosyak <vitaly.prosyak@amd.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-06-21 14:36:33 +00:00
Pekka Paalanen b12d4fcb53 gl-renderer: color transform in blit_shadow_to_output()
Use the blending to output color space transformation when blitting from
the shadow to a framebuffer.

This allows the blending and output color spaces to differ as long as
shadow is used, in case a backend does not off-load the color
transformation.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-06-21 14:36:33 +00:00
Pekka Paalanen e7b43ba3b4 gl-renderer: color transform output borders
Use the sRGB to output color space transformation when blitting the
borders (decorations) into an output window (nested compositor).

Nested output does not need to be sRGB anymore, as far as the
decorations are concerned.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-06-21 14:36:33 +00:00
Pekka Paalanen d7eca40787 gl-renderer: color transform censor fill and triangle fan
Use the sRGB to blending color space transformation for the censoring
color fill and triangle fan debug drawings.

This removes the assert that the output's blending space is (non-linear)
sRGB.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-06-21 14:36:33 +00:00
Pekka Paalanen 92f2367e58 gl-renderer: implement 3 x 1D LUT color pre-curve
This makes weston_color_transform object be able to express
three-channel one-dimensional look-up table transformations. They are
useful for applying EOTF and EOTF^-1 mapping, or, gamma curves. They
will also be useful in optimizing a following 3D LUT tap distribution
once support for 3D LUT is added.

The code added here translates from the lut_3x1d fill_in() interface to
a GL texture to be used with SHADER_COLOR_CURVE_LUT_3x1D for
weston_surfaces.

It demonstrates how renderer data is attached to weston_color_transform
and cached.

GL_OES_texture_float_linear is required to be able to use bilinear
texture filtering with 32-bit floating-point textures, used for the LUT.

As the size of the LUT depends on what implements it, lut_3x1d fill_in()
interface is a callback to the color management component to ask for an
arbitrary size. For GL-renderer this is not important as it can easily
realize any LUT size, but when DRM-backend wants to offload the EOTF^-1
mapping to KMS (GAMMA_LUT), the LUT size comes from KMS.

Nothing actually implements lut_3x1d fill_in() yet, that will come in a
later patch.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-06-21 14:36:33 +00:00