If the output backend doesn't support modes, get_preferred_mode will return NULL, and set_mode will accept NULL.
NBKUNVS3OI6G2JXUF2OA2NMA7EKDCHS3O2RKOZAY66HCHWJ4T5KAC
UCSTVE5NIAIQ3NJL5YLDFDKDPOCJS6NMAGABSWG67RGCPH47JQEQC
D425ND7AT3F7QJ3CCSESMVDOC3J5C5P32M5SJDBHECZJXLHNQ2FAC
7B74AT3BXYB7PVW4F6SGQNPMHOU5TEV5TZ54CG6VSQI46XSEKWXQC
ZDQJLNDNDQPWEEWF2QZDRY5LZNJS653SDUQZDHK6EQPH7N4MHXUQC
2QL2H4REDZT46FI3LQ4RYEMQYZBNBK3IC3KH3XERAJU3NCZWMNYQC
7L3TU7JVWPBPHN7WF4TJ263BZ6BC3AYRRW6PULFUP5JZUGWWNUSAC
/* 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 monitor's preferred mode, a more sophisticated compositor
* would let the user configure it. */
if (!wl_list_empty(&wlr_output->modes)) {
mode = wlr_output_preferred_mode(wlr_output);
wlr_output_set_mode(wlr_output, mode);
wlr_output_enable(wlr_output, 1);
if (!wlr_output_commit(wlr_output))
return;
}
/* The mode is a tuple of (width, height, refresh rate), and each
* monitor supports only a specific set of modes. We just pick the
* monitor's preferred mode; a more sophisticated compositor would let
* the user configure it. */
wlr_output_set_mode(wlr_output, wlr_output_preferred_mode(wlr_output));