Delete simple repeat code
authorSøren Sandmann Pedersen <ssp@redhat.com>
Tue, 28 Sep 2010 04:51:07 +0000 (00:51 -0400)
committerSøren Sandmann Pedersen <ssp@redhat.com>
Mon, 4 Oct 2010 15:19:27 +0000 (11:19 -0400)
This was supposedly an optimization, but it has pathological cases
where it definitely isn't. For example a 1 x n image will cause it to
have terrible memory access patterns and to generate a ton of modulus
operations.

Since no one has ever measured whether it actually is an improvement,
and since it is doing the repeating at the wrong the stage in the
pipeline, and since with the previous commit it can't be triggered
anymore because we now require SAMPLES_COVER_CLIP for regular fast
paths, just delete it.

pixman/pixman-image.c
pixman/pixman-private.h
pixman/pixman.c

index 9802d8c..7a9c423 100644 (file)
@@ -409,12 +409,6 @@ compute_image_info (pixman_image_t *image)
        else
        {
            code = image->bits.format;
-
-           if (!image->common.transform &&
-               image->common.repeat == PIXMAN_REPEAT_NORMAL)
-           {
-               flags |= FAST_PATH_SIMPLE_REPEAT;
-           }
        }
 
        if (!PIXMAN_FORMAT_A (image->bits.format)                               &&
index 59d9c5d..3979f60 100644 (file)
@@ -560,7 +560,7 @@ _pixman_choose_implementation (void);
 #define FAST_PATH_UNIFIED_ALPHA                        (1 <<  9)
 #define FAST_PATH_SCALE_TRANSFORM              (1 << 10)
 #define FAST_PATH_NEAREST_FILTER               (1 << 11)
-#define FAST_PATH_SIMPLE_REPEAT                        (1 << 12)
+#define FAST_PATH_HAS_TRANSFORM                        (1 << 12)
 #define FAST_PATH_IS_OPAQUE                    (1 << 13)
 #define FAST_PATH_NEEDS_WORKAROUND             (1 << 14)
 #define FAST_PATH_NO_NONE_REPEAT               (1 << 15)
@@ -570,7 +570,6 @@ _pixman_choose_implementation (void);
 #define FAST_PATH_Y_UNIT_ZERO                  (1 << 19)
 #define FAST_PATH_BILINEAR_FILTER              (1 << 20)
 #define FAST_PATH_NO_NORMAL_REPEAT             (1 << 21)
-#define FAST_PATH_HAS_TRANSFORM                        (1 << 22)
 
 #define FAST_PATH_PAD_REPEAT                                           \
     (FAST_PATH_NO_NONE_REPEAT          |                               \
index 15e7fbf..3a62b2d 100644 (file)
@@ -377,126 +377,6 @@ pixman_compute_composite_region32 (pixman_region32_t * region,
     return TRUE;
 }
 
-static void
-walk_region_internal (pixman_implementation_t *imp,
-                      pixman_op_t              op,
-                      pixman_image_t *         src_image,
-                      pixman_image_t *         mask_image,
-                      pixman_image_t *         dst_image,
-                      int32_t                  src_x,
-                      int32_t                  src_y,
-                      int32_t                  mask_x,
-                      int32_t                  mask_y,
-                      int32_t                  dest_x,
-                      int32_t                  dest_y,
-                      int32_t                  width,
-                      int32_t                  height,
-                      pixman_bool_t            src_repeat,
-                      pixman_bool_t            mask_repeat,
-                      pixman_region32_t *      region,
-                      pixman_composite_func_t  composite_rect)
-{
-    int w, h, w_this, h_this;
-    int x_msk, y_msk, x_src, y_src, x_dst, y_dst;
-    int src_dy = src_y - dest_y;
-    int src_dx = src_x - dest_x;
-    int mask_dy = mask_y - dest_y;
-    int mask_dx = mask_x - dest_x;
-    const pixman_box32_t *pbox;
-    int n;
-
-    pbox = pixman_region32_rectangles (region, &n);
-
-    /* Fast path for non-repeating sources */
-    if (!src_repeat && !mask_repeat)
-    {
-       while (n--)
-       {
-           (*composite_rect) (imp, op,
-                              src_image, mask_image, dst_image,
-                              pbox->x1 + src_dx,
-                              pbox->y1 + src_dy,
-                              pbox->x1 + mask_dx,
-                              pbox->y1 + mask_dy,
-                              pbox->x1,
-                              pbox->y1,
-                              pbox->x2 - pbox->x1,
-                              pbox->y2 - pbox->y1);
-           
-           pbox++;
-       }
-
-       return;
-    }
-    
-    while (n--)
-    {
-       h = pbox->y2 - pbox->y1;
-       y_src = pbox->y1 + src_dy;
-       y_msk = pbox->y1 + mask_dy;
-       y_dst = pbox->y1;
-
-       while (h)
-       {
-           h_this = h;
-           w = pbox->x2 - pbox->x1;
-           x_src = pbox->x1 + src_dx;
-           x_msk = pbox->x1 + mask_dx;
-           x_dst = pbox->x1;
-
-           if (mask_repeat)
-           {
-               y_msk = MOD (y_msk, mask_image->bits.height);
-               if (h_this > mask_image->bits.height - y_msk)
-                   h_this = mask_image->bits.height - y_msk;
-           }
-
-           if (src_repeat)
-           {
-               y_src = MOD (y_src, src_image->bits.height);
-               if (h_this > src_image->bits.height - y_src)
-                   h_this = src_image->bits.height - y_src;
-           }
-
-           while (w)
-           {
-               w_this = w;
-
-               if (mask_repeat)
-               {
-                   x_msk = MOD (x_msk, mask_image->bits.width);
-                   if (w_this > mask_image->bits.width - x_msk)
-                       w_this = mask_image->bits.width - x_msk;
-               }
-
-               if (src_repeat)
-               {
-                   x_src = MOD (x_src, src_image->bits.width);
-                   if (w_this > src_image->bits.width - x_src)
-                       w_this = src_image->bits.width - x_src;
-               }
-
-               (*composite_rect) (imp, op,
-                                  src_image, mask_image, dst_image,
-                                  x_src, y_src, x_msk, y_msk, x_dst, y_dst,
-                                  w_this, h_this);
-               w -= w_this;
-
-               x_src += w_this;
-               x_msk += w_this;
-               x_dst += w_this;
-           }
-
-           h -= h_this;
-           y_src += h_this;
-           y_msk += h_this;
-           y_dst += h_this;
-       }
-
-       pbox++;
-    }
-}
-
 #define N_CACHED_FAST_PATHS 8
 
 typedef struct
@@ -949,14 +829,26 @@ pixman_image_composite32 (pixman_op_t      op,
                                   dest_format, dest_flags,
                                   &imp, &func))
     {
-       walk_region_internal (imp, op,
-                             src, mask, dest,
-                             src_x, src_y, mask_x, mask_y,
-                             dest_x, dest_y,
-                             width, height,
-                             (src_flags & FAST_PATH_SIMPLE_REPEAT),
-                             (mask_flags & FAST_PATH_SIMPLE_REPEAT),
-                             &region, func);
+       const pixman_box32_t *pbox;
+       int n;
+
+       pbox = pixman_region32_rectangles (&region, &n);
+       
+       while (n--)
+       {
+           func (imp, op,
+                 src, mask, dest,
+                 pbox->x1 + src_x - dest_x,
+                 pbox->y1 + src_y - dest_y,
+                 pbox->x1 + mask_x - dest_x,
+                 pbox->y1 + mask_y - dest_y,
+                 pbox->x1,
+                 pbox->y1,
+                 pbox->x2 - pbox->x1,
+                 pbox->y2 - pbox->y1);
+           
+           pbox++;
+       }
     }
 
 out: