frecon: keep master while frecon is active

This change switches back to old frecon behavior where it would keep
DRM master for whole time it was active. I thought we could only keep
it for mode switch but it is also needed for framebuffer invalidation
which is necessary on some hardware so we would need to set and drop it
on every screen update.
This change also centralizes DRM master set and drop in term foreground
and background functions making it clear where it is set and dropped.
There was also a case where when Chrome is under high load it becomes
confused and still sends page flip requests even though frecon is active.
In this case, if when frecon dropped master page flip succeeds and it
appears the system is hanging (frecon is still processing keyboard events
but static Chrome window is visible).

BUG=chromium:610790,chromium:588425,chromium:616594,chrome-os-partner:51058
TEST=quickly switch between Chrome and frecon using ctrl-alt-< and ctrl-alt->\
while system is under high load.

Change-Id: I651a89b307dcf31396ba52e2dcb605d2a7617cd9
Signed-off-by: Dominik Behr <dbehr@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/351010
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
5 files changed