summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard@openedhand.com>2006-11-21 12:31:15 +0000
committerRichard Purdie <richard@openedhand.com>2006-11-21 12:31:15 +0000
commita936cf24a60ac3529e7506855e8edd71f5d56493 (patch)
tree6699d7d13ffab3cc26ae2979b062387fd2c153d9
parent30785a5b5e056dd8511d0add3995057d6efef3e1 (diff)
downloadpoky-a936cf24a60ac3529e7506855e8edd71f5d56493.tar.gz
cairo: Fix libx11 reference, add some patches from OE.dev (commented out for now)
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@926 311d38ba-8fff-0310-9ca6-ca027cbcb966
-rw-r--r--meta/packages/cairo/cairo-1.2.4/0001-Add-autoconf-macro-AX_C_FLOAT_WORDS_BIGENDIAN.diff103
-rw-r--r--meta/packages/cairo/cairo-1.2.4/0002-Change-_cairo_fixed_from_double-to-use-the-magic-number-technique.diff79
-rw-r--r--meta/packages/cairo/cairo-1.2.4/0003-Add-new-perf-test-pattern_create_radial.diff164
-rw-r--r--meta/packages/cairo/cairo_1.2.4.bb4
4 files changed, 349 insertions, 1 deletions
diff --git a/meta/packages/cairo/cairo-1.2.4/0001-Add-autoconf-macro-AX_C_FLOAT_WORDS_BIGENDIAN.diff b/meta/packages/cairo/cairo-1.2.4/0001-Add-autoconf-macro-AX_C_FLOAT_WORDS_BIGENDIAN.diff
new file mode 100644
index 0000000000..90718d4976
--- /dev/null
+++ b/meta/packages/cairo/cairo-1.2.4/0001-Add-autoconf-macro-AX_C_FLOAT_WORDS_BIGENDIAN.diff
@@ -0,0 +1,103 @@
1From nobody Mon Sep 17 00:00:00 2001
2From: Dan Amelang <dan@amelang.net>
3Date: Sun Oct 29 21:30:08 2006 -0800
4Subject: [PATCH] Add autoconf macro AX_C_FLOAT_WORDS_BIGENDIAN
5
6The symbol that this macro defines (FLOAT_WORDS_BIGENDIAN) can be used
7to make double arithmetic tricks portable.
8
9---
10
11 acinclude.m4 | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
12 configure.in | 1 +
13 2 files changed, 66 insertions(+), 0 deletions(-)
14
153231d91b59a6c2e1c40bbaa8b143694b6c693662
16diff --git a/acinclude.m4 b/acinclude.m4
17index af73800..a0eb13a 100644
18--- a/acinclude.m4
19+++ b/acinclude.m4
20@@ -51,3 +51,68 @@ ifelse([$1],[],,
21 AM_CONDITIONAL(ENABLE_GTK_DOC, test x$enable_gtk_doc = xyes)
22 AM_CONDITIONAL(GTK_DOC_USE_LIBTOOL, test -n "$LIBTOOL")
23 ])
24+
25+# AX_C_FLOAT_WORDS_BIGENDIAN ([ACTION-IF-TRUE], [ACTION-IF-FALSE],
26+# [ACTION-IF-UNKNOWN])
27+#
28+# Checks the ordering of words within a multi-word float. This check
29+# is necessary because on some systems (e.g. certain ARM systems), the
30+# float word ordering can be different from the byte ordering. In a
31+# multi-word float context, "big-endian" implies that the word containing
32+# the sign bit is found in the memory location with the lowest address.
33+# This implemenation was inspired by the AC_C_BIGENDIAN macro in autoconf.
34+# -------------------------------------------------------------------------
35+AC_DEFUN([AX_C_FLOAT_WORDS_BIGENDIAN],
36+ [AC_CACHE_CHECK(whether float word ordering is bigendian,
37+ ax_cv_c_float_words_bigendian, [
38+
39+# The endianess is detected by first compiling C code that contains a special
40+# double float value, then grepping the resulting object file for certain
41+# strings of ascii values. The double is specially crafted to have a
42+# binary representation that corresponds with a simple string. In this
43+# implementation, the string "noonsees" was selected because the individual
44+# word values ("noon" and "sees") are palindromes, thus making this test
45+# byte-order agnostic. If grep finds the string "noonsees" in the object
46+# file, the target platform stores float words in big-endian order. If grep
47+# finds "seesnoon", float words are in little-endian order. If neither value
48+# is found, the user is instructed to specify the ordering.
49+
50+ax_cv_c_float_words_bigendian=unknown
51+AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
52+
53+double d = 90904234967036810337470478905505011476211692735615632014797120844053488865816695273723469097858056257517020191247487429516932130503560650002327564517570778480236724525140520121371739201496540132640109977779420565776568942592.0;
54+
55+]])], [
56+
57+if grep noonsees conftest.$ac_objext >/dev/null ; then
58+ ax_cv_c_float_words_bigendian=yes
59+fi
60+if grep seesnoon conftest.$ac_objext >/dev/null ; then
61+ if test "$ax_cv_c_float_words_bigendian" = unknown; then
62+ ax_cv_c_float_words_bigendian=no
63+ else
64+ ax_cv_c_float_words_bigendian=unknown
65+ fi
66+fi
67+
68+])])
69+
70+case $ax_cv_c_float_words_bigendian in
71+ yes)
72+ m4_default([$1],
73+ [AC_DEFINE([FLOAT_WORDS_BIGENDIAN], 1,
74+ [Define to 1 if your system stores words within floats
75+ with the most significant word first])]) ;;
76+ no)
77+ $2 ;;
78+ *)
79+ m4_default([$3],
80+ [AC_MSG_ERROR([
81+
82+Unknown float word ordering. You need to manually preset
83+ax_cv_c_float_words_bigendian=no (or yes) according to your system.
84+
85+ ])]) ;;
86+esac
87+
88+])# AX_C_FLOAT_WORDS_BIGENDIAN
89diff --git a/configure.in b/configure.in
90index 2d2bf9f..797c7ce 100644
91--- a/configure.in
92+++ b/configure.in
93@@ -55,6 +55,7 @@ AC_PROG_CPP
94 AC_PROG_LIBTOOL dnl required version (1.4) DON'T REMOVE!
95 AC_STDC_HEADERS
96 AC_C_BIGENDIAN
97+AX_C_FLOAT_WORDS_BIGENDIAN
98
99 dnl ===========================================================================
100 dnl === Local macros
101--
1021.2.6
103
diff --git a/meta/packages/cairo/cairo-1.2.4/0002-Change-_cairo_fixed_from_double-to-use-the-magic-number-technique.diff b/meta/packages/cairo/cairo-1.2.4/0002-Change-_cairo_fixed_from_double-to-use-the-magic-number-technique.diff
new file mode 100644
index 0000000000..56d8b7e99a
--- /dev/null
+++ b/meta/packages/cairo/cairo-1.2.4/0002-Change-_cairo_fixed_from_double-to-use-the-magic-number-technique.diff
@@ -0,0 +1,79 @@
1From nobody Mon Sep 17 00:00:00 2001
2From: Dan Amelang <dan@amelang.net>
3Date: Sun Oct 29 21:31:23 2006 -0800
4Subject: [PATCH] Change _cairo_fixed_from_double to use the "magic number" technique
5
6See long thread here:
7http://lists.freedesktop.org/archives/cairo/2006-October/008285.html
8
9---
10
11 src/cairo-fixed.c | 48 +++++++++++++++++++++++++++++++++++++++++++++++-
12 1 files changed, 47 insertions(+), 1 deletions(-)
13
14d88acddcabe770e17664b34a2d5f74d3926e1642
15diff --git a/src/cairo-fixed.c b/src/cairo-fixed.c
16index 604c9e7..fe6c2dc 100644
17--- a/src/cairo-fixed.c
18+++ b/src/cairo-fixed.c
19@@ -42,10 +42,56 @@ _cairo_fixed_from_int (int i)
20 return i << 16;
21 }
22
23+/* This is the "magic number" approach to converting a double into fixed
24+ * point as described here:
25+ *
26+ * http://www.stereopsis.com/sree/fpu2006.html (an overview)
27+ * http://www.d6.com/users/checker/pdfs/gdmfp.pdf (in detail)
28+ *
29+ * The basic idea is to add a large enough number to the double that the
30+ * literal floating point is moved up to the extent that it forces the
31+ * double's value to be shifted down to the bottom of the mantissa (to make
32+ * room for the large number being added in). Since the mantissa is, at a
33+ * given moment in time, a fixed point integer itself, one can convert a
34+ * float to various fixed point representations by moving around the point
35+ * of a floating point number through arithmetic operations. This behavior
36+ * is reliable on most modern platforms as it is mandated by the IEEE-754
37+ * standard for floating point arithmetic.
38+ *
39+ * For our purposes, a "magic number" must be carefully selected that is
40+ * both large enough to produce the desired point-shifting effect, and also
41+ * has no lower bits in its representation that would interfere with our
42+ * value at the bottom of the mantissa. The magic number is calculated as
43+ * follows:
44+ *
45+ * (2 ^ (MANTISSA_SIZE - FRACTIONAL_SIZE)) * 1.5
46+ *
47+ * where in our case:
48+ * - MANTISSA_SIZE for 64-bit doubles is 52
49+ * - FRACTIONAL_SIZE for 16.16 fixed point is 16
50+ *
51+ * Although this approach provides a very large speedup of this function
52+ * on a wide-array of systems, it does come with two caveats:
53+ *
54+ * 1) It uses banker's rounding as opposed to arithmetic rounding.
55+ * 2) It doesn't function properly if the FPU is in single-precision
56+ * mode.
57+ */
58+#define CAIRO_MAGIC_NUMBER_FIXED_16_16 (103079215104.0)
59 cairo_fixed_t
60 _cairo_fixed_from_double (double d)
61 {
62- return (cairo_fixed_t) floor (d * 65536 + 0.5);
63+ union {
64+ double d;
65+ int32_t i[2];
66+ } u;
67+
68+ u.d = d + CAIRO_MAGIC_NUMBER_FIXED_16_16;
69+#ifdef FLOAT_WORDS_BIGENDIAN
70+ return u.i[1];
71+#else
72+ return u.i[0];
73+#endif
74 }
75
76 cairo_fixed_t
77--
781.2.6
79
diff --git a/meta/packages/cairo/cairo-1.2.4/0003-Add-new-perf-test-pattern_create_radial.diff b/meta/packages/cairo/cairo-1.2.4/0003-Add-new-perf-test-pattern_create_radial.diff
new file mode 100644
index 0000000000..c2b47deb7f
--- /dev/null
+++ b/meta/packages/cairo/cairo-1.2.4/0003-Add-new-perf-test-pattern_create_radial.diff
@@ -0,0 +1,164 @@
1From nobody Mon Sep 17 00:00:00 2001
2From: Dan Amelang <dan@amelang.net>
3Date: Tue Oct 31 23:47:35 2006 -0800
4Subject: [PATCH] Add new perf test "pattern_create_radial"
5
6This test is really just for hammering the double to fixed-point conversion
7(in _cairo_fixed_from_double) that happens as doubles from API calls gets
8translated into internal cairo fixed-point numbers.
9
10Because it's not generally useful, I don't recommend that it become part of
11the main cairo performance test. But hey, it might come in handy for someone
12else.
13
14---
15
16 perf/Makefile.am | 1
17 perf/cairo-perf.c | 1
18 perf/cairo-perf.h | 1
19 perf/pattern_create_radial.c | 98 ++++++++++++++++++++++++++++++++++++++++++
20 4 files changed, 101 insertions(+), 0 deletions(-)
21 create mode 100644 perf/pattern_create_radial.c
22
23977383b86c68d0523c899efcba3cf8d36e94d2a7
24diff --git a/perf/Makefile.am b/perf/Makefile.am
25index 419a998..e1cfdc7 100644
26--- a/perf/Makefile.am
27+++ b/perf/Makefile.am
28@@ -21,6 +21,7 @@ cairo_perf_SOURCES = \
29 stroke.c \
30 subimage_copy.c \
31 tessellate.c \
32+ pattern_create_radial.c \
33 text.c
34
35 if CAIRO_HAS_WIN32_SURFACE
36diff --git a/perf/cairo-perf.c b/perf/cairo-perf.c
37index d9734c4..0707433 100644
38--- a/perf/cairo-perf.c
39+++ b/perf/cairo-perf.c
40@@ -256,5 +256,6 @@ cairo_perf_case_t perf_cases[] = {
41 { text, 64, 256},
42 { tessellate, 100, 100},
43 { subimage_copy, 16, 512},
44+ { pattern_create_radial, 16, 16},
45 { NULL }
46 };
47diff --git a/perf/cairo-perf.h b/perf/cairo-perf.h
48index 560ba64..faacff9 100644
49--- a/perf/cairo-perf.h
50+++ b/perf/cairo-perf.h
51@@ -88,5 +88,6 @@ CAIRO_PERF_DECL (stroke);
52 CAIRO_PERF_DECL (subimage_copy);
53 CAIRO_PERF_DECL (tessellate);
54 CAIRO_PERF_DECL (text);
55+CAIRO_PERF_DECL (pattern_create_radial);
56
57 #endif
58diff --git a/perf/pattern_create_radial.c b/perf/pattern_create_radial.c
59new file mode 100644
60index 0000000..d793b7d
61--- /dev/null
62+++ b/perf/pattern_create_radial.c
63@@ -0,0 +1,98 @@
64+/*
65+ * Copyright © 2006 Dan Amelang
66+ *
67+ * Permission to use, copy, modify, distribute, and sell this software
68+ * and its documentation for any purpose is hereby granted without
69+ * fee, provided that the above copyright notice appear in all copies
70+ * and that both that copyright notice and this permission notice
71+ * appear in supporting documentation, and that the name of
72+ * the authors not be used in advertising or publicity pertaining to
73+ * distribution of the software without specific, written prior
74+ * permission. The authors make no representations about the
75+ * suitability of this software for any purpose. It is provided "as
76+ * is" without express or implied warranty.
77+ *
78+ * THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
79+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
80+ * FITNESS, IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL,
81+ * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
82+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
83+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
84+ * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
85+ *
86+ * Authors: Dan Amelang <dan@amelang.net>
87+ *
88+ * This test was originally created to test _cairo_fixed_from_double.
89+ * cairo_pattern_create_radial was selected as the entry point into
90+ * cairo as it makes several calls to _cairo_fixed_from_double and
91+ * presents a somewhat realistic use-case (although the RADIALS_COUNT
92+ * isn't very realistic).
93+ */
94+#include <time.h>
95+#include "cairo-perf.h"
96+
97+#define RADIALS_COUNT (100000)
98+
99+static struct
100+{
101+ double cx0;
102+ double cy0;
103+ double radius0;
104+ double cx1;
105+ double cy1;
106+ double radius1;
107+} radials[RADIALS_COUNT];
108+
109+static double
110+generate_double_in_range (double min, double max)
111+{
112+ double d;
113+
114+ d = rand () / (double) RAND_MAX;
115+ d *= max - min;
116+ d += min;
117+
118+ return d;
119+}
120+
121+static cairo_perf_ticks_t
122+do_pattern_create_radial (cairo_t *cr, int width, int height)
123+{
124+ int i;
125+ cairo_pattern_t *pattern;
126+
127+ cairo_perf_timer_start ();
128+
129+ for (i = 0; i < RADIALS_COUNT; i++)
130+ {
131+ pattern = cairo_pattern_create_radial (radials[i].cx0, radials[i].cy0,
132+ radials[i].radius0,
133+ radials[i].cx1, radials[i].cy1,
134+ radials[i].radius1);
135+ cairo_pattern_destroy (pattern);
136+ }
137+
138+ cairo_perf_timer_stop ();
139+
140+ return cairo_perf_timer_elapsed ();
141+}
142+
143+void
144+pattern_create_radial (cairo_perf_t *perf, cairo_t *cr, int width, int height)
145+{
146+ int i;
147+
148+ srand (time (0));
149+ for (i = 0; i < RADIALS_COUNT; i++)
150+ {
151+ radials[i].cx0 = generate_double_in_range (-50000.0, 50000.0);
152+ radials[i].cy0 = generate_double_in_range (-50000.0, 50000.0);
153+ radials[i].radius0 = generate_double_in_range (0.0, 1000.0);
154+ radials[i].cx1 = generate_double_in_range (-50000.0, 50000.0);
155+ radials[i].cy1 = generate_double_in_range (-50000.0, 50000.0);
156+ radials[i].radius1 = generate_double_in_range (0.0, 1000.0);
157+ }
158+
159+ cairo_perf_run (perf, "pattern_create_radial",
160+ do_pattern_create_radial);
161+}
162--
1631.2.6
164
diff --git a/meta/packages/cairo/cairo_1.2.4.bb b/meta/packages/cairo/cairo_1.2.4.bb
index 91528f6da0..61e3622954 100644
--- a/meta/packages/cairo/cairo_1.2.4.bb
+++ b/meta/packages/cairo/cairo_1.2.4.bb
@@ -1,12 +1,14 @@
1SECTION = "libs" 1SECTION = "libs"
2PRIORITY = "optional" 2PRIORITY = "optional"
3DEPENDS = "libx11 libpng fontconfig libxrender" 3DEPENDS = "virtual/libx11 libpng fontconfig libxrender"
4DESCRIPTION = "Cairo graphics library" 4DESCRIPTION = "Cairo graphics library"
5LICENSE = "MPL LGPL" 5LICENSE = "MPL LGPL"
6PR = "r1" 6PR = "r1"
7 7
8SRC_URI = "http://cairographics.org/releases/cairo-${PV}.tar.gz \ 8SRC_URI = "http://cairographics.org/releases/cairo-${PV}.tar.gz \
9 file://cairo-fixed.patch;patch=1" 9 file://cairo-fixed.patch;patch=1"
10# file://0001-Add-autoconf-macro-AX_C_FLOAT_WORDS_BIGENDIAN.diff;patch=1
11# file://0002-Change-_cairo_fixed_from_double-to-use-the-magic-number-technique.diff;patch=1
10 12
11inherit autotools pkgconfig 13inherit autotools pkgconfig
12 14