[igt-dev] [CI 1/2] lib/sw_sync: Fix querying fence status

Petri Latvala petri.latvala at intel.com
Thu Mar 14 10:27:39 UTC 2019


From: Chris Wilson <chris at chris-wilson.co.uk>

To query the fence status, and only the fence status, you only need to
pass .num_fences = 0.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
Cc: Petri Latvala <petri.latvala at intel.com>
---
 lib/sw_sync.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/lib/sw_sync.c b/lib/sw_sync.c
index f2086033..d671923c 100644
--- a/lib/sw_sync.c
+++ b/lib/sw_sync.c
@@ -206,19 +206,12 @@ int sync_fence_count_status(int fd, int status)
 
 int sync_fence_status(int fence)
 {
-	struct sync_fence_info fence_info;
-	struct sync_file_info file_info = {
-		.sync_fence_info = to_user_pointer(&fence_info),
-		.num_fences = 1,
-	};
+	struct sync_file_info info = { };
 
-	if (ioctl(fence, SYNC_IOC_FILE_INFO, &file_info))
+	if (ioctl(fence, SYNC_IOC_FILE_INFO, &info))
 		return -errno;
 
-	if (file_info.num_fences != 1)
-		return -EINVAL;
-
-	return fence_info.status;
+	return info.status;
 }
 
 static void modprobe(const char *driver)
-- 
2.19.1



More information about the igt-dev mailing list