21k
21k

Reputation: 429

eglSwapBuffers suddenly takes much longer time to finish

Today i found my opengles program frame time sometimes increases for unknown reason, usually its 16ms, but sometimes it will take 33ms to finish one frame. after hours profiling and researching i found the reason : the frame time increase is because the 'eglSwapBuffers' takes much longer time than usual. usually time spend on 'eglSwapBuffers' is less than 10 milliseconds, but sometimes it will take about 26 milliseconds.

the scene is static so the frame time is supposed to be stable?

Would anybody know the reason please help, what should i do to make my frame time stable?

Upvotes: 5

Views: 3306

Answers (3)

Bram
Bram

Reputation: 8283

In my case it turned out to be the MSAA. Using 4x MSAA, caused my eglSwapBuffers() to go to 30 milliseconds.

I had to take out two lines from my config, and got back to a 2 ms swap.

    const EGLint attribs[] = {
            EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
            EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
            EGL_DEPTH_SIZE, 16,
            EGL_BLUE_SIZE, 8,
            EGL_GREEN_SIZE, 8,
            EGL_RED_SIZE, 8,
//              EGL_SAMPLE_BUFFERS, 1,
//              EGL_SAMPLES, 4,
            EGL_NONE
    };

Upvotes: 0

peedee
peedee

Reputation: 3739

There was an answer in a different thread that helped me a lot with this problem.

this kind of behavior is usually caused by window and surface pixel format mismatch eg. 16bit (RGB565) vs 32bit.

Upvotes: 2

Bob
Bob

Reputation: 66

I am also meeting such a problem.

I found if the window of eglsurface is resized to more bigger, the time of eglSwapbuffer spent become very long (about 2x than normal state).

Upvotes: 0

Related Questions