GTK2/GTK3 Pixbuf to Pixmap performance



I'll start with a little background...

I'm working on a Xorg-based resource limited embedded platform which runs
an application that displays mapping built up from a set of smaller map
tiles. This mapping is nominally raster based images with each tile
encoded in a custom format (tweaked for loading performance at the
expense of size).

The time taken to get these map tiles on-screen is critical, as these are
tiles loaded as required in response to the user panning around the map.

Up to GTK 2.22 I have been loading the tiles in to a client side Pixbuf,
and then rendering to a server side Pixmap.

Thus the time taken to get this tile onscreen is as follows:
 - ~5ms to get the tile from a file on the SDCard to memory.
 - ~10ms to decode the tile in to a Pixbuf. 
 - ~40ms to render the client side Pixbuf to a server side Pixmap
   (using gdk_pixbuf_render_pixmap_and_mask()).
 - ~10ms to compose the map from a set of tiles, draw an overlay of relating
   information, and process the expose event for a drawing area on which
   the map is drawn.

I keep a cache of these tiles around, so we only load a tile when we move
beyond an area we have cached (with a "loading tile" in place until the
correct tile is loaded).

I've opted to keep all the tiles as server side objects to allow smooth
panning at about 30FPS. The time taken to render from the client side to
the server side is too great to allow me to work on the client side and
only render as a last step.

This is all fine until we hit GTK3...

With the removal of Pixmaps (and hence gdk_pixbuf_render_pixmap_and_mask())
we loose the ability to render from the client side to the server side using
the MIT-SHM extension (as Cairo does not support this). Instead we must paint
to an XLIB-based Cairo surface from a Pixbuf, and this takes a *lot* longer
than rendering a Pixbuf to a Pixmap (about 3x as long).

So, my questions are...

Is faster there a way to load an image directly to a server side object
that I've missed?

In GTK3 what options do I have for getting the performance of the render
back to GTK2 levels?

Am I going to have to learn some X programming and implement shared Pixmaps
using MIT-SHM myself?

I'm relatively new to X/GTK/Cairo so any pointers are welcome!

Cheers,
Joe





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]