X[Shm]GetImage is slow; what can I do about this?

Jonathan Lennox lennox at cs.columbia.edu
Mon Apr 4 12:51:13 PDT 2005


As I've mentioned before on this list, I'm working on an X-based server for
the protocol defined in the Internet-Draft
<http://www.ietf.org/internet-drafts/draft-lennox-avt-app-sharing-00.txt>.
It's like VNC, but optionally window-based, so you can share individual
applications -- e.g., just a slideshow, as part of a multimedia conference
-- instead of your whole desktop.

My current implementation is based on using XDamage to track changes to
windows or the whole screen, and then using XShmGetImage to retrieve screen
images to transmit them over the network.

However, I've found that XShmGetImage is remarkably slow, to the point of
probably being very painful for interactive work.  Retrieving an image of my
whole 1280x1024 desktop takes about 1.5 seconds, and even retrieving the
contents of a just-scrolled 512x342 XTerm takes 150 ms.

Some Googling seems to indicate that XGetImage slowness comes about because
the X server keeps screen images in video RAM, not main memory, and video
cards don't tend to be optimized for uploading images to the CPU.

So my questions are:
1.  Is this true?  And is my experience typical?
2.  Is there anything that can be done about this, for instance some way to
convince the X server to keep a mirrored copy of a window in main memory?
(Could XComposite be of use here?)

For reference's sake, I'm using X.Org 6.8.2 on FreeBSD 5.3; my video card is
an nVIDIA GeForce2 MX400.

-- 
Jonathan Lennox
lennox at cs dot columbia dot edu



More information about the xorg mailing list