[PATCH] Fix bug https://bugs.freedesktop.org/show_bug.cgi?id=86889 by emitting session signals on TTY switches so that the weston backends can handle VT switching when not called from weston-launch
David Herrmann
dh.herrmann at gmail.com
Mon Dec 15 04:39:32 PST 2014
Hi
On Mon, Dec 15, 2014 at 11:04 AM, Pekka Paalanen <ppaalanen at gmail.com> wrote:
> On Sun, 07 Dec 2014 10:15:29 -0500
> nerdopolis <bluescreen_avenger at verizon.net> wrote:
>
>> ---
>> src/logind-util.c | 6 ++++++
>> 1 file changed, 6 insertions(+)
>>
>> diff --git a/src/logind-util.c b/src/logind-util.c
>> index 6a1b498..4308bb6 100644
>> --- a/src/logind-util.c
>> +++ b/src/logind-util.c
>> @@ -695,9 +695,15 @@ signal_event(int fd, uint32_t mask, void *data)
>> switch (sig.ssi_signo) {
>> case SIGUSR1:
>> ioctl(wl->vt, VT_RELDISP, 1);
>> + wl->compositor->session_active=0;
>> + wl_signal_emit(&wl->compositor->session_signal,
>> + wl->compositor);
>> break;
>> case SIGUSR2:
>> ioctl(wl->vt, VT_RELDISP, VT_ACKACQ);
>> + wl->compositor->session_active=1;
>> + wl_signal_emit(&wl->compositor->session_signal,
>> + wl->compositor);
>> break;
>> }
>>
>
> Hi,
>
> reading the commit
> http://cgit.freedesktop.org/wayland/weston/commit/?id=aedc7732ebd9bc7b4f51ee247ea857ffec6260a7
> I'm not too sure this patch is right.
>
> David, would you mind taking a look?
This patch breaks compositor-drm.c, indeed. The underlying problem is
the way compositor-drm was written (by relying on the DRM device to
define session status). As that is non-trivial to change,
logind-util.c syns session state with the master DRM device.
I wrote a patch that should fix this issue for !DRM backends. I also
attached the patch in case the inlined version is whitespace damaged.
Thanks
David
>From 9b487b2177633c86f934ad3e682910e777d7b543 Mon Sep 17 00:00:00 2001
From: David Herrmann <dh.herrmann at gmail.com>
Date: Mon, 15 Dec 2014 13:34:35 +0100
Subject: [PATCH] logind: forward Active=true changes for non-DRM backends
Logind sends us 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 at 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.
Signed-off-by: David Herrmann <dh.herrmann at gmail.com>
---
src/compositor-drm.c | 2 +-
src/compositor-fbdev.c | 5 +++--
src/compositor-rpi.c | 5 +++--
src/launcher-util.c | 4 ++--
src/launcher-util.h | 2 +-
src/logind-util.c | 12 +++++++++---
src/logind-util.h | 4 ++--
7 files changed, 21 insertions(+), 13 deletions(-)
diff --git a/src/compositor-drm.c b/src/compositor-drm.c
index 9b4d4dc..4473254 100644
--- a/src/compositor-drm.c
+++ b/src/compositor-drm.c
@@ -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");
diff --git a/src/compositor-fbdev.c b/src/compositor-fbdev.c
index 65bb035..805a195 100644
--- a/src/compositor-fbdev.c
+++ b/src/compositor-fbdev.c
@@ -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");
diff --git a/src/compositor-rpi.c b/src/compositor-rpi.c
index 150e9e1..a064a86 100644
--- a/src/compositor-rpi.c
+++ b/src/compositor-rpi.c
@@ -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;
diff --git a/src/launcher-util.c b/src/launcher-util.c
index ac764dc..2d9fb9c 100644
--- a/src/launcher-util.c
+++ b/src/launcher-util.c
@@ -374,7 +374,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;
@@ -406,7 +406,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) {
diff --git a/src/launcher-util.h b/src/launcher-util.h
index d5b2fc9..a60f8a1 100644
--- a/src/launcher-util.h
+++ b/src/launcher-util.h
@@ -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);
diff --git a/src/logind-util.c b/src/logind-util.c
index 132a9a2..66ca784 100644
--- a/src/logind-util.c
+++ b/src/logind-util.c
@@ -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);
@@ -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) {
diff --git a/src/logind-util.h b/src/logind-util.h
index 552395e..0dd9f68 100644
--- a/src/logind-util.h
+++ b/src/logind-util.h
@@ -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;
}
--
2.1.3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-logind-forward-Active-true-changes-for-non-DRM-backe.patch
Type: text/x-patch
Size: 6636 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20141215/08469ecc/attachment.bin>
More information about the wayland-devel
mailing list