pixman: Branch 'master'

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat Feb 24 17:30:32 UTC 2024


 pixman/pixman-fast-path.c |    4 ----
 1 file changed, 4 deletions(-)

New commits:
commit ac485a9b668e013eb336592727cb8e52549a6ab9
Author: Gayathri Berli <gayathri.berli at ibm.com>
Date:   Mon Feb 5 12:26:25 2024 +0530

    Revert the changes to fix the problem in big-endian architectures
    
    This reverts commit b4a105d77232a87304b7b621e2f99e699a8eebd3.
    
    There is an endianness issue in pixman-fast-path.c. In the function
    bits_image_fetch_separable_convolution_affine we have this code:
    
    #ifdef WORDS_BIGENDIAN
            buffer[k] = (satot << 0) | (srtot << 8) | (sgtot << 16) | (sbtot << 24);
    #else
            buffer[k] = (satot << 24) | (srtot << 16) | (sgtot << 8) | (sbtot << 0);
    #endif
    
    This will write out the pixels as BGRA on big endian systems but
    obviously that's wrong. Pixel order should be ARGB on big endian systems
    so we don't need any #ifdef for big endian here at all. Instead, the
    code should be the same on little and big endian, i.e. it should be just
    this line instead of the 5 lines above:
    
            buffer[k] = (satot << 24) | (srtot << 16) | (sgtot << 8) | (sbtot << 0);
    
    Changing the code like this fixes the wrong colors that I get with
    pixman on my PowerPC/s390x system.
    
    Here is what cairo.h has to say (which is rooted in pixman):
    
     * @CAIRO_FORMAT_ARGB32: each pixel is a 32-bit quantity, with
     *   alpha in the upper 8 bits, then red, then green, then blue.
     *   The 32-bit quantities are stored native-endian. Pre-multiplied
     *   alpha is used. (That is, 50% transparent red is 0x80800000,
     *   not 0x80ff0000.) (Since 1.0)
    
    Closes: https://gitlab.freedesktop.org/pixman/pixman/-/issues/78
    Signed-off-by: Gayathri Berli <gayathri.berli at ibm.com>

diff --git a/pixman/pixman-fast-path.c b/pixman/pixman-fast-path.c
index e62a8ac..d510cac 100644
--- a/pixman/pixman-fast-path.c
+++ b/pixman/pixman-fast-path.c
@@ -2836,11 +2836,7 @@ bits_image_fetch_separable_convolution_affine (pixman_image_t * image,
 	sgtot = CLIP (sgtot, 0, 0xff);
 	sbtot = CLIP (sbtot, 0, 0xff);
 
-#ifdef WORDS_BIGENDIAN
-	buffer[k] = (satot << 0) | (srtot << 8) | (sgtot << 16) | (sbtot << 24);
-#else
 	buffer[k] = (satot << 24) | (srtot << 16) | (sgtot << 8) | (sbtot << 0);
-#endif
 
     next:
 	vx += ux;


More information about the xorg-commit mailing list