From a3f0d75d19aa252d3896af4763d6a9a5172f8814 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Tue, 3 Jan 2017 14:57:25 +0000 Subject: igt/gem_exec_fence: Check sync_file->status after the fence is signaled After the fence is signaled, the status feed reports whether or not the request completed successfully. We set this to -EIO if a hang was detected. Signed-off-by: Chris Wilson --- lib/sw_sync.c | 17 +++++++++++++++++ lib/sw_sync.h | 3 +++ 2 files changed, 20 insertions(+) (limited to 'lib') diff --git a/lib/sw_sync.c b/lib/sw_sync.c index 04585261..9dc6ec85 100644 --- a/lib/sw_sync.c +++ b/lib/sw_sync.c @@ -231,6 +231,23 @@ int sync_fence_count_status(int fd, int status) return count; } +int sync_fence_status(int fence) +{ + struct local_sync_fence_info fence_info; + struct local_sync_file_info file_info = { + .sync_fence_info = to_user_pointer(&fence_info), + .num_fences = 1, + }; + + if (ioctl(fence, LOCAL_SYNC_IOC_FILE_INFO, &file_info)) + return -errno; + + if (file_info.num_fences != 1) + return -EINVAL; + + return fence_info.status; +} + static bool kernel_has_sw_sync(void) { char buf[128]; diff --git a/lib/sw_sync.h b/lib/sw_sync.h index 82268908..571fe6a1 100644 --- a/lib/sw_sync.h +++ b/lib/sw_sync.h @@ -41,8 +41,11 @@ int sw_sync_timeline_create_fence(int timeline, uint32_t seqno); int sync_fence_merge(int fence1, int fence2); int sync_fence_wait(int fence, int timeout); +int sync_fence_status(int fence); int sync_fence_count(int fence); int sync_fence_count_status(int fence, int status); +#define SYNC_FENCE_OK 1 + #endif -- cgit v1.2.3