This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Can I create a opencl buffer from a GraphicBuffer or a raw ion buffer

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

Parents
  • 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

          }

    However, without a more recent revision of the driver (>= r7p0) you won't be able to use it, sorry.


    Regards,

    Anthony

Reply
  • 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

          }

    However, without a more recent revision of the driver (>= r7p0) you won't be able to use it, sorry.


    Regards,

    Anthony

Children