diff options
author | Stéphane Marchesin <marcheu@chromium.org> | 2015-07-05 02:00:08 -0700 |
---|---|---|
committer | Stéphane Marchesin <marcheu@chromium.org> | 2015-07-13 15:18:27 -0700 |
commit | b74e08cc80325883bf4561e11cec0e83f0863728 (patch) | |
tree | 3ebea2ddf816c9a02691c0e72f2be59ff8126525 /vsyncworker.cpp | |
parent | 9099aa5e280c094154fd312f415336c1aabb4b8e (diff) |
drm_hwcomposer: Convert v_refresh() to float
We convert v_refresh() to return a float and instead of storing it,
compute it on the fly from the pixel clock + htotal/vtotal. This makes
the synthetic vblank computation much more accurate.
Change-Id: I2a0becf75eaca8ace30d176fdc813f3b57ba23a5
Diffstat (limited to 'vsyncworker.cpp')
-rw-r--r-- | vsyncworker.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/vsyncworker.cpp b/vsyncworker.cpp index 9626022..29709f7 100644 --- a/vsyncworker.cpp +++ b/vsyncworker.cpp @@ -113,13 +113,13 @@ int VSyncWorker::SyntheticWaitVBlank(int64_t *timestamp) { struct timespec vsync; int ret = clock_gettime(CLOCK_MONOTONIC, &vsync); - int64_t refresh = 60; // Default to 60Hz refresh rate + float refresh = 60.0f; // Default to 60Hz refresh rate DrmConnector *conn = drm_->GetConnectorForDisplay(display_); - if (conn && conn->active_mode().v_refresh()) + if (conn && conn->active_mode().v_refresh() != 0.0f) refresh = conn->active_mode().v_refresh(); else - ALOGW("Vsync worker active with conn=%p refresh=%d\n", conn, - conn ? conn->active_mode().v_refresh() : -1); + ALOGW("Vsync worker active with conn=%p refresh=%f\n", conn, + conn ? conn->active_mode().v_refresh() : 0.0f); int64_t phased_timestamp = GetPhasedVSync( kOneSecondNs / refresh, vsync.tv_sec * kOneSecondNs + vsync.tv_nsec); |