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

4 times higher CPU usage compared to Qt 4 due to insufficient SHM permissions

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • None
    • 5.4.1, 5.5.0 Beta
    • QPA: X11/XCB
    • None
    • Gentoo Linux ~amd64

    Description

      Applications like Qt Designer have 4-10 times higher CPU usage compared to Qt 4.8 with native backend.

      most of time is spent in following function according to callgrind
      1,626,605,760 ???:xcb_image_put_pixel [/usr/lib64/libxcb-image.so.0.0.0]
      1,599,495,664 ???:xcb_image_get_pixel [/usr/lib64/libxcb-image.so.0.0.0]
      406,999,190 ???:xcb_image_subimage [/usr/lib64/libxcb-image.so.0.0.0]

      which are probably called from QXcbShmImage::put

      probably relevant information:
      following code returns error when my Qt application is running:

      if (shm_present)
      error = xcb_request_check(xcb_connection(), xcb_shm_attach_checked(xcb_connection(), m_shm_info.shmseg, m_shm_info.shmid, false));

      (gdb) print *error
      $4 = {response_type = 0 '\000', error_code = 10 '\n', sequence = 464, resource_id = 14729351, minor_code = 1, major_code = 130 '\202', pad0 = 0 '\000', pad =

      {0, 0, 0, 0, 0}

      , full_sequence = 464}
      (gdb) bt
      #0 QXcbShmImage::QXcbShmImage (this=0x2aaaaf1bc70, screen=<optimized out>, size=..., depth=<optimized out>, format=QImage::Format_ARGB32_Premultiplied) at qxcbbackingstore.cpp:125
      #1 0x000003fff293555a in QXcbBackingStore::resize (this=0x2aaaaf21c30, size=...) at qxcbbackingstore.cpp:371
      #2 0x000003fff77deb80 in QWidgetBackingStore::doSync() () from /usr/lib64/libQt5Widgets.so.5
      #3 0x000003fff77e0094 in QWidgetBackingStore::sync(QWidget*, QRegion const&) () from /usr/lib64/libQt5Widgets.so.5
      #4 0x000003fff783f9bb in QWidgetWindow::event(QEvent*) () from /usr/lib64/libQt5Widgets.so.5
      #5 0x000003fff77d036c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib64/libQt5Widgets.so.5
      #6 0x000003fff77d601a in QApplication::notify(QObject*, QEvent*) () from /usr/lib64/libQt5Widgets.so.5
      #7 0x000003fff6e8607d in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib64/libQt5Core.so.5
      #8 0x000003fff725b3e8 in sendSpontaneousEvent (event=0x3ffffffb700, receiver=0x2aaaaf1c560) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:231
      #9 QGuiApplicationPrivate::processExposeEvent (e=0x2aaaae55eb0) at kernel/qguiapplication.cpp:2610
      #10 0x000003fff725c1bd in QGuiApplicationPrivate::processWindowSystemEvent (e=e@entry=0x2aaaae55eb0) at kernel/qguiapplication.cpp:1635
      #11 0x000003fff723a8f9 in QWindowSystemInterface::sendWindowSystemEvents (flags=..., flags@entry=...) at kernel/qwindowsysteminterface.cpp:572
      #12 0x000003fff2958b9a in QUnixEventDispatcherQPA::processEvents (this=<optimized out>, flags=...) at eventdispatchers/qunixeventdispatcher.cpp:63
      #13 0x000003fff6e83cd3 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQt5Core.so.5
      #14 0x000003fff6e8ba8a in QCoreApplication::exec() () from /usr/lib64/libQt5Core.so.5
      #15 0x000002aaaaac661e in main (piarg=1, Pcarg=<optimized out>) at main.cpp:6435

      Attachments

        1. callgrind-qt4.txt
          239 kB
        2. callgrind-qt5.txt
          91 kB
        3. xcb_shm_attach_fd.c
          6 kB

        Issue Links

          For Gerrit Dashboard: QTBUG-46017
          # Subject Branch Project Status CR V

          Activity

            People

              paeglis Gatis Paeglis
              wbrana William Brana
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes