We're going to assert on a bunch of stuff, so let's put it in a function
to remove clutter.
For now it's trivial, but I'll be adding more tests shortly.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
It's the same as buffer->direct_display essentially 100% of the time,
except maybe if someone set weston_direct on a single-pixel-buffer, but
that's madness.
Just drop it entirely, and let the only existing reader of the variable
get it from the buffer directly.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Previously I didn't think we needed this set up before assign_planes, but
certainly in the near future we'll want access to these bits for plane
assignment. It should be harmless to move them all now.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Single-pixel buffers are, by definition, a single-colour fill across the
entire paint node. Use the draw_solid path for these where we can.
Signed-off-by: Daniel Stone <daniels@collabora.com>
When we're censoring output due to a content-protection mismatch, we
were setting draw_solid for the placeholder, but losing is_direct for
the original buffer.
There's no real effect with the current renderers, but best to be
consistent and make pnode->is_direct always accurate.
Signed-off-by: Daniel Stone <daniels@collabora.com>
On 32-bit ARM, tv_sec is of type long long int. Cast to int64_t and
use PRId64 from inttypes.h instead of %ld to silence these format
warnings:
.../libweston/compositor.c: In function 'weston_compositor_print_scene_graph':
.../libweston/compositor.c:9297:14: warning: format '%ld' expects argument of type 'long int', but argument 3 has type '__time64_t' {aka 'long long int'} [-Wformat=]
.../libweston/compositor.c:9322:16: warning: format '%ld' expects argument of type 'long int', but argument 3 has type '__time64_t' {aka 'long long int'} [-Wformat=]
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
And also for connector changes. This would allow tracking hot-plug
events from the udev/kernel and figure out that connector properties
changed.
Signed-off-by: Marius Vlad <marius.vlad@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>
When we have a mirror, it will be at the same x,y position as the output
it's mirroring. On hot unplug, the current logic results in the mirroring
output being moved to the left by the width of its target output. The
mirror will then be destroyed, and the views can be left dangling outside
of usable space when a hot plug restores the outputs.
Subtly change the reflow logic to only reflow outputs to the right of the
removed output by testing co-ordinates, instead of assuming that every
output in the list is to the right of the previous.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
For clients using old protocol versions, the WESTON_SURFACE_DIRTY_POS bit
currently gets set on any attachment. It should really only be set if
the attachment is non-zero.
Since it's possible to attach mulitple times, or to invoke
wl_surface.offset multiple times, let's allow clearing the bit so it
stays up to date with the state that will actually be used on commmit().
Currently, this is pointlessly pedantic, as we don't really do much with
the bit, but in a future commit I intend to use it to notice states that
may change visibility/occlusion status of a surface.
Signed-off-by: Derek Foreman <derek.foreman@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>
Add transform information to scene graph debug dumps, which can be
helpful in determining why application surfaces aren't ending up on
hardware planes.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
While this is generally drm specific stuff, it's leaked into paint nodes
a little bit already.
Pushing it into the core gives us the ability to print failure reasons
in the scene graph debug text (in a future commit), which can be very
informative.
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>
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>
On weston_output_repaint(), we have:
output_assign_planes(output);
...
output->repaint(output);
output_assign_planes() avoids calling output->assign_planes() when
output->disable_planes > 0. This brings a few complications to backends,
because they can't rely on the repaint loop starting from a certain
function: sometimes it starts from assign_planes(), others from
repaint().
Let's be more consistent: always call assign_planes() and let backends
handle output->disable_planes.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
This is a trivial change to allow passing a user-defined color to
specify the color for the placeholder.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
weston_surface retains a pointer to its associated output, but if the
output is destroyed, the pointer becomes invalid. In set_fullscreen(),
weston_shell_utils_get_focused_output may return this stale output via
weston_keyboard, leading to a use-after-free crash.
This change ensures the output reference is cleared when the output is
destroyed, preventing potential crashes.
Signed-off-by: zhou liang <liang.zhou@gehealthcare.com>
Add a function to move a view in front of a layer entry, so we can easily
add this functionality to lua-shell in a future commit.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
It has no more callers, and hasn't done what its name implies for a very
long time.
Remove it.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
weston_view_damage_below() does nothing but schedule a repaint, and a
repaint will be scheduled in weston_view_geometry_dirty_internal() anyway,
so remove the extra call.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Instead of calling weston_view_damage_below(), which only schedules a
repaint, call weston_view_schedule_repaint() instead.
The result is the same, but the code is less confusing.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Update transform only does something if we've called
weston_view_geometry_dirty_internal() previously to set the dirty flag.
weston_view_damage_below() just schedules a repaint, and
weston_view_geometry_dirty_internal() will already have done that.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>