mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-25 22:25:58 +01:00
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
This commit is contained in:
parent
2ee59e1a08
commit
f0ee563416
1 changed files with 10 additions and 0 deletions
|
@ -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…
Reference in a new issue