diff options
| author | Clarence Ip <cip@codeaurora.org> | 2016-09-09 16:41:00 -0400 |
|---|---|---|
| committer | Clarence Ip <cip@codeaurora.org> | 2016-10-12 16:57:55 -0400 |
| commit | 5d2ce55a38ef9f426323bef7980a2db794f14935 (patch) | |
| tree | 3a6a49c456cce635e4acabda86a1aaab0f7d7513 /drivers/gpu | |
| parent | 2f641caddaa619029b8e29e65678c2aa795c8b5d (diff) | |
drm/msm/sde: don't convert ktime to ns when waiting for fences
The driver should utilize the ktime_ series of functions to directly
manipulate the time structures rather than converting everything to
nanoseconds. This avoids possible trunction/rounding errors that may
be introduced by the conversion process.
Change-Id: Iac3dd40c679ffc9517881f41650aa5848dab884b
Signed-off-by: Clarence Ip <cip@codeaurora.org>
Diffstat (limited to 'drivers/gpu')
| -rw-r--r-- | drivers/gpu/drm/msm/sde/sde_crtc.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/drivers/gpu/drm/msm/sde/sde_crtc.c b/drivers/gpu/drm/msm/sde/sde_crtc.c index 46375e025598..a8ed1daa3706 100644 --- a/drivers/gpu/drm/msm/sde/sde_crtc.c +++ b/drivers/gpu/drm/msm/sde/sde_crtc.c @@ -402,8 +402,7 @@ static void _sde_crtc_wait_for_fences(struct drm_crtc *crtc) { struct drm_plane *plane = NULL; uint32_t wait_ms = 1; - u64 ktime_end; - s64 ktime_wait; /* need signed 64-bit type */ + ktime_t kt_end, kt_wait; DBG(""); @@ -413,8 +412,8 @@ static void _sde_crtc_wait_for_fences(struct drm_crtc *crtc) } /* use monotonic timer to limit total fence wait time */ - ktime_end = ktime_get_ns() + - to_sde_crtc_state(crtc->state)->input_fence_timeout_ns; + kt_end = ktime_add_ns(ktime_get(), + to_sde_crtc_state(crtc->state)->input_fence_timeout_ns); /* * Wait for fences sequentially, as all of them need to be signalled @@ -428,9 +427,9 @@ static void _sde_crtc_wait_for_fences(struct drm_crtc *crtc) drm_atomic_crtc_for_each_plane(plane, crtc) { if (wait_ms) { /* determine updated wait time */ - ktime_wait = ktime_end - ktime_get_ns(); - if (ktime_wait >= 0) - wait_ms = ktime_wait / NSEC_PER_MSEC; + kt_wait = ktime_sub(kt_end, ktime_get()); + if (ktime_compare(kt_wait, ktime_set(0, 0)) >= 0) + wait_ms = ktime_to_ms(kt_wait); else wait_ms = 0; } |
