aboutsummaryrefslogtreecommitdiffstats
path: root/amdgpu
diff options
context:
space:
mode:
authorMarek Olšák2017-09-08 09:05:54 -0500
committerMarek Olšák2017-10-12 13:35:57 -0500
commitc74d4614048f65b412caa572c900d15adba38ce3 (patch)
tree4445a1fedee3db9677dc9563ba99cdda1fae924b /amdgpu
parent59aa57b363ba8de550aced1d397c54fd9e5e213c (diff)
downloadexternal-libdrm-c74d4614048f65b412caa572c900d15adba38ce3.tar.gz
external-libdrm-c74d4614048f65b412caa572c900d15adba38ce3.tar.xz
external-libdrm-c74d4614048f65b412caa572c900d15adba38ce3.zip
amdgpu: add amdgpu_cs_fence_to_handle
v2: update amdgpu-symbol-check Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Diffstat (limited to 'amdgpu')
-rwxr-xr-xamdgpu/amdgpu-symbol-check1
-rw-r--r--amdgpu/amdgpu.h14
-rw-r--r--amdgpu/amdgpu_cs.c22
3 files changed, 37 insertions, 0 deletions
diff --git a/amdgpu/amdgpu-symbol-check b/amdgpu/amdgpu-symbol-check
index 7ecfc982..d9f89ef3 100755
--- a/amdgpu/amdgpu-symbol-check
+++ b/amdgpu/amdgpu-symbol-check
@@ -34,6 +34,7 @@ amdgpu_cs_ctx_free
34amdgpu_cs_destroy_semaphore 34amdgpu_cs_destroy_semaphore
35amdgpu_cs_destroy_syncobj 35amdgpu_cs_destroy_syncobj
36amdgpu_cs_export_syncobj 36amdgpu_cs_export_syncobj
37amdgpu_cs_fence_to_handle
37amdgpu_cs_import_syncobj 38amdgpu_cs_import_syncobj
38amdgpu_cs_query_fence_status 39amdgpu_cs_query_fence_status
39amdgpu_cs_query_reset_state 40amdgpu_cs_query_reset_state
diff --git a/amdgpu/amdgpu.h b/amdgpu/amdgpu.h
index 979acfc8..23cde108 100644
--- a/amdgpu/amdgpu.h
+++ b/amdgpu/amdgpu.h
@@ -1433,6 +1433,20 @@ int amdgpu_cs_syncobj_import_sync_file(amdgpu_device_handle dev,
1433 int sync_file_fd); 1433 int sync_file_fd);
1434 1434
1435/** 1435/**
1436 * Export an amdgpu fence as a handle (syncobj or fd).
1437 *
1438 * \param what AMDGPU_FENCE_TO_HANDLE_GET_{SYNCOBJ, FD}
1439 * \param out_handle returned handle
1440 *
1441 * \return 0 on success\n
1442 * <0 - Negative POSIX Error code
1443 */
1444int amdgpu_cs_fence_to_handle(amdgpu_device_handle dev,
1445 struct amdgpu_cs_fence *fence,
1446 uint32_t what,
1447 uint32_t *out_handle);
1448
1449/**
1436 * Submit raw command submission to kernel 1450 * Submit raw command submission to kernel
1437 * 1451 *
1438 * \param dev - \c [in] device handle 1452 * \param dev - \c [in] device handle
diff --git a/amdgpu/amdgpu_cs.c b/amdgpu/amdgpu_cs.c
index 2cde7bff..9577d5c9 100644
--- a/amdgpu/amdgpu_cs.c
+++ b/amdgpu/amdgpu_cs.c
@@ -713,3 +713,25 @@ void amdgpu_cs_chunk_fence_to_dep(struct amdgpu_cs_fence *fence,
713 dep->ctx_id = fence->context->id; 713 dep->ctx_id = fence->context->id;
714 dep->handle = fence->fence; 714 dep->handle = fence->fence;
715} 715}
716
717int amdgpu_cs_fence_to_handle(amdgpu_device_handle dev,
718 struct amdgpu_cs_fence *fence,
719 uint32_t what,
720 uint32_t *out_handle)
721{
722 union drm_amdgpu_fence_to_handle fth = {0};
723 int r;
724
725 fth.in.fence.ctx_id = fence->context->id;
726 fth.in.fence.ip_type = fence->ip_type;
727 fth.in.fence.ip_instance = fence->ip_instance;
728 fth.in.fence.ring = fence->ring;
729 fth.in.fence.seq_no = fence->fence;
730 fth.in.what = what;
731
732 r = drmCommandWriteRead(dev->fd, DRM_AMDGPU_FENCE_TO_HANDLE,
733 &fth, sizeof(fth));
734 if (r == 0)
735 *out_handle = fth.out.handle;
736 return r;
737}