This commit adds basic per-property change tracking.
When only FB_ID has changed, we try to re-use the previous allocation. If that
fails, go on with regular plane allocation.
Closes: https://github.com/emersion/libliftoff/issues/6
Instead of baking plane allocation constraints in output_choose_layers, extract
constraints checked at each step in check_layer_plane_compatible and final
constraints in check_alloc_valid.
Create a special layer that we will use only for composition.
If we manage to put all other layers into planes, we don't need to use it.
Otherwise, blend other layers that didn't make it in a plane.
This lets the library user define a layer where composition will happen. At the
moment there can be at most one composition layer per output, on the primary
plane. It should be possible to remove these restrictions in the future if
desirable.
The composition layer will be put on a plane if and only if composition is
needed.
The compositor needs to know where composited layers will be blended to resolve
zpos conflicts.
Closes: https://github.com/emersion/libliftoff/issues/9
If a plane was previously enabled on another CRTC, we need to set its CRTC_ID to
zero. Otherwise atomic commits fail with:
[drm:drm_atomic_check_only [drm]] [PLANE:31:primary A] CRTC set but no FB
Rename has_composited_layer_on_top to has_composited_layer_over. This is more
consistent with has_allocated_layer_over.
While at it, add a comment to explain why has_allocated_layer_over is named like
so.
Make sure we don't use planes with lower zpos for layers over the previous ones,
unless there is no collision.
This adds the last intersection check.
Closes: https://github.com/emersion/libliftoff/issues/3
And restore the original zpos-4x-disjoint test. Depending on the constraints on
the last two layers, one branch of the layer zpos check or the other is taken.
Fixes: 8617ddfd05 ("Add intersection check for planes under the current one")
has_composited_layer_on_top is now less strict and performs plane intersection
checks before returning true.
This allows for more layers to be assigned to planes, the relevant tests have
been enabled.
References: https://github.com/emersion/libliftoff/issues/3
This will be useful for implementing optimizations in case planes don't collide.
In these cases we can ignore some zpos constraints.
References: https://github.com/emersion/libliftoff/issues/3
This test makes sure composited layers make layers underneath fall back to
composition too, in a transitive manner. That is, if plane A is under plane B
which is itself under plane C, plane A falling back to composition means that
both planes B and C fall back to composition too (even if C isn't directly
underneath A).
If a layer cannot be mapped to a plane, make it so all layers under it also fail
plane allocation so that they can be properly composited on the primary plane.
A test was incorrect and has been fixed. Another test had two possible solutions
and has been updated with the one libliftoff yields.
zpos-3x maps three layers to primary, cursor and one of the overlays planes.
zpos-4x-partial sets up 4 layers but is only able to find a plane for 3 layers,
because ordering between the two overlay planes is undefined.