drm_hwcomposer: Remove redundant vsync timestamp
Vsync timestamp was being tracked in two values. One was used for
approximating the next timestamp when waiting for vblank failed, and the
other was used when vsync timestamp tracking was enabled.
Add a new bool to track whether a vsync has been recorded since a caller
enabled vsync timestamp tracking, and return the value of
vsync_timestamp_ if it is fresh.
Change-Id: I0129510d9ce7d72db8f1c64fa2178d2ce7836e81
Signed-off-by: Drew Davenport <ddavenport@google.com>
diff --git a/drm/VSyncWorker.h b/drm/VSyncWorker.h
index 784f85d..8e410f4 100644
--- a/drm/VSyncWorker.h
+++ b/drm/VSyncWorker.h
@@ -75,7 +75,7 @@
static constexpr uint32_t kDefaultVSPeriodNs = 16666666;
uint32_t vsync_period_ns_ GUARDED_BY(mutex_) = kDefaultVSPeriodNs;
bool enable_vsync_timestamps_ GUARDED_BY(mutex_) = false;
- uint32_t last_vsync_timestamp_ GUARDED_BY(mutex_) = 0;
+ bool last_timestamp_is_fresh_ GUARDED_BY(mutex_) = false;
std::optional<VsyncTimestampCallback> callback_ GUARDED_BY(mutex_);
std::condition_variable cv_;