aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGuido Günther <[email protected]>2020-01-22 11:43:11 +0100
committerMarge Bot <[email protected]>2020-01-23 18:07:13 +0000
commitc5334d2943edc34052269cdb5c1052f6eb65335c (patch)
tree667133493c7a53e7550aa3b786aa244d1af1709c /src
parentb327501dbf946279c8dff55566af73821d0d576e (diff)
freedreno/drm: Don't miscalculate timeout
The current code overflows (s * 1000000000) for s >= 5 but that is e.g. used in msm_bo_cpu_prep. Signed-off-by: Guido Günther <[email protected]> Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3514> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3514>
Diffstat (limited to 'src')
-rw-r--r--src/freedreno/drm/msm_priv.h5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/freedreno/drm/msm_priv.h b/src/freedreno/drm/msm_priv.h
index 172e9870fe5..37adb13624c 100644
--- a/src/freedreno/drm/msm_priv.h
+++ b/src/freedreno/drm/msm_priv.h
@@ -108,10 +108,9 @@ msm_dump_submit(struct drm_msm_gem_submit *req)
static inline void get_abs_timeout(struct drm_msm_timespec *tv, uint64_t ns)
{
struct timespec t;
- uint32_t s = ns / 1000000000;
clock_gettime(CLOCK_MONOTONIC, &t);
- tv->tv_sec = t.tv_sec + s;
- tv->tv_nsec = t.tv_nsec + ns - (s * 1000000000);
+ tv->tv_sec = t.tv_sec + ns / 1000000000;
+ tv->tv_nsec = t.tv_nsec + ns % 1000000000;
}
/*