[Xcb] Bug in image handling on PPC
Barton C Massey
bart at cs.pdx.edu
Sun Jul 27 01:10:24 PDT 2008
Thanks much for the bug report! It was not a known issue.
Thanks also for the really well done test case! It has been
crucial in tracking down the (?) problem.
I found two suspected bugs: (1) the byte-swapping was being
done with the wrong conversion unit, and (2) get_pixel() and
put_pixel() for XY bitmaps were using bpp instead of unit
for the indexing, which didn't work for big-endian images.
Note that since they agreed, they *seemed* to work. :-)
Attached is a patch that should fix things up. It works for
your test case, anyhow :-). I'll push it upstream as soon
as I have upstream commit access back and I've heard from
you. Do let me know if this doesn't work for you. Sorry
for the inconvenience, and thanks again for your testing.
Bart
In message <200807240753.03054.doomster at knuut.de> you wrote:
> 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
-------------- next part --------------
More information about the Xcb
mailing list