Fast Screenshot without blocking X events

Michel Dänzer michel at
Wed Oct 17 00:34:53 PDT 2007

On Tue, 2007-10-16 at 11:00 +0200, GORIN Guillaume wrote: 
> -I don't want that all events on X are waiting in a stack, or something
> like this. Actually when capturing (using XGetImage) i can't continue to
> move window. It's why I suppose there is a stack of X events, that wait
> while capturing. Is it true? (If someone can tell me where to find
> informations about that. Xorg Wiki didn't help me).

Yes, as the X server is mostly single threaded, event processing is
probably delayed while a request such as GetImage is being processed.

> I'm able to take screenshot in 3200x1200 in the framebuffer, but it
> takes 2.8 seconds. It's too long for me. I suppose there is a stream
> from X to the framebuffer, it's why reading is too long.

No, CPU reads from video RAM can actually be that slow, especially with
AGP. It's possible to accelerate this using the GPU though.

> My questions are:
> -How X use the framebuffer /dev/fb0 when activated?

The nvidia driver doesn't use it at all to the best of my knowledge.

> -Can I take screenshot without blocking X events?

If XGetImage is inadequate, the only alternative I can think of that
might be better is glReadPixels.

> -Where can I get the picture of the screen before X send it to my
> geforce? (Is it possible?)

Probably not, at least not without modifying the driver.

Hope this helps,

Earthling Michel Dänzer           |
Libre software enthusiast         |          Debian, X and DRI developer

More information about the xorg mailing list