This will help us to debug our color pipeline optimizer without the
need to craft special ICC profiles for that. In this initial patch,
we are able to add matrices and curve sets to the pipeline and assure
that the optimizer is doing the right thing.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
At the moment, when we merge two curve sets it becomes a sampled one.
With this change, we start merging power-law curve sets and keeping them
as parametric, as we'd rather have a parametric curve than a sampled
one.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
At the moment, when we merge curves we transform them into sampled
curves, even if they were parametric before.
If we have two inverse parametric curve sets in sequence in the color
pipeline, we can drop them both, as merging them would result in the
identity curve. If we don't do that and merge the resulting identity
with another curve set, we'll end up with a sampled curve.
Start dropping inverse curve sets in sequence. This change help us in
the following scenarios:
pipeline:
curve set A, curve set B (inverse of A), curve set C (parametric)
Merging A and B results in identity, and merging that with C results in
a sampled curve. With our changes, we end up with curve set C intact,
and we'd rather end up with a parametric curve than with a sampled one.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Move code that depend on cmsGetToneCurveSegment() to a new file:
color-curve-segments.c
This help us to eliminate #if HAVE_CMS_GET_TONE_CURVE_SEGMENT scattered
around color-transform.c, making the code clearer and helping to avoid
mistakes.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
clang 17 complains that `fourcc` in `gl_renderer_fill_buffer_info()` is
uninitialized in the default case, because it fails to recognize that
if hit, that case will `assert(0)`. To get rid of this complaint, we can
just apply clang's suggestion and initialize the variable with 0 when
declaring it.
Signed-off-by: Max Ihlenfeldt <max@igalia.com>
We already only conditionally use base.offset when an icon exists. We
should also avoid trying to create a coordinate with a NULL icon, as it
will fire an assert().
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
If we want to support multiple backends, the compositor must take care
to call this once, at the appropriate moment, so stop letting the
backends handle compositor shutdown themselves.
Move the weston_compositor_shutdown() calls from the backend::destroy
callbacks into weston_compositor_destroy() and the calls in the backend
creation error paths into weston_compositor_load_backend().
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Add a weston_backend::shutdown callback to split out the part of
weston_backend::destroy that needs to be done before compositor
shutdown.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Before this patch, we would leak the drm_output if there was a pending
flip during shutdown.
Now we destroy the drm_output even if there's a pending flip (only
during shutdown, as we don't want to wait until flip completion to
destroy the output).
Also, it fixes a problem where weston_output_enable() is called right
after weston_output_enable() or weston_output_disable() and it could
fail to find available DRM objects (as they are only released after
the flip completion).
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Preserve the same order as desktop-shell for handling view (un)mapping,
so we can move these into a shared helper. These should have no
functional effect but provide a helpful bisect point.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Destroy the renderer before disconnecting the Wayland display.
Trying to destroy the GL renderer with the Wayland display already gone
crashes in the Mesa Wayland integration.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
After freeing the renderer, clear the compositor->renderer pointer to
avoid use-after-free errors.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Calling clip_transformed() 4 times in a row with the same polygon8 in
commit a4d31fa8bd introduced a bug
because the surf input is modified each time. This is fixed by working
on a local copy. The input parameter is marked constant to reflect the
change on the function prototype.
Fixes#764
Signed-off-by: Loïc Molinari <loic.molinari@gmail.com>
Prefer outputs that are not powered off when assigning a surface to an
output. If a surface covers the same area on two outputs, prefer the
one with the higher refresh rate.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
attach needs to consider the viewport as well, so it makes more sense
for attach to consistently access the weston_surface_state, rather than
part from the surface and part from a function argument.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Pull the buffer-size calculation in when we attach a new buffer. This
will be able to save us from doing the calculation at all in some cases.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Rebuilding regions can be an expensive operation, and we're adding more
of them. This means we need to be clever about when we actually do them.
Only dirty the paint nodes when the transform or buffer size has
actually changed, not on every commit.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Akin to the paint_node_status we already have, start also tracking a
surface dirty status. This will allow us to minimise the updates we need
to make.
Currently this is only collected, with no functional change made.
Signed-off-by: Daniel Stone <daniels@collabora.com>
If there is an opaque full-screen view with a compatible SHM client
buffer left after peeling off the client-side cursor view, bypass the
renderer and let Neat VNC read from the client buffer directly.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Instead of directly converting damage from pixman_region32_t in
global coordinates to pixman_region16_t in local coordinates,
use weston_region_global_to_output() to convert to pixman_region32_t
in local coordinates and then convert again to pixman_region16_t
in the same coordinate system, using vnc_region32_to_region16().
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
We previously had our own local variable for this, but now we can just
use the one in weston_compositor.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Until now we've only had the unadorned arithmetic functions, but they're
easy to abuse and tedious to use.
For now, we just add weston_coord_global_add/sub functions and use them
where appropriate.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This is stored as an unadorned weston_coord internally, but with getter
functions we can put together the appropriate global or surface
coordinate.
Use them where appropriate.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Let the GL renderer render to FBOs for RDP outputs and read the pixels
into the RDP frame buffer. This allows to run the RDP backend with the
GL renderer.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Add switch statements where renderer specific API is called to prepare
for adding GL renderer support. No functional change.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Partially revert commit 89e1831cd7 ("pixman-renderer: add
weston_renderbuffer and create/destroy interface") to bring back the
shadow_surface pixman image. The renderbuffer is only wrapped around it.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Translate damage extents used to calculate glReadPixels rectangle from
global to local coordinates.
Fixes: b1606a9f2c ("gl-renderer: support automatically downloading FBO renderbuffers")
Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
When an output is moved, all views that are not moving with it should
cause damage where they appear in it before and after the move, and all
prior damage should move with the output.
To avoid this complexity, just damage the full output after the move.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Track damage on struct weston_renderbuffer and drop the custom damage
region from struct wayland_shm_buffer.
Pass repaint damage to wl_surface_damage() instead of accumulated
renderbuffer damage.
Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
While the GL renderer is not able to directly render into the PipeWire buffers,
it is possible to read the rendered frame from the fbo into the PipeWire buffer.
Use the automatic download to add support for the GL renderer to the PipeWire
backend.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Instead of always initializing the Pixman renderer, make the initialization
dependent on the selected renderer. This makes it easier to add other renderers.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Make it easier to understand where ptr points to by using local variables for
the spa_buffer and spa_data.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Extract the pixman renderbuffer configuration from the add_buffer function into
a helper function to simplify the addition of the GL renderer.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Use helper function for setting up the pixman renderer to simplify the addition
of the GL renderer.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
clip_quad() is a dedicated clipping function for quads that doesn't
depend on any GL renderer internal structures. It can be moved out to
the clipper to be called by both the renderer and the clipping test
client without having to duplicate code.
Signed-off-by: Loïc Molinari <loic.molinari@gmail.com>