enable adaptive sync if supported

but don't cause monitors to be ignored if it fails
This commit is contained in:
Leonardo Hernández Hernández 2022-09-06 00:29:44 -05:00
parent 83e37820d7
commit dc59f7733d
No known key found for this signature in database
GPG key ID: E538897EE11B9624

6
dwl.c
View file

@ -803,7 +803,6 @@ createmon(struct wl_listener *listener, void *data)
* monitor's preferred mode; a more sophisticated compositor would let * monitor's preferred mode; a more sophisticated compositor would let
* the user configure it. */ * the user configure it. */
wlr_output_set_mode(wlr_output, wlr_output_preferred_mode(wlr_output)); wlr_output_set_mode(wlr_output, wlr_output_preferred_mode(wlr_output));
wlr_output_enable_adaptive_sync(wlr_output, 1);
/* Set up event listeners */ /* Set up event listeners */
LISTEN(&wlr_output->events.frame, &m->frame, rendermon); LISTEN(&wlr_output->events.frame, &m->frame, rendermon);
@ -813,6 +812,11 @@ createmon(struct wl_listener *listener, void *data)
if (!wlr_output_commit(wlr_output)) if (!wlr_output_commit(wlr_output))
return; return;
/* Try to enable adaptive sync, note that not all monitors support it.
* wlr_output_commit() will deactivate it in case it cannot be enabled */
wlr_output_enable_adaptive_sync(wlr_output, 1);
wlr_output_commit(wlr_output);
wl_list_insert(&mons, &m->link); wl_list_insert(&mons, &m->link);
printstatus(); printstatus();