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
Hi songmao,
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,
Anthony
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?
Thanks,
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