Merge pull request #2093 from emersion/damage-debug

Add SWAY_DAMAGE_DEBUG
This commit is contained in:
emersion 2018-06-03 10:31:19 +01:00 committed by GitHub
commit ebe0b668c9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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)) {