OSDN Git Service

Fix vr flinger deadlock and race condition
authorSteven Thomas <steventhomas@google.com>
Wed, 8 Feb 2017 02:07:01 +0000 (18:07 -0800)
committerSteven Thomas <steventhomas@google.com>
Wed, 8 Feb 2017 19:28:09 +0000 (19:28 +0000)
commit282a5ed48f64e4010f97ca4077e3bd4b54ba3268
tree7bcd39163729795c6a224362a9d81a9d8fb5b0ed
parentba7a67e6f3eeedea75969d9a0f99229c5eca859f
Fix vr flinger deadlock and race condition

While investigating hangs when transitioning from 2d --> vr and back I
found a deadlock and race condition in the vr flinger pause/resume
handling. This CL should fix both issues.

Unfortunately there's still another deadlock related to multiple threads
trying to suspend/resume vr flinger, but considering how vr flinger is
currently used by surface flinger we shouldn't ever hit that scenario in
practice.

Bug: None

Test: I was able to reliably get a hang when starting/stopping vr
launcher a few times, but with this CL applied and another CL to remove
calls to SetPowerMode() applied (that CL will be submitted separately),
I no longer see any hangs.

Change-Id: Ie842bf9fb00e4e2937769ed7e1e2ec9cc47861f7
(cherry picked from commit cf921a3919d68d8c8d1b8be39e03a372f6346f57)
libs/vr/libvrflinger/hardware_composer.cpp
libs/vr/libvrflinger/hardware_composer.h