From: Kristian Høgsberg Date: Wed, 30 Oct 2013 23:27:16 +0000 (-0700) Subject: launcher: Make sure we drop drm master before we allow VT switches X-Git-Tag: upstream/0.1.8~769 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a28ba55b56c3c94a86524a8cd13cae9257d91376;p=profile%2Fivi%2Fweston-ivi-shell.git launcher: Make sure we drop drm master before we allow VT switches On shutdown, we can risk having a pending vt switch that we normally handle in the vt signal handler. However as we put the vt back in VT_AUTO mode, the pending VT switch will go through and if we haven't dropped drm master at that point, we could switch to another display server without dropping drm master. That will typically crash the other server, so let's try to make sure we don't do that. https://bugs.freedesktop.org/show_bug.cgi?id=70877 --- diff --git a/src/launcher-util.c b/src/launcher-util.c index a599686..5ccf302 100644 --- a/src/launcher-util.c +++ b/src/launcher-util.c @@ -202,6 +202,11 @@ weston_launcher_restore(struct weston_launcher *launcher) if (ioctl(launcher->tty, KDSETMODE, KD_TEXT)) weston_log("failed to set KD_TEXT mode on tty: %m\n"); + /* We have to drop master before we switch the VT back in + * VT_AUTO, so we don't risk switching to a VT with another + * display server, that will then fail to set drm master. */ + drm_drop_master(launcher->drm_fd); + mode.mode = VT_AUTO; if (ioctl(launcher->tty, VT_SETMODE, &mode) < 0) weston_log("could not reset vt handling\n"); diff --git a/src/weston-launch.c b/src/weston-launch.c index 03a6a43..d8364c8 100644 --- a/src/weston-launch.c +++ b/src/weston-launch.c @@ -407,6 +407,11 @@ quit(struct weston_launch *wl, int status) if (ioctl(wl->tty, KDSETMODE, KD_TEXT)) fprintf(stderr, "failed to set KD_TEXT mode on tty: %m\n"); + /* We have to drop master before we switch the VT back in + * VT_AUTO, so we don't risk switching to a VT with another + * display server, that will then fail to set drm master. */ + drmDropMaster(wl->drm_fd); + mode.mode = VT_AUTO; if (ioctl(wl->tty, VT_SETMODE, &mode) < 0) fprintf(stderr, "could not reset vt handling\n");