OSDN Git Service

Guard against racy ComposerClient reconnection
authorSteven Thomas <steventhomas@google.com>
Fri, 7 Jul 2017 19:34:20 +0000 (12:34 -0700)
committerSteven Thomas <steventhomas@google.com>
Tue, 1 Aug 2017 01:38:01 +0000 (18:38 -0700)
commit4492a30e143ba645433f4bf1231fd842abf3e9ed
treee078621a638455fc7ad8a305cd69a5130cd30992
parentff16a4805704269a6cd12862ed1f7ebb5c531313
Guard against racy ComposerClient reconnection

The hardware composer service has a rule that only one client can be
connected at a time. The surface flinger process, when transitioning
composer ownership from surface flinger to vr flinger, will destroy the
current client on one thread and create a new client on another
thread. Although surface flinger ensures that these events happen in the
expected sequence (delete then create), the requests sometimes land in
the hardware composer service in inverted order, causing the creation
request to fail with an error.

Instead of failing with an error, block for a brief period (1 second)
until the existing client is removed, then proceed to initialize the new
client. This gives us enough time to ensure an inverted
creation/destruction order doesn't cause client creation to fail, while
avoiding a deadlock if the existing client is never destroyed.

Bug: 62925812

Test: - Transitioned to/from vr flinger hundreds of times, and confirmed
I no longer see sporadic composer client creation failure due to an
already existing client.

- Ran the vts graphics composer tests and confirmed they all pass.

Change-Id: I40be1fb0cb3d42ddb5a9fc159188886e9f5b6267
graphics/composer/2.1/default/Hwc.cpp
graphics/composer/2.1/default/Hwc.h