mirror of
https://gitlab.freedesktop.org/emersion/libliftoff.git
synced 2025-01-18 10:27:00 +01:00
Add intersection check for planes under the current one
References: https://github.com/emersion/libliftoff/issues/3
This commit is contained in:
parent
c5d22e1310
commit
8617ddfd05
3 changed files with 38 additions and 6 deletions
38
display.c
38
display.c
|
@ -446,6 +446,37 @@ static bool has_composited_layer_on_top(struct liftoff_output *output,
|
|||
return false;
|
||||
}
|
||||
|
||||
static bool has_allocated_plane_under(struct liftoff_output *output,
|
||||
struct plane_data *data,
|
||||
struct liftoff_layer *layer)
|
||||
{
|
||||
struct liftoff_plane *plane, *other_plane;
|
||||
ssize_t i;
|
||||
|
||||
plane = liftoff_container_of(data->plane_link, plane, link);
|
||||
|
||||
i = -1;
|
||||
liftoff_list_for_each(other_plane, &output->display->planes, link) {
|
||||
i++;
|
||||
if (i >= (ssize_t)data->plane_idx) {
|
||||
break;
|
||||
}
|
||||
if (other_plane->type == DRM_PLANE_TYPE_PRIMARY) {
|
||||
continue;
|
||||
}
|
||||
if (data->alloc[i] == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (plane->zpos >= other_plane->zpos &&
|
||||
layer_intersects(layer, data->alloc[i])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool output_choose_layers(struct liftoff_output *output,
|
||||
struct plane_alloc *alloc, struct plane_data *data)
|
||||
{
|
||||
|
@ -512,11 +543,12 @@ bool output_choose_layers(struct liftoff_output *output,
|
|||
continue;
|
||||
}
|
||||
if ((int)zpos_prop->value < data->last_layer_zpos &&
|
||||
plane->zpos >= data->last_plane_zpos) {
|
||||
has_allocated_plane_under(output, data, layer)) {
|
||||
/* This layer needs to be under the last
|
||||
* allocated one, but this plane isn't under the
|
||||
* last one */
|
||||
/* TODO: don't skip if they don't intersect? */
|
||||
* last one (in practice, since planes are
|
||||
* sorted by zpos it means it has the same zpos,
|
||||
* ie. undefined ordering). */
|
||||
fprintf(stderr, "Layer %p -> plane %"PRIu32": "
|
||||
"plane zpos invalid\n",
|
||||
(void *)layer, plane->id);
|
||||
|
|
|
@ -32,7 +32,7 @@ alloc_tests = [
|
|||
'zpos-3x-disjoint-partial',
|
||||
#'zpos-3x-disjoint',
|
||||
'zpos-4x-intersect-partial',
|
||||
#'zpos-4x-disjoint',
|
||||
'zpos-4x-disjoint',
|
||||
'zpos-4x-domino-fail',
|
||||
'zpos-4x-domino-partial',
|
||||
]
|
||||
|
|
|
@ -315,7 +315,7 @@ static struct test_case tests[] = {
|
|||
.height = 100,
|
||||
.zpos = 2,
|
||||
.compat = FIRST_3_SECONDARY_PLANES,
|
||||
.result = &test_setup[3],
|
||||
.result = OVERLAY_PLANE,
|
||||
},
|
||||
{
|
||||
.x = 100,
|
||||
|
@ -324,7 +324,7 @@ static struct test_case tests[] = {
|
|||
.height = 100,
|
||||
.zpos = 3,
|
||||
.compat = FIRST_3_SECONDARY_PLANES,
|
||||
.result = OVERLAY_PLANE,
|
||||
.result = &test_setup[3],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue