From 7a0cbaa6e3c3e4477ca09cb0014e13fba48965c3 Mon Sep 17 00:00:00 2001 From: Lars Date: Fri, 15 Mar 2024 14:58:26 +0100 Subject: [PATCH 1/2] Added Output.enable_adaptive_sync, fixes #134 --- wlroots/ffi_build.py | 1 + wlroots/wlr_types/output.py | 15 +++++++++++++++ 2 files changed, 16 insertions(+) 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..feae9cdf 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) From b81839b4557b942794ba3e297acde450471a0801 Mon Sep 17 00:00:00 2001 From: Lars Date: Sat, 16 Mar 2024 11:24:57 +0100 Subject: [PATCH 2/2] Convert 'enable' to a keyword-only arg to align it with several other methods with a similar signature --- wlroots/wlr_types/output.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wlroots/wlr_types/output.py b/wlroots/wlr_types/output.py index feae9cdf..c61faec2 100644 --- a/wlroots/wlr_types/output.py +++ b/wlroots/wlr_types/output.py @@ -273,7 +273,7 @@ def test(self) -> bool: """ return lib.wlr_output_test(self._ptr) - def enable_adaptive_sync(self, enable: bool = True) -> None: + 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.