From 31f721286a23851a4fe5f0b6ee4fc324bdd79fef Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Sat, 28 Dec 2019 13:18:38 +0100 Subject: tinywl: enable and commit output when modesetting While at it, choose the preferred mode instead of the last one. --- tinywl/tinywl.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tinywl/tinywl.c b/tinywl/tinywl.c index 3ea7d073..e98aaf3f 100644 --- a/tinywl/tinywl.c +++ b/tinywl/tinywl.c @@ -648,12 +648,15 @@ static void server_new_output(struct wl_listener *listener, void *data) { /* Some backends don't have modes. DRM+KMS does, and we need to set a mode * before we can use the output. The mode is a tuple of (width, height, * refresh rate), and each monitor supports only a specific set of modes. We - * just pick the first, a more sophisticated compositor would let the user - * configure it or pick the mode the display advertises as preferred. */ + * just pick the monitor's preferred mode, a more sophisticated compositor + * would let the user configure it. */ if (!wl_list_empty(&wlr_output->modes)) { - struct wlr_output_mode *mode = - wl_container_of(wlr_output->modes.prev, mode, link); + struct wlr_output_mode *mode = wlr_output_preferred_mode(wlr_output); wlr_output_set_mode(wlr_output, mode); + wlr_output_enable(wlr_output, true); + if (!wlr_output_commit(wlr_output)) { + return; + } } /* Allocates and configures our state for this output */ -- cgit v1.2.3