output: allow kmscon_compositor_use to be called when asleep
authorDavid Herrmann <dh.herrmann@googlemail.com>
Fri, 30 Dec 2011 15:40:49 +0000 (16:40 +0100)
committerDavid Herrmann <dh.herrmann@googlemail.com>
Fri, 30 Dec 2011 15:40:49 +0000 (16:40 +0100)
There is no reason to prohibit a compositor from activating its GL context while
being asleep. It is even recommended to activate the GL context when being
asleep as there is no other way to initialize other subsystems without an GL
context.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
src/output.c

index 37e99c1..819d679 100644 (file)
@@ -985,8 +985,10 @@ bool kmscon_compositor_is_asleep(struct kmscon_compositor *comp)
 }
 
 /*
- * This activates the EGL/GL context of this compositor. This fails if the
- * compositor is asleep.
+ * This activates the EGL/GL context of this compositor. This works even if the
+ * compositor is asleep. Moreover, most other subsystems that need an GL context
+ * require this function to be called before they are used.
+ *
  * You must call this before trying to enable outputs. A new compositor is not
  * enabled by default.
  * Returns 0 on success.
@@ -997,9 +999,6 @@ bool kmscon_compositor_is_asleep(struct kmscon_compositor *comp)
  */
 int kmscon_compositor_use(struct kmscon_compositor *comp)
 {
-       if (kmscon_compositor_is_asleep(comp))
-               return -EINVAL;
-
        if (!eglMakeCurrent(comp->display, EGL_NO_SURFACE, EGL_NO_SURFACE,
                                                        comp->context))
                return -EFAULT;