From 2285ec5a2c09d0f3e0469a65291ffe983918d112 Mon Sep 17 00:00:00 2001 From: Terje Bergstrom Date: Tue, 22 May 2012 11:28:12 +0300 Subject: video: tegra: host: Improve timing of syncpt wait nvhost_syncpt_wait_timeout() relies on sync point interrupt to signal reaching the sync point value. With low timeout values, the resolution is not good enough and an error is returned even when the value is reached. Update syncpoint value from hardware when doing a sync point wait and do an explicit check for reaching the value even if wait returns a timeout. bug 984166 bug 986788 bug 987597 Change-Id: I640e32cdcdfa66b8977eac273dd32f62bd72abd6 Signed-off-by: Terje Bergstrom Reviewed-on: http://git-master/r/103827 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Mayuresh Kulkarni Reviewed-by: Juha Tukkinen --- drivers/video/tegra/host/nvhost_syncpt.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'drivers') diff --git a/drivers/video/tegra/host/nvhost_syncpt.c b/drivers/video/tegra/host/nvhost_syncpt.c index 4835d22881b8..1458a7cb5acc 100644 --- a/drivers/video/tegra/host/nvhost_syncpt.c +++ b/drivers/video/tegra/host/nvhost_syncpt.c @@ -129,6 +129,19 @@ void nvhost_syncpt_incr(struct nvhost_syncpt *sp, u32 id) nvhost_module_idle(syncpt_to_dev(sp)->dev); } +/** + * Updated sync point form hardware, and returns true if syncpoint is expired, + * false if we may need to wait + */ +static bool syncpt_update_min_is_expired( + struct nvhost_syncpt *sp, + u32 id, + u32 thresh) +{ + syncpt_op().update_min(sp, id); + return nvhost_syncpt_is_expired(sp, id, thresh); +} + /** * Main entrypoint for syncpoint value waits. */ @@ -190,9 +203,9 @@ int nvhost_syncpt_wait_timeout(struct nvhost_syncpt *sp, u32 id, while (timeout) { u32 check = min_t(u32, SYNCPT_CHECK_PERIOD, timeout); int remain = wait_event_interruptible_timeout(wq, - nvhost_syncpt_is_expired(sp, id, thresh), + syncpt_update_min_is_expired(sp, id, thresh), check); - if (remain > 0) { + if (remain > 0 || nvhost_syncpt_is_expired(sp, id, thresh)) { if (value) *value = nvhost_syncpt_read_min(sp, id); err = 0; -- cgit v1.2.3