Log layer priority only on change

Similar to reuse log print debug information only when the priority of a layer
changes not whenever priority gets updated but without change.

Otherwise the debug log is spammed (depending on LIFTOFF_PRIORITY_PERIOD).
This commit is contained in:
Roman Gilg 2020-02-26 11:23:26 +01:00 committed by Simon Ser
parent b713b17d31
commit a3b7c19204
No known key found for this signature in database
GPG key ID: 0FDE7BE0E88F5E48

14
layer.c
View file

@ -147,6 +147,17 @@ void layer_mark_clean(struct liftoff_layer *layer)
} }
} }
static void log_priority(struct liftoff_layer *layer)
{
if (layer->current_priority == layer->pending_priority) {
return;
}
liftoff_log(LIFTOFF_DEBUG, "Layer %p priority change: %d -> %d",
(void *)layer, layer->current_priority,
layer->pending_priority);
}
void layer_update_priority(struct liftoff_layer *layer, bool make_current) { void layer_update_priority(struct liftoff_layer *layer, bool make_current) {
struct liftoff_layer_property *prop; struct liftoff_layer_property *prop;
@ -158,10 +169,9 @@ void layer_update_priority(struct liftoff_layer *layer, bool make_current) {
} }
if (make_current) { if (make_current) {
log_priority(layer);
layer->current_priority = layer->pending_priority; layer->current_priority = layer->pending_priority;
layer->pending_priority = 0; layer->pending_priority = 0;
liftoff_log(LIFTOFF_DEBUG, "Layer %p has priority %d",
(void *)layer, layer->current_priority);
} }
} }