X[Shm]GetImage is slow; what can I do about this?
dicej at mailsnare.net
Mon Apr 4 16:19:58 PDT 2005
On Mon, 4 Apr 2005, Jonathan Lennox wrote:
> As I've mentioned before on this list, I'm working on an X-based server for
> the protocol defined in the Internet-Draft
> 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?)
May I assume you're using the shared-memory extension (extensions/XShm.h)
when it's available? That's good for a speed boost. Also, I noticed a
dramatic improvement in XGetImage speed when switching from the free nv
driver to the proprietary nvidia driver. On my nVidia 6600GT under Linux,
the performance is excellent.
On my ATI Rage Mobility -based laptop, using the free ati driver results
in performance comparible to our MS Windows implementation on the same
hardware. Are you developing for Windows also? If so, have you tried
doing head-to-head benchmarks?
> 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
> xorg mailing list
> xorg at lists.freedesktop.org
More information about the xorg