Andre Ahmed
Andre Ahmed

Reputation: 1891

Why the data transfer is slow from GPU to CPU?

Today I have figured out something that really made me wondering. I have the Samsung Exynos 4412 ARM9 CPU which has a GPU400(QuadCore). I tried to get a texture from the GPU to CPU by all known methods and its really slow. The same scenario and slow speed happens also in modern CPUs and GPUs in the PC Platform. My wondering is how that happens and the Samsung Exynos is an SoC and both of them has the same memory and I should not care about the bus. Why that happens ?

The data from the GPU to the CPU is transferred by many methods which I have tried glReadpixels, gltexSubImage2D, gltexImage2d, FBO. The frame rate drops from 40FPS to 7FPs or 7FPS while using any of those methods, on a texture 1024*1024 24bits.

Upvotes: 1

Views: 3333

Answers (1)

Zan Lynx
Zan Lynx

Reputation: 54325

Possible answers taken from the OpenGL forums:

  • Latency: it takes time for the read command to reach the hardware.
  • OpenGL command buffering: Reading the data requires the OpenGL driver to complete all outstanding commands.
  • Hardware buffering: Hardware must empty all GPU core pipelines before doing a readback.

Possible solution: - Copy the data internally on the GPU to another location and read it back some number of frames after computing it. This should allow everything writing to that location to have completed before you attempt to read it.

Upvotes: 2

Related Questions