From 1700cbf1c921881bd5939db22b67b2036d06d1e5 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Sat, 5 Dec 2020 12:18:36 +0100 Subject: [PATCH] Force re-alloc when setting FB to 0 --- alloc.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/alloc.c b/alloc.c index 3f4974d..78f07c1 100644 --- a/alloc.c +++ b/alloc.c @@ -496,12 +496,18 @@ static bool layer_needs_realloc(struct liftoff_layer *layer) if (!prop->changed) { continue; } + + /* If FB_ID changes from non-zero to zero, we don't need to + * display this layer anymore, so we may be able to re-use its + * plane for another layer. If FB_ID changes from + * non-zero to non-zero, we can try to re-use the previous + * allocation. */ if (strcmp(prop->name, "FB_ID") == 0) { - if (layer->force_composition) { + if (layer->force_composition || prop->value == 0) { return true; } /* TODO: check format/modifier is the same. Check - * previous/next value isn't zero. */ + * previous value isn't zero. */ continue; }