XGetImage returns junk with Xorg/dummy_drv/VTs

Peter Harris peter.harris at hummingbird.com
Mon Nov 24 11:54:18 PST 2008


McDonald, Michael-p7438c wrote:
> 
>> 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. 
> 
>   I'm only doing XGetImage on the root window.

Is your application prepared to handle undefined bits for windows that
are not the same depth as the root? (Overlays, for example, but also
non-sample servers make multiple depths available).

Is your application prepared to handle BadMatch if randr has rotated or
resized the root window since the last time you queried it?

> And I strongly disagree
> that "junk" is the correct result. In my example of running
> Xorg+dummy_drv, how can returing junk be considered the "correct"
> result? Dummy_drv's memory based framebuffer still has the pixels in it.
> OK, if I'm running multiple X servers sharing the same card, then junk
> might be a reasonable answer.

Ah. If that is case, xorg may be returning the wrong bits, and might
need to be fixed.

>   But heck, Xorg isn't even consistant in returning junk! If I start
> Xorg+dummy on a machine running Xorg+nvidia, I get good results. If I
> run Xorg+dummy on a machine running Xorg+intel, I get junk. If I run
> Xorg+dummy on a machine with no other X server, I get junk. What is
> Xorg+nvidia doing "wrong"?

nvidia is doing nothing "wrong". In the case of an obscured window, the
returned bits are undefined. "Undefined" means exactly that there is no
such thing as a "wrong" set of bits to return. It helps to think of it
as a stream from /dev/urandom, which might (through coincidence) match
what you were expecting.

In your case, I misunderstood what was going on. If the windows are not
obscured, then my reasoning is faulty.

>> Workaround (or, arguably, bug fix): Don't use XGetImage.
> 
>   And how is that a workaround?

"Doctor, it hurts when I hit my thumb with this hammer." "So don't use a
hammer, then." "And how is that a workaround?"

I'm afraid I don't know *why* you are using a hammer. If you are trying
to drive in a screw, I might suggest using a screwdriver instead. If you
are trying to cut a length of 2x4, maybe a band saw is a better choice.
Either way, I contend that XGetImage is probably not the right tool for
the job.

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