How to access(zero copy) android AHardWareBuffer and ANativeWindow_Buffer, with mali opencl?
please note, ANativeWindow_Buffer is not ANativeWindowBuffer.
AHardWareBuffer
https://developer.android.google.cn/ndk/reference/group/a-hardware-buffer
ANativeWindow_Buffer:
https://developer.android.google.cn/ndk/reference/group/a-native-window#group___a_native_window_1gad0983ca473ce36293baf5e51a14c3357
The Mali OpenCL driver now supports Importing AHardwareBuffer: www.khronos.org/.../cl_arm_import_memory.txt
yes, I have read the develope guide, and can AHARDWAREBUFFER_FORMAT_Y8Cb8Cr8_420 be Imported with the extention for R/W?
and, another question is, Can ION buffer imported with cl_arm_import_memory_dma_buf?
Yes, you can share the ION buffer to obtain a dma_buf file descriptor that can be imported with cl_arm_import_memory_dma_buf. You can look into ion_share or ION_IOC_SHARE.
If the buffer uses a single plane, it should be supported. The format's documentation implies that the buffer could either be mutiplanar (only the first plane would be imported) or semiplanar.
EDIT: we will be adding full support for this.
It look like that, AHARDWAREBUFFER_FORMAT_Y8Cb8Cr8_420 can't be import by the extention.
As ION can be imported, Can I import a NV21(YVU420P) image with graphic buffer, in such way:
get file handle of the ION from gb(graphic buf), the import the ION buffer with fd:
int fd =( (private_handle_t*) gb->handle)->fd;
AHARDWAREBUFFER_FORMAT_Y8Cb8Cr8_420 is very important because android camera provide the image data in this format. For Other format such as RGBA8888, It's not difficult and not nessesary to use the cl_arm_import_memory, opencl can acess it with openglTEXTURE2D.
Thanks for the feedback. What behaviour are you getting?
This should work but is not guaranteed to be portable.