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

Failure to match EGLConfig and X Visual buffer depth crashes app.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • Not Evaluated
    • None
    • 4.7.1
    • GUI: OpenGL
    • None
    • abcec6ba4b126358c50bf4c539253f88da6bb2d6

    Description

      When running applications using OpenGL (with -graphicssystem opengl) the application will crash with a segfault (release) or an assert (debug), e

      Trolltech/Qt-4.7.0/examples/widgets/analogclock/analogclock  -graphicssystem opengl
      QX11GLPixmapData is *NOT* being used
      Warning: EGL suggested using X visual ID 33 (24 bpp) for config 8 (16 bpp), but the depths do not match!
      Unable to find an X11 visual which matches EGL config 8
      X11Warning: EGL suggested using X visual ID 33 (24 bpp) for config 8 (16 bpp), but the depths do not match!
      Unable to find an X11 visual which matches EGL config 8
      ASSERT: "visualInfoPtr" in file egl/qegl_x11.cpp, line 339
      Aborted
      

      In QEgl::getCompatibleVisualId if X server returns a visual then an exact match on the color depth (buffer size) between the EGLConfig and the X Visual appears to be required. Unless an exact match is found the application crashes in QEgl::createSurface. In particular, it turns out my X server is running in 24 bit and it only returns a 24 bit visual to Qt but Qt insists it wants 16 bit. I did read the comment in qgl_egl.cpp:75 about prefering 16 bit for performance reasons.

      I recompiled after having removed the check on the depth of the X visual in qegl_x11.cpp:168 and now everything I tested (/examples/ and /demos/) works fine.
      \
      Why is it required that the depth of the visual given by EGL_NATIVE_VISUAL_ID matches the BUFFER_SIZE of the EGLConfig?

      Should the system not just try for 16 bit visual and if that doesn't succeed, then try for deeper surface?

      Thank you for any investigation into the issue.

      P.S. Here is an example trace just after the check and visualId is about to be set to 0 because the matching depth test failed:

      #0  QEgl::getCompatibleVisualId (config=0x80caf3c1) at egl/qegl_x11.cpp:185
              visualInfoTemplate = {visual = 0x0, visualid = 33, screen = 0, depth = 0, c_class = 0, red_mask = 0, green_mask = 0, blue_mask = 0, colormap_size = 0,
                bits_per_rgb = 0}
              chosenVisualInfo = 0x8a4b8
              matchingCount = 1
              visualId = 33
              eglValue = 33
              configRedSize = 5
              configGreenSize = 6
              configBlueSize = 5
              configAlphaSize = 0
              configBitDepth = 16
              configId = 8
      #1  0x40c3f5e0 in QEgl::createSurface (device=0x4cd20, config=0x80caf3c1, unusedProperties=0x0) at egl/qegl_x11.cpp:313
      #2  0x422dc690 in QGLContext::chooseContext (this=0x53700, shareContext=0x0) at qgl_x11egl.cpp:232
      #3  0x42268c1c in QGLContext::create (this=0x53700, shareContext=0x0) at qgl.cpp:3074
      #4  0x422dbfe4 in QGLWidget::setContext (this=0x4cd18, context=0x53700, shareContext=0x0, deleteOldContext=true) at qgl_x11egl.cpp:296
      #5  0x4226b788 in QGLWidgetPrivate::initContext (this=0x57500, context=0x53700, shareWidget=0x0) at qgl.cpp:5114
      #6  0x422dbd28 in QGLWidgetPrivate::init (this=0x57500, context=0x53700, shareWidget=0x0) at qgl_x11egl.cpp:313
      #7  0x4226d1e0 in QGLWidget (this=0x4cd18, parent=0x0, shareWidget=0x0, f=...) at qgl.cpp:3452
      #8  0x4229e9d0 in QGLGlobalShareWidget::shareWidget (this=0x53710) at qwindowsurface_gl.cpp:193
      #9  0x4229a438 in qt_gl_share_widget () at qwindowsurface_gl.cpp:233
      #10 0x4229a52c in QGLWindowSurface::hijackWindow (this=0x4f100, widget=0x8ea2d67c) at qwindowsurface_gl.cpp:354
      #11 0x4229a7f8 in QGLWindowSurface::updateGeometry (this=0x4f100) at qwindowsurface_gl.cpp:655
      #12 0x4229aff4 in QGLWindowSurface::paintDevice (this=0x4f100) at qwindowsurface_gl.cpp:374
      #13 0x405254ec in QWidgetBackingStore::sync (this=0x54070) at painting/qbackingstore.cpp:1300
      #14 0x40525820 in QWidgetBackingStore::sync (this=0x54070, exposedWidget=0x8ea2d67c, exposedRegion=...) at painting/qbackingstore.cpp:1105
      #15 0x4020b990 in QWidgetPrivate::syncBackingStore (this=0x54490, region=...) at kernel/qwidget.cpp:1718
      #16 0x40268108 in QETWidget::translatePaintEvent (this=0x8ea2d67c, event=0x8ea2d410) at kernel/qapplication_x11.cpp:5118
      #17 0x4026abf4 in QApplication::x11ProcessEvent (this=0x8ea2d690, event=0x8ea2d410) at kernel/qapplication_x11.cpp:3437
      #18 0x402ad8fc in x11EventSourceDispatch (s=0x1a128, callback=0, user_data=0x0) at kernel/qguieventdispatcher_glib.cpp:146
      #19 0x414e5c48 in g_main_dispatch (context=0x2) at gmain.c:2012
      #20 IA__g_main_context_dispatch (context=0x2) at gmain.c:2564
      #21 0x414e8d7c in g_main_context_iterate (context=0x19f80, block=1, dispatch=1092618196, self=<value optimized out>) at gmain.c:2645
      #22 0x414e8f00 in IA__g_main_context_iteration (context=0x19f80, may_block=1) at gmain.c:2708
      #23 0x410d8ae8 in QEventDispatcherGlib::processEvents (this=0x18580, flags=...) at kernel/qeventdispatcher_glib.cpp:412
      #24 0x402acca4 in QGuiEventDispatcherGlib::processEvents (this=0x18580, flags=...) at kernel/qguieventdispatcher_glib.cpp:204
      #25 0x410809c8 in QEventLoop::processEvents (this=0x8ea2d634, flags=...) at kernel/qeventloop.cpp:149
      #26 0x41080cb8 in QEventLoop::exec (this=0x8ea2d634, flags=...) at kernel/qeventloop.cpp:201
      #27 0x41086888 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:981
      #28 0x40178240 in QApplication::exec () at kernel/qapplication.cpp:3615
      #29 0x0000b618 in main (argc=1, argv=0x8ea2d7f4) at main.cpp:51
      

      Attachments

        Issue Links

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

          Activity

            People

              kjernase Trond Kjernåsen (Inactive)
              ndhb Nicolai de Haan
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes