@@ -916,6 +916,7 @@ int amdgpu_cs_query_fence_status(struct amdgpu_cs_fence *fence,
* otherwise, wait at least one fence
* \param timeout_ns - \c [in] The timeout to wait, in nanoseconds
* \param status - \c [out] '1' for signaled, '0' for timeout
+ * \param first - \c [out] the index of the first signaled fence from @fences
*
* \return 0 on success
* <0 - Negative POSIX Error code
@@ -927,7 +928,7 @@ int amdgpu_cs_wait_fences(struct amdgpu_cs_fence *fences,
uint32_t fence_count,
bool wait_all,
uint64_t timeout_ns,
- uint32_t *status);
+ uint32_t *status, uint32_t *first);
/*
* Query / Info API
@@ -439,7 +439,8 @@ static int amdgpu_ioctl_wait_fences(struct amdgpu_cs_fence *fences,
uint32_t fence_count,
bool wait_all,
uint64_t timeout_ns,
- uint32_t *status)
+ uint32_t *status,
+ uint32_t *first)
{
struct drm_amdgpu_fence *drm_fences;
amdgpu_device_handle dev = fences[0].context->dev;
@@ -467,6 +468,10 @@ static int amdgpu_ioctl_wait_fences(struct amdgpu_cs_fence *fences,
return -errno;
*status = args.out.status;
+
+ if (first)
+ *first = args.out.first_signaled;
+
return 0;
}
@@ -474,7 +479,8 @@ int amdgpu_cs_wait_fences(struct amdgpu_cs_fence *fences,
uint32_t fence_count,
bool wait_all,
uint64_t timeout_ns,
- uint32_t *status)
+ uint32_t *status,
+ uint32_t *first)
{
uint32_t ioctl_status = 0;
uint32_t i;
@@ -499,7 +505,7 @@ int amdgpu_cs_wait_fences(struct amdgpu_cs_fence *fences,
*status = 0;
r = amdgpu_ioctl_wait_fences(fences, fence_count, wait_all, timeout_ns,
- &ioctl_status);
+ &ioctl_status, first);
if (!r)
*status = ioctl_status;
@@ -316,7 +316,8 @@ struct drm_amdgpu_wait_fences_in {
};
struct drm_amdgpu_wait_fences_out {
- uint64_t status;
+ uint32_t status;
+ uint32_t first_signaled;
};
union drm_amdgpu_wait_fences {
@@ -974,7 +974,7 @@ static void amdgpu_command_submission_multi_fence_wait_all(bool wait_all)
r = amdgpu_cs_wait_fences(fence_status, ib_cs_num, wait_all,
AMDGPU_TIMEOUT_INFINITE,
- &expired);
+ &expired, NULL);
CU_ASSERT_EQUAL(r, 0);
r = amdgpu_bo_unmap_and_free(ib_result_handle, va_handle,