mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-10-29 05:40:12 -04:00
backend: make DRM and libinput backends optional
Co-authored-by: Simon Ser <contact@emersion.fr>
This commit is contained in:
parent
66c42f4fcb
commit
70fb21c35b
8 changed files with 69 additions and 17 deletions
|
|
@ -6,10 +6,9 @@
|
|||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <wayland-server-core.h>
|
||||
#include <wlr/backend/drm.h>
|
||||
|
||||
#include <wlr/backend/headless.h>
|
||||
#include <wlr/backend/interface.h>
|
||||
#include <wlr/backend/libinput.h>
|
||||
#include <wlr/backend/multi.h>
|
||||
#include <wlr/backend/noop.h>
|
||||
#include <wlr/backend/session.h>
|
||||
|
|
@ -22,6 +21,14 @@
|
|||
#include "render/allocator.h"
|
||||
#include "util/signal.h"
|
||||
|
||||
#if WLR_HAS_DRM_BACKEND
|
||||
#include <wlr/backend/drm.h>
|
||||
#endif
|
||||
|
||||
#if WLR_HAS_LIBINPUT_BACKEND
|
||||
#include <wlr/backend/libinput.h>
|
||||
#endif
|
||||
|
||||
#if WLR_HAS_X11_BACKEND
|
||||
#include <wlr/backend/x11.h>
|
||||
#endif
|
||||
|
|
@ -211,6 +218,7 @@ static struct wlr_backend *attempt_noop_backend(struct wl_display *display) {
|
|||
return backend;
|
||||
}
|
||||
|
||||
#if WLR_HAS_DRM_BACKEND
|
||||
static struct wlr_backend *attempt_drm_backend(struct wl_display *display,
|
||||
struct wlr_backend *backend, struct wlr_session *session) {
|
||||
struct wlr_device *gpus[8];
|
||||
|
|
@ -240,6 +248,7 @@ static struct wlr_backend *attempt_drm_backend(struct wl_display *display,
|
|||
|
||||
return primary_drm;
|
||||
}
|
||||
#endif
|
||||
|
||||
static struct wlr_backend *attempt_backend_by_name(struct wl_display *display,
|
||||
struct wlr_backend *backend, struct wlr_session **session,
|
||||
|
|
@ -265,9 +274,17 @@ static struct wlr_backend *attempt_backend_by_name(struct wl_display *display,
|
|||
}
|
||||
|
||||
if (strcmp(name, "libinput") == 0) {
|
||||
#if WLR_HAS_LIBINPUT_BACKEND
|
||||
return wlr_libinput_backend_create(display, *session);
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
} else {
|
||||
#if WLR_HAS_DRM_BACKEND
|
||||
return attempt_drm_backend(display, backend, *session);
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -355,6 +372,7 @@ struct wlr_backend *wlr_backend_autocreate(struct wl_display *display) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
#if WLR_HAS_LIBINPUT_BACKEND
|
||||
struct wlr_backend *libinput = wlr_libinput_backend_create(display,
|
||||
multi->session);
|
||||
if (!libinput) {
|
||||
|
|
@ -364,7 +382,9 @@ struct wlr_backend *wlr_backend_autocreate(struct wl_display *display) {
|
|||
return NULL;
|
||||
}
|
||||
wlr_multi_backend_add(backend, libinput);
|
||||
#endif
|
||||
|
||||
#if WLR_HAS_DRM_BACKEND
|
||||
struct wlr_backend *primary_drm =
|
||||
attempt_drm_backend(display, backend, multi->session);
|
||||
if (!primary_drm) {
|
||||
|
|
@ -376,6 +396,7 @@ struct wlr_backend *wlr_backend_autocreate(struct wl_display *display) {
|
|||
}
|
||||
|
||||
return backend;
|
||||
#endif
|
||||
|
||||
error:
|
||||
wlr_backend_destroy(backend);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue