[PATCH 3/3] drm/amdgpu: return first signaled fence index in status parameter

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "monk.liu" <monk.liu@xxxxxxx>

Return the index of the first signaled fence in the fences ioctl.
This information is useful in some APIs like Vulkan.

Signed-off-by: monk.liu <monk.liu@xxxxxxx>
Signed-off-by: Alex Deucher <alexander.deucher@xxxxxxx>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 4 +++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c | 2 +-
 include/uapi/drm/amdgpu_drm.h          | 3 ++-
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
index f0c3c356..f748162 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
@@ -1216,6 +1216,7 @@ static int amdgpu_cs_wait_any_fence(struct amdgpu_device *adev,
 {
 	unsigned long timeout = amdgpu_gem_timeout(wait->in.timeout_ns);
 	uint32_t fence_count = wait->in.fence_count;
+	uint32_t first = ~0;
 	struct fence **array;
 	unsigned i;
 	long r;
@@ -1241,13 +1242,14 @@ static int amdgpu_cs_wait_any_fence(struct amdgpu_device *adev,
 		}
 	}
 
-	r = fence_wait_any_timeout(array, fence_count, true, timeout);
+	r = fence_wait_any_timeout(array, fence_count, true, timeout, &first);
 	if (r < 0)
 		goto err_free_fence_array;
 
 out:
 	memset(wait, 0, sizeof(*wait));
 	wait->out.status = (r > 0);
+	wait->out.first_signaled = first;
 	/* set return value 0 to indicate success */
 	r = 0;
 
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c
index d8af37a..ed50d77 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c
@@ -361,7 +361,7 @@ int amdgpu_sa_bo_new(struct amdgpu_sa_manager *sa_manager,
 		if (count) {
 			spin_unlock(&sa_manager->wq.lock);
 			t = fence_wait_any_timeout(fences, count, false,
-						   MAX_SCHEDULE_TIMEOUT);
+						   MAX_SCHEDULE_TIMEOUT, NULL);
 			for (i = 0; i < count; ++i)
 				fence_put(fences[i]);
 
diff --git a/include/uapi/drm/amdgpu_drm.h b/include/uapi/drm/amdgpu_drm.h
index b726095..bca630c 100644
--- a/include/uapi/drm/amdgpu_drm.h
+++ b/include/uapi/drm/amdgpu_drm.h
@@ -328,7 +328,8 @@ struct drm_amdgpu_wait_fences_in {
 };
 
 struct drm_amdgpu_wait_fences_out {
-	__u64 status;
+	__u32 status;
+	__u32 first_signaled;
 };
 
 union drm_amdgpu_wait_fences {
-- 
2.5.5

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux