Mesa (master): winsys/amdgpu: avoid ioctl call when fence_wait is called without timeout

Nicolai Hähnle nh at kemper.freedesktop.org
Tue May 17 20:31:45 UTC 2016


Module: Mesa
Branch: master
Commit: fef08af99c7e83f100a5ae25f2798131c278d841
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=fef08af99c7e83f100a5ae25f2798131c278d841

Author: Nicolai Hähnle <nicolai.haehnle at amd.com>
Date:   Thu May  5 16:35:09 2016 -0500

winsys/amdgpu: avoid ioctl call when fence_wait is called without timeout

When user fences are used, we don't need the kernel for polling.

Reviewed-by: Marek Olšák <marek.olsak at amd.com>

---

 src/gallium/winsys/amdgpu/drm/amdgpu_cs.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
index 29692cd..8a801f0 100644
--- a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
+++ b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
@@ -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,




More information about the mesa-commit mailing list