aboutsummaryrefslogtreecommitdiff
path: root/backend/session
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2021-02-23 20:53:50 +0100
committerSimon Ser <contact@emersion.fr>2021-02-28 21:07:48 +0100
commit73137ace84bcb3acd156446abcbcf65034ff1f40 (patch)
tree0150ac7f0bba06cadeae8a134c5bb8689dfe502b /backend/session
parentc5dad8b626539c0492f14075fec63bd0fb881e76 (diff)
backend/session: fix KMS device filtering
As explained in [1], user-space should perform a drmModeGetResources call to figure out whether a device supports KMS. [1]: https://gitlab.freedesktop.org/mesa/drm/-/merge_requests/127
Diffstat (limited to 'backend/session')
-rw-r--r--backend/session/session.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/backend/session/session.c b/backend/session/session.c
index a076543a..cfb69ac2 100644
--- a/backend/session/session.c
+++ b/backend/session/session.c
@@ -265,12 +265,20 @@ static struct wlr_device *open_if_kms(struct wlr_session *restrict session,
return NULL;
}
- drmVersion *ver = drmGetVersion(dev->fd);
- if (!ver) {
+ // The kernel errors out with EOPNOTSUPP if DRIVER_MODESET isn't set
+ drmModeRes *res = drmModeGetResources(dev->fd);
+ if (!res) {
+ if (errno != EOPNOTSUPP) {
+ wlr_log_errno(WLR_ERROR, "drmModeGetResources(%s) failed", path);
+ }
+ goto out_dev;
+ }
+ if (res->count_crtcs == 0) {
+ drmModeFreeResources(res);
goto out_dev;
}
+ drmModeFreeResources(res);
- drmFreeVersion(ver);
return dev;
out_dev: