aboutsummaryrefslogtreecommitdiff
path: root/include/wlr/backend/drm.h
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2021-11-03 14:03:59 +0100
committerSimon Zeni <simon@bl4ckb0ne.ca>2021-11-19 16:06:07 +0000
commit86f5ecf46867236d4b96a3ce1ad664a8963d6ae4 (patch)
treefb3b103578f9883792e43b2c5d8752d98cc359c7 /include/wlr/backend/drm.h
parenta37f538ca0cc6d504358eb797150751b60c4511b (diff)
backend/drm: introduce wlr_drm_lease
Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3183
Diffstat (limited to 'include/wlr/backend/drm.h')
-rw-r--r--include/wlr/backend/drm.h32
1 files changed, 24 insertions, 8 deletions
diff --git a/include/wlr/backend/drm.h b/include/wlr/backend/drm.h
index 0e9f6108..800bc585 100644
--- a/include/wlr/backend/drm.h
+++ b/include/wlr/backend/drm.h
@@ -14,6 +14,20 @@
#include <wlr/backend/session.h>
#include <wlr/types/wlr_output.h>
+struct wlr_drm_backend;
+
+struct wlr_drm_lease {
+ int fd;
+ uint32_t lessee_id;
+ struct wlr_drm_backend *backend;
+
+ struct {
+ struct wl_signal destroy;
+ } events;
+
+ void *data;
+};
+
/**
* Creates a DRM backend using the specified GPU file descriptor (typically from
* a device node in /dev/dri).
@@ -41,18 +55,20 @@ uint32_t wlr_drm_connector_get_id(struct wlr_output *output);
int wlr_drm_backend_get_non_master_fd(struct wlr_backend *backend);
/**
- * 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.
+ * Leases the given outputs to the caller. The outputs must be from the
+ * associated DRM backend.
+ *
+ * Returns NULL on error.
*/
-int wlr_drm_create_lease(struct wlr_output **outputs, size_t n_outputs,
- uint32_t *lessee_id);
+struct wlr_drm_lease *wlr_drm_create_lease(struct wlr_output **outputs,
+ size_t n_outputs, int *lease_fd);
/**
- * Terminates a given lease. The output will be owned again by the backend
+ * Terminates and destroys a given lease.
+ *
+ * The outputs will be owned again by the backend.
*/
-bool wlr_drm_backend_terminate_lease(struct wlr_backend *backend,
- uint32_t lessee_id);
+void wlr_drm_lease_terminate(struct wlr_drm_lease *lease);
/**
* Add mode to the list of available modes