[Qt-interest] Performance issues with Graphics View Framework
Constantin Makshin
dinosaur-rus at users.sourceforge.net
Tue Jul 21 11:41:28 CEST 2009
Your animation method is very "GPU-unfriendly".
Since all widget handling (including drawing) is done on CPU, their
off-screen buffers are stored in RAM. If you use the default graphics
system, which is not hardware-accelerated, then pixmaps are also stored in
RAM and your QWidget<->QPixmap copy operations are relatively cheap. But
if you mix hardware- and software-accelerated things, e.g. QGLWidget and
software QPixmap-s, then you do a lot of RAM<->VRAM copy and probably
image processing (conversion between CPU and GPU formats, etc.) operations.
If you want to use available hardware acceleration, then do what Enrico
suggests (load the image as a texture and scroll it by modifying texture
coordinates). Updating 4 vertices is MUCH cheaper than uploading new image
to VRAM (assuming each vertex has 3 coordinates (x, y, z) and 2 texture
coordinates (s, t), 4 vertices'll occupy only 80 bytes).
On Tue, 21 Jul 2009 12:20:54 +0400, Simone Artesino <mlist.sa at gmail.com>
wrote:
> Enrico wrote : (you're copying memory
> to and from the video board many times with the current approach),
>
> Ok Enrico, but let's consider now these tests result, made on atom
> chipset
> polusbo.
> running a 30 fps timer,
> when use as viewport a Widget I obtain 30 fps and 19% cpu load.
> when use as viewport a QGLWidget I obtain 5 fps and 67% cpu load.
> these results are not influenced from switching viewport update policy.
>
> What I can infer from this result?
> my qpixmap copy is well hardware accelerated when I use a Widget (and is
> stored in gpu internal memory I guess), instead when I use a QGLWidget
> the
> copy is translated in a very bad open-gl code that makes several copies
> of
> memory from ram-cpu memory to gpu.
>
> Is a correct deduction? what you think about it?
>
> 2009/7/20 Enrico Ros <enrico.qt at email.it>
>
>> On Monday 20 July 2009 16:22:08 Simone Artesino wrote:
>> > *) I'm sure that I'm running openGL on gpu (no software-only mode)
>> > -) I'm using the latest qt 4.5.2
>> > --) I've take care off disable antialias and other cpu consuming.
>> > setRenderHint(QPainter::Antialiasing,false);
>> > setRenderHint(QPainter::TextAntialiasing,false);
>> > setRenderHint(QPainter::HighQualityAntialiasing,false);
>> > setRenderHint(QPainter::NonCosmeticDefaultPen,false);
>> > setRenderHint(QPainter::SmoothPixmapTransform,false);
>> > ---)I've tried both MinimalViewportUpdate, SmartViewportUpdate,
>> > BoundingRectViewportUpdate, FullViewportUpdate but the the
>> performances
>> > difference between the two viewpot still remains
>> > ----)About poulsbo I'm pretty sure to use the latest and stable gma
>> drivers
>> >
>> > x) In my animation i do the following work: like a slotmakine i
>> vertically
>> > move a set of 3 simbols of a 10 symbols stripe.
>> >
>> > I obtain that result in the following manner.
>> >
>> > Load a QImage that represent a stripes of 10 different symbols
>> > striscia = new QImage("media/images/striscia.png");
>> > Randomly choose a sequence of this ten symbols.
>> > Using this sequence i create an empty QPixmap and draw on it the
>> > corresponding symbols taken from the QImage.
>> >
>> > Animation cycle :
>> > Using a clipping rectangle and the QPixmap::copy i copy the right
>> portion
>> > of the stripe in the screen that simulate a scrool of the stripe.
>>
>> I think the clipping rectangle may hurt performance. You could convert
>> this
>> type of animation by pushing the texture to OpenGL ONCE (you're copying
>> memory
>> to and from the video board many times with the current approach), and
>> use
>> GL
>> commands inside the animation loop.
>>
>> The animation should "scroll the texture coordinates" of the 4 vertex of
>> the
>> rectangle and draw always the same rectangle. Saving will be huge ;-)
>>
>> Ciao,
>> Enrico
>>
>>
>>
>> --
>> Caselle da 1GB, trasmetti allegati fino a 3GB e in piu' IMAP, POP3 e
>> SMTP
>> autenticato? GRATIS solo con Email.it http://www.email.it/f
>>
>> Sponsor:
>> L’offerta più completa per Ferragosto al mare è quella di Riccione
>> Turismo! Bimbi gratis, spiaggia attrezzata, sport e benessere in hotel
>> Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid“54&d -7
--
Constantin "Dinosaur" Makshin
More information about the Qt-interest-old
mailing list