chris at chris-wilson.co.uk
Thu Oct 18 13:11:50 PDT 2007
Using XShm for transferring the images between Cairo and the Xserver
seems like a sensible performance optimization and one that interests
quite a few people. The nasty part is that in order to avoid copying the
image data, the shared memory segment must be constructed upon image
create and the image's pixels allocated from within the shared memory.
To allow the higher levels and application code to construct XShm-based
cairo_image_surface_t, we add a new function
cairo_image_surface_create_for_target() that purports to create an image
optimized for future use with the target backend.
The actual usage of XShm is quite simple and mirrors the current
XGetImage/XPutImage usage with the exception that a special image
surface is created and the ShmSegmentInfo is stored within its
user_data. The last segment is cached on the display to reduce the
number of times we have to rebuild the shared memory segment. An
improvement would be to implement a shared memory manager if the need
arose to handle multiple persistent XShm images.
The pair of attached patches are split between adding the new API and
implementing XShm in the xlib backend. (The granularity is a bit coarse
and the patches could do with further splitting...) Please review and
profile - cairo-perf hints that it may have significant performance
impact, but the results were not stable over repeated runs.
It's a start, passes make check and has an impact on make perf.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 0 bytes
Desc: not available
Url : http://lists.cairographics.org/archives/cairo/attachments/20071018/7dabfde2/attachment-0002.patch
More information about the cairo