diff options
author | Simon Ser <contact@emersion.fr> | 2022-10-20 09:49:16 +0200 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2022-10-20 09:49:16 +0200 |
commit | f0ee563416cb926c302aa5c98ef85aaab44b1646 (patch) | |
tree | 160f86f4e8048e19ba9db854ad8875a76350c168 | |
parent | 2ee59e1a08ba7b2e50a5122f074014111d8d7556 (diff) |
output: try to use fixed mode in wlr_output_set_custom_mode()
If a fixed mode matching the user requirements is available, use
that. This avoids generating the mode with GTF or CVT in the DRM
backend, and instead uses mode timings advertised by the output.
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3514
-rw-r--r-- | types/output/output.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/types/output/output.c b/types/output/output.c index 04361231..9a2e5515 100644 --- a/types/output/output.c +++ b/types/output/output.c @@ -215,6 +215,16 @@ void wlr_output_set_mode(struct wlr_output *output, void wlr_output_set_custom_mode(struct wlr_output *output, int32_t width, int32_t height, int32_t refresh) { + // If there is a fixed mode which matches what the user wants, use that + struct wlr_output_mode *mode; + wl_list_for_each(mode, &output->modes, link) { + if (mode->width == width && mode->height == height && + mode->refresh == refresh) { + wlr_output_set_mode(output, mode); + return; + } + } + wlr_output_state_set_custom_mode(&output->pending, width, height, refresh); } |