use cl_mem_ext_host_ptr extension always failed!
Join Date: 8 Sep 15
Posts: 1
Posted: Thu, 2015-10-15 23:33
Hi,
I use Opencl to do some calculation using adren330, the data input is a Android Graphic Buffer. The performance requirement is critical, so I don't want openCL spend time to copy data from host to device. I've done some research, and it seems that using cl_mem_ext_host_ptr extension may solve my problem. I mainly reference this site https://www.khronos.org/registry/cl/extensions/qcom/cl_qcom_android_native_buffer_host_ptr.txt
My problem is,to be specific, now I use clCreateImage2D using ANativeWindowBuffer, however, it always return -30(CL_INVALID_VALUE). My code is like:
sp<GraphicBuffer> gb;
cl_mem_android_native_buffer_host_ptr myANBmem = {0};
--snip--
myANBmem.ext_host_ptr.allocation_type = CL_MEM_ANDROID_NATIVE_BUFFER_HOST_PTR_QCOM;
myANBmem.ext_host_ptr.host_cache_policy = CL_MEM_HOST_WRITEBACK_QCOM;
myANBmem.anb_ptr = gb->getNativeBuffer();
buffer = clCreateImage2D(mContext,
CL_MEM_USE_HOST_PTR|CL_MEM_EXT_HOST_PTR_QCOM,
&clImageFormat,
width,
height,
pitch,
&myANBmem,
&errNum);
if (errNum != CL_SUCCESS)
{
LOGE("Error creating CL image object errNum=%d",errNum);
return UNKNOWN_ERROR;
}
Can someone give me some hints or suggestions? Or is there sample code for reference?
Thanks a lot!
Encountered the exact same problem.
Can't seem to find information about the issue anywhere.
Android logs aren't helpful as well.
Any pointers are welcome.
Thanks.
Open CL Platform info: