pixman: Branch 'master'

Søren Sandmann Pedersen sandmann at kemper.freedesktop.org
Fri Sep 9 20:49:32 PDT 2011


 pixman/pixman-bits-image.c |   58 ++++++++++++++++++++++++++++++++++-----------
 1 file changed, 44 insertions(+), 14 deletions(-)

New commits:
commit f5da52b6774bdefdfa88a28fdc3904797adb7e26
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Aug 22 15:29:25 2011 +0100

    bits: optimise fetching width==1 repeats
    
    Profiling ign.com, 20% of the entire render time was absorbed in this
    single operation:
    
    << /content //COLOR_ALPHA /width 480 /height 800 >> surface context
    << /width 1 /height 677 /format //ARGB32 /source <|!!!@jGb!m5gD']#$jFHGWtZcK&2i)Up=!TuR9`G<8;ZQp[FQk;emL9ibhbEL&NTh-j63LhHo$E=mSG,0p71`cRJHcget4%<S\X+~> >> image pattern
      //EXTEND_REPEAT set-extend
      set-source
    n 0 0 480 677 rectangle
    fill+
    pop
    
    which is a simple composition of a single pixel wide image. Sadly this
    is a workaround for lack of independent repeat-x/y handling in cairo and
    pixman. Worse still is that the worst-case behaviour of the general repeat
    path is for width 1 images...
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/pixman/pixman-bits-image.c b/pixman/pixman-bits-image.c
index f540c76..f382c65 100644
--- a/pixman/pixman-bits-image.c
+++ b/pixman/pixman-bits-image.c
@@ -935,17 +935,16 @@ MAKE_FETCHERS (reflect_r5g6b5,   r5g6b5,   PIXMAN_REPEAT_REFLECT)
 MAKE_FETCHERS (normal_r5g6b5,    r5g6b5,   PIXMAN_REPEAT_NORMAL)
 
 static void
-bits_image_fetch_solid_32 (pixman_image_t * image,
-                           int              x,
-                           int              y,
-                           int              width,
-                           uint32_t *       buffer,
-                           const uint32_t * mask)
+replicate_pixel_32 (bits_image_t *   bits,
+		    int              x,
+		    int              y,
+		    int              width,
+		    uint32_t *       buffer)
 {
     uint32_t color;
     uint32_t *end;
 
-    color = image->bits.fetch_pixel_32 (&image->bits, 0, 0);
+    color = bits->fetch_pixel_32 (bits, x, y);
 
     end = buffer + width;
     while (buffer < end)
@@ -953,18 +952,17 @@ bits_image_fetch_solid_32 (pixman_image_t * image,
 }
 
 static void
-bits_image_fetch_solid_64 (pixman_image_t * image,
-                           int              x,
-                           int              y,
-                           int              width,
-                           uint32_t *       b,
-                           const uint32_t * unused)
+replicate_pixel_64 (bits_image_t *   bits,
+		    int              x,
+		    int              y,
+		    int              width,
+		    uint32_t *       b)
 {
     uint64_t color;
     uint64_t *buffer = (uint64_t *)b;
     uint64_t *end;
 
-    color = image->bits.fetch_pixel_64 (&image->bits, 0, 0);
+    color = bits->fetch_pixel_64 (bits, x, y);
 
     end = buffer + width;
     while (buffer < end)
@@ -972,6 +970,28 @@ bits_image_fetch_solid_64 (pixman_image_t * image,
 }
 
 static void
+bits_image_fetch_solid_32 (pixman_image_t * image,
+                           int              x,
+                           int              y,
+                           int              width,
+                           uint32_t *       buffer,
+                           const uint32_t * mask)
+{
+    replicate_pixel_32 (&image->bits, 0, 0, width, buffer);
+}
+
+static void
+bits_image_fetch_solid_64 (pixman_image_t * image,
+                           int              x,
+                           int              y,
+                           int              width,
+                           uint32_t *       b,
+                           const uint32_t * unused)
+{
+    replicate_pixel_64 (&image->bits, 0, 0, width, b);
+}
+
+static void
 bits_image_fetch_untransformed_repeat_none (bits_image_t *image,
                                             pixman_bool_t wide,
                                             int           x,
@@ -1031,6 +1051,16 @@ bits_image_fetch_untransformed_repeat_normal (bits_image_t *image,
     while (y >= image->height)
 	y -= image->height;
 
+    if (image->width == 1)
+    {
+	if (wide)
+	    replicate_pixel_64 (image, 0, y, width, buffer);
+	else
+	    replicate_pixel_32 (image, 0, y, width, buffer);
+
+	return;
+    }
+
     while (width)
     {
 	while (x < 0)


More information about the xorg-commit mailing list