diff --git a/wlroots/ffi_build.py b/wlroots/ffi_build.py index 0344596b..8ba2925d 100644 --- a/wlroots/ffi_build.py +++ b/wlroots/ffi_build.py @@ -1157,6 +1157,7 @@ def has_xwayland() -> bool: int32_t height, int32_t refresh); void wlr_output_set_transform(struct wlr_output *output, enum wl_output_transform transform); +void wlr_output_enable_adaptive_sync(struct wlr_output *output, bool enabled); void wlr_output_set_scale(struct wlr_output *output, float scale); bool wlr_output_attach_render(struct wlr_output *output, int *buffer_age); diff --git a/wlroots/wlr_types/output.py b/wlroots/wlr_types/output.py index c4b6e044..c61faec2 100644 --- a/wlroots/wlr_types/output.py +++ b/wlroots/wlr_types/output.py @@ -273,6 +273,21 @@ def test(self) -> bool: """ return lib.wlr_output_test(self._ptr) + def enable_adaptive_sync(self, *, enable: bool = True) -> None: + """ + Enables or disables adaptive sync (ie. variable refresh rate) on this + output. On some backends, this is just a hint and may be ignored. + Compositors can inspect `wlr_output.adaptive_sync_status` to query the + effective status. Backends that don't support adaptive sync will reject + the output commit. + + When enabled, compositors can submit frames a little bit later than the + deadline without dropping a frame. + + Adaptive sync is double-buffered state, see commit(). + """ + lib.wlr_output_enable_adaptive_sync(self._ptr, enable) + @property def is_headless(self) -> bool: return lib.wlr_output_is_headless(self._ptr)