summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormonk.liu <Monk.Liu@amd.com>2015-12-01 17:48:18 +0800
committerAlex Deucher <alexander.deucher@amd.com>2015-12-04 02:14:12 -0500
commit71dc37a10d2a39b476a71ca8a1ad39d187fbab66 (patch)
treeae6d1ebc8a8225b63c8237970b595be9b8ade9a9
parent26f60db6e7c8c8ab9e53a9968676d5e2b3d510c2 (diff)
amdgpu: cs_wait_fences now can return the first signaled fence indexamd-staging-upstream-rebased
Change-Id: Idf3d3bf0f2d2396a77341f97174d0a173fdd8932 Signed-off-by: monk.liu <Monk.Liu@amd.com>
-rw-r--r--amdgpu/amdgpu.h3
-rw-r--r--amdgpu/amdgpu_cs.c12
-rw-r--r--include/drm/amdgpu_drm.h3
-rw-r--r--tests/amdgpu/basic_tests.c2
4 files changed, 14 insertions, 6 deletions
diff --git a/amdgpu/amdgpu.h b/amdgpu/amdgpu.h
index 8822a0c5..d4be7fcc 100644
--- a/amdgpu/amdgpu.h
+++ b/amdgpu/amdgpu.h
@@ -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
diff --git a/amdgpu/amdgpu_cs.c b/amdgpu/amdgpu_cs.c
index d033f8ea..5c7a3a3a 100644
--- a/amdgpu/amdgpu_cs.c
+++ b/amdgpu/amdgpu_cs.c
@@ -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;
diff --git a/include/drm/amdgpu_drm.h b/include/drm/amdgpu_drm.h
index 2cbea726..194e1f97 100644
--- a/include/drm/amdgpu_drm.h
+++ b/include/drm/amdgpu_drm.h
@@ -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 {
diff --git a/tests/amdgpu/basic_tests.c b/tests/amdgpu/basic_tests.c
index 56db9351..47cd1dbc 100644
--- a/tests/amdgpu/basic_tests.c
+++ b/tests/amdgpu/basic_tests.c
@@ -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,