User avatar
dividuum
Posts: 139
Joined: Sun Jun 16, 2013 1:18 pm
Location: Germany
Contact: Website

Texture uploading performance

Mon Sep 28, 2015 12:21 pm

In my tool info-beamer it is possible to upload textures while running a visualizations. One use case is for example having an animated slide show that shows more images than could possibly be stored in GPU memory. If that slide show uses animations it's important that the texture upload doesn't have any visible effect on the animation. It seems that this isn't easy. I tried different approaches: Using multiple gl contexts, using EGLImageKHR or OMX. All of them interrupted the foreground process in some way. You can read about all three experiments in my blog post: https://info-beamer.com/blog/faster-tex ... xperiments

I wonder if anyone else tried solving this problem or if there is any approach I missed. I'm especially confused about the performance difference between a single call to glTexImage2D and calling it multiple times:

Code: Select all

GLuint tex;
glGenTextures(1, &tex);
glBindTexture0IB(tex);

// this call takes 35ms...
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1920, 1080, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
and

Code: Select all

GLuint tex;
glGenTextures(1, &tex);
glBindTexture0IB(tex);

// These 3 calls only take 6ms. why?
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB,  512,  512, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1024, 1024, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1920, 1080, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
Both of them result in a usable texture that can be filled with glTexSubImage2D. Anyone have any idea or any hints? Thanks!
info-beamer hosted - A user and programmer friendly digital signage platform for the Pi: https://info-beamer.com/hosted

wnik
Posts: 1
Joined: Mon Jan 16, 2017 1:55 pm

Re: Texture uploading performance

Mon Jan 16, 2017 1:57 pm

I am really curious to know if you have figured out anything new related to this.

User avatar
dividuum
Posts: 139
Joined: Sun Jun 16, 2013 1:18 pm
Location: Germany
Contact: Website

Re: Texture uploading performance

Mon Jan 16, 2017 3:46 pm

wnik wrote:I am really curious to know if you have figured out anything new related to this.
Not really. There seems to be some way of directly mapping GPU memory into userland memory, but I got some GL error (sorry, don't remember which) when I tried that briefly. See https://github.com/raspberrypi/firmware ... e87564d6f9. I'll probably look into that again at some point. But it seems to only work for RGBA and might make rendering slower as the memory layout isn't optimal for the GPU(?). At least that's what I gathered from trying to understand this feature. I might be totally wrong. Any hint or correction is more than welcome.
info-beamer hosted - A user and programmer friendly digital signage platform for the Pi: https://info-beamer.com/hosted

Return to “OpenGLES”