[Pixman] [PATCH] test: Add a new benchmarker targeting affine operations

2015-04-08 Thread Ben Avison
---
 .gitignore|1 +
 test/Makefile.sources |1 +
 test/affine-bench.c   |  394 +
 3 files changed, 396 insertions(+), 0 deletions(-)
 create mode 100644 test/affine-bench.c

diff --git a/.gitignore b/.gitignore
index 0f11496..7da6b6f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -46,6 +46,7 @@ demos/tri-test
 pixman/pixman-srgb.c
 pixman/pixman-version.h
 test/a1-trap-test
+test/affine-bench
 test/affine-test
 test/alpha-loop
 test/alphamap
diff --git a/test/Makefile.sources b/test/Makefile.sources
index c20c34b..8b0e855 100644
--- a/test/Makefile.sources
+++ b/test/Makefile.sources
@@ -37,6 +37,7 @@ OTHERPROGRAMS = \
radial-perf-test\
 check-formats   \
scaling-bench   \
+   affine-bench\
$(NULL)
 
 # Utility functions
diff --git a/test/affine-bench.c b/test/affine-bench.c
new file mode 100644
index 000..720d066
--- /dev/null
+++ b/test/affine-bench.c
@@ -0,0 +1,394 @@
+/*
+ * Copyright © 2014 RISC OS Open Ltd
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of the copyright holders not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission.  The copyright holders make no
+ * representations about the suitability of this software for any purpose.  It
+ * is provided as is without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ *
+ * Author:  Ben Avison (bavi...@riscosopen.org)
+ */
+
+#include stdio.h
+#include stdlib.h
+#include string.h
+#include ctype.h
+#include stdint.h
+#include utils.h
+
+#ifdef HAVE_GETTIMEOFDAY
+#include sys/time.h
+#else
+#include time.h
+#endif
+
+#define WIDTH  1920
+#define HEIGHT 1080
+#define MAX_L2CACHE_SIZE (8 * 1024 * 1024) /* How much data to read to flush 
all cached data to RAM */
+#define PAGE_SIZE (4 * 1024)
+
+typedef struct box_48_16 box_48_16_t;
+
+struct box_48_16
+{
+pixman_fixed_48_16_tx1;
+pixman_fixed_48_16_ty1;
+pixman_fixed_48_16_tx2;
+pixman_fixed_48_16_ty2;
+};
+
+static pixman_bool_t
+compute_transformed_extents (pixman_transform_t   *transform,
+ const pixman_box32_t *extents,
+ box_48_16_t  *transformed)
+{
+pixman_fixed_48_16_t tx1, ty1, tx2, ty2;
+pixman_fixed_t x1, y1, x2, y2;
+int i;
+
+x1 = pixman_int_to_fixed (extents-x1) + pixman_fixed_1 / 2;
+y1 = pixman_int_to_fixed (extents-y1) + pixman_fixed_1 / 2;
+x2 = pixman_int_to_fixed (extents-x2) - pixman_fixed_1 / 2;
+y2 = pixman_int_to_fixed (extents-y2) - pixman_fixed_1 / 2;
+
+if (!transform)
+{
+transformed-x1 = x1;
+transformed-y1 = y1;
+transformed-x2 = x2;
+transformed-y2 = y2;
+
+return TRUE;
+}
+
+tx1 = ty1 = INT64_MAX;
+tx2 = ty2 = INT64_MIN;
+
+for (i = 0; i  4; ++i)
+{
+pixman_fixed_48_16_t tx, ty;
+pixman_vector_t v;
+
+v.vector[0] = (i  0x01)? x1 : x2;
+v.vector[1] = (i  0x02)? y1 : y2;
+v.vector[2] = pixman_fixed_1;
+
+if (!pixman_transform_point (transform, v))
+return FALSE;
+
+tx = (pixman_fixed_48_16_t)v.vector[0];
+ty = (pixman_fixed_48_16_t)v.vector[1];
+
+if (tx  tx1)
+tx1 = tx;
+if (ty  ty1)
+ty1 = ty;
+if (tx  tx2)
+tx2 = tx;
+if (ty  ty2)
+ty2 = ty;
+}
+
+transformed-x1 = tx1;
+transformed-y1 = ty1;
+transformed-x2 = tx2;
+transformed-y2 = ty2;
+
+return TRUE;
+}
+
+static void
+create_image (uint32_t   width,
+  uint32_t   height,
+  pixman_format_code_t   format,
+  pixman_filter_tfilter,
+  const pixman_transform_t  *t,
+  uint32_t **bits,
+  pixman_image_t   **image)
+{
+uint32_t stride = (width * PIXMAN_FORMAT_BPP(format) + 31) / 32 * 4;
+
+*bits = aligned_malloc (PAGE_SIZE, stride * height);
+memset (*bits, 0xCC, stride * height);
+*image = 

Re: [Pixman] [PATCH] lowlevel-blt-bench: Parse test name strings in general case

2015-04-08 Thread Ben Avison

On Wed, 08 Apr 2015 12:21:03 +0100, Pekka Paalanen ppaala...@gmail.com wrote:


But if I'll rework the lookup tables, I can rework this too. Would be
my pleasure, even, getting acquainted with Pixman style. :-)


I made some revisions to affine-bench.c (and a couple of tweaks to
lowlevel-blt-bench.c and pixman.c too) while responding to your comments
yesterday, but stopped short of posting it because I hoped someone might
express a preference about the addition of OS-specific code for reading
cache sizes etc. If you're planning on having a play, I'll report them
as they are.

Ben
___
Pixman mailing list
Pixman@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pixman


[Pixman] [PATCH] pixman.c: Coding style

2015-04-08 Thread Ben Avison
A few violations of coding style were identified in code copied from here
into affine-bench.
---
 pixman/pixman.c |   18 ++
 1 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/pixman/pixman.c b/pixman/pixman.c
index 9555cea..a07c577 100644
--- a/pixman/pixman.c
+++ b/pixman/pixman.c
@@ -325,18 +325,20 @@ _pixman_compute_composite_region32 (pixman_region32_t * 
region,
 return TRUE;
 }
 
-typedef struct
+typedef struct box_48_16 box_48_16_t;
+
+struct box_48_16
 {
-pixman_fixed_48_16_t   x1;
-pixman_fixed_48_16_t   y1;
-pixman_fixed_48_16_t   x2;
-pixman_fixed_48_16_t   y2;
-} box_48_16_t;
+pixman_fixed_48_16_tx1;
+pixman_fixed_48_16_ty1;
+pixman_fixed_48_16_tx2;
+pixman_fixed_48_16_ty2;
+};
 
 static pixman_bool_t
-compute_transformed_extents (pixman_transform_t *transform,
+compute_transformed_extents (pixman_transform_t   *transform,
 const pixman_box32_t *extents,
-box_48_16_t *transformed)
+box_48_16_t  *transformed)
 {
 pixman_fixed_48_16_t tx1, ty1, tx2, ty2;
 pixman_fixed_t x1, y1, x2, y2;
-- 
1.7.5.4

___
Pixman mailing list
Pixman@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pixman


Re: [Pixman] Is Pixman being maintained at all?

2015-04-08 Thread Bill Spitzak

On 04/07/2015 12:19 PM, Matt Turner wrote:


I don't know how Cairo does review, but I think it would be really
nice if a Cairo developer reviewed Bill's patches (I think they were
adding a new API to pixman?) if not for all the little technical
details but that the API makes sense for its uses in Cairo.


My patches are to move the current cairo FILTER_GOOD/BEST behavior into 
pixman. Pixman can do this better and faster, and it means that the X11 
Cairo backend does not have to do an image fallback for transforms.


The main difference between this patch and the Cairo code is that Søren 
wanted to preserve his current api for generating filters, which 
requires selection of two filters which are then integrated (one of them 
scaled by the width). I am not in full agreement with this as all other 
systems I have ever seen treat the smaller filter as impulse, and except 
for box+box (which produces a trapezoid and most software produces that 
directly when box is requested), I have to use impulse for one of the 
filters always.


In any case most of the series is to fix bugs and inefficiencies in the 
filter generation.


There is then a patch to enable use of the filtering for GOOD/BEST 
settings, matching Cairo (with a few minor improvements).


There is also patches to fix the demo programs so the GOOD/BEST filter 
can be tested and to fix the filter size for rotated images.


In addition if this is pushed we need a test in Cairo to detect if 
pixman is new enough and then remove Cairo's local emulation. There has 
to be a test for the linked Pixman and perhaps a different one for the X 
server.

___
Pixman mailing list
Pixman@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pixman