[Interest] Rotating objects in QML are killing performance
Michael Andersen
michael at steelcode.com
Fri Apr 12 10:58:34 CEST 2013
On 12 April 2013 09:55, Sletta Gunnar <Gunnar.Sletta at digia.com> wrote:
> On Apr 12, 2013, at 9:26 AM, Michael Andersen <michael at steelcode.com>
> wrote:
>
> > Is vsync enabled in your driver? Sounds like it might not be. If not,
> then Qt Quick 2.0 will render at 100% cpu rendering maybe many thousands of
> frames per second, even though you only see 60 of them.
> >
> > Unfortunately, VSync is enabled, that would have been a good explanation.
>
> Does it get any better if you switch to Unity 2D, the non-fancy one? We
> have registered some issues with the fancier window managers when using
> OpenGL.
>
I am actually on Ubuntu 12.10, so switching to unity2d is less trivial. I
did spend half an hour going through every setting in
compizconfig-settings-manager to try find interactions between the
compositor and Qt, but I didn't find any option that stopped the
lag-on-drag behaviour. I did crash unity about twenty times though.
>
> 846cf1a13f80fe4590cc9ad4d9972d7a173accd6 to QtBase, which is going into
> 5.1, resize issues on gnome for instance.
>
I will grab the 5.1 alpha and see if the behaviour still exists.
>
> You could also try to set the envvar:
>
> QML_BAD_GUI_RENDER_LOOP=1
>
> It switches the render loop to a single-threaded, timer-based loop which
> updates every 16 ms, not in sync with vsync. The default on linux/X11 is to
> use a dedicated render thread, advance animations once per frame and rely
> on vsync to be throttled.
>
I did this, and unfortunately I could still reproduce the problem.
>
> cheers,
> Gunnar
>
> >
> > I am using the Nvidia binary drivers (v304.51) so in order to double
> check that applications actually *were* vsynced, I ran glxgears. Turns out
> that glxgears does the same thing: no repainting while dragging and it lags
> the whole PC when you drag the app. This is not a small PC, I have a GTX
> 560 Ti, 32GB of ram and an i7 3930.. why oh why is glxgears lagging...
> >
> > For want of another data point, I ran minecraft, yes I know its a
> different language and all that, but it does have an OpenGL context... and
> it doesn't lag the pc at all while the window is being dragged.
> >
> > So I am not sure that this is really Qt's fault, except that the QtQuick
> 1.1 application did not exhibit the same problems, and it does seem
> possible to make an OpenGL application that repaints while the window is
> moved.
> >
> > Any ideas?
> >
> >
> > cheers,
> > Gunnar
> >
> > >
> > > Here is a simple reproducer of the problem, I create a QtQuick2
> application in Qt Creator 2.7. I adjust the QML to look like this:
> > >
> > > import QtQuick 2.0
> > >
> > > Rectangle {
> > > width: 400
> > > height: 400
> > > Rectangle {
> > > id: redsquare
> > > color: "red"
> > > width: 50
> > > height: 50
> > > x: 50
> > > y: 50
> > > }
> > > RotationAnimation {
> > > loops: Animation.Infinite
> > > target: redsquare
> > > properties: "rotation"
> > > from: 0
> > > to: 360
> > > duration: 300*5
> > > direction: RotationAnimation.Clockwise
> > > running: true
> > > }
> > > }
> > >
> > > My main.cpp is the default, but that looks like this:
> > >
> > > #include <QtGui/QGuiApplication>
> > > #include "qtquick2applicationviewer.h"
> > >
> > > int main(int argc, char *argv[])
> > > {
> > > QGuiApplication app(argc, argv);
> > >
> > > QtQuick2ApplicationViewer viewer;
> > >
> viewer.setMainQmlFile(QStringLiteral("qml/SimpleRotator/main.qml"));
> > > viewer.showExpanded();
> > >
> > > return app.exec();
> > > }
> > >
> > > I am new to Qt, so perhaps I am doing something wrong with my
> animation, but I have tried a couple other methods of animating and they
> all lag equally badly. The PC I develop on is quite a monster, so if it is
> lagging on this, I hate to think what it's going to do on my clients'
> laptops.
> > >
> > > Anyone have any ideas?
> > >
> > > Regards
> > > Michael
> > > _______________________________________________
> > > Interest mailing list
> > > Interest at qt-project.org
> > > http://lists.qt-project.org/mailman/listinfo/interest
> >
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130412/36edfe52/attachment.html>
More information about the Interest
mailing list