mirror of
https://gitlab.freedesktop.org/emersion/libliftoff.git
synced 2025-01-30 20:34:19 +01:00
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:
parent
e85a1a5ecf
commit
c5d22e1310
2 changed files with 13 additions and 8 deletions
17
display.c
17
display.c
|
@ -416,10 +416,16 @@ static bool is_layer_allocated(struct plane_data *data,
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool has_composited_layer_on_top(struct liftoff_output *output,
|
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 *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) {
|
liftoff_list_for_each(other_layer, &output->layers, link) {
|
||||||
if (is_layer_allocated(data, other_layer)) {
|
if (is_layer_allocated(data, other_layer)) {
|
||||||
|
@ -431,7 +437,8 @@ static bool has_composited_layer_on_top(struct liftoff_output *output,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (other_zpos_prop->value > zpos) {
|
if (layer_intersects(layer, other_layer) &&
|
||||||
|
other_zpos_prop->value > zpos_prop->value) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -518,9 +525,7 @@ bool output_choose_layers(struct liftoff_output *output,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (plane->type != DRM_PLANE_TYPE_PRIMARY &&
|
if (plane->type != DRM_PLANE_TYPE_PRIMARY &&
|
||||||
zpos_prop != NULL &&
|
has_composited_layer_on_top(output, data, layer)) {
|
||||||
has_composited_layer_on_top(output, data,
|
|
||||||
zpos_prop->value)) {
|
|
||||||
fprintf(stderr, "Layer %p -> plane %"PRIu32": "
|
fprintf(stderr, "Layer %p -> plane %"PRIu32": "
|
||||||
"has composited layer on top\n",
|
"has composited layer on top\n",
|
||||||
(void *)layer, plane->id);
|
(void *)layer, plane->id);
|
||||||
|
|
|
@ -29,12 +29,12 @@ alloc_tests = [
|
||||||
'zpos-3x',
|
'zpos-3x',
|
||||||
'zpos-3x-intersect-fail',
|
'zpos-3x-intersect-fail',
|
||||||
'zpos-3x-intersect-partial',
|
'zpos-3x-intersect-partial',
|
||||||
#'zpos-3x-disjoint-partial',
|
'zpos-3x-disjoint-partial',
|
||||||
#'zpos-3x-disjoint',
|
#'zpos-3x-disjoint',
|
||||||
'zpos-4x-intersect-partial',
|
'zpos-4x-intersect-partial',
|
||||||
#'zpos-4x-disjoint',
|
#'zpos-4x-disjoint',
|
||||||
'zpos-4x-domino-fail',
|
'zpos-4x-domino-fail',
|
||||||
#'zpos-4x-domino-partial',
|
'zpos-4x-domino-partial',
|
||||||
]
|
]
|
||||||
|
|
||||||
foreach name : alloc_tests
|
foreach name : alloc_tests
|
||||||
|
|
Loading…
Add table
Reference in a new issue