Commit Graph

7844 Commits

Author SHA1 Message Date
Daniel Stone bd9b0676dd shell: Make input capture optional for curtains
desktop-shell's focus surfaces want to reuse this, but they don't want
to capture the input, instead allowing it to fall through.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-03-31 17:15:55 +00:00
Daniel Stone 64ef87554b desktop-shell: Clean up fullscreen black view code
Rationalise it a little bit so we don't need pre-declarations of static
functions, and the order of creation more closely matches the others,
including making the same calls to explicitly set the output.

Doing this makes the behaviour match the other users of the same code
pattern. In making them the same, we make desktop-shell code a little
less magically divergent where people might wonder what the correct
pattern is to use. After we have moved all users to a uniform pattern,
later commits are then able to migrate these users to common helper
code, which reduces code duplication, improves code clarity as it is no
longer necessary to wonder about the exact semantics of every
special-case user of this common pattern, and makes it easier to make
interface changes which improve and clarify the patterns which are
prevalent throughout the desktop-shell code.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-03-31 17:15:55 +00:00
Daniel Stone de0cd53264 desktop-shell: Remove redundant geometry dirty call
Dirtying the geometry only sets a flag on the view saying that the
geometry is dirty, so we don't need to do it twice back-to-back.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-03-31 17:15:55 +00:00
Daniel Stone 791e8b1c5f desktop-shell: Fix opaque region co-ordinate confusion
Opaque regions are in surface co-ordinate space, not global co-ordinate
space, so the region should be anchored to (0,0).

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-03-31 17:15:55 +00:00
Daniel Stone e81b8d7cc9 shell: Add alpha to weston_curtain_create
Not all solid-colour views want to be opaque: sometimes we use them with
non-opaque alpha values in order to shade views underneath them.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-03-31 17:15:55 +00:00
Daniel Stone d21563360a shell: Move weston_curtain_create params into the struct
Given that we have a struct for argument params, we might as well use it
rather than have them split between the struct and native params. For
consistency between the implementations, this also includes a shift from
float to int positioning for the base offset within the compositor's
global co-ordinate space.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-03-31 17:15:55 +00:00
Daniel Stone 3a298b0b05 shell: Rename weston_solid_color_surface to weston_curtain_params
The name implied that it was a surface in and of itself, rather than
parameters used by a helper to create a surface and view.

Rename it now that we have weston_curtain as a name, and clean up
initialisers.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-03-31 17:15:55 +00:00
Daniel Stone b77c2374ee shell: Rename solid_color_surface to weston_curtain
create_solid_color_surface actually returns a weston_view that it
creates internally. Since weston_solid_color_view is long and dull,
rename it to weston_curtain.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-03-31 17:15:55 +00:00
Daniel Stone 7059ec7807 desktop-shell: Explicitly destroy black views on shutdown
desktop_shell_removed() won't get called when we shut down, so
explicitly destroy the fullscreen black view.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-03-31 17:15:55 +00:00
Daniel Stone c8a2fb7a40 pixel-formats: Add XYUV8888 format
XYUV8888 support was added to gl-renderer in 30104bd89a, but not to
pixel-formats. Oops.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-03-31 17:15:55 +00:00
Daniel Stone f48cf18a16 compositor: Fix harmless potential buffer overflow
We could overflow a local buffer if there were more than ten million
concurrently active displays within the current user's session. This
seems vanishingly unlikely, and harmless, but does at least squash a
compiler warning emitted by gcc 12+.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-03-31 17:15:55 +00:00
nerdopolis cdfe94b105 launcher-logind: Don't check wl->vtnr before returning it.
Signed-off-by: n3rdopolis <bluescreen_avenger@verizon.net>
2022-03-16 13:12:20 +00:00
Pekka Paalanen b3ba1becba libweston: remove fbdev backend
Fbdev backend was deprecated in the Weston 10.0.0 release with
6338dbd581. Before that, I suggested
already in 2019 to remove it, but it was too soon then. Now it seems the
final voices asking for fbdev to be kept have been satisfied, see the
linked issue.

Fbdev-backend uses a kernel graphics UAPI (fbdev) which is sub-par for a
Wayland compositor: you cannot do GPU accelerated graphics in any
reasonable way, no hotplug support, multi-output support is tedious, and
so on. Most importantly, Linux has deprecated fbdev a long time ago due
to the UAPI fitting modern systems and use cases very poorly, but cannot
get rid of it if any users remain. Let's do here what we can to reduce
fbdev usage.

I am doing color management related additions to libweston which require
adding checks to every backend. One backend less is less churn to write
and review.

Libweston major version has already been bumped to 11, so the next
release will be Weston 11, without fbdev. enum weston_compositor_backend
entries change their numerical values.

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

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-03-15 11:32:46 +02:00
Pekka Paalanen 18df9108ea man: replace tablet shell with kiosk shell
Tablet shell was removed in 873b515aee in
2013. Time to remove the hopefully last reference to it.

We also gained kiosk shell in the mean time, so mention that instead.
Yes, it's a bit of a lie, because we also have ivi-shell and
fullscreen-shell, but I heard they might be on their way out, so I
didn't add them here.

Would be nice to add kiosk-shell in the SHELLS section too, but in this
patch I am only concerned about dropping the tablet shell reference.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-03-14 19:42:33 +02:00
Pekka Paalanen bfefe8e8d4 man: add gbm-format in output section
Looks like at least from 2016 onwards the gbm-format option has also
been recognized in an output section.

Time to document that.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-03-14 19:42:33 +02:00
Pekka Paalanen ce059cffdb man: expand on gbm-format
Since 62a9436417 the gbm-format option has
recognized all pixel formats listed in libweston/pixel-formats.c.

Clarify what pixel formats can be used.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-03-14 19:42:33 +02:00
Pekka Paalanen 1f5e19fab3 man: move pageflip-timeout from weston.ini(5) to weston-drm(7)
This option is used only with the DRM-backend. Options in weston.ini(5)
should be either generic or for backends that do not have their own man
page yet.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-03-14 19:42:33 +02:00
Pekka Paalanen 79f73d2247 man: move gbm-format from weston.ini(5) to weston-drm(7)
This option is used only with the DRM-backend. Options in weston.ini(5)
should be either generic or for backends that do not have their own man
page yet.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-03-14 19:42:33 +02:00
Marius Vlad d284ab0322 pipewire,remoting,tests: Replace asprintf w/ str_printf
We have a string helper which wraps asprintf(). Uses that one because it
clears out the destination string, but also it won't return the number
of bytes unlinke asprintf().

Fixes warnings like:
warning: ignoring return value of ‘asprintf’ declared with attribute
‘warn_unused_result’.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2022-03-14 15:51:09 +02:00
Pekka Paalanen 3e94836a63 tests: add get_double in config-parser tests
weston_config_section_get_double() was not covered with tests before.

This patch follows the testing style already present in the file.

Cannot use ZUC_ASSERT_EQ() here, because that would convert the values
to integers before comparison. Luckily, simple strict equality
comparison works here, because we are testing conversion to float, not
the results of lossy calculations.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-03-14 08:50:30 +00:00
Pekka Paalanen 0a38fc7e75 shared: fix WL_EXPORT style in config-parser.c
This was the only file in Weston using WL_EXPORT on its own line. Fix
the style to follow everything else.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-03-14 08:50:30 +00:00
Pekka Paalanen f58a3a7e1d include: drop unused config-parser.h types
Apparently these are not used anywhere. Garbage-collect them, and trim
some empty lines.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-03-14 08:50:30 +00:00
Robert Mader 2669853562 clients/simple-dmabuf-feedback: Add fallback print method for unknown formats
Using `pixel_format_get_info()` can result in formats being
reported as `UNKNOWN` when used on compositors other than Weston.

As `weston-simple-dmabuf-feedback` somewhat succeeds `wayland-info`
as tool for `zwp_linux_dmabuf_v1` debugging from version 4 on, copy
the approach from the later for these cases.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2022-03-11 13:56:17 +01:00
Robert Mader f81aacdf2f pixel-formats: Add support for 64bbp float RGB formats
These are supported by some other compositors already.
Add them to the list so `weston-simple-dmabuf-feedback`
reports them correctly.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2022-03-11 13:55:19 +01:00
Marius Vlad c19cf3d684 libweston: Enable logging for libseat launcher
The built-in backend of libseat requires users to enable a logging
level in order for libseat to start writing out log messages.  For that
to happen we split out the info and error log level messages into the
compositor's log scope, while debug level messages go into a dedicated
scope.

With that, this patch brings in a new scope, called libseat-debug, which
users need to explicity create a subscription for it as to retrieve/have
access to debug message coming out of libseat. Note that by default we
have a subscription for the log-scope so any errors/info from libseat
would be displayed to the user.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2022-03-10 17:13:16 +02:00
Marius Vlad e9fe66a91c weston-log: Extract helper for generating a time stamp
As we might be needing it for other scopes extract the time stamp
genration into a helper.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2022-03-10 17:11:31 +02:00
Marius Vlad d40cedc8af desktop-shell: Remove wl_shell_surface::resize enum
And use the ones provided by libweston-desktop, as they are one
and the same.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2022-03-08 15:12:56 +02:00
Derek Foreman 7cae2a1fb0 backend-wayland: Stop supporting wl_shell
This has been deprecated for a long time, so let's stop supporting
it entirely.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-03-08 15:12:56 +02:00
Derek Foreman e6b8f5a5e4 remove wl_shell
This has been deprecated long enough, I think it's time to say goodbye.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-03-08 15:12:56 +02:00
Pekka Paalanen 5ba7ae2937 tests: preserve ivi runner section
Everywhere else where use this trick, we also have 'used' in the
attributes, except here. Make this consistent.

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

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-03-08 14:50:41 +02:00
Michael Olbrich 78c94d0719 libweston: explicitly cancel start_drag if no matching input device is found
Otherwise, the client will assume that dragging is in progress and remains in
that state forever.
This can happen when weston processes the mouse up event just before the
start_drag() arrives.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2022-03-04 11:51:01 +00:00
Pekka Paalanen 4fb095eca1 doc: running on different seat with libseat
When using the libseat launcher, there is one more detail to take care:
stop libseat from managing the VT.

A normal user does not have permissions to manage a VT, so launching
would just fail. In this use case you also do not want to be managing
the VT, because your normal desktop is already owning the seat
associated with the VT.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-03-04 11:22:47 +00:00
Pekka Paalanen c26326bfb1 doc: expand on libseat via ssh
Give a little more details about how running Weston via ssh or serial
terminal is best done, now that launcher-direct and weston-launch are
gone.

Hopefully the removal of launcher-direct also makes less people run
Weston as root, when seatd is the privileged process. Running 'weston'
as root might still work through libseat's builtin backend without
seatd.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-03-04 11:41:42 +02:00
Pekka Paalanen 952a951662 build: enable libseat support by default
Now that launcher-direct and weston-launch are gone, libseat takes their
place.

Enable libseat support by default to give users a hint in case they miss
either of those.

People who used to get launcher-logind when libseat support was disabled
will now be using logind through libseat. This should not cause any
regressions, and if it does, we want to hear about them, because the
separate logind-launcher is also planned to be deprecated in the future.

Disabling logind-launcher by default is left for when it actually gets
deprecated.

In case someone does not have libseat available but do have logind
running, they can just disable libseat support.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-03-04 11:20:16 +02:00
Derek Foreman 2c91c70250 launchers: Remove --tty option
This doesn't work with any of the launchers we've kept. Remove the option
and all the bits that handle it.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-03-03 17:00:15 -06:00
Derek Foreman a96dfc7098 launchers: remove launchers
Moving forward we're going to be supporting libseat and logind as our
only launchers. We're doing this to reduce our maintenance burden,
and security impact.

Libseat supports all our existing use cases, and seatd can replace
weston-launch so we no longer have to carry a setuid-root program.

This patch removes weston-launch, and launcher-direct, leaving only
libseat and logind.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-03-03 16:54:14 -06:00
Vitaly Prosyak 87f2d09f18 color-lcms: Always use cmsContext for LCMS API which has THR suffix
Fix a typo. No CM functional change, just redirect LCMS error
into  created cmsContext which output into weston log.

Signed-off-by: Vitaly Prosyak <vitaly.prosyak@amd.com>
2022-03-01 22:49:39 -05:00
Pekka Paalanen e2ee2b56f9 tests: make vertex-clip use WESTON_EXPORT_FOR_TESTS
This is probably the simplest case to demonstrate how to use
WESTON_EXPORT_FOR_TESTS.

Previously, vertex-clip test re-built vertex-clipping.c for itself. Now
it directly links in gl-renderer.so instead as that is where
vexter-clipping.c gets built into for actual use. This probably will not
work for any installed program, but luckily tests are never installed,
so Meson makes sure the DSO is found.

Unfortunately we cannot remove the definition of dep_vertex_clipping
yet, because clients/cliptest.c needs it.

This makes vertex-clip test depend on GL-renderer, but that is where the
code is really used.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-03-01 13:32:15 +00:00
Pekka Paalanen 32a790f774 shared: add WESTON_EXPORT_FOR_TESTS
This is a new function exporting macro that intends to make writing unit
tests in the Weston test suite easier.

A test needs to access a private function to be able to verify its
behavior. Previously we have used things like putting such functions in
a separate .c file and then building that file into the corresponding
test. That is a bit awkward and can lead to proliferation of arbitrary
.c files for no good reason. It may also require pre-processor magic,
and sometimes copying chunks of code causing a risk of deviating the
code being tested from the code actually used.

This patch proposes another approach: a private export from a DSO.
Except, private exports do not really exist, and this is just a normal
export with a specific C macro, and omitting the function from public
headers.

Once exported, a test program can link the DSO during build, be that a
shared library or even a plugin, use the private header declaring the
function, and simply call the function in the test.

The declaration of WESTON_EXPORT_FOR_TESTS is in shared/helpers.h so
that it is available to all components equally while still not being in
a public header. Other places that were considered:

- include/libweston/libweston.h is a public header, but external users
  should not know about the macro.

- libweston/libweston-private.h is too private and not available to all
  components, particularly color-lcms plugin.

- libweston/backend.h is not appropriate for color-lcms plugin either.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-03-01 13:32:15 +00:00
nerdopolis 8e2c67c317 clients/desktop-shell: Add a displayname= option for launchers
Signed-off-by: n3rdopolis <bluescreen_avenger@verizon.net>
2022-02-24 00:38:55 +02:00
James Le Cuirot 89587db3cb meson.build: Fix -Dbackend-default=auto following fbdev deprecation
Signed-off-by: James Le Cuirot <chewi@gentoo.org>
2022-02-23 15:57:57 +02:00
Takuro Ashie 351e6a4b21 Don't send compositor's global key bindings to the input method
Although weston_compositor_run_key_binding() is called when the current
keyboard grab is default_grab or input_method_grab, swallowing the key
event is processed only on default_grab. As a result key events that
should be swallowed are sent to the input method unexpectedly.

For example, when a user press `Super + s` on weston-editor to take a
screen shot, `s` will be unexpectedly entered to the text area.
I confirmed such behaviour with weston-simple-im and fcitx5-5.0.10.
It doesn't occur with weston-keyboard because it doesn't install
keyboard grab.

Signed-off-by: Takuro Ashie <ashie@clear-code.com>
2022-02-23 15:40:33 +02:00
Pekka Paalanen 29d4472e13 tests: use color_float rgb[] alias more
Iterate over rgb[] array instead of repeating the code for .r, .g and
.b.

Also in process_pipeline_comparison() f_max_err variable is dropped
since it was not used much.

This should make the code easier to read.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-02-18 15:22:44 +00:00
Pekka Paalanen 4012062228 tests: add rgb[] alias in color_float
Individual struct fields are inconvenient to index into, yet most
operations on a color just repeat the same for each of RGB channel.
Being able to index into RGB avoids repeating the same code for each
channel.

Alpha channel is left as separate, since it is almost never handled the
same as RGB.

The union keeps the old .r, .g and .b addressing working. The static
asserts ensure the aliasing is correct.

For demonstration, two simple functions in color_util.c are converted.

Unfortunately initializers need to be corrected everywhere. Field .a is
not explicitly initialized because it is unused in these cases.

This change should make code easier to read.

This change requires gnu99 or c11 standard. gnu99 is already the default
in top-level meson.build.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-02-18 15:22:44 +00:00
Daniel Stone 2ac6b6b084 tests: Add dependency on screenshooter client protocol
Given that the test-helper code relies on the screenshooter protocol,
make sure it's available for us to build, and the dependency ensures we
build in order.

Fixes: #588

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-02-18 12:24:01 +00:00
Robert Mader 3e6ef529f8 clients/simple-dmabuf-*: Increase buffer limit to four
In certain situations these clients crash a lot due to the low
buffer limit. Four buffers is also what EGL allows without blocking
and what is arguably the upper limit of what a compositor should
demand.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2022-02-17 12:26:41 +01:00
Vitaly Prosyak fe35ca2d68 tests: color shaper-matrix test
1. Use fixture_setup to set the generated by LCMS output profile based on
   given chromaticities and white points. The following  list of well known
   chromaticities:
    - sRGB
    - adobe RGB
    - bt2020
   and white point is D65. Use INTENT_ABSOLUTE_COLORIMETRIC to avoid BPC.
   Input profile is always sRGB and it is used internally by Weston as
   stock profile.

2. Use these hardcoded matrixes as part of pipeline 1DLUT->3x3->1DLUT.
   The diagnostic code to retrieve the transform matrix is availble into
   test in the comments. The conversion matrixes generated for the
   following cases:
    - sRGB to sRGB (unity)
    - sRGB to adobeRGB
    - sRGB to BT2020
3. Compare GPU shaders(gl texture3D) vs manual pipeline calculation
   Use different max tolerable error per transform.
   There are comments how number of points in 3DLUT is related to tolerance.
   Tolerance depends more on the 1D LUT used for the inv EOTF than
   the tested 3D LUT size: 9x9x9, 17x17x17, 33x33x33, 127x127x127.

4. Enable build matrix-shaper test if color-management-lcms is enabled.

Co-authored-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Signed-off-by: Vitaly Prosyak <vitaly.prosyak@amd.com>
2022-02-12 23:19:02 -05:00
Vitaly Prosyak 264a18f01a tests: shared color processing functions
Added pixel pipeline processing as following:
tone curve(EOTF) + 3x3 matrix + tone curve(INV_EOTF)

Co-authored-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Signed-off-by: Vitaly Prosyak <vitaly.prosyak@amd.com>
2022-02-12 23:19:02 -05:00
Vitaly Prosyak 6099c0e24b color-lcms: LCMS transform for color mapping
Use 3D LUT for color mapping.
For category CMLCMS_CATEGORY_INPUT_TO_BLEND use transform which has
3 profiles: input, output and light linearizing transfer function.
For category CMLCMS_CATEGORY_INPUT_TO_OUTPUT use input and output profiles +VCGT.
For category CMLCMS_CATEGORY_BLEND_TO_OUTPUT use output inverse EOTF + VCGT.

Co-authored-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Signed-off-by: Vitaly Prosyak <vitaly.prosyak@amd.com>
2022-02-12 23:19:00 -05:00
Vitaly Prosyak c199aade3f color-lcms: linearization of an arbitrary color profile
Graeme sketched a linearization method there:
https://lists.freedesktop.org/archives/wayland-devel/2019-March/040171.html
Sebastian prototyped there:
https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/14/commits

Thanks to Pekka for great simplifications in implementation, like the xyz_dot_prod()
Quote: "should help untangle lots of the multiplications and summations by saying
we are computing dot products, etc".

The approach was validated using matrix-shaper and cLUT type of profiles.
If profile is matrix-shaper type then an optimization is applied.
The extracted EOTF is inverted and concatenated with VCGT, if it is availible.
Introduce function cmlcms_reasonable_1D_points which would be shared between
linearization method and number of points in 1DLUT for the transform.
Co-authored-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Co-authored-by: Sebastian Wick <sebastian@sebastianwick.net>
Signed-off-by: Vitaly Prosyak <vitaly.prosyak@amd.com>
2022-02-11 13:06:11 -05:00