mirror of
https://github.com/swaywm/sway.git
synced 2025-11-29 06:59:46 -05:00
Add support for tearing-control-v1
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3871 Adds option to allow tearing per output, as well as an option to force enable or disable tearing for a specific application using a window rule. Only works with fullscreen applications.
This commit is contained in:
parent
b881c2e84c
commit
9a1c411abd
20 changed files with 243 additions and 3 deletions
|
|
@ -232,6 +232,23 @@ static void output_configure_scene(struct sway_output *output,
|
|||
}
|
||||
}
|
||||
|
||||
static bool output_can_tear(struct sway_output *output) {
|
||||
struct sway_workspace *workspace = output->current.active_workspace;
|
||||
if (!workspace) {
|
||||
return false;
|
||||
}
|
||||
|
||||
struct sway_container *fullscreen_con = root->fullscreen_global;
|
||||
if (!fullscreen_con) {
|
||||
fullscreen_con = workspace->current.fullscreen;
|
||||
}
|
||||
if (fullscreen_con && fullscreen_con->view) {
|
||||
return (output->allow_tearing && view_can_tear(fullscreen_con->view));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static int output_repaint_timer_handler(void *data) {
|
||||
struct sway_output *output = data;
|
||||
|
||||
|
|
@ -275,6 +292,17 @@ static int output_repaint_timer_handler(void *data) {
|
|||
wlr_output_state_set_gamma_lut(&pending, 0, NULL, NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
if (output_can_tear(output)) {
|
||||
pending.tearing_page_flip = true;
|
||||
|
||||
if (!wlr_output_test_state(output->wlr_output, &pending)) {
|
||||
sway_log(SWAY_DEBUG, "Output test failed on '%s', retrying without tearing page-flip",
|
||||
output->wlr_output->name);
|
||||
|
||||
pending.tearing_page_flip = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!wlr_output_commit_state(output->wlr_output, &pending)) {
|
||||
sway_log(SWAY_ERROR, "Page-flip failed on output %s", output->wlr_output->name);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue