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
Simon Ser 2 years ago
parent 2ee59e1a08
commit f0ee563416

@ -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, void wlr_output_set_custom_mode(struct wlr_output *output, int32_t width,
int32_t height, int32_t refresh) { 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); wlr_output_state_set_custom_mode(&output->pending, width, height, refresh);
} }

Loading…
Cancel
Save