Fix several bugs in the timeout logic of clientWait 1) timeout is unsigned, and clients tend to pass large unsigned values (like -1) to mean "wait as long as possible". Casting to signed at the start of the math meant that everything was negative, so we would never actually wait for fences to be signalled. 2) When going from nanoseconds to seconds, we should divide by 10^9, not multiply by 10^6. 3) Even with all of this, it's possible for a sufficiently large counter frequency to still cause overflow, so detect that case and clamp. Change-Id: I9e728aac72d8dc0b15582732b6fd4d87c90bd140 Reviewed-on: https://chromium-review.googlesource.com/707202 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>