diff --git a/backend/drm/backend.c b/backend/drm/backend.c index 4697234db..c50e278b9 100644 --- a/backend/drm/backend.c +++ b/backend/drm/backend.c @@ -96,6 +96,11 @@ bool wlr_backend_is_drm(struct wlr_backend *b) { return b->impl == &backend_impl; } +struct wlr_backend *wlr_drm_backend_get_parent(struct wlr_backend *backend) { + struct wlr_drm_backend *drm = get_drm_backend_from_backend(backend); + return drm->parent ? &drm->parent->backend : NULL; +} + static void handle_session_active(struct wl_listener *listener, void *data) { struct wlr_drm_backend *drm = wl_container_of(listener, drm, session_active); diff --git a/include/wlr/backend/drm.h b/include/wlr/backend/drm.h index e4fdf65dd..e8f9f6a33 100644 --- a/include/wlr/backend/drm.h +++ b/include/wlr/backend/drm.h @@ -43,6 +43,11 @@ struct wlr_backend *wlr_drm_backend_create(struct wl_display *display, bool wlr_backend_is_drm(struct wlr_backend *backend); bool wlr_output_is_drm(struct wlr_output *output); +/** + * Get the parent DRM backend, if any. + */ +struct wlr_backend *wlr_drm_backend_get_parent(struct wlr_backend *backend); + /** * Get the KMS connector object ID. */