OpenGL fullscreen slowdown

Hello,

We are developing an OpenGL (ES 2 & 3 compatible code) application to run on the tk1 and we are seeing a very strange behaviour. The frame rate in “windowed mode” is around 60 but in fullscreen mode at the same resolution its around 30! I was expecting the opposite.

We are currently using EGL + OpenGL ES3. The window creation code is the following:

m_xDisplay = _XOpenDisplay(NULL);

    EGLint s_configAttribsAntiAliased[] =
    {
        EGL_RED_SIZE, 8,
        EGL_GREEN_SIZE, 8,
        EGL_BLUE_SIZE, 8,
        EGL_ALPHA_SIZE, EGL_DONT_CARE,
        EGL_DEPTH_SIZE, EGL_DONT_CARE,
        EGL_STENCIL_SIZE, 8,
        EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
        EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
        EGL_SAMPLE_BUFFERS, 1,
        EGL_SAMPLES, 2,
        EGL_NONE
    };

    EGLint s_configAttribsSimple[] =
    {
        EGL_RED_SIZE, 8,
        EGL_GREEN_SIZE, 8,
        EGL_BLUE_SIZE, 8,
        EGL_ALPHA_SIZE, EGL_DONT_CARE,
        EGL_DEPTH_SIZE, EGL_DONT_CARE,
        EGL_STENCIL_SIZE, 8,
        EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
        EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
        EGL_SAMPLE_BUFFERS, 0,
        EGL_SAMPLES, 0,
        EGL_NONE
    };

    EGLint numconfigs;
    m_egldisplay = eglGetDisplay(m_xDisplay);
    eglInitialize(m_egldisplay, NULL, NULL);
    assert(eglGetError() == EGL_SUCCESS);
    eglBindAPI(EGL_OPENGL_ES_API);

    eglChooseConfig(m_egldisplay, s_configAttribsAntiAliased, &m_config, 1, &numconfigs);
    if (eglGetError() != EGL_SUCCESS || numconfigs == 0)
    {
        LOG4CXX_WARN(wmLogger, "Failed to create antialiased EGL display");
        eglChooseConfig(m_egldisplay, s_configAttribsSimple, &m_config, 1,
                        &numconfigs);
    }
    assert(eglGetError() == EGL_SUCCESS);
    assert(numconfigs == 1);

    // creates a fullscreen X11 window
    m_xWindow = _createX11Window(m_egldisplay, m_xDisplay, windowWidth, windowHeight);
    assert(m_xWindow);

    m_surface = eglCreateWindowSurface(m_egldisplay, m_config, m_xWindow, NULL);

    assert(eglGetError() == EGL_SUCCESS);
    EGLint ContextAttribList[] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE };
    m_context = eglCreateContext(m_egldisplay, m_config, EGL_NO_CONTEXT, ContextAttribList);
    assert(eglGetError() == EGL_SUCCESS);
    eglMakeCurrent(m_egldisplay, m_surface, m_surface, m_context);
    assert(eglGetError() == EGL_SUCCESS);

    wmDeleteMessage = XInternAtom(m_xDisplay, "WM_DELETE_WINDOW", False);
    XSetWMProtocols(m_xDisplay, m_xWindow, &wmDeleteMessage, 1);

I have tried various things like calling eglSwapInterval(0) to disable VSync or creating a borderless window (without decorations) rather than a fullscreen one but I always get the same results.

I also tried using OpenGL4 and GLFW and creating the window and context using the classes provided in “GameWorksOpenGLSamples/extensions” but still I get the same results: Around 60FPS at 1920x1080 in windowed mode and in fullscreen around 30FPS. I also tried disabling VSync in GLFW by calling “glfwWindowHint(GLFW_DECORATED, GL_FALSE)” but again… same results. This is really weird.

Next thing I’ll try is using GLX rather than EGL but I get the feeling it won’t change much.
Is this a problem in X11 in general? Has anyone seen this before?

A colleague told me that we could be creating one massive frame buffer for both the video outputs that are available on the tk1 (HDMI & LVDS) therefore not allowing the app to go in fullscreen mode, but this is not the case. LVDS is turned off, completely disabled and the frame buffer we are creating is 1920x1080 which matches the monitor’s resolution.

I can post more code if it helps. I’ve also attached logs we got from debugging X in both windowed and fullscreen mode in case it helps.

Any help would be greatly appreciated. Thank you.
Filippos
xtrace-fullscreen.log (1.12 MB)
xtrace-windowed.log (1.89 MB)

Hello,

Just a quick update on this. I’ve been trying to use glx in our project since yesterday but no joy. I keep getting linker errors from libglx.so:
libglx.so: undefined reference to XRC_DRAWABLE' libglx.so: undefined reference to dixSetPrivate’
etc

Can we actually use GLX for context creation on an X11 window or is EGL the only option we have?

I’m curious, did you test this under a bare X session? I’d assume that the window manager wouldn’t have much of an effect, but it’s the only thing I can think of that might affect the fullscreen display path vs. the windowed one.

Hello,

Thanks for the reply cstotts. We are using a bare X session with no window manager. Anyway I managed to hack this so I’ll just reply to myself cause I’ve seen quite a few people online that have similar problems.
So what I did was just add an extra pixel to the window’s width! This forces xorg to treat the window as a normal window and not a fullscreen one.
Because xorg actually expects a window size that matches the screen’s resolution in order to go in fullscreen mode, changing the size so that it does NOT match the resolution forces it to treat like a normal one.
So now we have a borderless window that is one pixel wider than the screen (so you can’t actually see that pixel) and it looks just like a fullscreen window. Job done. At least until fullscreen behaves as it should.

Thanks