Add intersection checks for composited layer on top check

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 commit is contained in:
Simon Ser 2019-09-15 17:08:32 +03:00
parent e85a1a5ecf
commit c5d22e1310
No known key found for this signature in database
GPG key ID: 0FDE7BE0E88F5E48
2 changed files with 13 additions and 8 deletions

View file

@ -416,10 +416,16 @@ static bool is_layer_allocated(struct plane_data *data,
}
static bool has_composited_layer_on_top(struct liftoff_output *output,
struct plane_data *data, uint64_t zpos)
struct plane_data *data,
struct liftoff_layer *layer)
{
struct liftoff_layer *other_layer;
struct liftoff_layer_property *other_zpos_prop;
struct liftoff_layer_property *zpos_prop, *other_zpos_prop;
zpos_prop = layer_get_property(layer, "zpos");
if (zpos_prop == NULL) {
return false;
}
liftoff_list_for_each(other_layer, &output->layers, link) {
if (is_layer_allocated(data, other_layer)) {
@ -431,7 +437,8 @@ static bool has_composited_layer_on_top(struct liftoff_output *output,
continue;
}
if (other_zpos_prop->value > zpos) {
if (layer_intersects(layer, other_layer) &&
other_zpos_prop->value > zpos_prop->value) {
return true;
}
}
@ -518,9 +525,7 @@ bool output_choose_layers(struct liftoff_output *output,
}
if (plane->type != DRM_PLANE_TYPE_PRIMARY &&
zpos_prop != NULL &&
has_composited_layer_on_top(output, data,
zpos_prop->value)) {
has_composited_layer_on_top(output, data, layer)) {
fprintf(stderr, "Layer %p -> plane %"PRIu32": "
"has composited layer on top\n",
(void *)layer, plane->id);

View file

@ -29,12 +29,12 @@ alloc_tests = [
'zpos-3x',
'zpos-3x-intersect-fail',
'zpos-3x-intersect-partial',
#'zpos-3x-disjoint-partial',
'zpos-3x-disjoint-partial',
#'zpos-3x-disjoint',
'zpos-4x-intersect-partial',
#'zpos-4x-disjoint',
'zpos-4x-domino-fail',
#'zpos-4x-domino-partial',
'zpos-4x-domino-partial',
]
foreach name : alloc_tests