Commit Graph

9415 Commits

Author SHA1 Message Date
Pekka Paalanen efec55cf62 color-lcms: print transformation id instead of pointer
Pointer values are hard to track for humans, being long numbers. Now
that we have unique id for each color transformation, print that instead
of the pointer. It is a small number easy to track for humans.

Transformation id numbers do get re-used aggressively, so you have to
keep track of what is being destroyed and created over time when reading
logs. Pointers had the same caveat, just a lot more random.

The prefix 't' indicates "transformation".

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-03-20 12:58:12 +00:00
Pekka Paalanen aef9404b1d color: generate id for color transformations
Just like with color profiles, generate an ID for color transformations
as well. This is not needed by protocol or anything, it is just for
debugging purposes. A small ID is easier for humans than a long pointer
value.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-03-20 12:58:12 +00:00
Pekka Paalanen b0224c4752 color-lcms: print profile id instead of pointer
Pointer values are hard to track for humans, being long numbers. Now
that we have unique id for each color profile, print that instead of the
pointer. It is a small number easy to track for humans.

Profile id numbers do get re-used aggressively, so you have to keep
track of what is being destroyed and created over time when reading
logs. Pointers had the same caveat, just a lot more random.

The prefix 'p' indicates "profile", just in case we use another id space
for some other thing similarly.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-03-20 12:58:12 +00:00
Jordan Williams 2e6c58fb37
meson: Add missing dependencies on egl
A proper dependency on egl is missing for several backends as well as
for libshared. This dependency is necessary to pull in the correct
include directories from the egl.pc pkg-config file. 

Signed-off-by: Jordan Williams <jordan@jwillikers.com>
2024-03-18 10:27:40 -05:00
Loïc Molinari f4c69abc57 libweston: Let multiple backends register the Windowed Output API
The windowed output API is implemented by the Wayland, the X11 and the
headless backends. It's currently not possible to create a secondary
headless backend when the primary backend is Wayland or X11 because
the windowed output API would be registered twice. This commit
suffixes the windowed output API names with the backend name in order
to avoid clashes: "weston_windowed_output_api_<backend>_v2".

A use case for Wayland or X11 as primary backend and headless as
secondary is for instance to request output captures on the headless
backend to avoid read backs on the primary backend's render buffers.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-03-12 18:35:57 +00:00
Marius Vlad 1eae99b2ee stream-pipewire: Add a helper script for the pipewire backend
This is mostly for a easy way to stream out content from the pipewire
backend.

Similarly to the rdp script this can used on the server after checking the
pipewire id. On the remote side the rdp script can be used. Script
mentions that as usage.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-03-11 12:31:55 +00:00
Marius Vlad b93335a741 backend-pipewire: Move region initialization at the start
Failure to do so, might cause a crash if the output repaint happens
before the pipewire pipeline started -- calling pixman_region32_fini on
a uninitialized region.

Fixes 2abe4efcf7, "libweston/backends: Move damage flush into backends"

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-03-11 12:31:55 +00:00
Loïc Molinari 4861b19f3d gl-renderer: Enable async output capture support for OpenGL ES 2
Plug async read back support to OpenGL ES 2 implementations using
GL_NV_pixel_buffer_object, GL_OES_mapbuffer extensions and
GL_EXT_map_buffer_range.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-03-08 13:12:13 +00:00
Loïc Molinari b5553cb5dd gl-renderer: Use fence sync to listen for async capture completion
Using a fence sync triggered on read back completion allows to
precisely know when it completed. The timeout path is kept as a
fallback when fence syncs aren't available.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-03-08 13:12:13 +00:00
Loïc Molinari f1f921b8cf gl-renderer: Validate SHM stride in common output capture path
SHM buffer stride validation is duplicated in sync and async output
capture paths. Move it into a common path to avoid duplication.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-03-08 13:12:13 +00:00
Loïc Molinari b9be532b27 gl-renderer: Add OpenGL ES 3 async output capture support
ReadPixels() implies a synchronous read back of the render buffer to
return pixel data. OpenGL ES 3 adds asynchronous read back support by
writing the pixel data into a dedicated buffer object. This commit
adds asynchronous read back support to the output capture code. It
spawns a read back request and schedules a timeout a few frames later
in order to store the pixels into the client SHM buffer.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-03-08 13:12:13 +00:00
Pekka Paalanen 5223b8430e color-lcms: move 3D LUT vs. blend-to-output assert
There is no reason why cmlcms_fill_in_3dlut() would not work for
blend-to-output category, so the assert is a little misplaced.

However, there would be a bug if 3D LUT was used for blend-to-output,
because we should never fail to optimize that chain. Put the assert
where it belongs.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-03-07 14:50:47 +00:00
Pekka Paalanen 4b9fa23ec6 color-lcms: stop hard-coding blend-to-output transformation
Stop special-casing the blend-to-output category, and pass it through
the same mechnisms and optimizations as all other transformations. In
the future, more curve types will be added to weston_color_transform,
meaning that blend-to-output does not always have to be a LUT. It could
become a parametric curve, which is more efficient and more precise to
compute, when VCGT does not exist.

Drop the special crafting of output_inv_eotf_vcgt LUT and replace it
with inv_eotf cms profile. inv_eotf will be combined with vcgt cms
profile as a chain as needed instead.

Blend-to-output transformations do not use a render intent, but we have
to tell cmsCreateMultiprofileTransformTHR() something, so arbitrarily
pick ICC-Absolute render intent for it.

Now all color transformations go through xform_realize_chain(), where
the documentation is improved.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-03-07 14:50:47 +00:00
Pekka Paalanen 98454720be color-lcms: convert VCGT curves to lcmsProfilePtr
We need it as a cms profile, so let's make it one to start with. We even
gain non-datal error handling.

This will also be useful in rewriting output_inv_eotf_vcgt next.

The type change of vcgt_curves is required to be able to call
cmsCreateLinearizationDeviceLinkTHR(), even though everything about
vcgt_curves should be doubly const. The curves are populated on demand
and cached in cmsHPROFILE, so we also must not explicitly free them.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-03-07 14:50:47 +00:00
Pekka Paalanen fd63243c02 color-lcms: convert output eotf from curves to lcmsProfilePtr
We need it as a cms profile, so let's make it one to start with. We even
gain non-fatal error handling.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-03-07 14:50:47 +00:00
Pekka Paalanen 236ee19ed4 color-lcms: wrap cmsHPROFILE type
cmsHPROFILE is a typedef of void *.

This means you can change the type of pointer variable to or from
cmsHPROFILE, and the compiler will not see any difference. The compiler
is happy to implicitly cast any pointer type to cmsHPROFILE and back.

In order to bring some type safety for future refactorings that will be
doing such type changes, introduce a wrapper struct. The wrapper being
an actual unique type will not allow implicit casting.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-03-07 14:50:47 +00:00
Pekka Paalanen 570b348f45 color-lcms: replace comments in ensure_output_profile_adds_icc()
I did not understand the old comments. The new comments explain what
happens here.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-03-07 14:50:47 +00:00
Pekka Paalanen 547dc2738a color-lcms: improve ensure_output_profile_extract() error reporting
Return an error string so we can report the cause in more detail.

For consistency, add checking for VCGT dup failure, so we can report
that too. Leaking partial VCGT array on VCGT dup failure is fixed.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-03-07 14:50:47 +00:00
Pekka Paalanen 3488e2403f color-lcms: refactor into ensure_output_profile_extract()
Refactor and rename retrieve_eotf_and_output_inv_eotf().

Refactoring to make the calls more convenient to read, and preparation
for changing the object types for the curves.

ensure_output_profile_extract() reserves a place for another function
that works on parametric profiles instead of ICC profiles.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-03-07 14:50:47 +00:00
Pekka Paalanen 7ccb9736b3 color-lcms: move output-only fields from cmlcms_color_profile
Refactoring to allow the next patch, no functional changes.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-03-07 14:50:47 +00:00
Pekka Paalanen 5d6e7115a9 color-lcms: make identity_pipeline comment more detailed
This perhaps better explains what the issue here is.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-03-07 14:50:47 +00:00
Pekka Paalanen e6551ef41f color-lcms: remove stale comments about eotf_mode
The plan is to have the frontend decide on the EOTF mode and colorimetry
mode, but also the frontend is responsible for setting up a color
profile that matches the chosen modes. Therefore we don't need to care
about the modes explicitly here.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-03-07 14:50:47 +00:00
Pekka Paalanen 07eeed8f90 color-lcms: simplify getting render intent
Render intent does not depend on the output (profile), so drop that
argument. Render intent does not apply in blend-to-output category in
our design, so make it NULL there. Then, we only need to check the
surface for a render intent from a client.

The assert is dropped, because we don't need to advertise to clients all
the rendering intents we support internally. Even though we do.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-03-07 14:50:47 +00:00
Pekka Paalanen 0d3fa81840 color-lcms: handle NULL render intent
The clean-up following this patch will set the render intent field to
NULL when it does not apply (blend-to-output transformation). Make sure
we handle it.

In the search param string, fix a typo, and stop claiming we get a
render intent from a profile; we never do.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-03-07 14:50:47 +00:00
Loïc Molinari bc2d30050b gl-renderer: Only update y2 when merging damage rects
No need to update x1, x2 and y1 when merging a damage rect into a
previous one because they don't change. Melt merge_rect() into the
band compression routine as it's quite short now and convert the
boolean-based for/else construct to a more concise goto-based one.

Describe the compression logic to give a bit more context.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-03-05 11:48:17 +00:00
Loïc Molinari 7ba16ef264 gl-renderer: Prevent programming errors on damage regions
transform_damage() expects a non-empty damage region. Remove
compress_bands()'s run-time handling of errors and use asserts to
prevent programming errors.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-03-05 11:48:17 +00:00
Loïc Molinari 946bb51a2a gl-renderer: Test axis alignment once per paint node
The axis alignment test is part of the damage transformation routine
executed for each damage rect. Extract it in order to compute it once
per paint node.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-03-05 11:48:17 +00:00
Loïc Molinari 445e83c417 gl-renderer: Transform damage rects once per paint node
Previous commit ensured damage rects compression (first step) happens
just once when a paint node both has an opaque and a translucent
region. This one makes sure that the damage rects transformation to
surface space (second step) happens just once.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-03-05 11:48:17 +00:00
Loïc Molinari 2170caade0 gl-renderer: Compress damage rects once per paint node
Before rendering a surface, its visible region is intersected with the
damage region in global space. The resulting region is compressed
(first step) and transformed to surface space (second step) for
clipping. These steps sometimes happen twice when a paint node both
has an opaque and a translucent region. This commit makes sure the
first step happens just once.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-03-05 11:48:17 +00:00
Loïc Molinari 2d71347397 gl-renderer: Move functions to ease next commit review
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-03-05 11:48:17 +00:00
vanfanel 90664b0f3b libweston: enable pointer constraints for fullscreen surfaces.
Signed-off-by: vanfanel <redwindwanderer@gmail.com>
2024-03-04 12:45:07 +01:00
Witold Lipieta 215cceb45d desktop-shell: shell: Capture input on fade animation curtain
Shell fades out and in depending on user interactions. When screen
is faded out, first interaction wakes up the shell from idle and screen
fades back in. However, this first interaction is applied to whatever
is "behind" faded screen and it may trigger unwanted actions (first
touch or mouse click on active GUI elements). Behavior is the same for
both idle and lock screen (because unlock dialog is created after the
first interaction).

Update fade animation curtain creation function to capture inputs in
order to prevent unwanted interactions within faded or locked shell.

Fixes issues #147 and #569.

Signed-off-by: Witold Lipieta <witold.lipieta@thaumatec.com>
2024-02-29 15:29:23 +01:00
Pekka Paalanen 7e22c28444 color: declare cm_image_desc_info
Fixes compiler warnings about the declaration in function signatures not
applying outside of the functions.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-02-23 16:46:39 +02:00
Pekka Paalanen 61b3ae335a color-lcms: clean up context in init failure
This is not strictly necessary, because if init fails, then
weston_compositor_backends_loaded() fails, main.c will
weston_compositor_destroy() -> weston_compositor_shutdown() ->
cmclcms_destroy() which will free this. But that is very hard to track
down, so let's make the code obviously more correct.

We must also avoid cmsDeleteContext(NULL), because it will then do
something to the default cms context rather than bail out.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-02-23 16:46:39 +02:00
Pekka Paalanen 80c0d5e643 color-lcms: create log scopes in cmlcms_init()
This does not change any behaviour, but creating complex dynamic things
was intended to be done in init() rather than color_manager_create().

Create is called from weston_compositor_load_color_manager() before
loading backends, and init is called from
weston_compositor_backends_loaded() after loading backends.

Now we assert instead of check that scope creation succeeded, because
the only way it could fail is to have small memory allocations fail, or
internal code error.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-02-23 16:46:39 +02:00
Pekka Paalanen 3e9f8402ad color-lcms: move two functions up in file
No changes to the functions at all. This makes them available for use in
cmlcms_init() for the next patch.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-02-23 16:46:39 +02:00
Pekka Paalanen dcaff175b4 libweston: assert that color manager supports perceptual
This is required by the protocol spec.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-02-23 16:46:39 +02:00
Pekka Paalanen bdea44919b shared: add weston_assert_bit_is_set()
Will be used in the next patch.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-02-23 16:46:39 +02:00
Pekka Paalanen d9a7b3795a libweston: move color-management protocol init call to core
This reverts commit 188a3ebd5e.

Call weston_compositor_enable_color_management_protocol() after
compositor->color_manager has been set, and so allows to check if the
color manager supports the features mandatory in protocol. The check is
added in the next patch.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-02-23 16:46:39 +02:00
Pekka Paalanen 35a580dab6 color-lcms: rename get_cprof_or_stock_sRGB to to_cprof_or_stock_sRGB
"Get" could imply increasing reference count, and color transform
objects indeed are reference counted, but this function does not do
that. Rename it to reduce confusion.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-02-23 16:46:39 +02:00
Pekka Paalanen 4f796a52e1 color: rename get_stock_sRGB_color_profile to ref_stock_sRGB_color_profile
This makes it more explicit that this indeed is increasing the reference
count, rather than just returning a pointer.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-02-23 16:46:39 +02:00
Pekka Paalanen ce51a04013 color-lcms: rename get_xform() to to_cmlcms_xform()
"Get" could imply increasing reference count, and color transform
objects indeed are reference counted, but this function does not do
that. Rename it to reduce confusion.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-02-23 16:46:39 +02:00
Pekka Paalanen 6fe294c18a color-lcms: rename get_cprof() to to_cmlcms_cprof()
"Get" could imply increasing reference count, and color profile objects
indeed are reference counted, but this function does not do that. Rename
it to reduce confusion.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-02-23 16:46:39 +02:00
Pekka Paalanen 952f3ef61d color-lcms: rename get_cmlcms() to to_cmlcms()
"Get" might easily imply reference counting, but there is none here.
"to" is more descriptive for a cast.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-02-23 16:46:39 +02:00
Pekka Paalanen f19b15e373 color-noop: rename get_cprof() to to_cmnoop_cprof()
"Get" could imply increasing reference count, and color profile objects
indeed are reference counted, but this function does not do that. Rename
it to reduce confusion.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-02-23 16:46:33 +02:00
Pekka Paalanen de1db83e04 color-noop: rename get_cmnoop to to_cmnoop
"Get" might easily imply reference counting, but there is none here.
"to" is more descriptive for a cast.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-02-23 16:31:40 +02:00
Leandro Ribeiro ffe08c4344 libweston: create/destroy color profile id generator in a safe point
Currently we create the color profile id generator in
weston_compositor_backends_loaded() and destroy it in
weston_compositor_shutdown().

If something goes wrong and Weston does not start properly, we end up
calling weston_compositor_shutdown() for a struct weston_compositor
whose color profile id generator is NULL, crashing.

This fixes that, creating/destroying the id generator in
weston_compositor_create()/destroy().

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2024-02-23 11:50:23 +00:00
Wujian Sun 042d02f422 libweston-desktop: Fix weston crash when lost the shsurf
The shell_surface may disappear when keyboard lost focus,
then the shsurf will be NULL.
Have an ahead check for shsurf before calling the callback
in weston_desktop_surface_foreach_child.

Fixes #811

Tested-by: Erkai Ji <erkai.ji@nxp.com>
Signed-off-by: Wujian Sun <wujian.sun_1@nxp.com>
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-02-23 10:14:42 +08:00
Loïc Molinari 31a9a4831f tests: Only wait for frame callback when necessary
Some tests don't need to wait for the frame callback when a surface is
moved. This commit renames the move_client() helper function to
move_client_frame_sync() so that tests which need synchronisation must
explicitely request it. This allows to get 4 more tests using
repaint only on capture and to speed up runtime.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-02-22 14:26:32 +00:00
Loïc Molinari 5791bdf6ec backend-headless: Improve documentation
Add a section about the headless backend to the main Weston manual
page and describe the current CLI options as well the new
`--refresh-rate` one.

Fix the incorrect list of supported transforms in the CLI usage.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-02-22 14:26:32 +00:00