[Pixman] [PATCH] lowlevel-blt-bench: use a8r8g8b8 for CA solid masks

Pekka Paalanen ppaalanen at gmail.com
Thu Apr 16 06:08:21 PDT 2015


From: Pekka Paalanen <pekka.paalanen at collabora.co.uk>

When doing component alpha, use a mask format that has all the color
channels instead of just a8. As Ben Avison explains it:

"Lowlevel-blt-bench initialises all its images using memset(0xCC) so an
a8 solid image would be converted by _pixman_image_get_solid() to
0xCC000000 whereas an a8r8g8b8 would be 0xCCCCCCCC. When you're not in
component alpha mode, only the alpha byte matters for the mask image,
but in the case of component alpha operations, a fast path might decide
that it can save itself a lot of multiplications if it spots that 3
constant mask components are already 0."

No (default) test so far has a solid mask with CA. This is just
future-proofing lowlevel-blt-bench to do what one would expect.

Signed-off-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
---
 test/lowlevel-blt-bench.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/test/lowlevel-blt-bench.c b/test/lowlevel-blt-bench.c
index 9d80d21..aff4608 100644
--- a/test/lowlevel-blt-bench.c
+++ b/test/lowlevel-blt-bench.c
@@ -868,7 +868,11 @@ parse_test_pattern (test_entry_t *test, const char *pattern)
 
     if (test->mask_fmt == PIXMAN_solid)
     {
-        test->mask_fmt = PIXMAN_a8;
+        if (test->mask_flags & CA_FLAG)
+            test->mask_fmt = PIXMAN_a8r8g8b8;
+        else
+            test->mask_fmt = PIXMAN_a8;
+
         test->mask_flags |= SOLID_FLAG;
     }
 
-- 
2.0.5



More information about the Pixman mailing list