How to access(zero copy) android AHardWareBuffer and ANativeWindow_Buffer, with mali opencl?
please note, ANativeWindow_Buffer is not ANativeWindowBuffer.
I started to think about this after posting my reply yesterday. This looks like it would be a plausible route but unfortunately the Mali driver doesn't support EGL_ANDROID_get_native_client_buffer.
If rendering a texture with OpenGL is an acceptable solution, a possible route to explore would be:
- create an EGL image from a dma_buf allocation (via ION most likely)
- import it in CL using clCreateFromEGLImageKHR
- create a GL external texture from it
- write to it using CL
- render it using GL
This is definitely something that we support and validate.
Also, If I understand correctly, you're using OpenCV. You may want to have a look our compute library  (built on top of OpenCL) that has a number of algorithms optimised for Mali GPUs.
Lastly, I am going to be away for a couple of weeks and won't be able to reply until I get back but don't hesitate to keep posting your findings and questions. I'll pick up the thread when I'm back (and other might be able to help as well).
I have queried the system with huawei P30 pro, with eglQueryString, it looks like support the EGL_ANDROID_get_native_client_buffer.
EGL_EXTENSIONS:EGL_KHR_get_all_proc_addresses EGL_ANDROID_presentation_time EGL_KHR_swap_buffers_with_damage EGL_ANDROID_get_native_client_buffer EGL_ANDROID_front_buffer_auto_refresh EGL_ANDROID_get_frame_timestamps EGL_EXT_surface_SMPTE2086_metadata EGL_EXT_surface_CTA861_3_metadata EGL_KHR_image EGL_KHR_image_base EGL_EXT_image_gl_colorspace EGL_KHR_gl_colorspace EGL_KHR_gl_texture_2D_image EGL_KHR_gl_texture_cubemap_image EGL_KHR_gl_renderbuffer_image EGL_KHR_fence_sync EGL_KHR_create_context EGL_KHR_config_attribs EGL_KHR_surfaceless_context EGL_EXT_create_context_robustness EGL_ANDROID_image_native_buffer EGL_KHR_wait_sync EGL_ANDROID_recordable EGL_KHR_partial_update EGL_EXT_pixel_format_float EGL_KHR_mutable_render_buffer EGL_EXT_protected_content EGL_IMG_context_priority EGL_KHR_no_config_context
Yes, while we don't support this extension directly, it is indeed implemented in Android's EGL layer so you can rely on it. Have you been able to make the EGL route work?
Thanks for the update. Good luck and let us know how you get on.