From 73f4867ba13e1035ccf03b014567e67d4fc69174 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Fri, 13 Aug 2021 12:41:36 +0200 Subject: [PATCH] Remove primary plane special case This doesn't work on i915. 8a971695bd3d ("test: introduce liftoff_mock_require_primary_plane") makes sure we catch this in the tests. --- alloc.c | 10 ++-------- plane.c | 23 ++++++++--------------- test/test_alloc.c | 12 ++++++------ 3 files changed, 16 insertions(+), 29 deletions(-) diff --git a/alloc.c b/alloc.c index 353b5ea..e9f0a19 100644 --- a/alloc.c +++ b/alloc.c @@ -127,7 +127,7 @@ plane_step_init_next(struct alloc_step *step, struct alloc_step *prev, if (layer != NULL) { zpos_prop = layer_get_property(layer, "zpos"); } - if (zpos_prop != NULL && plane->type != DRM_PLANE_TYPE_PRIMARY) { + if (zpos_prop != NULL) { step->last_layer_zpos = zpos_prop->value; } else { step->last_layer_zpos = prev->last_layer_zpos; @@ -212,9 +212,6 @@ has_allocated_layer_over(struct liftoff_output *output, struct alloc_step *step, if (i >= (ssize_t)step->plane_idx) { break; } - if (other_plane->type == DRM_PLANE_TYPE_PRIMARY) { - continue; - } other_layer = step->alloc[i]; if (other_layer == NULL) { @@ -253,9 +250,6 @@ has_allocated_plane_under(struct liftoff_output *output, if (i >= (ssize_t)step->plane_idx) { break; } - if (other_plane->type == DRM_PLANE_TYPE_PRIMARY) { - continue; - } if (step->alloc[i] == NULL) { continue; } @@ -311,7 +305,7 @@ check_layer_plane_compatible(struct alloc_step *step, } } - if (plane->type != DRM_PLANE_TYPE_PRIMARY && + if (layer != layer->output->composition_layer && has_composited_layer_over(output, step, layer)) { liftoff_log(LIFTOFF_DEBUG, "%s Layer %p -> plane %"PRIu32": " diff --git a/plane.c b/plane.c index 1e1835a..4b19e79 100644 --- a/plane.c +++ b/plane.c @@ -119,23 +119,16 @@ liftoff_plane_create(struct liftoff_device *device, uint32_t id) } /* During plane allocation, we will use the plane list order to fill - * planes with FBs. Primary planes need to be filled first, then planes - * far from the primary planes, then planes closer and closer to the - * primary plane. */ - if (plane->type == DRM_PLANE_TYPE_PRIMARY) { - liftoff_list_insert(&device->planes, &plane->link); - } else { - liftoff_list_for_each(cur, &device->planes, link) { - if (cur->type != DRM_PLANE_TYPE_PRIMARY && - plane->zpos >= cur->zpos) { - liftoff_list_insert(cur->link.prev, &plane->link); - break; - } + * planes with FBs. */ + liftoff_list_for_each(cur, &device->planes, link) { + if (plane->zpos >= cur->zpos) { + liftoff_list_insert(cur->link.prev, &plane->link); + break; } + } - if (plane->link.next == NULL) { /* not inserted */ - liftoff_list_insert(device->planes.prev, &plane->link); - } + if (plane->link.next == NULL) { /* not inserted */ + liftoff_list_insert(device->planes.prev, &plane->link); } return plane; diff --git a/test/test_alloc.c b/test/test_alloc.c index f1571ce..1eeec40 100644 --- a/test/test_alloc.c +++ b/test/test_alloc.c @@ -159,7 +159,7 @@ static struct test_case tests[] = { .height = 1080, .zpos = 1, .compat = { PRIMARY_PLANE }, - .result = PRIMARY_PLANE, + .result = NULL, }, { .width = 100, @@ -190,7 +190,7 @@ static struct test_case tests[] = { .height = 1080, .zpos = 1, .compat = { PRIMARY_PLANE }, - .result = PRIMARY_PLANE, + .result = NULL, }, { .width = 100, @@ -218,7 +218,7 @@ static struct test_case tests[] = { .height = 1080, .zpos = 1, .compat = { PRIMARY_PLANE }, - .result = PRIMARY_PLANE, + .result = NULL, }, { .width = 100, @@ -282,7 +282,7 @@ static struct test_case tests[] = { .height = 1080, .zpos = 1, .compat = { PRIMARY_PLANE }, - .result = PRIMARY_PLANE, + .result = NULL, }, { .width = 100, @@ -394,7 +394,7 @@ static struct test_case tests[] = { .height = 1080, .zpos = 1, .compat = { PRIMARY_PLANE }, - .result = PRIMARY_PLANE, + .result = NULL, }, { .width = 100, @@ -435,7 +435,7 @@ static struct test_case tests[] = { .height = 1080, .zpos = 1, .compat = { PRIMARY_PLANE }, - .result = PRIMARY_PLANE, + .result = NULL, }, { .width = 100,