diff options
author | Terje Bergstrom <tbergstrom@nvidia.com> | 2012-03-13 15:53:10 +0200 |
---|---|---|
committer | Rohan Somvanshi <rsomvanshi@nvidia.com> | 2012-03-21 23:35:07 -0700 |
commit | 1857d4711aab59006e2d2d517b96487b170bf609 (patch) | |
tree | ed3705693b2808fb008e14356f1c099badcb4d8b | |
parent | 6ab7670d0a6e91035e2e74cb4fa028488d80f4f8 (diff) |
video: tegra: host: Correct waitchk comparison logic
Change waitchk comparison logic to use the new
nvhost_syncpt_is_expired().
Bug 941327
Change-Id: Ib7de04ad7663990bb416e39f8d79a46a9f5955fa
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: http://git-master/r/89769
Reviewed-by: Rohan Somvanshi <rsomvanshi@nvidia.com>
Tested-by: Rohan Somvanshi <rsomvanshi@nvidia.com>
-rw-r--r-- | drivers/video/tegra/host/host1x/host1x_syncpt.c | 25 |
1 files changed, 6 insertions, 19 deletions
diff --git a/drivers/video/tegra/host/host1x/host1x_syncpt.c b/drivers/video/tegra/host/host1x/host1x_syncpt.c index 14ee3c0bd663..b0fd9970aaa0 100644 --- a/drivers/video/tegra/host/host1x/host1x_syncpt.c +++ b/drivers/video/tegra/host/host1x/host1x_syncpt.c @@ -97,19 +97,6 @@ static void t20_syncpt_cpu_incr(struct nvhost_syncpt *sp, u32 id) wmb(); } -/* returns true, if a <= b < c using wrapping comparison */ -static inline bool nvhost_syncpt_is_between(u32 a, u32 b, u32 c) -{ - return b-a < c-a; -} - -/* returns true, if syncpt >= threshold (mod 1 << 32) */ -static bool nvhost_syncpt_wrapping_comparison(u32 syncpt, u32 threshold) -{ - return nvhost_syncpt_is_between(threshold, syncpt, - (1UL<<31UL)+threshold); -} - /* check for old WAITs to be removed (avoiding a wrap) */ static int t20_syncpt_wait_check(struct nvhost_syncpt *sp, struct nvmap_client *nvmap, @@ -130,12 +117,11 @@ static int t20_syncpt_wait_check(struct nvhost_syncpt *sp, /* compare syncpt vs wait threshold */ while (num_waitchk) { - u32 syncpt, override; + u32 override; BUG_ON(wait->syncpt_id >= NV_HOST1X_SYNCPT_NB_PTS); - - syncpt = atomic_read(&sp->min_val[wait->syncpt_id]); - if (nvhost_syncpt_wrapping_comparison(syncpt, wait->thresh)) { + if (nvhost_syncpt_is_expired(sp, + wait->syncpt_id, wait->thresh)) { /* * NULL an already satisfied WAIT_SYNCPT host method, * by patching its args in the command stream. The @@ -145,10 +131,11 @@ static int t20_syncpt_wait_check(struct nvhost_syncpt *sp, * is guaranteed to be popped by the host HW. */ dev_dbg(&syncpt_to_dev(sp)->dev->dev, - "drop WAIT id %d (%s) thresh 0x%x, syncpt 0x%x\n", + "drop WAIT id %d (%s) thresh 0x%x, min 0x%x\n", wait->syncpt_id, syncpt_op(sp).name(sp, wait->syncpt_id), - wait->thresh, syncpt); + wait->thresh, + nvhost_syncpt_read_min(sp, wait->syncpt_id)); /* patch the wait */ override = nvhost_class_host_wait_syncpt( |