mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-22 04:45:58 +01: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);
|
||||
|
|
|
@ -8,3 +8,5 @@ wlr_files += files(
|
|||
'renderer.c',
|
||||
'util.c',
|
||||
)
|
||||
|
||||
features += { 'drm-backend': true }
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
msg = ['Required for libinput backend support.']
|
||||
if 'libinput' in backends
|
||||
msg += 'Install "libinput" or disable the libinput backend.'
|
||||
endif
|
||||
|
||||
libinput = dependency(
|
||||
'libinput',
|
||||
version: '>=1.14.0',
|
||||
required: 'libinput' in backends,
|
||||
not_found_message: '\n'.join(msg),
|
||||
)
|
||||
|
||||
if not libinput.found()
|
||||
subdir_done()
|
||||
endif
|
||||
|
||||
wlr_files += files(
|
||||
'backend.c',
|
||||
'events.c',
|
||||
|
@ -8,3 +24,6 @@ wlr_files += files(
|
|||
'tablet_tool.c',
|
||||
'touch.c',
|
||||
)
|
||||
|
||||
features += { 'libinput-backend': true }
|
||||
wlr_deps += libinput
|
||||
|
|
|
@ -1,11 +1,22 @@
|
|||
wlr_files += files('backend.c')
|
||||
|
||||
subdir('drm')
|
||||
subdir('headless')
|
||||
subdir('libinput')
|
||||
all_backends = ['drm', 'libinput', 'x11']
|
||||
backends = get_option('backends')
|
||||
if 'auto' in backends and get_option('auto_features').enabled()
|
||||
backends = all_backends
|
||||
elif 'auto' in backends and get_option('auto_features').disabled()
|
||||
backends = []
|
||||
endif
|
||||
|
||||
foreach backend : all_backends
|
||||
if backend in backends or 'auto' in backends
|
||||
subdir(backend)
|
||||
endif
|
||||
endforeach
|
||||
|
||||
subdir('multi')
|
||||
subdir('noop')
|
||||
subdir('wayland')
|
||||
subdir('x11')
|
||||
subdir('noop')
|
||||
subdir('headless')
|
||||
|
||||
subdir('session')
|
||||
|
|
|
@ -10,17 +10,14 @@ x11_required = [
|
|||
'xcb-xinput',
|
||||
]
|
||||
|
||||
msg = []
|
||||
if get_option('x11-backend').enabled()
|
||||
msg += 'Install "@0@" or pass "-Dx11-backend=disabled" to disable it.'
|
||||
endif
|
||||
if not get_option('x11-backend').disabled()
|
||||
msg += 'Required for X11 backend support.'
|
||||
msg = ['Required for X11 backend support.']
|
||||
if 'x11' in backends
|
||||
msg += 'Install "@0@" or disable the X11 backend.'
|
||||
endif
|
||||
|
||||
foreach lib : x11_required
|
||||
dep = dependency(lib,
|
||||
required: get_option('x11-backend'),
|
||||
required: 'x11' in backends,
|
||||
not_found_message: '\n'.join(msg).format(lib),
|
||||
)
|
||||
if not dep.found()
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#ifndef WLR_CONFIG_H
|
||||
#define WLR_CONFIG_H
|
||||
|
||||
#mesondefine WLR_HAS_DRM_BACKEND
|
||||
#mesondefine WLR_HAS_LIBINPUT_BACKEND
|
||||
#mesondefine WLR_HAS_X11_BACKEND
|
||||
|
||||
#mesondefine WLR_HAS_GLES2_RENDERER
|
||||
|
|
|
@ -86,7 +86,9 @@ else
|
|||
endif
|
||||
|
||||
features = {
|
||||
'drm-backend': false,
|
||||
'x11-backend': false,
|
||||
'libinput-backend': false,
|
||||
'xwayland': false,
|
||||
'gles2-renderer': false,
|
||||
}
|
||||
|
@ -98,7 +100,6 @@ wayland_server = dependency('wayland-server', version: '>=1.19')
|
|||
wayland_client = dependency('wayland-client')
|
||||
drm = dependency('libdrm', version: '>=2.4.105')
|
||||
gbm = dependency('gbm', version: '>=17.1.0')
|
||||
libinput = dependency('libinput', version: '>=1.14.0')
|
||||
xkbcommon = dependency('xkbcommon')
|
||||
udev = dependency('libudev')
|
||||
pixman = dependency('pixman-1')
|
||||
|
@ -111,7 +112,6 @@ wlr_deps = [
|
|||
wayland_client,
|
||||
drm,
|
||||
gbm,
|
||||
libinput,
|
||||
xkbcommon,
|
||||
udev,
|
||||
pixman,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
option('xcb-errors', type: 'feature', value: 'auto', description: 'Use xcb-errors util library')
|
||||
option('xwayland', type: 'feature', value: 'auto', yield: true, description: 'Enable support for X11 applications')
|
||||
option('x11-backend', type: 'feature', value: 'auto', description: 'Enable X11 backend')
|
||||
option('examples', type: 'boolean', value: true, description: 'Build example applications')
|
||||
option('icon_directory', description: 'Location used to look for cursors (default: ${datadir}/icons)', type: 'string', value: '')
|
||||
option('renderers', type: 'array', choices: ['auto', 'gles2'], value: ['auto'], description: 'Select built-in renderers')
|
||||
option('backends', type: 'array', choices: ['auto', 'drm', 'libinput', 'x11'], value: ['auto'], description: 'Select built-in backends')
|
||||
|
|
Loading…
Reference in a new issue