[Xcb] Bug in image handling on PPC

Ulrich Eckhardt doomster at knuut.de
Fri Aug 8 10:15:57 PDT 2008


> IOW, xcb_image_convert() fails while manually converting the pixels works,
> at least for the case at hand.

Maybe I have figured out where the problem lies, though I'm still trying to 
extract the relevant information from the X11 protocol specs. Anyway...

Take a look at xcb_image_native(). For the case of an XY pixmap, there is a 
call to xcb_image_create() with the parameter 'unit' set to 
the 'bitmap_format_scanline_unit' of the setup. However, I believe that XY 
bitmap planes and pixmap planes are always in octet/byte units. In any case, 
hard-wiring that parameter to 8 fixed my problem.

Notes:

 * The resulting image is correctly decoded by xcb_image_get_pixel() and by 
the X server itself, so it can't be completely wrong. ;)

 * This only affects X servers that want the the byte order to be MSB first 
(big endian) because otherwise the byte order is the same for source and 
target bitmap.

 * This looks like I just changed the target format and thus circumvented the 
real problem, but the 'unit' field of the xcb_image_t isn't even transmitted 
to the X server, so my guess is that taking the unit field from the X server 
was the actual problem. Of course, it could also be the X server misreporting 
what it wants as unit, maybe once I'm through with the protocol I'll be able 
to say more.

 * I'd say these simple algorithmic parts of the library would merit a set of 
unit tests, is there already some in place? If not, I'll try to modify the 
testcase I posted to simply create a bunch of different target formats and 
check if the results match the expectations. From experience, I can say there 
is nothing better than knowing that your last changes didn't affect the 
correctness of something.

 * I have accumulated a lot of documentation (some algorithms were almost 
undocumented) while hacking on this which I want to submit after cleaning it 
up a bit. Is there some kind of patch tracker or should it go to the 
mailinglist for public review?

Happy weekend!

Uli


More information about the Xcb mailing list