diff options
author | Adrian Salido <salidoa@google.com> | 2017-02-16 10:29:46 -0800 |
---|---|---|
committer | Sean Paul <seanpaul@chromium.org> | 2017-04-25 14:41:03 -0400 |
commit | fa37f67815c29aaa17501569a19037b18512db99 (patch) | |
tree | 5e717fc08e35e30774802eb7da7979a06c16375a /drmcompositorworker.cpp | |
parent | ac8741504befec1d8aa2067a6eb5c2088bc84160 (diff) |
drm_hwcomposer: refactor Worker
Make use of standard library mutex and conditions which simplifies use
of condition variables and benefits from things like scoped locking.
Also add tests to make sure it runs as expected.
Change-Id: Iaf92e17e1f6757dce490eddee61f84cb1f953b0c
Diffstat (limited to 'drmcompositorworker.cpp')
-rw-r--r-- | drmcompositorworker.cpp | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/drmcompositorworker.cpp b/drmcompositorworker.cpp index 9804322..a4e7fc9 100644 --- a/drmcompositorworker.cpp +++ b/drmcompositorworker.cpp @@ -44,23 +44,14 @@ int DrmCompositorWorker::Init() { void DrmCompositorWorker::Routine() { int ret; if (!compositor_->HaveQueuedComposites()) { - ret = Lock(); - if (ret) { - ALOGE("Failed to lock worker, %d", ret); - return; - } + Lock(); // Only use a timeout if we didn't do a SquashAll last time. This will // prevent wait_ret == -ETIMEDOUT which would trigger a SquashAll and be a // pointless drain on resources. int wait_ret = did_squash_all_ ? WaitForSignalOrExitLocked() : WaitForSignalOrExitLocked(kSquashWait); - - ret = Unlock(); - if (ret) { - ALOGE("Failed to unlock worker, %d", ret); - return; - } + Unlock(); switch (wait_ret) { case 0: |