glReadPixels quite slow

This topic contains 5 replies, has 2 voices, and was last updated by  Xmas 9 years, 2 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #29575

    mialsa
    Member

    Hi,

     

    I’m trying to read data from framebuffer with following line on Zoom OMAP 3430:

     

    glReadPixels( 0, 0, 1920, 1920, GL_RGBA, GL_UNSIGNED_BYTE, pData );

     

    The download speed I get at best is about 8 MB/s. Is that normal? I understood that embedded devices have shared memory, so this should be much faster. Does the tiling effect on the speed? What are the most optimal format and type for reading?

     

    Thanks.
    #32248

    Xmas
    Member

    Hi,

    What surface are you reading from, is it a renderbuffer or a texture? What format does it have? How are you measuring the transfer rate? Note that glReadPixels implicitly flushes rendering to the surface you’re reading from, so the time required for glReadPixels may include the whole render pipeline latency.

    #32249

    mialsa
    Member

    Hi,

     

    I’m reading from framebuffer. I have attached texture with GL_RGB format to it. I also learned this latency issue later and discovered that the actual readback speed is about 25 MB/s. After I’m sure that the execution on GPU is really over, I start the timer before I call the glReadPixels and after I get back from reading, I stop the time.
    #32250

    Xmas
    Member

    Do you specify format and type as (GL_RGB, GL_UNSIGNED_BYTE), or (GL_RGB, GL_UNSIGNED_SHORT_5_6_5)? Are the texture dimensions powers of two? Do you actually use it as a texture, or could you use a renderbuffer instead? What are you using the pixel data for?

    #32251

    mialsa
    Member

    I have tryid both, SHORT_5_6_5 and BYTE. I have noticed that reading back as SHORT_5_6_5 is little bit faster. The dimensions haven’t been always powers of two. What I’m doing is sort of general programming (GPGPU) and the resulting pixel data is not for display.

    #32252

    Xmas
    Member

    Yes, 565 should be faster as it needs less bandwidth. If you don’t need to use the data as a texture you should try using a renderbuffer. Textures typically use a different memory layout thus reading from them may be slower.

    Regards,

    Georg

Viewing 6 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic.