On Sat, 2005-01-29 at 11:57 +0100, Martin Bouzek wrote: > Hello, > > I am complete newbie to this mailing list and to programming of modern > graphic HW, but have the following problem: I want to grab complete X > window screen (eg. root window) reasonably fast. When I use standard way > by XGetImage, I am able to grab about 1.5 screen (1280x1024x32) per > second having CPU usage 100%. (Athlon XP 1.8 GHz, ATI Radeon QD (AGP), > X.Org 6.8.1, on P4 1.7GHz, integrated SiS graphic chip it was about 2.5 > grabs per sec.). It is too slow, so I mmap-ed /dev/mem and memcpy linear > framebuffer. To my surprise a got only slightly better results. I am > using kernel 2.6.9, on ATI DRI was enabled, on SiS it was not.
DRI is not involved in this, so really off-topic for this list. (In the future, using DRI as the basis for 2D acceleration might happen. Currently it's only used for 3D graphics.) This would really be better on the [EMAIL PROTECTED] mailing list. I'll answer quickly anyways. 10 megabytes/sec is really not that unreasonable for read speads over PCI (AGP isn't used for reading by the CPU from the frame buffer). Your /dev/mem tests probably indicate pretty much the maximimal possible rate for this technique. (You could try writing a manual memcpy loop using 32-bit quantities or, using MMX, 64-bit quantities. My experience is that doesn't really help, but your milage may vary.) The only real way to do better is to program the card to DMA the data to the CPU. I believe the proprietary nvidia driver does that. I'm not aware of any open-source driver that accelerates GetImage that way. One thing you might want to try is running the 'vesa' driver with the "ShadowFB" option enabled. All drawing will then be in software and the framebuffer will be in system memory. While drawing will be a bit slower, grabbing the screen image via GetImage will be much faster. If you can get around the video card => cpu bottleneck, you'd probably get better throughput for Xserver => app by using a shared memory pixmap and doing a CopyArea to it. Regards, Owen
signature.asc
Description: This is a digitally signed message part