In preparation for multi-backend support, add a list of backends to the
weston_compositor structure. Until backends are converted, this list
just contains the single weston_compositor::backend. Keep that pointer
for now, until the conversion is complete.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Most of these don't use the parameter that changes at all, but some get
a nice simplification.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
There are many times when we want to set a global position with a surface
offset added.
It's a fairly nasty operation, and most places in the code currently do
it naively, ignoring the painful existence of freeform window rotations
and other complex transforms that could be in play (but probably aren't)
Add a helper for this and convert existing usage.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Simple helper to multiply a surface coordinate by -1, -1. There are no
uses yet, but will be in a follow up patch that wants to have cursor
hotspots in their inverted form.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Let backends declare the presentation clocks they can use with a
new bitfield weston_backend::supported_presentation_clocks and set
presentation clock after loading the backend in the compositor.
Make weston_compositor_set_presentation_clock() internal and replace
weston_compositor_set_presentation_clock_software() with an exported
weston_compositor_backends_loaded(), which is called by the compositor
after the backend is loaded.
In the future, this can be extended to determine the subset of clocks
supported by all backends.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
The function find_focus_successor() is called when destroying a surface to find
a successor to the current focus. It, however, has the following issues:
- Its first parameter is the weston layer from which to search for a successor.
This is an unnecessary flexibility for our use, which only adds complexity to
the user of the function by having to make a call for each layer. We know
that we want to search for a successor first in the normal layer, and if that
fails, then in the inactive layer. So we change the signature of
find_focus_successor(), removing this first parameter.
- It includes logic to decide whether to do the search or not: if the destroyed
surface is different from the surface that currently has focus, and if their
outputs are the same, then abort and don't do the search. This returns NULL to
the calling function. The problem is that the function also returns NULL if
it does the search and finds no successor. The distinction for the failing
reason is lost, and the user of the function needs to add more logic to know
the reason for failure. To simplify, we take the logic out of
find_focus_successor() and inside the caller.
- It returns the successor view, although it receives surfaces and the client
has logic to retrieve the surface corresponding to the returned view. To
simplify and maintain symmetry, we change the signature so that the function
returns the surface corresponding to the successor view.
Fixes: #738
Signed-off-by: Sergio Gómez <sergio.g.delreal@gmail.com>
Currently this isn't calculated properly, and results in clipping away
important damage when a client moves from a non-primary plane to the
primary plane.
Instead of trying to fix it, let's just throw it away.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Currently dbus support is built when launcher-logind option
is set; let's split that such that dbus is its own option
and launcher-logind depends on dbus.
Signed-off-by: Christopher Obbard <chris.obbard@collabora.com>
Currently the dbus helper stuff is internal only in libweston,
let's move it to being public so that custom shells may use
the helper code.
Signed-off-by: Christopher Obbard <chris.obbard@collabora.com>
The primary_plane is currently shared amongst all outputs, and is the last
barrier to having overlapping outputs.
Split it up and make it per output instead.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
We're going to move primary planes from compositor to output, so we need
struct weston_plane to precede struct weston_output.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Remove plane->damage and instead accumulate damage on paint
nodes.
This is a step towards allowing multiple overlapping outputs.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Tracking the view's plane in the paint node in this way is a step towards
inflicting plane damage from paint node update during the output repaint,
instead of manually doing weston_view_damage_below().
We remove view->plane entirely and do all access through pnodes.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Later, we'll want to use the visible region for damage tracking in
paint_nodes. For now, we can use it in the renderers where they've been
calculating it independently to draw paint nodes.
We still can't remove view->clip entirely, because
weston_view_damage_below() may be called before the first render of
a view, when its visible region hasn't been calculated yet. The
clip is empty at that point, which allows weston_view_damage_below()
to "work".
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
In the future we'd like to have multiple overlapping outputs.
weston_output_damage() currently adds damage to the output's coordinates
on the primary plane. This plane is shared between all outputs, so it
would result in damaging more than the intended output.
Eventually, plane damage will go away and be replaced by paint node damage,
and damaging the entire output would involve adding damage to a list of
paint nodes.
Instead, use a flag to indicate the output must be fully redrawn, and add
the damage during the repaint loop.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Most of the time when we're changing things about views, we don't need
to throw away the view list and rebuild it from scratch. The only times
when we need to do this are when views have been added to or removed
from the scene graph, or have been restacked within it.
Signed-off-by: Daniel Stone <daniels@collabora.com>
There's no need to go through and rebuild the subsurface list every
time. In addition to being unnecessary work, it complicates things like
damage tracking.
Track a new surface dirty status indicating that the subsurface tree has
changed in some way, and only rebuild subsurface stacking when this has
occurred.
Signed-off-by: Daniel Stone <daniels@collabora.com>
This indicates that more than just the content changing, the form of the
buffer has changed in a way which may not be like-for-like to the
previous buffer but require significant reinterpretation. Examples
include the format, opacity, colour state, etc.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Instead of having a bool for whether or not a buffer has been attached
in this commit cycle, use a status bitmask.
Signed-off-by: Daniel Stone <daniels@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>
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>
Remove all handling of process/PID internals from libweston's Xwayland
launcher, and keep this only in the frontend. libweston now only sees
the wl_client and nothing else.
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>
Truncating a weston coord to integer values is something we do
frequently enough to warrant a helper function.
Use this in the kiosk and desktop shells where appropriate.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This adds three new helpers: one to iterate over all debug scopes
created/added and other two are for simpler getters for the scope name
and the description.
Included with this change is also a simple test to retrieve them.
This is an alternative to using the debug scope list advertised when
using the weston-debug private extension. libweston users can use this
directly to know which scopes they can subscribe to, and there's no need
to have a client implementation for the weston-debug protocol.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
This will be used to let know the constraints code that the reason for
activation is that the client has requested to set the surface to fullscreen.
Signed-off-by: Sergio Gómez <sergio.g.delreal@gmail.com>
Since we want to pass the view to the surface activation listener inside the
constraints code, and the surface is reachable from the view anyway.
The flags field will let us pass the reason for activation to the constraints
code, which will then handle especially the fullscreen case.
Signed-off-by: Sergio Gómez <sergio.g.delreal@gmail.com>
Pass the backend instead of the compositor to the PipeWire output API
create_head() method and increment the API version.
That way the backend will not have to find the backend pointer from the
compositor. This is trivial now, but in the multi-backend case would
entail iterating over all backends to find the correct one.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>