OSDN Git Service

minigbm: cros_gralloc: Do not lock gralloc_close
authorDaniel Kurtz <djkurtz@chromium.org>
Fri, 12 May 2017 11:20:06 +0000 (19:20 +0800)
committerchrome-bot <chrome-bot@chromium.org>
Sun, 21 May 2017 03:47:11 +0000 (20:47 -0700)
commitde558ae8a22cbd6c0b25691b56c6fd4884ec3ac5
tree1c1ee4bc2eceea4e6ad622a150d7652c806a126b
parentcb1471bc69300f5203aa79b179a861c56c5c569f
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>
cros_gralloc/cros_alloc_device.cc