minigbm: cros_gralloc: Do not lock gralloc_close

cros_gralloc implements Gralloc Module API 0.2.  Android framework's
libui uses a Gralloc1On0Adapter adapter on top of gralloc modules < 1.0.

The Gralloc1On0Adapter is a singleton object that calls gralloc_close in
its destructor.  cros_gralloc implements gralloc_close() as
cros_gralloc_close().

In other words cros_gralloc_close() is called at process exit during
__cxa_finalize, which is not a safe place to do std::mutex operations.
In fact, the lock_guard() sometimes hangs while trying to aquire the
lock resulting in a non-responsive app.

Fix this by removing the lock_guard in cros_gralloc_close().

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>

BUG=b/38016927
TEST=Use cherry to run 1 dEQP test.
 => No anr crash after 30 seconds in com.drawelements.deqp:testercore

Change-Id: I469516b8b3a7d8ac6b89e571f137935f097c9af9
Reviewed-on: https://chromium-review.googlesource.com/504429
Commit-Ready: Ilja H. Friedel <ihf@chromium.org>
Tested-by: Daniel Kurtz <djkurtz@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
1 file changed