Hello,
I found out that on qcom platform, there's a extension,
https://www.khronos.org/registry/cl/extensions/qcom/cl_qcom_ion_host_ptr.txt
Can I do the same on mali T760, android platform?
Songmao
Actually I have a yuy2(yuyv) GraphicBuffer, But it seems I can not eglCreateImageKHR from a yuy2 format buffer, any way I can get this done?
Hi songmao,
OpenCL will not do any kind of data interpretation on the data sampled from the image (Assuming you're not using any kind of interpolation on the image sampled), therefore you could use an RGBA8888 format for your GraphicBuffer and re-interpret it as YUY2 in your OpenCL kernel, do you see what I mean ?
Alternatively if you have a recent enough version of the driver ( >= r7p0) then you could use clImportMemoryARM to import a dma_buf allocation as a CL buffer.
Usually you will have a dma_buf file descriptor as part of the private data inside your Gralloc allocation. (However this is platform dependent, so this will depend on what device you're using).
Hope this helps,
Anthony
Hi Anthony,
Thanks, I am implementing zero copy scheme for a camera frame processing framework, the gpu driver seems to be a r5p0 release, and I have no way to upgrade the driver. Would you please show me some magic code, so that my own version clImportMemoryARM would work for me? Since zero copy would be very important for performance.
Thanks,
Here is how to use this extension:
#define WIDTH 1024 #define HEIGHT 512 // Create buffer to be used as a hardware texture with graphics APIs (can also // include video/camera use flags here) int dma_buf_handle = get_dma_buf_handle_from_exporter_kernel_module( ..., WIDTH * HEIGHT * 2 ); cl_int error = CL_SUCCESS; cl_mem buffer = clImportMemoryARM( ctx, CL_MEM_READ_WRITE, { CL_IMPORT_TYPE_ARM, CL_IMPORT_TYPE_DMA_BUF_ARM, 0 }, &dma_buf_handle WIDTH * HEIGHT * 2, &error ); if( error == CL_SUCCESS ) { // Use <buffer> as you would any other cl_mem buffer }
#define WIDTH 1024
#define HEIGHT 512
// Create buffer to be used as a hardware texture with graphics APIs (can also
// include video/camera use flags here)
int dma_buf_handle = get_dma_buf_handle_from_exporter_kernel_module( ..., WIDTH * HEIGHT * 2 );
cl_int error = CL_SUCCESS;
cl_mem buffer = clImportMemoryARM( ctx,
CL_MEM_READ_WRITE,
{ CL_IMPORT_TYPE_ARM, CL_IMPORT_TYPE_DMA_BUF_ARM, 0 },
&dma_buf_handle
WIDTH * HEIGHT * 2,
&error );
if( error == CL_SUCCESS )
{
// Use <buffer> as you would any other cl_mem buffer
}
However, without a more recent revision of the driver (>= r7p0) you won't be able to use it, sorry.
Regards,
thx, I see, and I have another popular platform, rk3288.
Will the driver have a update to >= r7p0?
http://malideveloper.arm.com/resources/drivers/arm-mali-midgard-gpu-user-space-drivers/
And would you please suggest some opensource benchmark to evaluate the gpu/opencl performance?
guillaume.tucker is preparing a release of an updated driver for the Firefly. It should be soon.
Kind Regards,
Michael McGeagh
Thanks, Michael and Anthony, Thanks for your help.
hi,
where is the api "get_dma_buf_handle_from_exporter_kernel_module"
Hi,
This is not an API that Arm supports. It was used to represent the fact that the application needs to obtain a dma_buf file descriptor, which is a platform-specific operation. With recent versions of Android, we recommend you use AHardwareBuffer that can be imported directly with cl_arm_import_memory_android_hardware_buffer (https://www.khronos.org/registry/OpenCL/extensions/arm/cl_arm_import_memory.txt).
You may want to have a look at github.com/.../GraphicBuffer.
Kevin