Slow glTexSubImage2D performance on Nexus 10 / Android 4.2.2 (Samsung Exynos 5 w / Mali-T604)

I have an Android app that decodes video in yuv420p format and then creates video clips using OpenGLES. I use glTexSubImage2D () to load the y / u / v buffer into the GPU and then convert the YUV2RGB using a shader. All EGL / OpenGL installation / rendering code is native code.

Now I'm not saying that there is no problem with my code, but given the same code, it works fine on iOS (iPad / iPhone), Nexus 7, Kindle HD 8.9, Samsung Note 1 and several other cheap Chinese tablets (A31 / RockChip 3188) running Android 4.0 / 4.1 / 4.2. I would say that it is less likely that my code is wrong. On these devices, glTexSubImage2D () uses less than 16 ms to load HD SD or 720P textures.

However, on a Nexus 10 glTexSubImage2D (), an SD or 720P HD texture takes about 50 ~ 90 ms, which is too slow for video at 30 frames per second or 60 frames per second.

I'd like to know

1) if I have to choose a different texture format (RGBA or BGRA). Are there any ways to determine which of the best textures is used by the GPU?

2) if there is a function that is “OFF” for all other SOCs, but set to 'ON' on Exynos 5. For example, the option to automatically select MIPMAP. (I have it, by the way)

3) if this is a known Samsung Exynos SOC issue - I cannot find a support forum for Exynos CPU

4) Is there any parameter that I need to set when setting up the EGL surface? e.g. transparency, surface format, etc.? (I have no idea what I'm talking about)

5) This may mean that the GPU is performing an implicit format conversion, but I checked that GL_LUMINANCE is always used. Again it works on any other platform.

6) anything else?

My EGL configuration:

const EGLint attribs[] = { EGL_SURFACE_TYPE, EGL_WINDOW_BIT, EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, EGL_BLUE_SIZE, 8, EGL_GREEN_SIZE, 8, EGL_RED_SIZE, 8, EGL_NONE }; 

Initial setting:

 glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, ctx->frameW, ctx->frameH, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, NULL); /* also for U/V */ 

subsequent partial replacement:

 glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, ctx->frameW, ctx->frameH, GL_LUMINANCE, GL_UNSIGNED_BYTE, yBuffer); /*also for U/V */ 

I am trying to make a video with a resolution of ~ 30FPS or ~ 60FPS with a resolution of SD or 720P HD.

+6
source share
3 answers

This is a known driver issue that we reported to ARM. A future update should fix it.

+6
source

EDIT Status Update

Now we were able to reproduce the slow loading conditions for one path in the publicly available firmware, which you may click, and this will be fixed in the next driver release.

If you duplicate texture identifiers (for example, frame N = ID X, N + 1 = ID Y, N + 2 = ID X, N + 3 = ID Y, etc.) for the textures you upload to it should help to avoid this on the current firmware.

Thanks, Iso

+1
source

I can confirm that this has been fixed in Android 4.3. I see a performance increase of 2-3 times with the RGBA format and 10-50 times with other texture formats compared to Android 4.2.2. These results apply to both glTexImage2D and glTexSubImage2D. (I can not add comments, so I had to put it here)

EDIT: if you are stuck with 4.2.2, you can try using an RGBA texture instead, it should have better performance (3-10x or so with larger texture sizes from two textures).

+1
source

All Articles