Add SWAY_DAMAGE_DEBUG

Setting it to "rerender" will always re-render everything
regardless of the damaged region. Setting it to "highlight" will
clear the screen and render only damaged regions.
master
emersion 7 years ago
parent fb932cf847
commit 55b855d867
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48

@ -846,11 +846,24 @@ static void render_output(struct sway_output *output, struct timespec *when,
wlr_renderer_begin(renderer, wlr_output->width, wlr_output->height);
bool damage_whole_before_swap = false;
if (!pixman_region32_not_empty(damage)) {
// Output isn't damaged but needs buffer swap
goto renderer_end;
}
const char *damage_debug = getenv("SWAY_DAMAGE_DEBUG");
if (damage_debug != NULL) {
if (strcmp(damage_debug, "highlight") == 0) {
wlr_renderer_clear(renderer, (float[]){1, 1, 0, 1});
damage_whole_before_swap = true;
} else if (strcmp(damage_debug, "rerender") == 0) {
int width, height;
wlr_output_transformed_resolution(wlr_output, &width, &height);
pixman_region32_union_rect(damage, damage, 0, 0, width, height);
}
}
struct sway_container *workspace = output_get_active_workspace(output);
if (workspace->sway_workspace->fullscreen) {
@ -905,6 +918,12 @@ renderer_end:
wlr_output->transform_matrix, 0, 0, 1);
}
if (damage_whole_before_swap || root_container.sway_root->debug_tree) {
int width, height;
wlr_output_transformed_resolution(wlr_output, &width, &height);
pixman_region32_union_rect(damage, damage, 0, 0, width, height);
}
wlr_renderer_scissor(renderer, NULL);
wlr_renderer_end(renderer);
if (!wlr_output_damage_swap_buffers(output->damage, when, damage)) {

Loading…
Cancel
Save