diff options
author | Thomas Hellstrom <thomas@tungstengraphics.com> | 2006-03-06 13:50:05 +0000 |
---|---|---|
committer | Thomas Hellstrom <thomas@tungstengraphics.com> | 2006-03-06 13:50:05 +0000 |
commit | a39116e4ff21f2309206bda43aff5536d4e94219 (patch) | |
tree | 0fe047cf5539c7757ce613d3fea9797325140566 /libdrm/xf86mm.c | |
parent | 8ec9cfb704e7535cabaf8cd904a2432c302ff980 (diff) |
mm: Flag documentation in libdrm. Validation sequence numbers in mm blocks
so that we can evict a buffer before it's validation sequence wraps
around. (Every 100th day or so :))
Diffstat (limited to 'libdrm/xf86mm.c')
-rw-r--r-- | libdrm/xf86mm.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/libdrm/xf86mm.c b/libdrm/xf86mm.c index 0b670b53..adb3be89 100644 --- a/libdrm/xf86mm.c +++ b/libdrm/xf86mm.c @@ -257,10 +257,6 @@ drmWaitFence(int drmFD, drmFence fence) fence.fenceSeq) < DRM_MM_WRAP) return 0; - arg.req.op = wait_fence; - arg.req.fence_type = fence.fenceType; - arg.req.fence_seq = fence.fenceSeq; - /* * Ugly, but necessary for multiple DRI clients with the userspace * arbitration scheme. We need a scheduler!!. @@ -268,6 +264,15 @@ drmWaitFence(int drmFD, drmFence fence) sched_yield(); + if ((drmMMKI.sarea->retired[fence.fenceType & DRM_FENCE_MASK] - + fence.fenceSeq) < DRM_MM_WRAP) + return 0; + + arg.req.op = wait_fence; + arg.req.fence_type = fence.fenceType; + arg.req.fence_seq = fence.fenceSeq; + + if (ioctl(drmFD, DRM_IOCTL_FENCE, &arg)) { drmMsg("drmWaitFence: failed: %s\n", strerror(errno)); |