[Qt-interest] real time strip chart
Atlant Schmidt
aschmidt at dekaresearch.com
Fri May 20 19:32:40 CEST 2011
Giovanni:
> I'm developing a QT application which includes a real time chart (with several (8 or more)
> traces), similar to an ECG monitor. Traces should move on the monitor with a speed of
> about 5cm/sec. The active window is, in principle almost the whole screen.
If you think about it, this is really quite a data-intensive operation.
If you're animating sixty frames per second, the window occupies
nearly the entire screen, and the animation is moving "side-to-side"
(right-to-left or left-to-right), you need to be able to paint almost the
entire frame buffer during the vertical refresh interval or your screen
will show "tearing". In this situation, you (or Qt) will almost certainly
need to employ "double buffering. And depending upon the order with
which you're accessing the pixels to do the scrolling, you may also
find that the CPU caches are working against you.
If the animation is moving upwards, you might be able to avoid
double-buffering by burying the frame buffer update time inside
the vertical scan interval; keep the update "wavefront" running
ahead of the vertical scan line and you win. It's also easier to
effectively use the cache.
Either way, I can't remember whether Qt has any mechanism to
allow you to run in synchronism with the vertical scanning rate;
last I knew, I don't think it does.
A GPU can, of course, make all of this much faster if you (or
your graphics framework) can make effective use of it.
It's not for nothing that Nokia was struggling to even get to 25 FPS
graphical interfaces while Apple have the entire iPhone interface
running at 60 FPS (including scrolling/panning); Apple have invested
very heavily from the bottom of their graphical stack to the top to allow
this to happen.
Atlant
________________________________
From: qt-interest-bounces+aschmidt=dekaresearch.com at qt.nokia.com [mailto:qt-interest-bounces+aschmidt=dekaresearch.com at qt.nokia.com] On Behalf Of giovanni drogo
Sent: Friday, May 20, 2011 12:06
To: qt-interest at qt.nokia.com
Subject: [Qt-interest] real time strip chart
Hi All,
I'm developing a QT application which includes a real time chart (with several (8 or more) traces), similar to an ECG monitor. Traces should move on the monitor with a speed of about 5cm/sec. The active window is, in principle almost the whole screen. Target operating system is Linux.
Do somebody has some suggestion about the best approach?
I try to look in the archive, but all the messages I found are now too old.
The approach I'm taking now is the following:
I have a timer, clocking at about 50Hz. When the timer expires I compute the scrolling amount using the effective elapsed time, and I scroll the widget using the QWidget::scroll() function. Then I paint the traces in the empty space.
The algorithm is fine, but visual aspect is very bad. Traces run very unsmooth, unless the widget is made very small.
After some profiling I found that the QT program run quite fast: it takes only few milliseconds to scroll the widget and to paint the traces, however the X server is *really* busy. My impression is that, at the end of my PaintEvent, Qt simply tell X to repaint the whole widget, and this is clearly too much.
Before that I tried the classical canvas approach, scrolling and painting a QImage or a Qpixmaps, and drawing them to the widget. Results are even worst: computer and X server are so busy that timer event are lost!
Any suggestion?
Thanks in advance,
G. Drogo
Click here<https://www.mailcontrol.com/sr/k176eUzkbzzTndxI!oX7Ul+sZxelw3DR1nSFzZgD9K95kuR7lTYCSqi1AXQvfVKPiCxqbwqmt0xUlvAsdlYHAg==> to report this email as spam.
________________________________
This e-mail and the information, including any attachments, it contains are intended to be a confidential communication only to the person or entity to whom it is addressed and may contain information that is privileged. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please immediately notify the sender and destroy the original message.
Thank you.
Please consider the environment before printing this email.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110520/b924b408/attachment.html
More information about the Qt-interest-old
mailing list