From 7c02655ee78c4e59dc812d5b2f9a341be3de1784 Mon Sep 17 00:00:00 2001 From: Roman Gilg Date: Wed, 26 Feb 2020 19:11:20 +0100 Subject: [PATCH] feat: log output relevant data Log the creation of outputs and simplify output-specific data on apply. --- alloc.c | 16 ---------------- output.c | 13 ++++++++++++- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/alloc.c b/alloc.c index c1c8270..ab93047 100644 --- a/alloc.c +++ b/alloc.c @@ -571,21 +571,6 @@ static void log_reuse(struct liftoff_output *output) output->alloc_reuse++; } -static void log_no_reuse(struct liftoff_output *output) -{ - if (!log_has(LIFTOFF_DEBUG)) { - return; - } - - liftoff_log(LIFTOFF_DEBUG, "\nApply on output %p.", (void *) output); - - if (output->alloc_reuse != 0) { - liftoff_log(LIFTOFF_DEBUG, "Stopped reusing previous plane allocation on output %p. " - "Had reused it %d times.", (void *) output, output->alloc_reuse); - output->alloc_reuse = 0; - } -} - bool liftoff_output_apply(struct liftoff_output *output, drmModeAtomicReq *req) { struct liftoff_device *device; @@ -604,7 +589,6 @@ bool liftoff_output_apply(struct liftoff_output *output, drmModeAtomicReq *req) log_reuse(output); return true; } - log_no_reuse(output); output_log_layers(output); diff --git a/output.c b/output.c index 876654e..11fbe2b 100644 --- a/output.c +++ b/output.c @@ -23,8 +23,11 @@ struct liftoff_output *liftoff_output_create(struct liftoff_device *device, return NULL; } + liftoff_log(LIFTOFF_DEBUG, "Creating output for CRTC id: %"PRIu32 " index: %zu", crtc_id, crtc_index); + output = calloc(1, sizeof(*output)); if (output == NULL) { + liftoff_log_errno(LIFTOFF_ERROR, "calloc"); return NULL; } output->device = device; @@ -63,7 +66,15 @@ void output_log_layers(struct liftoff_output *output) { return; } - liftoff_log(LIFTOFF_DEBUG, "Layers on CRTC %"PRIu32":", output->crtc_id); + liftoff_log(LIFTOFF_DEBUG, "\nApply request for output %"PRIu32".", output->crtc_id); + + if (output->alloc_reuse != 0) { + liftoff_log(LIFTOFF_DEBUG, " Note: Reused previous plane allocation %d times.", + output->alloc_reuse); + output->alloc_reuse = 0; + } + + liftoff_log(LIFTOFF_DEBUG, "Layers:"); liftoff_list_for_each(layer, &output->layers, link) { if (layer->force_composition) {