[Pixman] Performance regression with pixman 0.40

Ludovic.Desroches at microchip.com Ludovic.Desroches at microchip.com
Fri Jun 4 07:08:29 UTC 2021


We are developping a graphics framework called EGT dedicated to Microchip parts:

We are using Cairo, and so Pixman, for the drawing part. Updating our
distribution, we noticed a performance decrease in our benchmark suite, in
the worst case our fps decrease from 200 to 60.

We have identified the move from Pixman 0.38.4 to 0.40 as the cause. I did a
bisect to find which commit impacts us and it's this one:

commit 6fe0131394fb029d2fccaee6b8edcb108840ad8a (refs/bisect/bad)
Author: Federico Mena Quintero <federico at gnome.org>
Date:   Wed Mar 18 18:49:30 2020 -0600

    Initialize temporary buffers in general_composite_rect()
    Otherwise, Valgrind shows things like "conditional jump or move
    depends on uninitialised values" errors much later in calling code.
    For example, see https://gitlab.gnome.org/GNOME/librsvg/issues/572
    Fixes https://gitlab.freedesktop.org/pixman/pixman/issues/9

diff --git a/pixman/pixman-general.c b/pixman/pixman-general.c
index 7d74f98..7e5a0d0 100644
--- a/pixman/pixman-general.c
+++ b/pixman/pixman-general.c
@@ -165,6 +165,12 @@ general_composite_rect  (pixman_implementation_t *imp,
        if (!scanline_buffer)
+       memset (scanline_buffer, 0, width * Bpp * 3 + 15 * 3);
+    }
+    else
+    {
+       memset (stack_scanline_buffer, 0, sizeof (stack_scanline_buffer));
     src_buffer = ALIGN (scanline_buffer);

I don't know which drawing paths are impacted by this change, I can dig further
if needed. We have 2 benches with small performance decrease for all our
devices: armv5 and armv7. And one bench with huge performance decrease on our
armv5 device. This bench is about drawing circles with alpha blending. Other
benches which draw squares, squares with alpha blending, and circles are not

For sure, having an extra memset in the path can explain the performance

Do we have to consider that the new scores we get are the valid ones or can we
find an alternative?



More information about the Pixman mailing list