0

I am using Yocto as an embedded system with OpenGL 2.1, GLEW 2.0.0 and Mesa 17.0.2. I am software rendering off screen to a monitor through HD/SDI. The problem I am having is my update rate is around 1 hertz. On my development machine I have about 20 FPS when hardware acceleration is disabled on Debian. The embedded machine isn't as powerful so I understand a performance hit, but 1 FPS seems a bit low. For my Optimization I disabled:

glDiasble(GL_LINE_SMOOTH)
glDiasble(GL_POINT_SMOOTH)
glDiasble(GL_SMOOTH)
glDiasble(GL_MULTISAMPLE)
glShadeModel(GL_NONE)

I do not have any culling because I am only using 2D images.

However I do set the min and mag filter to GL_NEAREST.

My buffer swapping and context creation is something like:

        bool makeContext()
        {
            width = 1280;
            height = 720;

            context = OSMesaCreateContextExt(OSMESA_RGBA, 0, 0, 0, NULL);
            if(!context)
            {
              //...
              return false;
            }
            bufferSize = width * height * 4 * sizeof(GL_UNSIGNED_BYTE);
            frameBuffer = (char*)mallic(bufferSize);
            frameBuffer = (char*)0_buf_baseaddr;
            if(!OSMesaMakeCurrent(context, frameBuffer, GL_UNSIGNED_BYTE, width, height));
            {
               //...
               return false;
            }

            OSMesaPixelStore(OSMESA_Y_UP, 0)
            {
              //...
            }

            return true;
         }

void swapBuffers()
    {
      frameBuffer = (char*) swap_page(); //returns a spot in memory with update
      OSMesaMakeCurrent(context, frameBuffer, GL_UNSIGNED_BYTE, width, height);
    }

I was thinking about applying stenciling, but I'm not sure if that will help the performance. I'm almost certain the issue stems from the heavy use of Alpha channels with my images I'm using. Multiple moving layers behind one another to the effects I wanted.

Is there anything wrong with my swapping or creation that's obvious? Also, based on the optimizations I have already made, is there anything else I can do that might help?

genpfault
  • 51,148
  • 11
  • 85
  • 139
Noble
  • 104
  • 10
  • 1
    What are the specs for your embedded target (CPU speed, memory bandwidth, etc.)? Drop your framebuffer size to like 320x240. 1280x720 is a *lot* of pixels for an embedded target, much less desktop hardware. Does your embedded target have multiple cores? If so, are you using the llvmpipe backend? It's multi-threaded by default. – genpfault Mar 12 '19 at 14:29
  • 2
    Check if your Mesa supports [`glInvalidateFramebuffer()`](https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glInvalidateFramebuffer.xhtml) through [`ARB_invalidate_subdata`](https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_invalidate_subdata.txt), it *may* be faster than straight `glClear()`s. – genpfault Mar 12 '19 at 14:33
  • Great questions, CPU speed is unknown at the moment and max memory is two gigs. As far as lowering the buffer size down, won't that change how my images are arranged on screen? Say, I have an Image positioned at 722, 240 (random point). Would this now be drawn outside of the context? And since I have a scissor test, cut out all together? Also, I will research up on the glInvalidateFrameBuffer as you mentioned. These are all great points, thank you very much. – Noble Mar 12 '19 at 15:28
  • Quad-core ARM 1.5 GHz – Noble Mar 12 '19 at 15:38
  • Your ARM has GL drivers, right? If drivers are not present then Mesa will fall back to software rendering. Note that ARM typically *does not have* GL and most drivers are GLES. – Ross Burton Mar 27 '19 at 13:24
  • If you do need software rendering, then either turn on `llvmpipe` or, even better, don't use GL. If you're just blending images using something that isn't software GL will be a lot faster. – Ross Burton Mar 27 '19 at 13:27

1 Answers1

0

I was able to increase performance ~10% by eliminating and combing some resource images. Mainly, making my glClear as the color of my farthest image (one less resource to draw) and then overlapping my images with alpha channels on top. My GUI relies heavily on alpha channels, so even one less draw call makes an impact with software rendering.

Noble
  • 104
  • 10
  • 1
    Also, from https://gitlab.freedesktop.org/mesa/demos/tree/master/src/demos. It appears that ~1 FPS is expected without somekind of hardware support when using heavy blending. Putting this here in case someone else runs into something similar. – Noble Apr 04 '19 at 13:01