From 8d1dd038233cf946b36813c4c8508c17f4cda0fc Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Sat, 18 Aug 2018 16:58:50 +1000 Subject: Standardise debug variables This makes all debug options stored in a single struct rather than in various places, changes/fixes the behaviour of existing options, and introduces some new options. * Fixes damage issues with `-Drender-tree` texture (by removing scissor) * Offsets the render tree overlay's `y` position for those who have swaybar at the top * Replaces `-Ddamage=rerender` with `-Dnodamage` * Replaces `-Ddamage=highlight` with `-Dhighlight-damage` * Replaces `-Dtxn-debug` with `-Dtxn-wait` * Introduces `-Dnoatomic` * Removes the `create_time` and `ms_arranging` figures from transactions and the log message. Transactions are created after arranging and the create time is of no significance. * Fixes `-Dtxn-debug` (now `-Dtxn-wait`) not working. --- include/sway/debug.h | 19 +++++++++++-------- include/sway/server.h | 3 +-- 2 files changed, 12 insertions(+), 10 deletions(-) (limited to 'include') diff --git a/include/sway/debug.h b/include/sway/debug.h index 38d4eccd..5dcd9e00 100644 --- a/include/sway/debug.h +++ b/include/sway/debug.h @@ -1,15 +1,18 @@ #ifndef SWAY_DEBUG_H #define SWAY_DEBUG_H +#include -// Tree -extern bool enable_debug_tree; -void update_debug_tree(); +struct sway_debug { + bool highlight_damage; // Highlight regions of the screen being damaged + bool noatomic; // Ignore atomic layout updates + bool nodamage; // Render the full output on each frame + bool render_tree; // Render the tree overlay + bool txn_timings; // Log verbose messages about transactions + bool txn_wait; // Always wait for the timeout before applying +}; -// Damage -extern const char *damage_debug; +extern struct sway_debug debug; -// Transactions -extern int txn_timeout_ms; -extern bool txn_debug; +void update_debug_tree(); #endif diff --git a/include/sway/server.h b/include/sway/server.h index b93584b6..1e20f2c8 100644 --- a/include/sway/server.h +++ b/include/sway/server.h @@ -54,8 +54,7 @@ struct sway_server { struct wl_listener server_decoration; struct wl_list decorations; // sway_server_decoration::link - bool debug_txn_timings; - + size_t txn_timeout_ms; list_t *transactions; list_t *dirty_containers; }; -- cgit v1.2.3-54-g00ecf From f9563d88f30fd70c5999520fa7f4b3d0dffd1a4c Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Sun, 19 Aug 2018 11:29:59 +1000 Subject: Use enum for damage debug options --- include/sway/debug.h | 8 ++++++-- sway/desktop/render.c | 6 +++--- sway/desktop/transaction.c | 4 +--- sway/main.c | 8 ++++---- 4 files changed, 14 insertions(+), 12 deletions(-) (limited to 'include') diff --git a/include/sway/debug.h b/include/sway/debug.h index 5dcd9e00..bf3a5f6d 100644 --- a/include/sway/debug.h +++ b/include/sway/debug.h @@ -3,12 +3,16 @@ #include struct sway_debug { - bool highlight_damage; // Highlight regions of the screen being damaged bool noatomic; // Ignore atomic layout updates - bool nodamage; // Render the full output on each frame bool render_tree; // Render the tree overlay bool txn_timings; // Log verbose messages about transactions bool txn_wait; // Always wait for the timeout before applying + + enum { + DAMAGE_DEFAULT, // Default behaviour + DAMAGE_HIGHLIGHT, // Highlight regions of the screen being damaged + DAMAGE_RERENDER, // Render the full output when any damage occurs + } damage; }; extern struct sway_debug debug; diff --git a/sway/desktop/render.c b/sway/desktop/render.c index 8fc642a6..f6afb82b 100644 --- a/sway/desktop/render.c +++ b/sway/desktop/render.c @@ -834,9 +834,9 @@ void output_render(struct sway_output *output, struct timespec *when, goto renderer_end; } - if (debug.highlight_damage) { + if (debug.damage == DAMAGE_HIGHLIGHT) { wlr_renderer_clear(renderer, (float[]){1, 1, 0, 1}); - } else if (debug.nodamage) { + } else if (debug.damage == DAMAGE_RERENDER) { int width, height; wlr_output_transformed_resolution(wlr_output, &width, &height); pixman_region32_union_rect(damage, damage, 0, 0, width, height); @@ -918,7 +918,7 @@ renderer_end: wlr_render_texture(renderer, root_container.sway_root->debug_tree, wlr_output->transform_matrix, 0, 40, 1); } - if (debug.highlight_damage) { + if (debug.damage == DAMAGE_HIGHLIGHT) { int width, height; wlr_output_transformed_resolution(wlr_output, &width, &height); pixman_region32_union_rect(damage, damage, 0, 0, width, height); diff --git a/sway/desktop/transaction.c b/sway/desktop/transaction.c index 219f5362..8688fa13 100644 --- a/sway/desktop/transaction.c +++ b/sway/desktop/transaction.c @@ -345,9 +345,7 @@ static void set_instruction_ready( } instruction->container->instruction = NULL; - if (!txn_debug) { - transaction_progress_queue(); - } + transaction_progress_queue(); } void transaction_notify_view_ready_by_serial(struct sway_view *view, diff --git a/sway/main.c b/sway/main.c index 7a1afd4c..3ba4ba75 100644 --- a/sway/main.c +++ b/sway/main.c @@ -235,12 +235,12 @@ static void drop_permissions(bool keep_caps) { } void enable_debug_flag(const char *flag) { - if (strcmp(flag, "highlight-damage") == 0) { - debug.highlight_damage = true; + if (strcmp(flag, "damage=highlight") == 0) { + debug.damage = DAMAGE_HIGHLIGHT; + } else if (strcmp(flag, "damage=rerender") == 0) { + debug.damage = DAMAGE_RERENDER; } else if (strcmp(flag, "noatomic") == 0) { debug.noatomic = true; - } else if (strcmp(flag, "nodamage") == 0) { - debug.nodamage = true; } else if (strcmp(flag, "render-tree") == 0) { debug.render_tree = true; } else if (strcmp(flag, "txn-wait") == 0) { -- cgit v1.2.3-54-g00ecf