mirror of
https://github.com/swaywm/sway.git
synced 2025-11-24 06:59:51 -05:00
Add an adaptive_sync output command
This enables/disables adaptive synchronization on the output. For now, the default is disabled because it might cause flickering on some hardware if clients don't submit frames at regular enough intervals. In the future an "auto" option will only enable adaptive sync if a fullscreen client opts-in via a Wayland protocol.
This commit is contained in:
parent
9d0aa0cb83
commit
5d692b0581
7 changed files with 43 additions and 0 deletions
|
|
@ -64,6 +64,7 @@ struct output_config *new_output_config(const char *name) {
|
|||
oc->transform = -1;
|
||||
oc->subpixel = WL_OUTPUT_SUBPIXEL_UNKNOWN;
|
||||
oc->max_render_time = -1;
|
||||
oc->adaptive_sync = -1;
|
||||
return oc;
|
||||
}
|
||||
|
||||
|
|
@ -104,6 +105,9 @@ void merge_output_config(struct output_config *dst, struct output_config *src) {
|
|||
if (src->max_render_time != -1) {
|
||||
dst->max_render_time = src->max_render_time;
|
||||
}
|
||||
if (src->adaptive_sync != -1) {
|
||||
dst->adaptive_sync = src->adaptive_sync;
|
||||
}
|
||||
if (src->background) {
|
||||
free(dst->background);
|
||||
dst->background = strdup(src->background);
|
||||
|
|
@ -390,6 +394,10 @@ bool apply_output_config(struct output_config *oc, struct sway_output *output) {
|
|||
wlr_output_set_scale(wlr_output, scale);
|
||||
}
|
||||
|
||||
if (oc && oc->adaptive_sync != -1) {
|
||||
wlr_output_enable_adaptive_sync(wlr_output, oc->adaptive_sync == 1);
|
||||
}
|
||||
|
||||
sway_log(SWAY_DEBUG, "Committing output %s", wlr_output->name);
|
||||
if (!wlr_output_commit(wlr_output)) {
|
||||
// Failed to modeset, maybe the output is missing a CRTC. Leave the
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue