aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorMarcin Slusarz <marcin.slusarz@gmail.com>2012-04-25 17:20:33 -0400
committerBen Skeggs <bskeggs@redhat.com>2012-05-24 02:31:59 -0400
commit695b95b810d1c3024d7bad9e3658a35e11a60d86 (patch)
tree20a57ff7ec4ee458ff409eb26b3238fac8960182 /drivers/gpu
parentd58086deaa32dc5e630aab222851b282f77e00bb (diff)
drm/nouveau: base fence timeout on time of emission
Wait loop can be interrupted by signal, so if signals are raised periodically (e.g. SIGALRM) this loop may never finish. Use emission time as a base for fence timeout. Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_fence.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_fence.c b/drivers/gpu/drm/nouveau/nouveau_fence.c
index cb19bf447952..ff5969d057ea 100644
--- a/drivers/gpu/drm/nouveau/nouveau_fence.c
+++ b/drivers/gpu/drm/nouveau/nouveau_fence.c
@@ -44,6 +44,7 @@ struct nouveau_fence {
44 44
45 uint32_t sequence; 45 uint32_t sequence;
46 bool signalled; 46 bool signalled;
47 unsigned long timeout;
47 48
48 void (*work)(void *priv, bool signalled); 49 void (*work)(void *priv, bool signalled);
49 void *priv; 50 void *priv;
@@ -172,6 +173,7 @@ nouveau_fence_emit(struct nouveau_fence *fence)
172 } 173 }
173 OUT_RING (chan, fence->sequence); 174 OUT_RING (chan, fence->sequence);
174 FIRE_RING(chan); 175 FIRE_RING(chan);
176 fence->timeout = jiffies + 3 * DRM_HZ;
175 177
176 return 0; 178 return 0;
177} 179}
@@ -230,7 +232,8 @@ __nouveau_fence_signalled(void *sync_obj, void *sync_arg)
230int 232int
231__nouveau_fence_wait(void *sync_obj, void *sync_arg, bool lazy, bool intr) 233__nouveau_fence_wait(void *sync_obj, void *sync_arg, bool lazy, bool intr)
232{ 234{
233 unsigned long timeout = jiffies + (3 * DRM_HZ); 235 struct nouveau_fence *fence = nouveau_fence(sync_obj);
236 unsigned long timeout = fence->timeout;
234 unsigned long sleep_time = NSEC_PER_MSEC / 1000; 237 unsigned long sleep_time = NSEC_PER_MSEC / 1000;
235 ktime_t t; 238 ktime_t t;
236 int ret = 0; 239 int ret = 0;