aboutsummaryrefslogtreecommitdiff
path: root/backend/session/direct.c
diff options
context:
space:
mode:
authorScott Anderson <ascent12@hotmail.com>2017-08-26 14:50:16 +1200
committerScott Anderson <ascent12@hotmail.com>2017-08-26 14:50:16 +1200
commitd16b2977f6b156e5b3a4ceb028cfbe70b9a350c1 (patch)
treefe4436815369d2acfd308b5d7cfda2776d1b3e60 /backend/session/direct.c
parentfb93628bda0cb7750628e227213a1ddc2ae34be9 (diff)
Remove single GPU assumptions from wlr_session
Diffstat (limited to 'backend/session/direct.c')
-rw-r--r--backend/session/direct.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/backend/session/direct.c b/backend/session/direct.c
index 4eff10e1..942dc552 100644
--- a/backend/session/direct.c
+++ b/backend/session/direct.c
@@ -48,7 +48,7 @@ static int direct_session_open(struct wlr_session *base, const char *path) {
}
if (major(st.st_rdev) == DRM_MAJOR) {
- session->base.drm_fd = fd;
+ direct_ipc_setmaster(session->sock, fd);
}
return fd;
@@ -65,8 +65,7 @@ static void direct_session_close(struct wlr_session *base, int fd) {
}
if (major(st.st_rdev) == DRM_MAJOR) {
- direct_ipc_dropmaster(session->sock, session->base.drm_fd);
- session->base.drm_fd = -1;
+ direct_ipc_dropmaster(session->sock, fd);
} else if (major(st.st_rdev) == INPUT_MAJOR) {
ioctl(fd, EVIOCREVOKE, 0);
}
@@ -109,11 +108,27 @@ static int vt_handler(int signo, void *data) {
if (session->base.active) {
session->base.active = false;
wl_signal_emit(&session->base.session_signal, session);
- direct_ipc_dropmaster(session->sock, session->base.drm_fd);
+
+ struct wlr_device *dev;
+ wl_list_for_each(dev, &session->base.devices, link) {
+ if (major(dev->dev) == DRM_MAJOR) {
+ direct_ipc_dropmaster(session->sock,
+ dev->fd);
+ }
+ }
+
ioctl(session->tty_fd, VT_RELDISP, 1);
} else {
ioctl(session->tty_fd, VT_RELDISP, VT_ACKACQ);
- direct_ipc_setmaster(session->sock, session->base.drm_fd);
+
+ struct wlr_device *dev;
+ wl_list_for_each(dev, &session->base.devices, link) {
+ if (major(dev->dev) == DRM_MAJOR) {
+ direct_ipc_setmaster(session->sock,
+ dev->fd);
+ }
+ }
+
session->base.active = true;
wl_signal_emit(&session->base.session_signal, session);
}
@@ -221,7 +236,6 @@ static struct wlr_session *direct_session_create(struct wl_display *disp) {
wlr_log(L_INFO, "Successfully loaded direct session");
snprintf(session->base.seat, sizeof(session->base.seat), "%s", seat);
- session->base.drm_fd = -1;
session->base.impl = &session_direct;
return &session->base;