logind: forward Active=true changes for non-DRM backends
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 aedc7732eb
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>
This commit is contained in:
parent
541b6047b6
commit
2ecb84a20d
@ -2774,7 +2774,7 @@ drm_compositor_create(struct wl_display *display,
|
||||
|
||||
/* 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");
|
||||
|
@ -891,8 +891,9 @@ fbdev_compositor_create(struct wl_display *display, int *argc, char *argv[],
|
||||
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");
|
||||
|
@ -480,8 +480,9 @@ rpi_compositor_create(struct wl_display *display, int *argc, char *argv[],
|
||||
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;
|
||||
|
@ -386,7 +386,7 @@ weston_launcher_activate_vt(struct weston_launcher *launcher, int vt)
|
||||
|
||||
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;
|
||||
@ -418,7 +418,7 @@ weston_launcher_connect(struct weston_compositor *compositor, int tty,
|
||||
}
|
||||
} 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) {
|
||||
|
@ -31,7 +31,7 @@ struct weston_launcher;
|
||||
|
||||
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);
|
||||
|
@ -51,6 +51,7 @@
|
||||
|
||||
struct weston_logind {
|
||||
struct weston_compositor *compositor;
|
||||
bool sync_drm;
|
||||
char *seat;
|
||||
char *sid;
|
||||
unsigned int vtnr;
|
||||
@ -315,8 +316,12 @@ get_active_cb(DBusPendingCall *pending, void *data)
|
||||
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);
|
||||
@ -490,7 +495,7 @@ device_paused(struct weston_logind *wl, DBusMessage *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);
|
||||
}
|
||||
|
||||
@ -516,7 +521,7 @@ device_resumed(struct weston_logind *wl, DBusMessage *m)
|
||||
* 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);
|
||||
}
|
||||
|
||||
@ -835,7 +840,7 @@ weston_logind_destroy_vt(struct weston_logind *wl)
|
||||
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;
|
||||
@ -849,6 +854,7 @@ weston_logind_connect(struct weston_logind **out,
|
||||
}
|
||||
|
||||
wl->compositor = compositor;
|
||||
wl->sync_drm = sync_drm;
|
||||
|
||||
wl->seat = strdup(seat_id);
|
||||
if (!wl->seat) {
|
||||
|
@ -51,7 +51,7 @@ weston_logind_activate_vt(struct weston_logind *wl, int vt);
|
||||
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);
|
||||
@ -107,7 +107,7 @@ weston_logind_activate_vt(struct weston_logind *wl, int vt)
|
||||
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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user