weston_subsurface_commit_to_cache and weston_subsurface_commit are
trivial functions with single call sites. Eliminate them.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Now that we don't have a buffer_ref to manage outside the surface_state
struct, this function is a trivial wrapper.
Just inline it where it's used.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Use a buffer_ref here to allow us to remove the subsurface
cached_buffer_ref and keep it in the surface state struct instead.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
We don't need to define weston_compositor_build_view_list here, as it's
already defined before it's used.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
compositor.c is too big, let's try to peel off a bit of surface state
handling code into another file.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
I'll want to use this in another file soon, but for now let's just
clean up the extra prototypes.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Push the subsurface vs surface logic into weston_surface_commit so there's
just one function to call from surface_commit to handle both.
This is mostly preparation for splitting off a bunch of surface handling
functions into their own file later.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Do a subsurface cache flush in weston_subsurface_set_effectively_synchronized
instead of in the protocol handler.
This is just so when I move some functions into another file later, I don't
need to expose weston_subsurface_apply_from_cache().
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Finish up renaming functions so that committing state and applying state
have their own function names. This will be useful soon when we have a
mechanism to commit state into a queue and apply it later.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
To streamline state handling, push the weston_subsurface_parent_apply
calls and list walks into weston_surface_apply().
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
We have several places where we apply surface state, then walk the
subsurface list.
In surface_commit() however, we walk the list first then apply state.
Re-order surface_commit() so it's the same as the other sites.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Continue renaming "commit" functions to "apply" in anticipation of
a violent split between the two concepts.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
In a future commit, we'll need weston_subsurface_parent_commit sooner,
so just move both of these prototypes earlier in the file.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
We don't use it anymore, we just casually commit and expect that
applying clean state is harmless.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
It really doesn't matter if we do a little extra work here,
weston_subsurface_commit_from_cache() is harmless if called on clean state.
If this turns out to waste some cycles we can add some more dirty bits
later.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
We called subsurface_parent_commit with a flag to indicate whether we're
committing from a synchronized parent or not - this was used for
determining if a subsurface was effectively synchronized.
Now that we know whether a subsurface is effectively synchronized, we
can drop the parameter.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This was used to check if a subsurface was effectively sync,
and we now have a bool to check for that instead.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Keep track of subsurface effective sync status when it changes instead of
figuring it out when we need to know it.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Create a common weston_surface_apply() for both subsurface and normal
surfaces to push state through, as this will let us remove a bunch of
common code in the future.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Continuing to make a split between "commit" and "apply" in preparation
for a future where the application happens later.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
We'll eventually have a hard split between the commit and the application
of state, so rename this function to better indicate what it does.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Use the shared helper in order to avoid duplication. This will also
ensure that any format added to the test will also be usable by other
tests and clients.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
Factor out client-buffer creation into a helper library in order to
avoid duplication. This notably allows clients and tests to easily reuse
the dmabuf and yuv logic.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
Historically, weston-screenshooter attempts a capture on all
wl_outputs, and if any output fails to capture it exits immediately.
These days it's possible to set up the pipewire backend to mirror
a drm backend output. This leads to surprising behaviour if one
tries to screenshot while no pipewire client is in use. Since the
pipewire backend has no buffer to render into at this point, the
screenshot fails. The drm screenshot is then dropped on the floor
because one of the wl_outputs failed to capture.
Avoid this for now by just continuing in the case of such
"graceful failures". Though maybe in the future we should allow
picking a wl_output by name, or have a command line switch to
decide whether to stop after a failure or not.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
If there's no running connection, we can't capture, so just burn down any
waiting tasks so we don't assert later.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Listen to the capture destroy signal so we can prevent the async fd
source from causing a UAF.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
An output task may be destroyed by a client disconnect. This causes
problems for our drm backend's asynchronous capture task handler, which
currently has no way to notice this.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
No functional change.
This will help to keep the code more straightforward when
parametric<->ICC color transformations are added, and they need more
operations than just the cmap_3dlut for the 3D LUT.
Particularly, there will be a new flag telling if cmap_3dlut is
populated, and the flag is best set in init_icc_to_icc_chain() instead
of xform_realize_chain().
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
When crafting an ICC to ICC color transformation, all the steps in
weston_color_transformation are at disposal. In the future also
parametric<->ICC color transformations will be crafted using the same
ICC chain machinery. However, there some steps must be reserved for
additional operations.
Add a bit mask that tells which color steps can be used by
xform_realize_icc_chain().
Unfortunately the mask is most conveniently stored in struct
cmlcms_color_transform. The LittleCMS context user data is the only good
way of passing our own bits into the factory code, but the user data
cannot be reset without destroying the context. It is probably not safe
to destroy the context as long as we have any LittleCMS objects alive
and created in that context. Hence, the user data must out-live the
LittleCMS context.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
I will be adding a MAPPING value, and it would look odd without any
prefix. This adds a bit of namespacing.
The definition is moved to the header, because I will be needing it in
struct cmlcms_color_transform.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Split init_icc_to_icc_chain() into two parts:
- init_icc_to_icc_chain() is specific for ICC to ICC transformation
- xform_realize_icc_chain() can process any chain of cmsHPROFILEs
xform_realize_icc_chain() will be used by ICC-to-parametric and
parametric-to-ICC transformations in following commits.
No changes to functionality. 'extra' local variable is lost as unused.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
I will be splitting this function, and xform_realize_chain() matches the
parts I'm going to split out of it, while the remainder will be specific
to icc-to-icc transformations.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
In this patch we allow offloading the post-blend color transformation
to KMS.
As KMS currently only supports to offload the transformation in a LUT,
this may result in precision issues. So this introduces the config
option "offload-blend-to-output", which is disabled by default.
This option requires "color-management" to be enabled, otherwise it is
ignored.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
We already get the core section a few lines above, and no other call
get_section() call are made in between.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
This is a leftover from "color: do not use color steps for non-optimized
pipelines". If a xform don't have valid steps, it shouldn't have curves.
So this function should fail.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
At this point, the DRM/KMS API supports offloading post-blend color
xform only through LUT's. This is not ideal, and an API to improve that
should be proposed in the future.
But we still want to experiment with offloading pre-blend (not post)
color transformation through the colorop API, which is close to being
accepted upstream. But this requires us to offload post-blend as well.
weston_color_curve_to_3x1D_LUT() currently fails if we detect that
crafting a LUT from the color curve may result in bad precision.
Instead, let's add a boolean param to control if we forbid or not bad
precision. This should allow us to offload post-blend xform through
LUT's.
This also improves the error messages in this function.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Since commit "backend-drm: improve code that chooses output->format", we
changed how b->format (the GBM format from the config file) is used.
There are config options in weston.ini that allow us to ignore the GBM
format set. So what matters to us is which output->format is being used,
and we compute that in drm_output_pick_format_egl() and
drm_output_pick_format_pixman().
So remove these checks that disable underlay planes based on b->format,
keeping only the ones that depend on the output->format selection.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>