winsys/amdgpu: avoid ioctl call when fence_wait is called without timeout
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Thu, 5 May 2016 21:35:09 +0000 (16:35 -0500)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Tue, 17 May 2016 20:28:39 +0000 (15:28 -0500)
When user fences are used, we don't need the kernel for polling.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/winsys/amdgpu/drm/amdgpu_cs.c

index 29692cdb0355e8ad94bc375b79e7c35befc2b577..8a801f087fb0db1e12d530af02e436bbe3e8ce17 100644 (file)
@@ -89,10 +89,17 @@ bool amdgpu_fence_wait(struct pipe_fence_handle *fence, uint64_t timeout,
       abs_timeout = os_time_get_absolute_timeout(timeout);
 
    user_fence_cpu = rfence->user_fence_cpu_address;
-   if (user_fence_cpu && *user_fence_cpu >= rfence->fence.fence) {
-       rfence->signalled = true;
-       return true;
+   if (user_fence_cpu) {
+      if (*user_fence_cpu >= rfence->fence.fence) {
+         rfence->signalled = true;
+         return true;
+      }
+
+      /* No timeout, just query: no need for the ioctl. */
+      if (!absolute && !timeout)
+         return false;
    }
+
    /* Now use the libdrm query. */
    r = amdgpu_cs_query_fence_status(&rfence->fence,
                                    abs_timeout,