PDA

View Full Version : Increase perfromance copy pbo pixel buffer to RAM.



kevinataz
10-27-2016, 01:51 PM
Hi there,

We are using openGL with our video processing project, we grab the video frame from Linux V4l2 interface ( user pointer mode), and we provide pixel buffer object directly for v4l2 driver using as buffers. It is really fast to dump data direct to GPU( DMA ) without copying to RAM first. Then we process the video data in shader fragment, and render to framebuffer directly, and it work fine by this way.

Right now, we want to read those video buffer back to RAM, then encode and send out through network. So other than passing the buffer to the default framebuffer, we also create a FBO and dump data (after processing) to PBOs( ASYNC read back ), then map the PBO buffers to userspace. The problem is that reading video buffers from GPU to RAM is really slow, it take around 18~20ms to copy a YUV420 3840x2160 size frame comparing to 5~6ms from RAM to PBO , which increase our render time, and decrease the frame rate( from 30fps to around 20~25fps). I tried with multi-thread, and copy PBO buffer without blocking the render thread, but the result is not as I expected, the copy time increase to 35~50 ms using non openGl thread.

So are there any methods to increase the speed reading gpu data back to cpu, or improve multi-thread read back performance? Thank you.

Kevin

Dark Photon
10-27-2016, 06:25 PM
Which GPU and drivers?

kevinataz
10-27-2016, 06:40 PM
It is Nvida Jetson TX1, OpenGL 4.4, you can check this https://developer.nvidia.com/embedded/linux-tegra here, thank you so much.

Which GPU and drivers?

Dark Photon
10-28-2016, 05:20 AM
It is Nvida Jetson TX1, OpenGL 4.4, you can check this https://developer.nvidia.com/embedded/linux-tegra here, thank you so much.

Sorry, no experience with Tegra. But as I understand it this this is a standard sort-last (desktop) GPU with high memory bandwidth, so there's hope for you.

This is a complete shot-in-the-dark but you might try this:

* Re: Nvidia Dual Copy Engines (https://www.opengl.org/discussion_boards/showthread.php/172509-Nvidia-Dual-Copy-Engines?p=1231714&viewfull=1#post1231714) (also described here (https://www.opengl.org/discussion_boards/showthread.php/181118-slow-transfer-speed-on-fermi-cards-part-II?p=1248544&viewfull=1#post1248544))