From 323e2f2eb1e2589b8bc1fc0ac0bde8debc11d27b Mon Sep 17 00:00:00 2001 From: Chuanbo Weng Date: Fri, 6 Nov 2015 15:57:38 +0800 Subject: 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 Reviewed-by: "Yang, Rong R" --- include/CL/cl_intel.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'include') 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 -- cgit v1.2.1