[cairo] XShm, again

Chris Wilson chris at chris-wilson.co.uk
Sat Aug 16 23:55:51 PDT 2008

On Sat, 2008-08-16 at 17:21 -0700, Vladimir Vukicevic wrote:
> One of our interns spent a while looking at XShm for cairo in mozilla;  
> he documented some of his findings here -- http://www.ericbutler.net/blog/2008/07/adventures-in-x-programming/ 
>   . He was just trying to use it for fast image upload and was getting  
> consistently disappointing results.  Given that your own results don't  
> really show any big speedups (and the ones that are shown are strange  
> -- why is tessellate-256-100 affected by xshm or no xshm?  why is  
> paint-solid-rgb-source showing speedups?), is it worth pursuing this?

I'd be interested in reading through his code, if you have a pointer
handy. As he mentions in his blog, the subtlety in fast uploads is
avoiding the XSync, which is possible by tracking the X request serial
number along with the shm segment and expending more memory (i.e.
delaying reclaim). Given some new API to create an image surface in a
shared memory segment, then the earlier patch was around 8x quicker for
image uploads. The current patch only modifies the fallback paths, and
so is always going to have limited impact - but the consistent negative
effect on text is dismaying.

At the moment, I think XShm is less interesting than reducing the
frequency of _get_image_surface()/_draw_image_surface(). For which a
strategy of once you hit a fallback path, to always use the image
surface for that region and to only push the image back to the X server
on a flush(). Well, that's the premise at least.
Chris Wilson

More information about the cairo mailing list