mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-11-02 09:01:38 -05:00
backend/drm: scan leases on uevent
Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3181
This commit is contained in:
parent
6bb8973309
commit
e656697a7d
3 changed files with 36 additions and 2 deletions
|
|
@ -1425,6 +1425,36 @@ void scan_drm_connectors(struct wlr_drm_backend *drm,
|
|||
}
|
||||
}
|
||||
|
||||
void scan_drm_leases(struct wlr_drm_backend *drm) {
|
||||
drmModeLesseeListRes *list = drmModeListLessees(drm->fd);
|
||||
if (list == NULL) {
|
||||
wlr_log_errno(WLR_ERROR, "drmModeListLessees failed");
|
||||
return;
|
||||
}
|
||||
|
||||
struct wlr_drm_connector *conn;
|
||||
wl_list_for_each(conn, &drm->outputs, link) {
|
||||
if (conn->lease == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
bool found = false;
|
||||
for (size_t i = 0; i < list->count; i++) {
|
||||
if (list->lessees[i] == conn->lease->lessee_id) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
wlr_log(WLR_DEBUG, "DRM lease %"PRIu32" has been terminated",
|
||||
conn->lease->lessee_id);
|
||||
drm_lease_destroy(conn->lease);
|
||||
}
|
||||
}
|
||||
|
||||
drmFree(list);
|
||||
}
|
||||
|
||||
static int mhz_to_nsec(int mhz) {
|
||||
return 1000000000000LL / mhz;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue