Forums - glTexImage2D too slow?

9 posts / 0 new
Last post
glTexImage2D too slow?
jonathan_young
Join Date: 11 Nov 10
Posts: 4
Posted: Fri, 2010-11-19 05:14

We have wrote a YUV2RGB shader in the GPU and used glTexImage2D to transfer yuv Luminance data to GPU.

the resolution of the frame is about 600*300, it cost about 40 ms to copy one frame to GPU [nexus one], why it is so slow?

we have also tested with MOTO DROID (PowerVR GPU), it only costs about 3 ms to do so.

Does it need a special setting in OpenGL ES 2.0 for  Adreno200?

please help me!

  • Up0
  • Down0
Steve L (not verified)
Posted: Wed, 2010-11-24 15:29

This is currently very slow due to the memory copies that must be done to get data from the camera to the GPU.  A fix for this is currently in development for Froyo but is not yet publicly available.

  • Up0
  • Down0
jonathan_young
Join Date: 11 Nov 10
Posts: 4
Posted: Fri, 2010-11-26 01:16

Thanks for your response.

but that's verid, if I change glTexImage2D data type to GL_RGBA, it only cost 9 ms to copy data to GPU.

so my question is why GL_LUMINANCE cost 40ms to copy the same data to GPU?

is that the driver uses RGBA format, so GL_LUMINANCE need an extra convert time?

  • Up0
  • Down0
[email protected] (not verified)
Posted: Tue, 2011-01-04 14:50

Yes, our drivers internally only deal with RGBA and so every texture loaded is converted.  I don’t think it should take so much longer to load a luminance texture compared to a RGB, but this could be a performance issue as opposed to a driver issue.  If you can provide the test application we can attempt to help debug the issue for you.

  • Up0
  • Down0
pt_nijs
Join Date: 3 Jan 11
Posts: 7
Posted: Thu, 2011-01-06 09:39

Hello,

I have exactly the same issue. I am developing an AR app in which I want to use the preview images from the camera as streaming textures. My setup:

- nexus one

- camera preview with 2 preview callback buffers, resolution 800x480

- RENDERMODE_WHEN_DIRTY enabled (glSurfaceView::onDraw only executed when a new camera preview image is available)

- initial setup in glSurfaceView::onSurfaceCreate creates two 1024x1024 GL_LUMINANCE textures with glTexImage2D, setups orthographic projection, gl surface setup:  setEGLConfigChooser(8, 8, 8, 8, 0, 0);

- In glSurfaceView::onDraw, a full screen 800x840 quad is rendered using glDrawArrays() with GL_VERTEX_ARRAY, GL_TEXCOORDS_ARRAY enabled and pointing to the vertex and texcoords buffers.

- After the quad is rendered the texture is updated directly from the received camera preview buffer with  a glTexSubImage2D  call (also in onDraw (!)) updating only 800x480 in the 1024x1024 texture (GL_LUMINANCE), so I am directly copying the Y plane from the YUV420SP (NV21) buffer. After the glTexSubImage2D the buffer is readded as preview callback buffer.

With this setup the onDraw function takes between 185-200 ms. When I disable the glDrawArrays call the onDraw function only takes 3-5ms. Also, when I disable the glTexSubImage2D and enable the glDrawArrays call it takes 3-5ms. GL calls are error checked and no errors occur.  I do not fully understand what's going on. I assume that the path from glTexSubImage2D to videomemory is fast and not too buffered by the driver. Why do things get slow when the glDrawArrays call is enabled to draw and texture the quad and after that, glTexSubImage2D is called to update the texture for the next onDraw?I do not glTexSubImage2D to the texture that is bind for texturing. I switch between them, glDrawArrays using texture 0, upload to 1 and vica versa.

Is this connected to your previous post about the slow buffer access? When will the fix you mentioned for Froyo be available? I can supply a test project if needed.

Thank you.

 

  • Up0
  • Down0
Evrin_Yu
Join Date: 25 Nov 10
Posts: 5
Posted: Mon, 2011-01-10 19:20

I have tested glTexImage2D on different GPUs including Adreno 200, PowerVR530, 540, Tegra2 and OMAP, It will take too much time to do glTexImage2D while needing to do 16-bits RGB uploading from main memory to graphics memory on Adreno 200.

when will you update driver to fix this issue?

This will cause we can't use OpenGL solution on Adreno. 

  • Up0
  • Down0
pt_nijs
Join Date: 3 Jan 11
Posts: 7
Posted: Tue, 2011-01-11 22:25

evrin_yu,

how does glTexImage2D perform on the VR530,540, Tegra2, OMAP and on which devices did you test? Do you get usable performance or is it the same as with the Adreno 200?

  • Up0
  • Down0
Evrin_Yu
Join Date: 25 Nov 10
Posts: 5
Posted: Wed, 2011-01-12 04:28

I need to create 1024 by 768  texture with 16-bit RGB on our app. on Adreno 200 (HTC Desire, HTC EVO, Incredible, Mytouch), it needs about 330ms to do glTexImage2D. on PowerVR 540 (Samsung Galaxy tab and Samsung Galaxy S), it just needs about 20ms. 

I need to call glTexImage2D frequently because each frame has different content.

our app needs to support different devices including android tab and android phone. most of phone use adreno 200. Thus we can't use opengl solution to do. for other non-adreno devices, we can use opengl to improve performance.

  • Up0
  • Down0
pt_nijs
Join Date: 3 Jan 11
Posts: 7
Posted: Fri, 2011-01-14 06:45

Can you tell us when the Froyo patch will be publicly available?

Any time soon? Weeks? Months?

Thanks.

  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.