UbuntuShape incompatible with Qt Scenegraph renderer batching strategy

Bug #1350863 reported by Gerry Boland
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ubuntu UI Toolkit
Fix Released
High
Loïc Molinari
ubuntu-ui-toolkit (Ubuntu)
Fix Released
Undecided
Unassigned
Vivid
New
Undecided
Unassigned

Bug Description

The default Qt Scenegraph renderer tries to assemble common primitives in the scenegraph into batches which it can use to reduce the number of draw calls and state changes. See
http://doc-snapshot.qt-project.org/qt5-5.3/qtquick-visualcanvas-scenegraph-renderer.html
for more info.

The UbuntuShape appears to break this batching behaviour.

You can see how Qt selects batches by setting QSG_VISUALIZE=batches - the more unique colors you can see, the less good the batching and the more GL calls Qt needs to make to render your scene.

Here is a file which shows good batching:

import QtQuick 2.0

Item {
    width: 400
    height: 400

    Grid {
        columns: 100
    Repeater {
        model: 1000
        delegate: Image {
                source: "/usr/share/ubuntu-html5-ui-toolkit/0.1/ambiance/img/map_icon.png"
        }
    }
    }
}

If you run that with the QSG_VISUALIZE=batches variable set, you'll see just a block of color on screen - all the delegates were identified to share the same primitives and thus could be placed in one batch. If you run this example under apitrace, you'll notice that the number of GL calls is - once the batch is identified and uploaded, it takes under 50 GL calls to re-render everything. Sure it's a trivial example though.

Now try:

import QtQuick 2.0
import Ubuntu.Components 0.1

Item {
    width: 400
    height: 400

    Grid {
        columns: 100
    Repeater {
        model: 1000
        delegate: UbuntuShape {
            image: Image {
                source: "/usr/share/ubuntu-html5-ui-toolkit/0.1/ambiance/img/map_icon.png"
            }
        }
    }
    }
}

and you'll see every delegate has a different color. This means Qt was unable to recognize that the delegates all had similar basis. If you run under apitrace, you'll see the GPU calls per frame are in the multiple thousands.

We really suffer from this lack of batching in listviews or gridviews where each delegate uses an UbuntuShape.

Related branches

Changed in ubuntu-ui-toolkit:
status: New → In Progress
importance: Undecided → High
assignee: nobody → Loïc Molinari (loic.molinari)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

Fix committed into lp:~ubuntu-sdk-team/ubuntu-ui-toolkit/staging at revision None, scheduled for release in ubuntu-ui-toolkit, milestone Unknown

Changed in ubuntu-ui-toolkit:
status: In Progress → Fix Committed
Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote :

ubuntu-ui-toolkit (1.1.1179+14.10.20140804-0ubuntu1) utopic; urgency=medium

  [ Florian Boucault ]
  * UbuntuShape: removed QML proxy.

  [ Loïc Molinari ]
  * [UbuntuShape] Implemented QSGMaterial::compare() methods so that
    Ubuntu shapes can be batched.
    Fixes: https://bugs.launchpad.net/bugs/1350863.
  * Disconnected from old texture provider signals (Ubuntushape)

  [ Tim Peeters ]
  * Make header text color configurable, and always match the header
    icon colors to the header text color.
    Fixes: https://bugs.launchpad.net/bugs/1315884
           https://bugs.launchpad.net/bugs/1317816.

  [ Christian Dywan ]
  * Move QSKIP for test_updateAlarm_Repeating one line up.

  [ Zsombor Egri ]
  * Text input context menu facelift.

  [ Michał Sawicz ]
   * Add "source" property to the Icon component.
     Fixes: https://bugs.launchpad.net/bugs/1284233
 -- Ubuntu daily release <email address hidden> Mon, 04 Aug 2014 16:00:56 +0000

Changed in ubuntu-ui-toolkit:
status: Fix Committed → Fix Released
Zsombor Egri (zsombi)
Changed in ubuntu-ui-toolkit (Ubuntu):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.