Log re-use only on change

On debug verbosity logging every reuse of planes is spamming the log making it
difficult to debug the process.

With this patch only the change of reusing the same allocation is logged and
how often the allocation was reused after this changed back again.
This commit is contained in:
Roman Gilg 2020-02-26 10:47:37 +01:00 committed by Simon Ser
parent 7f5b699f2c
commit b713b17d31
No known key found for this signature in database
GPG key ID: 0FDE7BE0E88F5E48
2 changed files with 28 additions and 1 deletions

27
alloc.c
View file

@ -558,6 +558,30 @@ static void update_layers_priority(struct liftoff_device *device)
}
}
static void log_reuse(struct liftoff_output *output)
{
if (output->alloc_reused_counter == 0) {
liftoff_log(LIFTOFF_DEBUG,
"Reusing previous plane allocation on output %p",
(void *)output);
}
output->alloc_reused_counter++;
}
static void log_no_reuse(struct liftoff_output *output)
{
liftoff_log(LIFTOFF_DEBUG, "Computing plane allocation on output %p",
(void *)output);
if (output->alloc_reused_counter != 0) {
liftoff_log(LIFTOFF_DEBUG,
"Stopped reusing previous plane allocation on "
"output %p (had reused it %d times)",
(void *)output, output->alloc_reused_counter);
output->alloc_reused_counter = 0;
}
}
bool liftoff_output_apply(struct liftoff_output *output, drmModeAtomicReq *req)
{
struct liftoff_device *device;
@ -573,9 +597,10 @@ bool liftoff_output_apply(struct liftoff_output *output, drmModeAtomicReq *req)
update_layers_priority(device);
if (reuse_previous_alloc(output, req)) {
liftoff_log(LIFTOFF_DEBUG, "Re-using previous plane allocation");
log_reuse(output);
return true;
}
log_no_reuse(output);
output_log_layers(output);

View file

@ -32,6 +32,8 @@ struct liftoff_output {
struct liftoff_list layers; /* liftoff_layer.link */
/* layer added or removed, or composition layer changed */
bool layers_changed;
int alloc_reused_counter;
};
struct liftoff_layer {