summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTerje Bergstrom <tbergstrom@nvidia.com>2012-05-22 11:28:12 +0300
committerSimone Willett <swillett@nvidia.com>2012-05-24 14:43:39 -0700
commit2285ec5a2c09d0f3e0469a65291ffe983918d112 (patch)
tree85860e1d0e3524fd5afc425bc73efeafa91991c7
parentbe1e69e5163ba61068d6a6a61e33778f7cf90b42 (diff)
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 <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/103827 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Mayuresh Kulkarni <mkulkarni@nvidia.com> Reviewed-by: Juha Tukkinen <jtukkinen@nvidia.com>
-rw-r--r--drivers/video/tegra/host/nvhost_syncpt.c17
1 files changed, 15 insertions, 2 deletions
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
@@ -130,6 +130,19 @@ void nvhost_syncpt_incr(struct nvhost_syncpt *sp, u32 id)
}
/**
+ * 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.
*/
int nvhost_syncpt_wait_timeout(struct nvhost_syncpt *sp, u32 id,
@@ -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;