[Pixman] [PATCH v3 2/2] affine-bench: remove 8e margin from COVER area

Pekka Paalanen ppaalanen at gmail.com
Wed Sep 23 01:40:33 PDT 2015


From: Ben Avison <bavison at riscosopen.org>

Patch "Remove the 8e extra safety margin in COVER_CLIP analysis" reduced
the required image area for setting the COVER flags in
pixman.c:analyze_extent(). Do the same reduction in affine-bench.

Leaving the old calculations in place would be very confusing for anyone
reading the code.

Also add a comment that explains how affine-bench wants to hit the COVER
paths. This explains why the intricate extent calculations are copied
from pixman.c.

[Pekka: split patch, change comments, write commit message]
Signed-off-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>

---

This is v2 part 2/2 of the patch "Change conditions for setting
FAST_PATH_SAMPLES_COVER_CLIP flags".

v3: no changes.
---
 test/affine-bench.c | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/test/affine-bench.c b/test/affine-bench.c
index 9e0121e..86bf46e 100644
--- a/test/affine-bench.c
+++ b/test/affine-bench.c
@@ -395,14 +395,26 @@ main (int argc, char *argv[])
         return EXIT_FAILURE;
     }
 
+    /* Compute required extents for source and mask image so they qualify
+     * for COVER fast paths and get the flags in pixman.c:analyze_extent().
+     * These computations are for FAST_PATH_SAMPLES_COVER_CLIP_BILINEAR,
+     * but at the same time they also allow COVER_CLIP_NEAREST.
+     */
     compute_transformed_extents (&binfo.transform, &dest_box, &transformed);
-    /* The source area is expanded by a tiny bit (8/65536th pixel)
-     * to match the calculation of the COVER_CLIP flags in analyze_extent()
+    xmin = pixman_fixed_to_int (transformed.x1 - pixman_fixed_1 / 2);
+    ymin = pixman_fixed_to_int (transformed.y1 - pixman_fixed_1 / 2);
+    xmax = pixman_fixed_to_int (transformed.x2 + pixman_fixed_1 / 2);
+    ymax = pixman_fixed_to_int (transformed.y2 + pixman_fixed_1 / 2);
+    /* Note:
+     * The upper limits can be reduced to the following when fetchers
+     * are guaranteed to not access pixels with zero weight. This concerns
+     * particularly all bilinear samplers.
+     *
+     * xmax = pixman_fixed_to_int (transformed.x2 + pixman_fixed_1 / 2 - pixman_fixed_e);
+     * ymax = pixman_fixed_to_int (transformed.y2 + pixman_fixed_1 / 2 - pixman_fixed_e);
+     * This is equivalent to subtracting 0.5 and rounding up, rather than
+     * subtracting 0.5, rounding down and adding 1.
      */
-    xmin = pixman_fixed_to_int (transformed.x1 - 8 * pixman_fixed_e - pixman_fixed_1 / 2);
-    ymin = pixman_fixed_to_int (transformed.y1 - 8 * pixman_fixed_e - pixman_fixed_1 / 2);
-    xmax = pixman_fixed_to_int (transformed.x2 + 8 * pixman_fixed_e + pixman_fixed_1 / 2);
-    ymax = pixman_fixed_to_int (transformed.y2 + 8 * pixman_fixed_e + pixman_fixed_1 / 2);
     binfo.src_x = -xmin;
     binfo.src_y = -ymin;
 
-- 
2.4.9



More information about the Pixman mailing list