From e5a949a9550ad2d6c5aca3c8d0997dbfdca086d5 Mon Sep 17 00:00:00 2001 From: Simon Zeni Date: Thu, 15 Jul 2021 09:48:29 -0400 Subject: backend/drm: implement drm lease function --- include/backend/drm/drm.h | 2 ++ include/backend/drm/properties.h | 1 + include/wlr/backend/drm.h | 14 ++++++++++++++ include/wlr/types/wlr_output.h | 3 +++ 4 files changed, 20 insertions(+) (limited to 'include') diff --git a/include/backend/drm/drm.h b/include/backend/drm/drm.h index b4e95861..6d70d844 100644 --- a/include/backend/drm/drm.h +++ b/include/backend/drm/drm.h @@ -37,6 +37,7 @@ struct wlr_drm_plane { struct wlr_drm_crtc { uint32_t id; + uint32_t lessee_id; // Atomic modesetting only uint32_t mode_id; @@ -119,6 +120,7 @@ struct wlr_drm_connector { enum wlr_drm_connector_status status; bool desired_enabled; uint32_t id; + uint32_t lessee_id; struct wlr_drm_crtc *crtc; uint32_t possible_crtcs; diff --git a/include/backend/drm/properties.h b/include/backend/drm/properties.h index bd90871d..99d5a92e 100644 --- a/include/backend/drm/properties.h +++ b/include/backend/drm/properties.h @@ -18,6 +18,7 @@ union wlr_drm_connector_props { uint32_t path; uint32_t vrr_capable; // not guaranteed to exist uint32_t subconnector; // not guaranteed to exist + uint32_t non_desktop; // atomic-modesetting only diff --git a/include/wlr/backend/drm.h b/include/wlr/backend/drm.h index baa03421..c5351d65 100644 --- a/include/wlr/backend/drm.h +++ b/include/wlr/backend/drm.h @@ -33,6 +33,20 @@ bool wlr_output_is_drm(struct wlr_output *output); */ uint32_t wlr_drm_connector_get_id(struct wlr_output *output); +/** + * Leases a given output to the caller. The output must be from the associated + * DRM backend. + * Returns a valid opened DRM FD or -1 on error. + */ +int wlr_drm_create_lease(struct wlr_output **outputs, size_t n_outputs, + uint32_t *lessee_id); + +/** + * Terminates a given lease. The output will be owned again by the backend + */ +bool wlr_drm_backend_terminate_lease(struct wlr_backend *backend, + uint32_t lessee_id); + /** * Add mode to the list of available modes */ diff --git a/include/wlr/types/wlr_output.h b/include/wlr/types/wlr_output.h index 8363261d..5ef5a485 100644 --- a/include/wlr/types/wlr_output.h +++ b/include/wlr/types/wlr_output.h @@ -141,6 +141,9 @@ struct wlr_output { bool frame_pending; float transform_matrix[9]; + // true for example with VR headsets + bool non_desktop; + struct wlr_output_state pending; // Commit sequence number. Incremented on each commit, may overflow. -- cgit v1.2.3