[PATCH 4/5] drm/amdgpu: add syncfile fence support to wait_any/all ioctl
Chunming Zhou
David1.Zhou at amd.com
Tue Sep 12 10:23:46 UTC 2017
Change-Id: Ibe77f213560846ec12901e366129d9368750b7ba
Signed-off-by: Chunming Zhou <David1.Zhou at amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 6 ++++++
include/uapi/drm/amdgpu_drm.h | 2 ++
2 files changed, 8 insertions(+)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
index 6c0ea9a..a2fbdaa 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
@@ -1233,6 +1233,12 @@ static struct dma_fence *amdgpu_cs_get_fence(struct amdgpu_device *adev,
struct dma_fence *fence;
int r;
+ if (user->sf_fd > 0) {
+ struct dma_fence *fence = sync_file_get_fence(user->sf_fd);
+
+ WARN_ONCE(fence, "get fence failed from syncfile fd!");
+ return fence;
+ }
ctx = amdgpu_ctx_get(filp->driver_priv, user->ctx_id);
if (ctx == NULL)
return ERR_PTR(-EINVAL);
diff --git a/include/uapi/drm/amdgpu_drm.h b/include/uapi/drm/amdgpu_drm.h
index ce110d9..cf3fb62 100644
--- a/include/uapi/drm/amdgpu_drm.h
+++ b/include/uapi/drm/amdgpu_drm.h
@@ -419,6 +419,8 @@ struct drm_amdgpu_fence {
__u32 ip_instance;
__u32 ring;
__u64 seq_no;
+ int32_t sf_fd;
+ int32_t _pad;
};
struct drm_amdgpu_wait_fences_in {
--
1.9.1
More information about the amd-gfx
mailing list