backend: make wlr_backend_autocreate() fail when DRM is missing

When we change the required dependencies for the DRM backend,
Meson might auto-disable the backend for users missing the new
requirements. This results in confused users [1] because they don't
notice the "drm-backend: NO" line burried in the Meson logs, and
then get a black screen when starting the compositor.

Update wlr_backend_autocreate() to refuse to create a backend with
only libinput (without DRM).

Users really wanting to start their compositor with a libinput
backend and without a DRM backend can manually set WLR_BACKENDS.

[1]: https://github.com/swaywm/sway/issues/7457
This commit is contained in:
Simon Ser 2023-02-27 11:10:30 +01:00
parent 5079000e49
commit 8acaabcbab

View file

@ -350,11 +350,6 @@ struct wlr_backend *wlr_backend_autocreate(struct wl_display *display,
} }
#endif #endif
#if !(WLR_HAS_LIBINPUT_BACKEND || WLR_HAS_DRM_BACKEND)
wlr_log(WLR_ERROR, "Neither DRM nor libinput backend support is compiled in");
goto error;
#endif
// Attempt DRM+libinput // Attempt DRM+libinput
#if WLR_HAS_SESSION #if WLR_HAS_SESSION
session = session_create_and_wait(display); session = session_create_and_wait(display);
@ -389,6 +384,10 @@ struct wlr_backend *wlr_backend_autocreate(struct wl_display *display,
wlr_log(WLR_ERROR, "Failed to open any DRM device"); wlr_log(WLR_ERROR, "Failed to open any DRM device");
goto error; goto error;
} }
#else
wlr_log(WLR_ERROR, "DRM backend support is not compiled in, "
"refusing to start");
goto error;
#endif #endif
success: success: