diff --git a/display.c b/display.c index 2ffd8f2..a606e54 100644 --- a/display.c +++ b/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); diff --git a/test/meson.build b/test/meson.build index 1102a17..faa9fbd 100644 --- a/test/meson.build +++ b/test/meson.build @@ -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', ] diff --git a/test/test_alloc.c b/test/test_alloc.c index 473e00f..9921452 100644 --- a/test/test_alloc.c +++ b/test/test_alloc.c @@ -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], }, }, },