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

[5.5 regression] Text rendering takes 100% CPU load

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 5.6.2
    • 5.5.0, 5.5.1
    • GUI: Font handling
    • None
    • Gentoo Linux ~x86_64
    • 6f423555eba55ccdf7287071e10576bc1b687fd2

    Description

      Any Qt app with complicated text rendering (like KDE5 Konsole) has high CPU usage on text redrawing, original issue: https://bugs.kde.org/show_bug.cgi?id=354082 (and the gentoo one: https://bugs.gentoo.org/show_bug.cgi?id=564666)

      How to reproduce:

      1. Open Konsole, run midnight commander (or any other curses-based app)
      2. Do any activity causing screen redraw (like changing folders)
      3. Konsole will become slow, unresponsive and use 100% CPU while redrawing. Downgrading Qt to 5.4 makes this issue disappear.

      After a small research in callgrind, I've found the strange behaviour:

      • On Qt5.5 FT_Load_Glyph is called 55000 times per minute (and growing with time), re-rendering every glyph every time it was shown.
      • On Qt5.4 FT_Lload_Glyph is called 100-200 times per whole run, possibly rendering each glyph only once.

      There is a QFontEngineFT::QGlyphSet cache to actually cache already rendered glyphs, and it used inside QFontEngine::loadGlyph. It caches glyphs based on their indexes, but loadGlyph will anyway re-render glyph if the cached glyph has different format. The problem is that:

      • in Qt5.4 loadGlyph was called only once per glyph with format = A32, the caching worked fine.
      • in Qt5.5 loadGlyph called twice per glyph with glyph (A32) and mask (A8). In that case the cache was constantly updated with glyphs with different formats, loadGlyph was contantly re-rendering glyphs because of the format mismatch.

      Attachments

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

        Activity

          People

            esabraha Eskil Abrahamsen Blomfeldt
            shutty roman grebennikov
            Votes:
            1 Vote for this issue
            Watchers:
            9 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes