From 2ef8b394d72d6c13f96347626b09613f805d9f8c Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=B8ren=20Sandmann=20Pedersen?= Date: Sat, 19 Sep 2009 06:14:38 -0400 Subject: [PATCH] Use the destination buffer directly in more cases instead of fetching. When the destination buffer is either a8r8g8b8 or x8r8g8b8, we can use it directly instead of fetching into a temporary buffer. When the format is x8r8g8b8, we require the operator to not make use of destination alpha, but when it is a8r8g8b8, there are no restrictions. This is approximately a 5% speedup on the poppler cairo benchmark: [ # ] backend test min(s) median(s) stddev. count Before: [ 0] image poppler 6.661 6.709 0.59% 6/6 After: [ 0] image poppler 6.307 6.320 0.12% 5/6 --- pixman/pixman-general.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/pixman/pixman-general.c b/pixman/pixman-general.c index 3ead3da..c96a3f9 100644 --- a/pixman/pixman-general.c +++ b/pixman/pixman-general.c @@ -133,15 +133,27 @@ general_composite_rect (pixman_implementation_t *imp, /* Skip the store step and composite directly into the * destination if the output format of the compose func matches * the destination format. + * + * If the destination format is a8r8g8b8 then we can always do + * this. If it is x8r8g8b8, then we can only do it if the + * operator doesn't make use of destination alpha. */ - if (!wide && - !dest->common.alpha_map && - !dest->bits.write_func && - (op == PIXMAN_OP_ADD || op == PIXMAN_OP_OVER) && - (dest->bits.format == PIXMAN_a8r8g8b8 || - dest->bits.format == PIXMAN_x8r8g8b8)) + if ((dest->bits.format == PIXMAN_a8r8g8b8) || + (dest->bits.format == PIXMAN_x8r8g8b8 && + (op == PIXMAN_OP_OVER || + op == PIXMAN_OP_ADD || + op == PIXMAN_OP_SRC || + op == PIXMAN_OP_CLEAR || + op == PIXMAN_OP_IN_REVERSE || + op == PIXMAN_OP_OUT_REVERSE || + op == PIXMAN_OP_DST))) { - store = NULL; + if (!wide && + !dest->common.alpha_map && + !dest->bits.write_func) + { + store = NULL; + } } if (!store) -- 2.7.4