summaryrefslogtreecommitdiff
path: root/lib/igt_aux.c
diff options
context:
space:
mode:
authorRob Clark <robdclark@chromium.org>2022-07-10 10:18:46 -0700
committerRob Clark <robdclark@chromium.org>2023-02-20 10:31:36 -0800
commit5b213b75f3fa086aae2196592c2cf05ca511367a (patch)
tree3c5ec2697eb4db4b9cec67d77aa2b36fa4beb582 /lib/igt_aux.c
parentecbc2bb589d73f941f8202970089f4118f6e95ad (diff)
lib: Add helper to wait and close fence fd
Get rid of some copy/pasta and open coding of a common pattern, waiting for GPU commands to complete. Signed-off-by: Rob Clark <robdclark@chromium.org>
Diffstat (limited to 'lib/igt_aux.c')
-rw-r--r--lib/igt_aux.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/igt_aux.c b/lib/igt_aux.c
index 15e304407..672d7d4b0 100644
--- a/lib/igt_aux.c
+++ b/lib/igt_aux.c
@@ -1919,3 +1919,14 @@ void *igt_memdup(const void *ptr, size_t len)
return dup;
}
+
+/**
+ * igt_wait_and_close: helper to wait on a fence-fd and then close it
+ *
+ * @fence_fd: the fence-fd to wait on and close
+ */
+void igt_wait_and_close(int fence_fd)
+{
+ poll(&(struct pollfd){fence_fd, POLLIN}, 1, -1);
+ close(fence_fd);
+}