Add a signal for touch device creation to allow plugins to detect and
respond to touch device changes.
Signed-off-by: liang zhou <liang.zhou@gehealthcare.com>
Annotations give us a more generic way to incorporate flows into our
perfetto traces.
This will eventually let us remove some _FLOW() variants of our trace
macros.
It also lets us have multiple flows through the same function/annotation.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Replace weston_pointer_move with weston_pointer_move_to and drop
uneeded weston_pointer_motion_event, as weston_pointer_move_to
would clamp the pointer inside the output's area.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
This pointer is the same for the life of the view, even if the matrix
changes.
This is a last pedantic step towards preventing renderers from directly
accessing a weston_view.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Instead of having the drm backend calculate these per frame, let's store
them in the paint node when they change.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This was confusing, because it seemed to magically imply that we could
transform points by invalid transformations.
Rename and better define the variable.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Since a paint node is a combination of surface, view, and output, using
the surface flow in paint node functions can make a confusing twisty mess.
Perfetto flows have in/out degree of one, so we can't properly express the
1 surface to multiple paint nodes relationship with flows.
So for now let's break up the surface and paint node flows, but in the
future we'll have better ways to map multiple flow starts to the same
function via INSTANT events, and we'll be able to better link surface
content update to paint node render.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
A few custom shells want to know when the compositor is going to sleep.
This adds a new sleep signal and emits it when DPMS is going off.
To showcase the feature, this adds a sleep signal listener to
desktop-shell whose handler logs a message.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Since the commit "color-lcms: extract HDR static metadata from profile"
this was all dead code.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Backends should be relying on paint nodes for their information, not
views.
Since we always have a paint node when we want to pass a buffer, we can
pass that instead of a view.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Assertions are the usual way of failing tests in the compositor code,
but it means the test program cannot continue further. It would be
better to save an error exit code and run the compositor to the finish,
and then continue with the next test fixture.
I want to force some paths in GL-renderer output initialization for a
test, and fail otherwise. Calling weston_compositor_exit_with_code()
crashes there though, because the frontend has not installed the exit
handler yet.
Skip the exit handler if it's not there. The error exit code is still
saved, and will eventually bubble out of the compositor.
While at it, let's document these.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Rather than passing a NULL use sizeloc to pass the size. Otherwise
fflush(3) and fclose(3) would die out crashing in libc.
Use size also when printing out to a subscriber.
Fixes: e9665ef36
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Fix the following error:
Generating doc/sphinx/weston-doc-breathe with a custom command
FAILED: [code=1] doc/sphinx/weston
doc/sphinx/run_doxygen_sphinx.sh
/home/pq/git/weston/libweston/compositor.c:10001: error:
Found non-existing group 'client' for the command '@ingroup',
ignoring command (warning treated as error, aborting now)
Fixes: df622cbb20
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
I added these assert()s and have regretted it ever since. I'm sorry.
They've led to a bunch of places that just cargo-cult call
weston_view_update_transform() immediately after dirtying the transform,
as well as a lot of very carefully chosen places that took far too long to
sort out.
weston_view_update_transform() is an immediate return if the transform
isn't dirty, so let's just update them here instead of making everyone
think really hard about when to call weston_view_update_transform().
This should let us remove a few transform updates, and should
make the weston_coord functions a little easier to use.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
When a paint node is drawing rotated content, it's treated like its axis
aligned bounding box. Even if it only contains fully opaque content,
the parts of the axis aligned bounding box outside of that content
are not opaque.
We need to ensure we don't claim a paint node that isn't axis aligned
is fully opaque, or we'll improperly update regions outside of the
really opaque content.
Fixes 485e1796af
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
It makes more sense to update the transform than to bail.
These functions are sort of hints - they have to be correct when true, so
the previous code isn't really buggy. But they make more sense at a glance
this way.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
As weston_surface_attach_solid() can change quite a lot about a surface,
we need to mark it as dirty.
Signed-off-by: Daniel Stone <daniels@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>
Two lines open-coded in two places was not much a problem, but I'm going
to add a new member to weston_buffer that needs freeing, and I want to
do it in just one place.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Use fputs() as much as possible. My theory is that since fprintf() needs
to scan through the format string to find any formatting codes, it must
be less efficient than fputs() that does not scan.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This is useful for cases where we already have an open stream which we
can pass straight in and use it when printing node information.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Being able to print the scene-graph straight into a FILE removes one
temporary memory allocation that used to be mandatory. That memory
allocation is now gone from the DRM-backend debug log. It has moved into
the scene-graph log scope. In the case of
weston_log_subscription_printf() it shouldn't matter, because it is only
used when new subscribers appear.
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>
Use the new label field instead. The code becomes much simpler.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Subsurfaces labels do not have dynamic fields that change so we can just
use it as is.
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>
On the quest to delete the get_label() vfunc completely, a temporary
default get_label implementation needs to be plugged in. This would
affect all the code that checks whether the get_label vfunc is NULL.
Let's make get_label vfunc non-NULL always intentionally first. We can
delete all the code that checked for NULL, and the bespoke label
replacements in that case. Now all those different "no label" cases are
unified.
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>
weston_output_init() should be setting all members to a default value,
it can't assume anything is already 0.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Right now, any non-renderer plane only has a single paint node on it. It
can be useful to know what paint node that was after the damage flush.
This will be used shortly to simplify cursor handling in the drm backend.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
I found it confusing to read:
[view] view 3-2-1 will be placed on the renderer: no color transform
The view definitely has a color transform. What this means is:
[view] view 3-2-1 will be placed on the renderer: cannot off-load color transform
I hope that's more clear.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Makes the print-out a little bit tidier. Passing NULL for "%s" is
handled by glibc gracefully, but I'm not sure what standard requires it
if any.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
We have a consistent and more human-friendly name for views. Use it
instead of pointer values, view_idx, and protocol object ID. This makes
the scene-graph print more readable.
I presume the view_idx was just an ad hoc human-readable addressing for
views. It was stable only as long as the scene-graph didn't change. The
view internal_name is always stable and unique.
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>