[Xcb] Bug in image handling on PPC

Ulrich Eckhardt doomster at knuut.de
Wed Jul 23 22:53:02 PDT 2008


Hi!

I'm currently getting a familiar with XCB and I'm trying to port a small 
program I wrote using Xlib over to XCB. Up to a certain point, things went 
well, but then I started having problems with pixmaps. I managed to find a 
solution, which consists of this simple change in function xcb_image_native:

    if (tmp_image) {
        memset( tmp_image->data, 0, tmp_image->size);
#if 1
        // works:
        for( int x=0; x!=image->width; x++)
            for( int y=0; y!=image->height; ++y)
            {
                uint32_t pix = xcb_image_get_pixel( image, x, y);
                xcb_image_put_pixel( tmp_image, x, y, pix);
            }
#else
        // broken:
        if (!xcb_image_convert(image, tmp_image)) {
            xcb_image_destroy(tmp_image);
            return 0;
        }
#endif
        image = tmp_image;
    }

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

Notes:
- There are actually two changes above, one is the call to memset (which 
showed me lots of uninitialised bytes in the result, too!) and the other is 
replacing the part labelled "broken" with the part labelled "works".
- The image is actually a pixmap (depth=1) for use with the SHAPE extension.
- The X server is running on PowerPC, i.e. a big-endian platform.
- The two images' byte_order and bit_order fields both differ, the source has 
XCB_IMAGE_ORDER_LSB_FIRST in both, the target has XCB_IMAGE_ORDER_MSB_FIRST.


Now, is this is a known issue? I'm using "0.2+git36-1" from Debian, are there 
fixes already available or should I upgrade for another reason? I can try to 
create a complete testcase later today, shouldn't be too complicated now that 
I have actually found the problem.

cheers

Uli



More information about the Xcb mailing list