diff options
author | Chuanbo Weng <chuanbo.weng@intel.com> | 2015-11-06 15:57:38 +0800 |
---|---|---|
committer | Yang Rong <rong.r.yang@intel.com> | 2015-11-10 10:51:37 +0800 |
commit | 323e2f2eb1e2589b8bc1fc0ac0bde8debc11d27b (patch) | |
tree | 673c328e17c7b5c3221b437537daa54718a9a40f /include | |
parent | 2b5c3bfce7c5c0ca4d9947dc42b56693be290ef4 (diff) |
Add extension clCreateBufferFromFdINTEL to create cl buffer by external buffer object's fd.
Before this patch, Beignet can only create cl buffer from external bo by
its handle using clCreateBufferFromLibvaIntel. Render node is the first
choice of accessing gpu in currect Beignet implementation. DRM_IOCTL_GEM_OPEN
is used by clCreateBufferFromLibvaIntel but forbidden in Render node mode.
So it's necessary to add this extension to support buffer sharing between
different libraries.
v2:
Seperate clCreateMemObjectFromFdIntel into two extensions:
clCreateBufferFromFdINTEL and clCreateImageFromFdINTEL.
v3:
Fix rebase conflict: add a parameter when invoke cl_mem_allocate.
Signed-off-by: Chuanbo Weng <chuanbo.weng@intel.com>
Reviewed-by: "Yang, Rong R" <rong.r.yang@intel.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/CL/cl_intel.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/include/CL/cl_intel.h b/include/CL/cl_intel.h index 28bcb62b..01da5533 100644 --- a/include/CL/cl_intel.h +++ b/include/CL/cl_intel.h @@ -133,6 +133,22 @@ typedef CL_API_ENTRY cl_int (CL_API_CALL *clGetMemObjectFdIntel_fn)( cl_mem /* Memory Obejct */, int* /* returned fd */); +typedef struct _cl_import_buffer_info_intel { + int fd; + int size; +} cl_import_buffer_info_intel; + +/* Create memory object from external buffer object by fd */ +extern CL_API_ENTRY cl_mem CL_API_CALL +clCreateBufferFromFdINTEL(cl_context /* context */, + const cl_import_buffer_info_intel * /* info */, + cl_int * /* errcode_ret */); + +typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateBufferFromFdINTEL_fn)( + cl_context /* context */, + const cl_import_buffer_info_intel * /* info */, + cl_int * /* errcode_ret */); + #ifdef __cplusplus } #endif |