Logind sends us a notification whenever the Active attribute of our session
changes. However, due to the way compositor-drm.c relies on the master DRM
device to be synced with the session, we used to delay Active=true
handling until the DRM device was up, too. See:
commit
aedc7732ebd9bc7b4f51ee247ea857ffec6260a7
Author: David Herrmann <dh.herrmann@gmail.com>
Date: Sat Nov 30 11:25:45 2013 +0100
logind: delay wakeup until DRM-device is resumed
However, the other compositor backends do not use DRM, so logind-util will
never get notified about any DRM device. Therefore, we have to forward the
Active=true change immediately.
This commit fixes logind-util to take sync_drm as argument. If it is true,
we do DRM-device synchronisation, otherwise we don't.
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=86889
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Tested-by: nerdopolis <bluescreen_avenger@verizon.net>
/* Check if we run drm-backend using weston-launch */
ec->base.launcher = weston_launcher_connect(&ec->base, param->tty,
- param->seat_id);
+ param->seat_id, true);
if (ec->base.launcher == NULL) {
weston_log("fatal: drm backend should be run "
"using weston-launch binary or as root\n");
compositor->session_listener.notify = session_notify;
wl_signal_add(&compositor->base.session_signal,
&compositor->session_listener);
- compositor->base.launcher =
- weston_launcher_connect(&compositor->base, param->tty, "seat0");
+ compositor->base.launcher = weston_launcher_connect(&compositor->base,
+ param->tty, "seat0",
+ false);
if (!compositor->base.launcher) {
weston_log("fatal: fbdev backend should be run "
"using weston-launch binary or as root\n");
compositor->session_listener.notify = session_notify;
wl_signal_add(&compositor->base.session_signal,
&compositor ->session_listener);
- compositor->base.launcher =
- weston_launcher_connect(&compositor->base, param->tty, "seat0");
+ compositor->base.launcher = weston_launcher_connect(&compositor->base,
+ param->tty, "seat0",
+ false);
if (!compositor->base.launcher) {
weston_log("Failed to initialize tty.\n");
goto out_udev;
struct weston_launcher *
weston_launcher_connect(struct weston_compositor *compositor, int tty,
- const char *seat_id)
+ const char *seat_id, bool sync_drm)
{
struct weston_launcher *launcher;
struct wl_event_loop *loop;
}
} else {
r = weston_logind_connect(&launcher->logind, compositor,
- seat_id, tty);
+ seat_id, tty, sync_drm);
if (r < 0) {
launcher->logind = NULL;
if (geteuid() == 0) {
struct weston_launcher *
weston_launcher_connect(struct weston_compositor *compositor, int tty,
- const char *seat_id);
+ const char *seat_id, bool sync_drm);
void
weston_launcher_destroy(struct weston_launcher *launcher);
struct weston_logind {
struct weston_compositor *compositor;
+ bool sync_drm;
char *seat;
char *sid;
unsigned int vtnr;
goto err_unref;
dbus_message_iter_get_basic(&sub, &b);
- if (!b)
- weston_logind_set_active(wl, false);
+
+ /* If the backend requested DRM master-device synchronization, we only
+ * wake-up the compositor once the master-device is up and running. For
+ * other backends, we immediately forward the Active-change event. */
+ if (!wl->sync_drm || !b)
+ weston_logind_set_active(wl, b);
err_unref:
dbus_message_unref(m);
if (!strcmp(type, "pause"))
weston_logind_pause_device_complete(wl, major, minor);
- if (major == DRM_MAJOR)
+ if (wl->sync_drm && major == DRM_MAJOR)
weston_logind_set_active(wl, false);
}
* there is no need for us to handle this event for evdev. For DRM, we
* notify the compositor to wake up. */
- if (major == DRM_MAJOR)
+ if (wl->sync_drm && major == DRM_MAJOR)
weston_logind_set_active(wl, true);
}
WL_EXPORT int
weston_logind_connect(struct weston_logind **out,
struct weston_compositor *compositor,
- const char *seat_id, int tty)
+ const char *seat_id, int tty, bool sync_drm)
{
struct weston_logind *wl;
struct wl_event_loop *loop;
}
wl->compositor = compositor;
+ wl->sync_drm = sync_drm;
wl->seat = strdup(seat_id);
if (!wl->seat) {
int
weston_logind_connect(struct weston_logind **out,
struct weston_compositor *compositor,
- const char *seat_id, int tty);
+ const char *seat_id, int tty, bool sync_drm);
void
weston_logind_destroy(struct weston_logind *wl);
static inline int
weston_logind_connect(struct weston_logind **out,
struct weston_compositor *compositor,
- const char *seat_id, int tty)
+ const char *seat_id, int tty, bool sync_drm)
{
return -ENOSYS;
}