frecon: Speed up / simplify get-resolution

Running "freecon --get-resolution" needs to be fast and robust.  It's in
the critical path in bootup and gates showing the splash screen.

Before this change, we'd run _a lot_ of code before reporting the
resolution.  All that code was taking a long time.  Running:
  time freecon --get-resolution
...on veyron systems reported that we were spending .5 seconds to get
the resolution, which isn't so great.

By removing all the crust and using a stopwatch to measure when the boot
screen comes up, we can see that the boot screen comes up much faster
after this change.

Note that this change also appears to fix problems where the splash
screen wouldn't come up at all, at least on veyron systems.  The old
"get-resolution" code was actually calling video_init() twice: in
splash_init() and and in the video_init() call to handle
"get-resolution".  It never called "video_close() at all.  This probably
ought to work, but there appear to be some races in the DRM layers.
From instrumenting the kernel, it appears that the DRM master wasn't
released for a bit of time after the call to get-resolution returned.
This seemed to trip up actually displaying the splash screen.  These
races are avoided after this CL.

BUG=chrome-os-partner:37740
TEST=Can no longer reproduce problems where splash screen doesn't show.
TEST=Stopwatch shows splash screen comes up sooner.
TEST=On veyron "dmesg | grep LIT" shows edp turns on earlier.

Change-Id: I2b949ef5f754f41420d713ea03dead0713c35c52
Reviewed-on: https://chromium-review.googlesource.com/304131
Commit-Ready: Douglas Anderson <dianders@chromium.org>
Tested-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Dominik Behr <dbehr@chromium.org>
(cherry picked from commit 4da95cd9b402d2849713a101459d7a25d0b08c24)
Reviewed-on: https://chromium-review.googlesource.com/304339
Reviewed-by: Douglas Anderson <dianders@chromium.org>
1 file changed