XGetImage returns junk with Xorg/dummy_drv/VTs

Peter Harris peter.harris at hummingbird.com
Mon Nov 24 10:17:53 PST 2008


McDonald, Michael-p7438c wrote:
>   I'm trying to run the Xorg server using the dummy driver in the
> "background" in Linux. Everything works fine as long as the dummy Xorg
> has the VT "focus". If it's in the background, then XGetImage returns
> junk data.

XGetImage *always* returns junk data. The actual bits are highly
dependant on BackingStores and/or obscuring of your particular window
and/or XSECURITY and/or XACE settings. And possibly Composite settings
too, although I haven't checked that particular extension for GetImage
interactions.

Basically, unless you are taking a screen shot, XGetImage is the wrong
thing to do. And if you *are* taking a screen shot of a screen that has
switched to another VT, "junk" is the correct result. Although I suppose
you could argue that the "junk" should be overwritten with a regular
pattern, such as that created by XaceCensorImage, as the "junk" may be a
security leak.

>   It seems like the VT code is somehow causing the framebuffer to get
> swapped out. Can someone give me a hint as to what's going on? And how
> to work around it if there is a work around?

Workaround (or, arguably, bug fix): Don't use XGetImage.

Alternate workaround (or, arguably, bug fix): Use XGetImage only on
Pixmaps, never Windows. (Ditto for the source drawable of
CopyArea/CopyPlane).

Potential alternate workaround, depending on what exactly you are doing:
Make sure BackingStore is enabled for your particular window. As you can
see on page 57 of the X protocol reference, this is the only reliable
way to get the bits of an obscured window (and a window is definitely
obscured if the VT has been switched). Most Linux distributions ship
with BackingStore disabled, though, so this isn't viable if you want
your app to run everywhere. Also, the BackingStore bit is just a hint.
Even if the server claims to support the BackingStore bit, it is free to
discard your BackingStore at any time, although few servers do so.

Peter Harris
-- 
     Hummingbird Connectivity - A Division of Open Text
Peter Harris                    http://connectivity.hummingbird.com
Research and Development        Phone: +1 905 762 6001
peter.harris at hummingbird.com    Toll Free: 1 877 359 4866



More information about the xorg mailing list