From d8ca4945581577f570c02ad46878571c48a08c79 Mon Sep 17 00:00:00 2001 From: Chris Chamberlain Date: Fri, 10 Dec 2021 21:14:57 +0100 Subject: backend/drm: add wlr_drm_backend_monitor This helper is responsible for listening for new DRM devices and create new child DRM backends as necessary. --- include/backend/drm/monitor.h | 24 ++++++++++++++++++++++++ include/backend/session/session.h | 3 +++ 2 files changed, 27 insertions(+) create mode 100644 include/backend/drm/monitor.h (limited to 'include/backend') diff --git a/include/backend/drm/monitor.h b/include/backend/drm/monitor.h new file mode 100644 index 00000000..51817193 --- /dev/null +++ b/include/backend/drm/monitor.h @@ -0,0 +1,24 @@ +#ifndef BACKEND_DRM_MONITOR_H +#define BACKEND_DRM_MONITOR_H + +#include + +/** + * Helper to create new DRM sub-backends on GPU hotplug. + */ +struct wlr_drm_backend_monitor { + struct wlr_backend *multi; + struct wlr_backend *primary_drm; + struct wlr_session *session; + + struct wl_listener multi_destroy; + struct wl_listener primary_drm_destroy; + struct wl_listener session_destroy; + struct wl_listener session_add_drm_card; +}; + +struct wlr_drm_backend_monitor *drm_backend_monitor_create( + struct wlr_backend *multi, struct wlr_backend *primary_drm, + struct wlr_session *session); + +#endif diff --git a/include/backend/session/session.h b/include/backend/session/session.h index ebe6fc70..5eca7f57 100644 --- a/include/backend/session/session.h +++ b/include/backend/session/session.h @@ -11,4 +11,7 @@ bool libseat_change_vt(struct wlr_session *base, unsigned vt); void session_init(struct wlr_session *session); +struct wlr_device *session_open_if_kms(struct wlr_session *restrict session, + const char *restrict path); + #endif -- cgit v1.2.3