diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2013-04-10 10:33:48 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2013-04-10 10:38:30 +0100 |
commit | 540802595fee7f8b2c73e74c2b44e9a21f6471ae (patch) | |
tree | e98b4e879bbee0150cde4238bf706b68671e7f32 | |
parent | 7afe2b45556f07b7e3a36e36da5a6d1c60366c25 (diff) |
sna: Suppress hotplug events whilst VT switched away
Whilst we are not DRM master, not only is another server in control of
the outputs and responding to the udev event, we ourselves cannot
change modes and just cause contention upon the DRM device. Instead
inform userspace of the change as soon as we are DRM master again and
back in control.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/sna.h | 1 | ||||
-rw-r--r-- | src/sna/sna_driver.c | 19 |
2 files changed, 17 insertions, 3 deletions
diff --git a/src/sna/sna.h b/src/sna/sna.h index 13a5ce32..61f26722 100644 --- a/src/sna/sna.h +++ b/src/sna/sna.h @@ -206,6 +206,7 @@ struct sna { #define SNA_TRIPLE_BUFFER 0x4 #define SNA_TEAR_FREE 0x10 #define SNA_FORCE_SHADOW 0x20 +#define SNA_REPROBE 0x80000000 unsigned cpu_features; #define MMX 0x1 diff --git a/src/sna/sna_driver.c b/src/sna/sna_driver.c index 0458743c..5c8ba2db 100644 --- a/src/sna/sna_driver.c +++ b/src/sna/sna_driver.c @@ -734,8 +734,11 @@ sna_handle_uevents(int fd, void *closure) if (memcmp(&s.st_rdev, &udev_devnum, sizeof (dev_t)) == 0 && hotplug && atoi(hotplug) == 1) { DBG(("%s: hotplug event\n", __FUNCTION__)); - sna_mode_update(sna); - RRGetInfo(xf86ScrnToScreen(scrn), TRUE); + if (sna->scrn->vtSema) { + sna_mode_update(sna); + RRGetInfo(xf86ScrnToScreen(scrn), TRUE); + } else + sna->flags |= SNA_REPROBE; } udev_device_unref(dev); @@ -1106,9 +1109,19 @@ static void sna_free_screen(FREE_SCREEN_ARGS_DECL) static Bool sna_enter_vt(VT_FUNC_ARGS_DECL) { SCRN_INFO_PTR(arg); + struct sna *sna = to_sna(scrn); DBG(("%s\n", __FUNCTION__)); - return sna_become_master(to_sna(scrn)); + if (!sna_become_master(sna)) + return FALSE; + + if (sna->flags & SNA_REPROBE) { + sna_mode_update(sna); + RRGetInfo(xf86ScrnToScreen(scrn), TRUE); + sna->flags &= ~SNA_REPROBE; + } + + return TRUE; } static Bool sna_switch_mode(SWITCH_MODE_ARGS_DECL) |