This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

PixMap Surface slower and slower, why?

Hi everyone.

I am using Mali-400 GPU, on Allwinner A20, under linux.

I am using egl pixmap surface. Rendering results correct, but every time when i calling glDraw with the same  parameters, the runtime of glDraw(only last) slower and slower.

I am checking only glDraw without anything else.

The time of drawing

1 call -- 150ms

2 time repeat -- 240ms( only second call without first)

.

.

6  time repeat -- 620ms( only 6 call without any other)

I am repeating this

GL_CHECK(glEnableVertexAttribArray(iLocPosition));
GL_CHECK(glVertexAttribPointer(iLocPosition, 2, GL_FLOAT, GL_FALSE, 0, vertex));
time.Start();
     LoadDataToTexture( first, second );
time.Stop();
timeOfGPU.loadTime = time.GetTime();

time.Start();
     GL_CHECK(glDrawArrays( type, 0, sizeOfVertex ));
     GL_CHECK(glFinish());
time.Stop();
timeOfGPU.drawTime = time.GetTime();

time.Start();
     GL_CHECK(glReadPixels(0, 0, windowW, windowH, GL_RGBA, GL_UNSIGNED_BYTE , result));
time.Stop();
timeOfGPU.retTime = time.GetTime();

Why any new call slower than previews call?

When i was used window surface, this problem solved by eglSwapBuffers...

But now i don't know what is problem...

Thank for any reply.

  • I'm no expert at all in OpenGL programming (though I've done some more then 10 years ago)

    My first thought: Memory allocation.

    Then I looked at the code. Perhaps 'LoadDataToTexture' keeps allocating memory, but is the memory released ?

  • Thanks for reply.

    No, memory not released. But i have no need to release the memory. I am loading the same data to the same texture with the same view port.

    And the loading time doesn't change. Changes only drawing time(drawing to same memory, without changing anything).

  • Hmm.. It's been a while, but I remember something about glFlush() - maybe it's a bad guess.

    Actually I'm hoping that someone else will see this thread and be able to give a much more qualified answer.

  • You're not clearing the render state on each iteration, so you are calling finish to force the intermediate render state to the framebuffer, and then forcing the GPU to re-read and re-render all over again. Mali may handle this in two ways depending on circumstances:


    • Read back the old framebuffer at the start of each tile, and render on top of it.
    • Not read-back and just re-render everything since the last full clear (which may be less expensive if the inputs are, for example, compressed textures).

    Based on the fact it gets slower and slower on each loop iteration, it would be safe to surmise that the second route is being taken. In general you cannot safely time individual drawcalls on a tile-based architecture without significant performance overheads. The best route for handling framebuffers is outlines in my blog here:

    Mali Performance 2: How to Correctly Handle Framebuffers

    Cheers,
    Pete