[Lazarus] Fast drawing to canvas

Marco van de Voort marcov at stack.nl
Thu Feb 23 17:37:04 CET 2012


On Thu, Feb 23, 2012 at 04:29:16PM +0100, Reimar Grabowski wrote:
> > The limit in OpenGL is going to be uploading speed.

> True, the absolut limit is PCI-E transfer speed (for 2.0 it is 5GT/s with
> a data rate of 500MB/s so a x32 connector can do about 16GB/s).  Looks
> more like HD speed is a bigger issue than PCI-E transfer speed.

I did some tests with that, including with a x16 card in a x1 slot, and
didn't notice any difference. (P35 mobo)

The speed (with a non integrated GPU) is always about 1mb/ms so about
1gbyte/s. But that is for a single uploaded frame (see below). If I increase
the framerate (generate a new frame more often), I see that the times get
significantly (several times) longer, so the opengl call blocking time is
not entirely the same as the time the card is busy.

> > IIRC speed also depends
> > on your opengl implementation match your videocard (iow, do not create
> > opengl3 context on e.g. gf8x00 series, but do for new cards)
> That's news to me. Do you have any links where I can look this up?

Benchmarking with own code. I had enabled gl3 contexts and PBOs, and I saw
that that was faster on new machines, but slower on older ones. Old and new
was mainly videocard. (HD5400 series from ATI vs older GF8500's)

> AFAIK this are the general upload bottlenecks:

> - the driver (CPU overhead)
> - conversion or reformatting of data

While the code can do other types, I've most experience with 8-bit
grayscale. (transformed to RGBA or ABGR while uploading)

> - the CPU bandwidth while copying the data from user space
> - the PCI-E bus while transferring the data
 
I simply measure my frame upload method times, which are zero copy in my own
code, thus entirely bound by opengl.

This consists out of one texture upload, and some linedrawing which is done
with ARB buffers.

> For OpenGL it is hard to predict anything. Most of the time there isn't
> even one optimal way as much depends on hardware/driver combination.

True.




More information about the Lazarus mailing list