Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-18755

EGL error BAD_ATTRIBUTE trying to choose config that supports EGL_SWAP_BEHAVIOR



    • Bug
    • Resolution: Out of scope
    • Not Evaluated
    • None
    • 4.7.0, 4.7.1, 4.7.2, 4.8.x
    • None
    • Nvidia Tegra2 with X11 server 1.9.0, EGL 1.4, ES 2.0.


      We are seeing an error when Qt is looking for EGL configs. I believe it affects all public versions.

      The EGL driver is being called in eglChooseConfig with an invalid attribute, EGL_SWAP_BEHAVIOR. The spec mandates this function call sets BAD_ATTRIBUTE on unknown attributes (EGL 1.4, sec. 3.4.1), so that part looks correct.

      Qt is apparently looking for an EGL config that permits setting the swap behavior. The correct way to do this should be to send in an attribute in the list to eglChooseConfig that is EGL_SURFACE_TYPE (not EGL_SWAP_BEHAVIOR) and the value for this attribute should have the EGL_SWAP_BEHAVIOR_PRESERVED_BIT set. Then, if one or more configs are then returned, they support setting the swap behavior with the function call eglSurfaceAttrib(dpy, surface, EGL_SWAP_BEHAVIOR, [EGL_BUFFER_PRESERVED | EGL_BUFFER_DESTROYED ]). And the same for getting an attribute with eglQuerySurface.

      Relevant source code that I could find to fix (there might be more of course):

      src/opengl/qgl_x11egl.cpp ~ line 204
      // as described above, eventually leads to the egl error when eglChooseConfig is later called, probably want to set the EGL_SWAP_BEHAVIOR_PRESERVED_BIT in an EGL_SURFACE_TYPE attribute that is used

      src/gui/egl/qeglproperties.cpp ~ line 244
      // when reducing configs, probably want to reset a the same bit

      src/gui/egl/qeglproperties.cpp ~ line 391
      // toString for EGL_SWAP_BEHAVIOR_PRESERVED_BIT should be handled the same as the others because this looks correct (e.g. EGL_VG_COLOR_LINEAR_BIT)

      Relevant commit appears to be 74f2881


        No reviews matched the request. Check your Options in the drop-down menu of this sections header.



            Unassigned Unassigned
            ndhb Nicolai de Haan
            0 Vote for this issue
            2 Start watching this issue



              Gerrit Reviews

                There are no open Gerrit changes