From 53a7bfebc9520acecda30fd3c9f3c911608eba89 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Thu, 19 Dec 2019 17:49:18 +0100 Subject: [PATCH] Don't allocate planes for layers without a FB When FB_ID is unet or zero, don't try to allocate a plane for the layer. There's nothing to display anyway. --- alloc.c | 3 +++ include/private.h | 1 + layer.c | 7 +++++++ 3 files changed, 11 insertions(+) diff --git a/alloc.c b/alloc.c index c41de19..cecd6c1 100644 --- a/alloc.c +++ b/alloc.c @@ -418,6 +418,9 @@ bool output_choose_layers(struct liftoff_output *output, if (layer->plane != NULL || layer->force_composition) { continue; } + if (!layer_has_fb(layer)) { + continue; /* no FB set, nothing to display */ + } if (!check_layer_plane_compatible(step, layer, plane)) { continue; } diff --git a/include/private.h b/include/private.h index deed0d5..c0f7b84 100644 --- a/include/private.h +++ b/include/private.h @@ -84,6 +84,7 @@ void layer_get_rect(struct liftoff_layer *layer, struct liftoff_rect *rect); bool layer_intersects(struct liftoff_layer *a, struct liftoff_layer *b); void layer_mark_clean(struct liftoff_layer *layer); void layer_update_priority(struct liftoff_layer *layer, bool make_current); +bool layer_has_fb(struct liftoff_layer *layer); struct liftoff_plane *plane_create(struct liftoff_device *device, uint32_t id); void plane_destroy(struct liftoff_plane *plane); diff --git a/layer.c b/layer.c index e3d6bbc..7b91a40 100644 --- a/layer.c +++ b/layer.c @@ -160,3 +160,10 @@ void layer_update_priority(struct liftoff_layer *layer, bool make_current) { (void *)layer, layer->current_priority); } } + +bool layer_has_fb(struct liftoff_layer *layer) { + struct liftoff_layer_property *fb_id_prop; + + fb_id_prop = layer_get_property(layer, "FB_ID"); + return fb_id_prop != NULL && fb_id_prop->value != 0; +}