Commit Graph

7630 Commits

Author SHA1 Message Date
Leandro Ribeiro
8eb8414fcd libweston: add initial dma-buf feedback implementation
This adds the initial dma-buf feedback implementation, following the
changes in the dma-buf protocol extension.

The initial dma-buf feedback implementation gives support to send
default feedback and per-surface feedback. For now the per-surface
feedback support is very basic and is still not implemented in the
DRM-backend, what basically means that KMS plane's formats/modifiers are
not being exposed to clients. In the next commits of this series we add
the DRM-backend implementation.

This patch is based on previous work of Scott Anderson (@ascent).

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Signed-off-by: Scott Anderson <scott.anderson@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2021-11-25 11:16:14 -03:00
Leandro Ribeiro
18f53ab2d4 libweston: assert that renderer->get_supported_formats() is set
This just documents why we can be sure that
renderer->get_supported_formats() is set in bind_linux_dmabuf().

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2021-11-25 10:47:45 -03:00
Leandro Ribeiro
60c7fee48d drm-formats: add weston_drm_format_array_count_pairs()
It simply returns the number of format/modifier pairs in the array. This
will be useful for the next commits, in which we add support for dma-buf
feedback.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2021-11-25 10:47:45 -03:00
Scott Anderson
f9787ba482 gl-renderer: query DRM device given an EGLDisplay
Add function to query the DRM device given an EGLDisplay. It is the
device being used by the compositor to perform composition.

This will be useful in the next commits of this series, where we add
support for dma-buf feedback.

Signed-off-by: Scott Anderson <scott.anderson@collabora.com>
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2021-11-25 10:47:39 -03:00
Leandro Ribeiro
6e98c0dfd1 CI: bump mesa and wayland-protocol versions for dma-buf feedback
Bump the wayland-protocol dependency version in order to include dma-buf
feedback, whose support in Weston is added in the next commits.

Also, as we need the newer EGL extension EGL_EXT_device_drm_render_node
to add the support for dma-buf feedback, bump the Mesa dependency
version as well.

It also includes some minor changes in order to keep build-deps.sh more
consistent.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2021-11-25 10:43:53 -03:00
Manuel Stoeckl
b4e70a49ef simple-egl: only force config buffer size for 16bpp
Constraining the buffer size of an EGLConfig to 32 means that
the sum of red, green, blue, and alpha channels must equal 32.
This constraint prevented weston-simple-egl from picking an
RGBX pixel format when an opaque surface was asked for, since
the typical RGBX pixel formats have buffer sizes of 30, 24,
and 16.

Signed-off-by: Manuel Stoeckl <code@mstoeckl.com>
2021-11-25 11:54:46 +02:00
Daniel Stone
4564b799b8 ci: Move Debian from Buster to Bullseye
Now Debian 11 (Bullseye) has been released, shift our CI builds to using
that instead of the older Buster.

Due to dependency-chain changes, we have to install a lot more packages
explicitly and retain more at runtime. This is exacerbated by pkg-config
now requiring the entire chain to be installed, not just the immediate
dependencies.

Our documentation toolchain also gets bumped to a higher version to deal
with Doxygen changes.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2021-11-25 10:55:31 +02:00
Daniel Stone
753b6656fe CI: Upgrade kernel to v5.14
Older kernels cannot be built and booted with GCC 10+, as included in
Debian bullseye, due to unfortunate stack-canary issues:
    https://lore.kernel.org/lkml/20200314164451.346497-1-slyfox@gentoo.org/T/

Upgrade to the last-released kernel, 5.14, to fix this.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2021-11-25 10:55:31 +02:00
Daniel Stone
42c763c14d ci: Use a non-conflicting directory for PipeWire clone
Rather than aliasing it with our existing 'pipewire' directory.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2021-11-25 10:55:31 +02:00
Daniel Stone
430378edd3 ci: Clean up Wayland build directory
We don't need to keep it around.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2021-11-25 10:55:31 +02:00
Marius Vlad
e9a0c0648b libinput-seat: Cascade errors and bail out in case of failure
Errors happening to devices being added or removed shouldn't fail
silently so exit if any of that happens.

Sprinkle some debug logs for other cases as well.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Suggested-by: Daniel Stone <daniel.stone@collabora.com>
2021-11-25 10:47:04 +02:00
Marius Vlad
137c793f22 desktop-shell: Guard against invalid seats in get_shell_seat()
Starting with commit 'desktop-shell: Embed keyboard focus handle code
when activating' we are iterating over all the seats when removing a
weston_desktop_surface to be able to invalidate the activate surface.

Upon compositor tear down the shell destroy might invalidate seats
before removal of the weston_desktop_surface making the shell_seat
itself invalid. This wasn't apparent at that time because we're not
handling at that the removal of surfaces from layers.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2021-11-24 12:17:26 +00:00
Pekka Paalanen
a882794027 compositor: add icc_profile weston.ini option for outputs
This adds "icc_profile" key support in [output] sections for backends
headless, x11, wayland, and drm, and also for remoted and pipewire
outputs FWIW. On the other hand, RDP-backend does not use output
sections from weston.ini, and fbdev-backend does not deserve anything
new (it wouldn't support color management anyway due to no GL-renderer).

This allows one to configure an ICC v2 or v4 file to be used as an
output profile. However, color-lcms does not actually use output
profiles yet, so trying this will fail until support is implemented.

The parent_winsys_profile argument is reserved for using the color
profile from a parent window system where applicable, if nothing else is
set in weston.ini. None of the nested backends provide an output color
profile yet. It is more of a reminder of a missing feature than a
serious implementation.

Note: cms-static Weston plugin uses the exact same weston.ini key for
loading VCGT from ICC profiles. If "color-management" option is set to
false, this new use of "icc_profile" is disabled and the old behavior
with cms-static is kept.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-11-23 09:23:05 +00:00
Pekka Paalanen
9a9e6ced1b libweston: add weston_output::color_profile
Add API to set an output's color profile. This new function can also be
called while the output is enabled. This allows changing the output
color profile even at runtime if desired.

color-noop has no way of creating weston_color_profile objects, so it
just asserts that no color profile is set.

color-lcms does not yet implement taking the output color profile into
account, so for now it just fails everything if a profile is set.

weston_surface_color_transform_fini() was previously used only prior to
freeing the struct, but now it is used also to just clear the struct,
hence it needs to reset the fields.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-11-23 09:23:05 +00:00
Pekka Paalanen
9a0aa37edd libweston: refactor into weston_output_set_color_transforms()
Move the code into a new function that either succeeds in setting all
the color transformations or does not change anything. This will be
useful when implementing output color profiles changes while the output
is enabled.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-11-23 09:23:05 +00:00
Pekka Paalanen
f45d57623e color: add weston_compositor_load_icc_file()
This function will be useful for Weston to load output ICC profiles from
weston.ini.

Co-authored-by: Sebastian Wick <sebastian@sebastianwick.net>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-11-23 09:23:05 +00:00
Pekka Paalanen
aa6346f274 color: introduce weston_color_profile
Roughly speaking, a color profile describes the color space of content
or an output. Under the hood, the description includes one or more ways
to map colors between the profile space and some standard profile
connecting space (PCS).

This object is not called a color space. A color space has a unique
definition, while a color profile may contain multiple different
mappings depending on render intent. Some of these mappings may be
subjective, with an artistic touch.

When a source color profile and a destination color profile are combined
under a specific render intent, they produce a color transformation.
Color transformations are already preresented by weston_color_transform.

This patch adds the basic API for color profile objects. Everything
worthwhile of these objects is implemented in the color managers:
color-noop never creates these, and in color-lcms they are basically a
container for cmsHPROFILE, the Little CMS object for color profiles.
Color profile objects will not be interpreted outside of the color
managers, unlike color transformations.

For a start, the color manager API has one function to create color
profiles: from ICC profile data. More creation functions for other
sources will be added later.

The API has errmsg return parameter for error messages. These are not
simply weston_log()'d, because CM&HDR protocol will allow clients to
trigger errors and the protocol handles that gracefully. Therefore
instead of flooding the compositor logs, the error messages will
probably need to be relayed back to clients.

Color-lcms is expected to create a cmsHPROFILE for all kinds of color
profiles, not just for those created from ICC profile data. Hence,
color-lcms will fingerprint color profiles by the MD5 hash which Little
CMS computes for us. The fingerprint is used for de-duplication: instead
of creating copies, reference existing color profiles.

This code is very much based on Sebastian Wick's earlier work on Weston
color management, but structured and named differently.

Co-authored-by: Sebastian Wick <sebastian@sebastianwick.net>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-11-23 09:23:05 +00:00
Takuro Ashie
29d81c0d4a Fix crash on activating a text area without a real keyboard
It will cause on following situation:

* Enable weston-simple-im
  * It's also reproducible with IBus or Fcitx5
* Connect a mouse or a touch panel
* Don't connect keyboad
* Launch weston-editor and touch the text area

It doesn't reproduce with weston-keyboard because it doesn't use
grab_keyboard of input-method-context-v1.

Signed-off-by: Takuro Ashie <ashie@clear-code.com>
2021-11-18 11:29:56 +02:00
Alyssa Ross
7c12182576 clients: don't use deprecated fontconfig aliases
The "sans" and "mono" aliases for "sans-serif" and "monospace" are
deprecated[1].  Let's standardize on the non-deprecated versions, which were
already in use in some places.

[1]: be453bd159/fonts.conf.in (L33-67)

Signed-off-by: Alyssa Ross <hi@alyssa.is>
2021-11-18 10:57:16 +02:00
Alyssa Ross
6e2eb8fa94 terminal: use /bin/sh as the default shell
When trying to get Weston to run on a new system I was building up bit
by bit, I encountered a problem: when I started weston-terminal, it
would close a split second later.  This turned out to be because
weston-terminal defaults to trying to spawn /bin/bash, which my
busybox-based system didn't have.

I can configure the terminal to use a shell I do have, of course, but I
think /bin/sh is a much friendlier default, because it's more likely to
exist (POSIX requires it), and will save people just trying to get
started with Weston from the confusing experience I had.  I think it's
better overall that somebody who specifically wants /bin/bash has to
configure that (if they even have to — depending on how they're running
Weston, $SHELL might already be /bin/bash) than somebody who just wants
to see the terminal working debug why it won't launch at all.

I realise there might be a (small) backward compatibility concern here
as well, but I hope I've made the case for a friendlier default.

Signed-off-by: Alyssa Ross <hi@alyssa.is>
2021-11-18 10:44:20 +02:00
Simon Ser
0d5ce4fb3e readme: advertise the doc website
The doc website is currently hidden in the Wayland homepage. Add
an explicit link in the README.

While at it, rename the section about documentation. "Weston" is
already in the repository name and the top oif the README, so no
need to repeat here.

Signed-off-by: Simon Ser <contact@emersion.fr>
2021-11-16 10:43:07 +00:00
Vitaly Prosyak
15d7546b2d tests: refactoring alpha-blending
No functional change. Moved color processing
functions into shared files which can be used
between different tests.

Signed-off-by: Vitaly Prosyak <vitaly.prosyak@amd.com>
2021-11-13 00:17:03 +00:00
Marius Vlad
4b23aa11ae kiosk-shell: Remove keyboard_focus and seat_caps listeners
The seat_cap listener was to register a signal for keyboard_focus, which
we no longer use. Remove it entirely to avoid dead code.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Suggested-by: Derek Foreman <derek.foreman@collabora.com>
2021-11-12 15:58:46 +02:00
Marius Vlad
f886311353 kiosk-shell: ignore additional seats
As kiosk-shell can't cope with multiple seat add a warning and avoid
creating any new seats. With it, this guards against potentially
receiving an invalid seat.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2021-11-12 15:58:43 +02:00
Marius Vlad
79cf52e556 kiosk-shell: Handle child top-level windows at destruction
With the seperation of surface activation and keyboard input, a special
corner case arose for child top-level windows when surfaces are being
destroyed. To make sure we never pick the wrong window to activate upon
destruction, we verify if the current focused surface is different than
the one being destroyed.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2021-11-12 15:22:53 +02:00
Marius Vlad
365f445eab kiosk-shell: Embed keyboard focus activation code
Just like desktop-shell, we shouldn't be dependent on having a keyboard
be present in order to activate a window/surface.

This adds a libweston helper to retrieve the first available seat, and
to use it in order to avoid going over the seat list.

We also encapsulate the activation of the surface in one place, and use
it on surface removal, when the surface has been committed, or for
touch/pointer events. With it we also deal with the keyboard focus and
shell activation in one place.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2021-11-12 15:22:50 +02:00
Manuel Stoeckl
742a0232b0 gl-renderer: add support for (a|x)bgr16161616f shm formats
These formats will be eventually be useful for color managed clients
using wl_shm that wish to submit buffers encoding high dynamic range
images.

While the minimum requirement for linearly filterable half float
textures is GL ES 2.0 + GL_OES_texture_half_float_linear, to keep
the code simple, this commit only enables the new formats when
the requirements for color management (notably including GL ES 3.0
and GL_EXT_color_buffer_half_float) are available.

Signed-off-by: Manuel Stoeckl <code@mstoeckl.com>
2021-11-06 23:52:58 -04:00
Marius Vlad
5b357a4bbb backend-rdp: Correctly tear down the RDP back-end
This fixes the tear-down and the destroying part in case RDP back-end
couldn't be initialized. The first issue is the rdp_output which will
not be created in some circumstances (can't open the socket for
instance) and requires a guard check, and secondly, the
rdp_head being created above of that, wasn't removed and tripped an
assert when destroying the compositor instance.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2021-11-03 10:33:21 +02:00
Marius Vlad
5699dbaae7 desktop-shell: Don't crash on when attemping to switch
Attempting to perform a switch on a surface (already) closed will trip
the assert in activate(), so check if we have a weston_desktop_surface
before trying to activate it.

Fixes #543

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2021-11-03 10:10:58 +02:00
Marius Vlad
b5dbb7a7ab kiosk-shell: Allow to retrieve surface labels
Nothing special, but allows scene-graph to display surface labels.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2021-11-02 19:32:55 +02:00
Marius Vlad
2be09373b4 desktop-shell, kiosk-shell: Migrate helpers to create a view to shell-utils
Incidentally fixes #553

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2021-11-02 19:32:24 +02:00
Marius Vlad
d98c7e86fb shared/shell-utils: Create common helpers functions for shells
Group common functions found in both kiosk-shell and deskop-shell to
a shared utils file.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2021-11-02 19:29:50 +02:00
Marius Vlad
d6ccc8b025 libweston: Rename weston_view_activate() to weston_view_activate_input()
This way, we try to differentiate between input focus and window/surface
activation.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2021-11-02 19:04:33 +02:00
Marius Vlad
f3584cf995 desktop-shell: Remove keyboard_focus_listener
We no longer make use of the keyboard_focus_listener so remove it
entirely.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Suggested-by: Derek Foreman <derek.foreman@collabora.com>
2021-11-02 19:04:33 +02:00
Marius Vlad
f12697bb3e desktop-shell: Embed keyboard focus handle code when activating
We shouldn't be constrained by having a keyboard plugged-in, so avoid
activating/de-activating the window/surface in the keyboard focus
handler and embed it straight into the window activation part.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2021-11-02 19:04:33 +02:00
Marius Vlad
ab39e1d76d desktop-shell: Rename gain/lose keyboard focus to activate/de-activate
This way it better reflects that it handles activation rather that input
focus.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2021-11-02 19:04:33 +02:00
Marius Vlad
05bef4c18a desktop-shell: Remove no-op de-activation of the xdg top-level surface
The shsurf is calloc'ed so the surface count is always 0.  Not only
that but the surface is not set as active by default, so there's no
need to de-activate it.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2021-11-02 19:04:33 +02:00
Marius Vlad
11bc0d0428 kiosk-shell: Swap green with blue for the background-color
Fix a trivial typo, where the green channel was swapped with the blue
channel, resulting in rbg instead of rgb.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2021-11-01 19:57:32 +02:00
Emmanuel Gil Peyrot
d4a208c2b1 pipewire: Drop support for 0.2 API
According to repology.org, all relevant distributions now ship
pipewire 0.3, so we can drop the pretty ugly #if/#else code that was
added to support both at compile-time.

Signed-off-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
2021-10-27 09:18:51 +00:00
Manuel Stoeckl
c7fbc97120 gl-renderer: add support for (a|x)bgr2101010 shm formats
Adding these formats makes it possible for clients using wl_shm to
submit buffers with 10 bits per pixel, and thus (if Weston is
configured with an xrgb2101010 frame buffer) display more precise
colors on some computer monitors.

Signed-off-by: Manuel Stoeckl <code@mstoeckl.com>
2021-10-27 09:02:07 +00:00
Marek Vasut
b02149e43b screen-share: Add option to start screen sharing on weston startup
Currently the screen sharing has to be manually started after weston has
started by pressing Ctrl+Alt+S on a keyboard. Add new bool config option
to the screen-share section which permits starting the screen sharing of
all outputs on weston start up. This is useful e.g. for doing screen
mirroring between two devices over network.

Signed-off-by: Marek Vasut <marex@denx.de>
2021-10-27 08:52:17 +00:00
Derek Foreman
c00aba6893 xwayland: Fix copy and paste error
This leg of the if/else ladder is a duplicate of the previous conditional.

It appears to have been intended to log enter events, but we already
handle those earlier. The drop event is already logged as well,
so let's just discard this branch entirely.

Fixes #552

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2021-10-25 17:24:41 -05:00
Manuel Stoeckl
3208ee42cd backend-wayland: clean up wayland_input structs
The struct wayland_input objects tracking the outer compositor's
wl_seats are now properly destroyed when the wayland backend is.

Signed-off-by: Manuel Stoeckl <code@mstoeckl.com>
2021-10-20 00:25:43 -04:00
Manuel Stoeckl
ac20d4a293 backend-wayland: replace a nested wl_display_roundtrip call
The wl_display_roundtrip call was originally introduced to let the
display_add_seat function wait until a wl_seat.name event was received.

This change replaces the wl_display_roundtrip call with an
asynchronous, nonrecursive equivalent. Now a wl_display.sync callback
is used to delay the final steps of adding a seat until one protocol
roundtrip has occured/the name has been received.

Signed-off-by: Manuel Stoeckl <code@mstoeckl.com>
2021-10-18 19:21:25 -04:00
Marius Vlad
43ec334c77 gitlab-ci: Use the same name as for check-commits
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2021-10-18 15:51:16 +03:00
Marius Vlad
15a552b671 gitlab-ci: Check merge request for allowing edits
Ensures that users tick allow collabration to make rebasing possible
from maintainers, and fast forward merge requests.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2021-10-18 15:27:28 +03:00
Emmanuel Gil Peyrot
152405b8f9 simple-touch: Exit on xdg_toplevel::close
This makes it possible to close this client without using a terminal,
especially useful on a phone.

Signed-off-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
2021-10-15 16:52:08 +00:00
Emmanuel Gil Peyrot
b596342e37 simple-touch: Remove unused include
Signed-off-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
2021-10-15 16:52:08 +00:00
Emmanuel Gil Peyrot
b94219adeb simple-touch: Use true/false instead of 1/0 for bool type
Signed-off-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
2021-10-15 16:52:08 +00:00
Takuro Ashie
5ff978a52b weston-keyboard: Enable to set as overlay panel
input-method-v1 protocol provides two surface type for the input
panel, `toplevel` and `overlay`. But there is no example for the later
one. This change enables to set weston-keyboard as overlay panel by the
environment variable `WESTON_KEYBOARD_SURFACE_TYPE=overlay` to
demonstrate this feature. In Addition, add weston.ini option
`overlay-keyboard` to set it.

Signed-off-by: Takuro Ashie <ashie@clear-code.com>
2021-10-14 21:17:07 +09:00