diff options
Diffstat (limited to 'vsyncworker.cpp')
-rw-r--r-- | vsyncworker.cpp | 49 |
1 files changed, 10 insertions, 39 deletions
diff --git a/vsyncworker.cpp b/vsyncworker.cpp index cc9c96b..3ad16fe 100644 --- a/vsyncworker.cpp +++ b/vsyncworker.cpp @@ -48,41 +48,19 @@ int VSyncWorker::Init(DrmResources *drm, int display) { return InitWorker(); } -int VSyncWorker::RegisterCallback(std::shared_ptr<VsyncCallback> callback) { - int ret = Lock(); - if (ret) { - ALOGE("Failed to lock vsync worker lock %d\n", ret); - return ret; - } - +void VSyncWorker::RegisterCallback(std::shared_ptr<VsyncCallback> callback) { + Lock(); callback_ = callback; - - ret = Unlock(); - if (ret) { - ALOGE("Failed to unlock vsync worker lock %d\n", ret); - return ret; - } - return 0; + Unlock(); } -int VSyncWorker::VSyncControl(bool enabled) { - int ret = Lock(); - if (ret) { - ALOGE("Failed to lock vsync worker lock %d\n", ret); - return ret; - } - +void VSyncWorker::VSyncControl(bool enabled) { + Lock(); enabled_ = enabled; last_timestamp_ = -1; - int signal_ret = SignalLocked(); - - ret = Unlock(); - if (ret) { - ALOGE("Failed to unlock vsync worker lock %d\n", ret); - return ret; - } + Unlock(); - return signal_ret; + Signal(); } /* @@ -135,12 +113,9 @@ int VSyncWorker::SyntheticWaitVBlank(int64_t *timestamp) { } void VSyncWorker::Routine() { - int ret = Lock(); - if (ret) { - ALOGE("Failed to lock worker %d", ret); - return; - } + int ret; + Lock(); if (!enabled_) { ret = WaitForSignalOrExitLocked(); if (ret == -EINTR) { @@ -151,11 +126,7 @@ void VSyncWorker::Routine() { bool enabled = enabled_; int display = display_; std::shared_ptr<VsyncCallback> callback(callback_); - - ret = Unlock(); - if (ret) { - ALOGE("Failed to unlock worker %d", ret); - } + Unlock(); if (!enabled) return; |