options: add always_rebind_pixmap debug option

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2024-04-13 12:36:58 +01:00
parent d5163f0a50
commit d7fdbdc4f1
No known key found for this signature in database
GPG Key ID: D3A4405BE6CC17F4
3 changed files with 15 additions and 2 deletions

View File

@ -229,6 +229,14 @@ bool paint_all_new(session_t *ps, struct managed_win *const t) {
win_bind_mask(ps->backend_data, w);
}
if (ps->o.debug_options.always_rebind_pixmap) {
auto pixmap = ps->backend_data->ops->release_image(
ps->backend_data, w->win_image);
assert(pixmap != XCB_NONE);
w->win_image = ps->backend_data->ops->bind_pixmap(
ps->backend_data, pixmap, x_get_visual_info(&ps->c, w->a.visual));
}
// The clip region for the current window, in global/target coordinates
// reg_paint_in_bound \in reg_paint
region_t reg_paint_in_bound;

View File

@ -629,8 +629,9 @@ const char *vblank_scheduler_str[] = {
[LAST_VBLANK_SCHEDULER] = NULL
};
static const struct debug_options_entry debug_options_entries[] = {
{"smart_frame_pacing", NULL, offsetof(struct debug_options, smart_frame_pacing)},
{"force_vblank_sched", vblank_scheduler_str, offsetof(struct debug_options, force_vblank_scheduler)},
{"always_rebind_pixmap", NULL , offsetof(struct debug_options, always_rebind_pixmap)},
{"smart_frame_pacing" , NULL , offsetof(struct debug_options, smart_frame_pacing)},
{"force_vblank_sched" , vblank_scheduler_str, offsetof(struct debug_options, force_vblank_scheduler)},
};
// clang-format on

View File

@ -92,6 +92,10 @@ struct debug_options {
int smart_frame_pacing;
/// Override the vblank scheduler chosen by the compositor.
int force_vblank_scheduler;
/// Release then immediately rebind every window pixmap each frame.
/// Useful when being traced under apitrace, to force it to pick up
/// updated contents. WARNING, extremely slow.
int always_rebind_pixmap;
};
/// Structure representing all options.