Unused.
This was using the old way of getting screenshots: hooking to
weston_output::frame_signal and calling weston_renderer::read_pixels().
This old way stalled Weston until the GPU work was complete, and
supported only wl_shm buffers.
At this time there is no libweston API for frontends/plugins to ask for
a screenshot, but there is a protocol interface in
weston-output-capture.xml.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This should cut the cost of debug_scene_view_print_buffer() in half on
ARM A55 CPU. Debug printing is quite expensive on such platform.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Printing directly into an stdio stream and hooking up to the flush (the
write callback) avoids having to allocate+free a temporary buffer on
every printing call. The FILE uses a permanent buffer for storing the
text, and once it fills up or a newline is detected, it is flushed out.
It is fine to mix the new and the old APIs, since the old API flushes
the stream.
The buffer size of 3 kB is just a guess.
The man-page for fopencookie() recommends setting _FILE_OFFSET_BITS to
64. Even though this patch does not strictly need it (we don't implement
seek or take the address of fopencookie()), I think it's good to follow
anyway.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This adds a new output color effect: grayscale. It takes RGB color as
input and computes a gray pixel color using the luminance formula for
linear sRGB:
Y = 0.2126 * R + 0.7152 * G + 0.0722 * B
Just like the other color effects we have, this only works for sRGB and
are not enabled when color-management is on.
Note: although the technique is designed to be applied in linear, it's
costly to convert to linear and then back to electrical. As doing the
conversion in electrical still gives a reasonable result, we do it this
way. When we add support for color effects with color-management on,
we'll apply the effect in linear.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
struct weston_curtain_params is changed to match the new
weston_surface_set_label() API. For now, I did not bother hooking up the
static label flavor.
Part of migration away from get_label().
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
To update the surface label based on client-controllable fields like
app_id and title we need to use a listener and update the label
accordingly using weston_surface_set_label() added previously.
The added weston_desktop_surface_make_label() will eventually supersede
weston_shell_utils_surface_get_label() by having a more fluent API.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This is an alternative to using set_label_func to avoid using get_label()
callback. get_label() is inconvenient to set up and to call. It incurs
the cost of creating the string every time it is needed. During
debug logging, the string is needed much more often than it changes.
The new label field simply stores the string, making it easy and cheap
to use. As the trade-off, components that set the label string must
re-create the string when it changes, whether it is needed or not.
For the migration to the new label field, get_label_member callback is
used. It will be deleted once the migration is done.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Doing
weston_log_subscription_printf(sub, "%s", str);
would malloc a new buffer, copy str into it, flush it our to the
subscriber, and free the buffer before returning.
Using weston_log_subscription_write() instead there is no malloc and
copy. Only open_memstream() has a malloc'd temporary buffer.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Views did not have any identification of their own, except the memory
address "%p" (not human-readable) and very likely assumption that a
surface would have only one view (but we support multiple views).
For trace and debug print purposes, give views nice names like we just
added for surfaces. The owning surface is apparent from the view name.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
So far we have had two ways of identifying a weston_surface: by its
memory address "%p", and by its get_label function. The memory address
is not human-friendly and can get recycled. get_label() is not unique,
and in some cases it is client-controllable.
Oh, we also have the protocol object ID, but that does not exist for
internally created weston_surfaces.
We also have weston_surface::s_id, damage_track_id and flow_id. These
are used by some Perfetto instrumentation. s_id comes from a
compositor-wide counter rather than per-client counter, the others are
probably not what I'm looking for.
None of these are really nice for trace and debug prints for identifying
surfaces for human reading. Therefore, let's add one more ID, and with
it, a nice name for each surface.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This adds the framework to track clients with custom data. The first use
is to associate an ID with each client. The ID is much better suited for
debug printing than a pointer value.
The string representation is stored so that it can be overridden if
desired for compositor forked clients like Xwayland or shell helpers.
Change to a struct in the public header forces a major version bump for
this development cycle.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Backends can end up in indeterminate/invalid state and be unable to
process updates.
Add a way for the backend to tell the core to stop scheduling repaints,
and a way for the backend to schedule all the repaints that should have
taken place during the invalid state period.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
CVD correction is composed by a linear transformation, so we should be
able to collapse it into a single matrix multiplication:
Y = M * X
Where Y is the result, X is the original color, and M is the CVD
correction matrix.
As we need to perform CVD correction for every pixel, this can be
beneficial for limited hardware.
In this patch we do that, updating the libweston core code and also the
GL-renderer and its fragment shader.
Suggested-by: Christopher Healy <healych@amazon.com>
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
When repainting a paint node, if the buffer is a solid color buffer we
may skip the rendering pipeline and directly call glClear() with the
solid color, for optimization purposes.
Currently there's a bug where if the output has an output color effect
set, it is skipped when we have a solid color buffer (as we don't go
through the rendering pipeline, where the effects are implemented).
When we have color-management and the paint node contains a color xform,
we've opted for skipping this optimization and going through the
rendering pipeline for now. However, output color effects are simple,
so let's add the logic to apply them on CPU when we have a solid color
buffer.
Reported-by: Christopher Healy <healych@amazon.com>
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
For now limited to coefficients and ranges that are typically
supported by KMS drivers. We notably leave out alpha modes and
chroma locations for now.
The protocol initialization is guarded by the WESTON_CAP_COLOR_REP
backend capability and thus not enabled anywhere yet.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
Introduce support for the commit-timing protocol to allow applications
to attach a presentation time to a content update.
We use the repaint timer to schedule content updates in advance of
the frame time when they should be displayed.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
In the near future commit-timing + VRR combined will want to have better
than the 1ms precision we're allowed now.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
These are used to determine if the previous frame was displayed with
tearing, which is useful in determining when the next frame time should
be.
Store these as a step towards breaking the frame time calculations out
of output_finish_frame into a separate function.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
For the upcoming commit-timing protocol, we're interested in when a
scheduled repaint will be displayed, so let's keep track of both the
repaint time and the anticipated presentation time.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
When running headless, weston will not expose a wl_seat.
This was removed with commit a1046adc ("compositor-headless: do not
create a seat").
However, some applications, namely GTK3 based, will log a warning when
there is no wl_seat:
| gdk_seat_get_keyboard assertion GDK_IS_SEAT(seat) failed
While this is arguably a bug in GTK3 which should not complain with a
legit setup, that breaks the CI of those projects when using Weston,
while most of the other Wayland compositors will create a fake seat when
running headless, making weston the odd ball there.
This changes adds a new option "--fake-seat" that will instruct weston
to create a seat when running headless. The default remains not to
create a seat though, so backward compatibility is preserved.
This partially reverts commit a1046adc66.
See-also: https://gitlab.freedesktop.org/ofourdan/xwayland-run/-/issues/12
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Add support for the fifo protocol, which allows an application to submit
a content update that can only be applied after the previous content
update has been active for a display refresh.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Now that we have surface-state application streamlined, it's fairly easy to
add a framework for deferring content updates.
This will be used soon for fifo and commit timing. For now, the
weston_surface_state_ready() call that makes any of this do something
will always return true.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Keep track of whether a view has any unoccluded pixels on an output,
use this information to add a weston_surface_visibility_mask() function
that we'll use later.
Since the visibility information is calculated at repaint, and invalidated
by some (but not all) state updates, we'll keep track of when the previous
repaint's status is still valid by watching surface status bits.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Latch is the moment when the compositor considers updates for an upcoming
redraw. Nothing that takes place after an output latches for repaint can
change what will be repainted.
This needs a more explicit treatment now that upcoming transactional
protocols require things to happen immediately after the latch (ie:
when it's too late to change the upcoming render).
Add an explicit latch point, a signal to tap for testing, and some asserts
to make sure nothing can violate the inevitability of the current render
state.
Note that currently latch is tied to repaint such that we only claim to
have latched when a repaint will happen. In a future commit this will lead
to forcing the repaint loop to fire without damage when the fifo protocol
needs something to happen after a latch. This could be an area for
future improvement.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
We're going to be adding protocols (commit-timing, fifo, syncobj) that
allow deferred surface content updates.
It makes sense to start the perfetto flow ids from the surface state so
we can track a flow from creation (ie:commit) to presentation.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
To accommodate some future CI bump to Trixie (doxygen/breathe issue)
move out the anonymous enum out of weston_output object.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
With the addition of the weston_output_set_ready() call, the shell fade
animation is now started during the very first repaint. The first repaint
doesn't have an accurate frame_time for the previous repaint, as none has
occurred yet.
Since we set the time base for an animation based on the output's frame
time the second time the animation is run, we end up setting the shell fade
start time to 0, and the first real repaint advances the timer to the real
time, generating a warning and truncating the animation.
Instead of tracking the number of animation frames, let's just continue to
reset the time base until we finally get a non-zero time.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This de-couples the compositor view build list from the paint node
ordered list to allow a more finer grain over what lists we need to
rebuild upon repaints.
As a consequence to that this avoids a trip over from the compositor
when paint nodes are destroyed and no longer re-created upon rebuilding
the view list.
Fixes: #1070
Fixes: abfe874a ("core: Don't rebuild view list on surface-local changes")
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
We've added a curtain to the shells so at startup we have something to
render, but this causes a flicker if someone is trying to have a seamless
transition from boot to weston.
Add a ready flag that allows the shell to indicate repaints are safe, so
we can remove the curtains and have no wasted frames at startup.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This already existed for surface, so it is trivial to add.
This will let the upcoming plane state reuse code notice a format change.
This is handy because a client might respond to dmabuf feedback by changing
formats, with the expectation that doing so would land content on a plane.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Future development will need to evaluate pipelines with curves and
matrices. Such pipelines naturally operate on vec3, as matrices cannot
be operated one channel at a time. Make weston_color_curve_sample()
operate on arrays of vec3.
Its currently only caller, weston_color_curve_to_3x1D_LUT(), is modified
to employ a temporary array for the API impedance mismatch. This
workaround will be removed later as weston_color_curve_to_3x1D_LUT()
itself will be converted to operate on vec3 arrays.
weston_v3f_array_to_planar() documentation was generated with AI.
weston_color_curve_sample() is restructured a little bit, attempting to
make it simpler to read.
color-operations.h gets the #includes needed to make it self-standing.
Assisted-by: Github Copilot (Claude Sonnet 3.5)
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
For some cases such as remote control, need to disable the interaction
between input device and the weston. It will not affect the use of input
device by other modules or applications.
Signed-off-by: Elliot Chen <elliot.chen@nxp.com>
Allow dictating which color format we'd like to use. This introduces the
front-end side and the core parts, leaving the EDID parsing and DRM
connector property for later patches.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
When we're going through assign_planes and repaint, give the backend an
opportunity to see what's changed during this repaint.
Signed-off-by: Daniel Stone <daniels@collabora.com>
The protocol does not carry target primaries by enumeration, but in
weston.ini I want to be able to use a name rather than raw values.
Adding this API makes that possible.
main.c cannot look up the enumeration itself, because color-properties.h
is private. As it should be.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This will be useful for parsing config file entries that have several
items on key, like x,y coordinates or a list of flags. Code reading
custom color profiles from weston.ini will use this.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
It is nice to see the numbers of a parametric color profile when created
from CTA or EDID or just to cross-check with weston.ini.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Output color effects are applied to the whole output scenegraph. It
depends on color-management being disabled, as the color effects are
applied in sRGB content.
For now we added only a few accessibility options: color inversion,
deuteranopia, protanopia and tritanopia CVD correction.
Note that surfaces presented on outputs that contains a color effect
can't be used for direct scanout (i.e. bypass composition and offloading
to KMS overlay planes). The color effect is applied in our GL-renderer.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
This is not what any sensible person would expect it to be. It was updated
by a walk of all the paint nodes on the output most recently repainted,
so if a view spanned outputs the visible region would only make sense
within the most recently painted output's region.
It's basically a scratchpad for a mid-repaint operation. Instead of making
it a view member, put it in the paint node, which are always per-output.
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 use it anymore, we just casually commit and expect that
applying clean state is harmless.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>