[Pixman] [PATCH] Add fast paths for bilinear scaling

Siarhei Siamashka siarhei.siamashka at gmail.com
Thu Jun 28 18:26:24 PDT 2012


On Tue, Jun 26, 2012 at 8:11 AM, Jeff Muizelaar <jmuizelaar at mozilla.com> wrote:
> This patch adds fast paths for bilinear scaling of (SRC, r5g6b5, r5g6b5), (OVER, a8r8g8b8, r5g6b5), and (OVER, a8r8g8b8, a8r8g8b8). These make a noticeable
> improvement in the performance of Firefox on Android.

Hi, thanks. If this is a patch submission intended to be pushed to
pixman git, then it should normally meet some basic requirements to be
accepted:
1. make sure that "make check" test does not detect problems
2. for performance patches, some benchmark numbers demonstrating the
improvement are very much welcome in the commit message (preferably
with cairo-perf-trace, but lowlevel-blt-bench can be used too)


+static force_inline void
+scaled_bilinear_scanline_8888_8888_OVER (uint32_t *       dst,
+                                         const uint32_t * mask,
+                                         const uint32_t * src_top,
+                                         const uint32_t * src_bottom,
+                                         int32_t          w,
+                                         int              wt,
+                                         int              wb,
+                                         pixman_fixed_t   vx,
+                                         pixman_fixed_t   unit_x,
+                                         pixman_fixed_t   max_vx,
+                                         pixman_bool_t    zero_src)
+{
+    while ((w -= 1) >= 0)
+    {
+	uint32_t tl = src_top [pixman_fixed_to_int (vx)];
+	uint32_t tr = src_top [pixman_fixed_to_int (vx) + 1];
+	uint32_t bl = src_bottom [pixman_fixed_to_int (vx)];
+	uint32_t br = src_bottom [pixman_fixed_to_int (vx) + 1];
+	uint32_t src;
+	uint32_t d;
+	d = *dst;
+	src = bilinear_interpolation (tl, tr,
+				      bl, br,
+				      (vx >> 8) & 0xff,
+				      (wb >> 8) & 0xff);

Currently 'wb' variable is a weight factor for the bottom row with
valid values in [0, 255] range. Shifting it right by 8 bits just
converts it to zero. Also the 'wt' variable is ignored, and this is
going to cause problems for NONE repeat:
    http://cgit.freedesktop.org/pixman/tree/pixman/pixman-inlines.h?id=pixman-0.26.0#n761

+	vx += unit_x;
+	*dst++ = over (src, d);
+    }
+}


But surely knowing what kind of fast paths are missing in pixman and
cause performance problems is a valuable information. This patch or
something similar has to be applied after we are done with the
bilinear interpolation precision tweaks (optimistically this should
not take long).

-- 
Best regards,
Siarhei Siamashka


More information about the Pixman mailing list