From e195d911e1c965dd73686dfd0fa51ed4dd1204b7 Mon Sep 17 00:00:00 2001 From: David Herrmann Date: Sat, 3 Dec 2011 16:39:06 +0100 Subject: [PATCH] Output: Correctly acquire/release DRM master If we switch VT, we must release DRM master to allow other applications to access the DRM. When waking up the compositor we try to acquire the master again to access the DRM. Signed-off-by: David Herrmann --- src/output.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/output.c b/src/output.c index 02bad14..857792f 100644 --- a/src/output.c +++ b/src/output.c @@ -929,8 +929,11 @@ void kmscon_compositor_unref(struct kmscon_compositor *comp) */ void kmscon_compositor_sleep(struct kmscon_compositor *comp) { - if (comp) - comp->state = COMPOSITOR_ASLEEP; + if (!comp) + return; + + comp->state = COMPOSITOR_ASLEEP; + drmDropMaster(comp->drm_fd); } /* @@ -946,10 +949,14 @@ int kmscon_compositor_wake_up(struct kmscon_compositor *comp) if (!comp) return -EINVAL; - + if (comp->state == COMPOSITOR_AWAKE) return comp->count_outputs; + ret = drmSetMaster(comp->drm_fd); + if (ret) + return -EACCES; + comp->state = COMPOSITOR_AWAKE; ret = kmscon_compositor_refresh(comp); if (ret >= 0) -- 2.7.4