From aa5de9cfcb55ebd1cff8db62ab71c7afdbb6ec99 Mon Sep 17 00:00:00 2001 From: securecrt Date: Thu, 21 Jun 2012 12:34:57 +0800 Subject: [PATCH] msm: kgsl: increase valid timestamp range The existing timestamp_cmp function returns a different result depending on the order of the input parameters due to having an asymetric valid window. When no rollover is detected the window is 2^31 but when a rollover is detected the window is 25000. This change makes the rollover window symmetric at 2^31. --- drivers/gpu/msm/kgsl.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/msm/kgsl.h b/drivers/gpu/msm/kgsl.h index 968f2b11..324b6b65 100755 --- a/drivers/gpu/msm/kgsl.h +++ b/drivers/gpu/msm/kgsl.h @@ -24,6 +24,9 @@ #define KGSL_NAME "kgsl" +/* Timestamp window used to detect rollovers */ +#define KGSL_TIMESTAMP_WINDOW 0x80000000 + /*cache coherency ops */ #define DRM_KGSL_GEM_CACHE_OP_TO_DEV 0x0001 #define DRM_KGSL_GEM_CACHE_OP_FROM_DEV 0x0002 @@ -193,7 +196,7 @@ static inline int timestamp_cmp(unsigned int new, unsigned int old) if (ts_diff == 0) return 0; - return ((ts_diff > 0) || (ts_diff < -20000)) ? 1 : -1; + return ((ts_diff > 0) || (ts_diff < -KGSL_TIMESTAMP_WINDOW)) ? 1 : -1; } static inline void