Commit a3f0d75d authored by Chris Wilson's avatar Chris Wilson

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's avatarChris Wilson <chris@chris-wilson.co.uk>
parent 31811f4b
......@@ -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];
......
......@@ -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
......@@ -22,6 +22,7 @@
*/
#include "igt.h"
#include "sw_sync.h"
#include <sys/ioctl.h>
#include <sys/poll.h>
......@@ -140,7 +141,7 @@ static void test_fence_busy(int fd, unsigned ring, unsigned flags)
batch = gem_mmap__wc(fd, obj.handle, 0, 4096, PROT_WRITE);
gem_set_domain(fd, obj.handle,
I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
reloc.target_handle = obj.handle; /* recurse */
reloc.presumed_offset = 0;
......@@ -194,6 +195,8 @@ static void test_fence_busy(int fd, unsigned ring, unsigned flags)
}
igt_assert(!gem_bo_busy(fd, obj.handle));
igt_assert_eq(sync_fence_status(fence),
flags & HANG ? -EIO : SYNC_FENCE_OK);
close(fence);
gem_close(fd, obj.handle);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment