[Mesa-dev] bad performance issue in GPU & CPU data sharing

Tapani Pälli tapani.palli at intel.com
Thu Jun 3 05:22:54 UTC 2021


Hi;

On 5/31/21 12:33 PM, Zong, Wei wrote:
> Hello,
> 
> I'm using GLES shader to run algorithms on image frames, I got very bad 
> performance issue in GPU & CPU data sharing, especially retrieve data 
> from GPU to CPU.
> 
> Basically, I use 
> */glGenBuffers/*/*/glBindBuffer/*/*/glBufferData(target, size, data, 
> usage) /*to create GPU buffer object and initialize GPU data store with 
> CPU data pointer. After GLES shader finished the processing, I use 
> /*glMapBufferRange*///to retrieve processed image data back to CPU, and 
> for some reason I have to do an extra data copy from the gl map pointer 
> to another CPU buffer, this is super slow.
> 
> Here’s the code snippet 
> https://github.com/intel/libxcam/blob/master/modules/gles/gl_buffer.cpp#L94 
> <https://github.com/intel/libxcam/blob/master/modules/gles/gl_buffer.cpp#L94>
> 
> https://github.com/intel/libxcam/blob/master/modules/gles/gl_buffer.cpp#L127 
> <https://github.com/intel/libxcam/blob/master/modules/gles/gl_buffer.cpp#L127>
> 
> I wonder If there has other efficient way to sharing data between CPU & 
> GPU GLES shader?
> 
> Thanks,
> 
> Zong Wei
> 

Could you break down the use-case here a bit, why do you need CPU access 
to the image? If I understand correctly, is it so that camera pipeline 
renders to a dmabuf and then this is imported to GLES for processing and 
then you map it to CPU for ... something?

Thanks;

// Tapani


More information about the mesa-dev mailing list