summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/recipes-graphics/xorg-lib/pixman/0001-ARM-qemu-related-workarounds-in-cpu-features-detecti.patch144
-rw-r--r--meta/recipes-graphics/xorg-lib/pixman/0002-Generic-C-implementation-of-pixman_blt-with-overlapp.patch127
-rw-r--r--meta/recipes-graphics/xorg-lib/pixman_0.27.2.bb11
3 files changed, 280 insertions, 2 deletions
diff --git a/meta/recipes-graphics/xorg-lib/pixman/0001-ARM-qemu-related-workarounds-in-cpu-features-detecti.patch b/meta/recipes-graphics/xorg-lib/pixman/0001-ARM-qemu-related-workarounds-in-cpu-features-detecti.patch
new file mode 100644
index 0000000000..4569dca01e
--- /dev/null
+++ b/meta/recipes-graphics/xorg-lib/pixman/0001-ARM-qemu-related-workarounds-in-cpu-features-detecti.patch
@@ -0,0 +1,144 @@
1From a0f53e1dbb3851bb0f0efcfdbd565b05e4be9cac Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Andreas=20M=C3=BCller?= <schnitzeltony@googlemail.com>
3Date: Thu, 23 Aug 2012 18:10:57 +0200
4Subject: [PATCH 1/2] ARM: qemu related workarounds in cpu features detection
5 code
6MIME-Version: 1.0
7Content-Type: text/plain; charset=UTF-8
8Content-Transfer-Encoding: 8bit
9
10This was ported from meta-oe's patch [1]. The original pixman patch is found
11at [2].
12
13[1] http://cgit.openembedded.org/meta-openembedded/tree/meta-oe/recipes-graphics/xorg-lib/pixman-0.26.2/0001-ARM-qemu-related-workarounds-in-cpu-features-detecti.patch
14[2] http://lists.freedesktop.org/archives/pixman/2011-January/000906.html
15
16Upstream-Status: Inappropriate [other] qemu fix
17
18Signed-off-by: Andreas Müller <schnitzeltony@googlemail.com>
19---
20 pixman/pixman-arm.c | 82 ++++++++++++++++++++++++++++++++++++++++----------
21 1 files changed, 65 insertions(+), 17 deletions(-)
22
23diff --git a/pixman/pixman-arm.c b/pixman/pixman-arm.c
24index 23374e4..d98bda6 100644
25--- a/pixman/pixman-arm.c
26+++ b/pixman/pixman-arm.c
27@@ -129,16 +129,35 @@ detect_cpu_features (void)
28 #include <sys/types.h>
29 #include <sys/stat.h>
30 #include <sys/mman.h>
31+#include <sys/utsname.h>
32 #include <fcntl.h>
33 #include <string.h>
34 #include <elf.h>
35
36+/*
37+ * The whole CPU capabilities detection is a bit ugly: when running in
38+ * userspace qemu, we see /proc/self/auxv from the host system. To make
39+ * everything even worse, the size of each value is 64-bit when running
40+ * on a 64-bit host system. So the data is totally bogus because we expect
41+ * 32-bit values. As AT_PLATFORM value is used as a pointer, it may cause
42+ * segfault (null pointer dereference on x86-64 host). So in order to be
43+ * on a safe side, we require that AT_PLATFORM value is found only once,
44+ * and it has non-zero value (this is still not totally reliable for a big
45+ * endian 64-bit host system running qemu and may theoretically fail).
46+ */
47+#define ARM_HWCAP_VFP 64
48+#define ARM_HWCAP_IWMMXT 512
49+#define ARM_HWCAP_NEON 4096
50+
51 static arm_cpu_features_t
52 detect_cpu_features (void)
53 {
54 arm_cpu_features_t features = 0;
55 Elf32_auxv_t aux;
56 int fd;
57+ uint32_t hwcap = 0;
58+ const char *plat = NULL;
59+ int plat_cnt = 0;
60
61 fd = open ("/proc/self/auxv", O_RDONLY);
62 if (fd >= 0)
63@@ -147,32 +166,61 @@ detect_cpu_features (void)
64 {
65 if (aux.a_type == AT_HWCAP)
66 {
67- uint32_t hwcap = aux.a_un.a_val;
68-
69- /* hardcode these values to avoid depending on specific
70- * versions of the hwcap header, e.g. HWCAP_NEON
71- */
72- if ((hwcap & 64) != 0)
73- features |= ARM_VFP;
74- if ((hwcap & 512) != 0)
75- features |= ARM_IWMMXT;
76- /* this flag is only present on kernel 2.6.29 */
77- if ((hwcap & 4096) != 0)
78- features |= ARM_NEON;
79+ hwcap = aux.a_un.a_val;
80 }
81 else if (aux.a_type == AT_PLATFORM)
82 {
83- const char *plat = (const char*) aux.a_un.a_val;
84-
85- if (strncmp (plat, "v7l", 3) == 0)
86+ plat = (const char*) aux.a_un.a_val;
87+ plat_cnt++;
88+ }
89+ }
90+ close (fd);
91+ if (plat == NULL || plat_cnt != 1 || *plat != 'v')
92+ {
93+ /*
94+ * Something seems to be really wrong, most likely we are
95+ * running under qemu. Let's use machine type from "uname" for
96+ * CPU capabilities detection:
97+ * http://www.mail-archive.com/qemu-devel at nongnu.org/msg22212.html
98+ */
99+ struct utsname u;
100+ hwcap = 0; /* clear hwcap, because it is bogus */
101+ if (uname (&u) == 0)
102+ {
103+ if (strcmp (u.machine, "armv7l") == 0)
104+ {
105 features |= (ARM_V7 | ARM_V6);
106- else if (strncmp (plat, "v6l", 3) == 0)
107+ hwcap |= ARM_HWCAP_VFP; /* qemu is supposed to emulate vfp */
108+ hwcap |= ARM_HWCAP_NEON; /* qemu is supposed to emulate neon */
109+ }
110+ else if (strcmp (u.machine, "armv6l") == 0)
111+ {
112 features |= ARM_V6;
113+ hwcap |= ARM_HWCAP_VFP; /* qemu is supposed to emulate vfp */
114+ }
115 }
116 }
117- close (fd);
118+ else if (strncmp (plat, "v7l", 3) == 0)
119+ {
120+ features |= (ARM_V7 | ARM_V6);
121+ }
122+ else if (strncmp (plat, "v6l", 3) == 0)
123+ {
124+ features |= ARM_V6;
125+ }
126 }
127
128+ /* hardcode these values to avoid depending on specific
129+ * versions of the hwcap header, e.g. HWCAP_NEON
130+ */
131+ if ((hwcap & ARM_HWCAP_VFP) != 0)
132+ features |= ARM_VFP;
133+ if ((hwcap & ARM_HWCAP_IWMMXT) != 0)
134+ features |= ARM_IWMMXT;
135+ /* this flag is only present on kernel 2.6.29 */
136+ if ((hwcap & ARM_HWCAP_NEON) != 0)
137+ features |= ARM_NEON;
138+
139 return features;
140 }
141
142--
1431.7.6.5
144
diff --git a/meta/recipes-graphics/xorg-lib/pixman/0002-Generic-C-implementation-of-pixman_blt-with-overlapp.patch b/meta/recipes-graphics/xorg-lib/pixman/0002-Generic-C-implementation-of-pixman_blt-with-overlapp.patch
new file mode 100644
index 0000000000..abd501a106
--- /dev/null
+++ b/meta/recipes-graphics/xorg-lib/pixman/0002-Generic-C-implementation-of-pixman_blt-with-overlapp.patch
@@ -0,0 +1,127 @@
1From 211b2bcdb19f86f3868a18520df7dcb4fd122f05 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Andreas=20M=C3=BCller?= <schnitzeltony@googlemail.com>
3Date: Sun, 19 Aug 2012 14:48:00 +0200
4Subject: [PATCH 2/2] Generic C implementation of pixman_blt with overlapping
5 support
6MIME-Version: 1.0
7Content-Type: text/plain; charset=UTF-8
8Content-Transfer-Encoding: 8bit
9
10This was ported from meta-oe's patch [1]:
11Uses memcpy/memmove functions to copy pixels, can handle the
12case when both source and destination areas are in the same
13image (this is useful for scrolling).
14
15It is assumed that copying direction is only important when
16using the same image for both source and destination (and
17src_stride == dst_stride). Copying direction is undefined
18for the images with different source and destination stride
19which happen to be in the overlapped areas (but this is an
20unrealistic case anyway).
21
22[1] http://cgit.openembedded.org/meta-openembedded/tree/meta-oe/recipes-graphics/xorg-lib/pixman-0.26.2/0008-Generic-C-implementation-of-pixman_blt-with-overlapp.patch
23
24Upstream-Status: Unknown - this patch is in meta-oe for a while
25
26Signed-off-by: Andreas Müller <schnitzeltony@googlemail.com>
27---
28 pixman/pixman-general.c | 21 ++++++++++++++++++---
29 pixman/pixman-private.h | 43 +++++++++++++++++++++++++++++++++++++++++++
30 2 files changed, 61 insertions(+), 3 deletions(-)
31
32diff --git a/pixman/pixman-general.c b/pixman/pixman-general.c
33index d4b2daa..a86b206 100644
34--- a/pixman/pixman-general.c
35+++ b/pixman/pixman-general.c
36@@ -215,9 +215,24 @@ general_blt (pixman_implementation_t *imp,
37 int width,
38 int height)
39 {
40- /* We can't blit unless we have sse2 or mmx */
41-
42- return FALSE;
43+ uint8_t *dst_bytes = (uint8_t *)dst_bits;
44+ uint8_t *src_bytes = (uint8_t *)src_bits;
45+ int bpp;
46+
47+ if (src_bpp != dst_bpp || src_bpp & 7)
48+ return FALSE;
49+
50+ bpp = src_bpp >> 3;
51+ width *= bpp;
52+ src_stride *= 4;
53+ dst_stride *= 4;
54+ pixman_blt_helper (src_bytes + src_y * src_stride + src_x * bpp,
55+ dst_bytes + dest_y * dst_stride + dest_x * bpp,
56+ src_stride,
57+ dst_stride,
58+ width,
59+ height);
60+ return TRUE;
61 }
62
63 static pixman_bool_t
64diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
65index d5e6a72..c77d256 100644
66--- a/pixman/pixman-private.h
67+++ b/pixman/pixman-private.h
68@@ -24,6 +24,7 @@
69
70 #include "pixman.h"
71 #include <time.h>
72+#include <string.h>
73 #include <assert.h>
74 #include <stdio.h>
75 #include <string.h>
76@@ -1096,6 +1097,48 @@ void pixman_timer_register (pixman_timer_t *timer);
77 extern const uint8_t linear_to_srgb[4096];
78 extern const uint16_t srgb_to_linear[256];
79
80+/* a helper function, can blit 8-bit images with src/dst overlapping support */
81+static inline void
82+pixman_blt_helper (uint8_t *src_bytes,
83+ uint8_t *dst_bytes,
84+ int src_stride,
85+ int dst_stride,
86+ int width,
87+ int height)
88+{
89+ /*
90+ * The second part of this check is not strictly needed, but it prevents
91+ * unnecessary upside-down processing of areas which belong to different
92+ * images. Upside-down processing can be slower with fixed-distance-ahead
93+ * prefetch and perceived as having more tearing.
94+ */
95+ if (src_bytes < dst_bytes + width &&
96+ src_bytes + src_stride * height > dst_bytes)
97+ {
98+ src_bytes += src_stride * height - src_stride;
99+ dst_bytes += dst_stride * height - dst_stride;
100+ dst_stride = -dst_stride;
101+ src_stride = -src_stride;
102+ /* Horizontal scrolling to the left needs memmove */
103+ if (src_bytes + width > dst_bytes)
104+ {
105+ while (--height >= 0)
106+ {
107+ memmove (dst_bytes, src_bytes, width);
108+ dst_bytes += dst_stride;
109+ src_bytes += src_stride;
110+ }
111+ return;
112+ }
113+ }
114+ while (--height >= 0)
115+ {
116+ memcpy (dst_bytes, src_bytes, width);
117+ dst_bytes += dst_stride;
118+ src_bytes += src_stride;
119+ }
120+}
121+
122 #endif /* __ASSEMBLER__ */
123
124 #endif /* PIXMAN_PRIVATE_H */
125--
1261.7.4.4
127
diff --git a/meta/recipes-graphics/xorg-lib/pixman_0.27.2.bb b/meta/recipes-graphics/xorg-lib/pixman_0.27.2.bb
index e55276e47b..35a2defef6 100644
--- a/meta/recipes-graphics/xorg-lib/pixman_0.27.2.bb
+++ b/meta/recipes-graphics/xorg-lib/pixman_0.27.2.bb
@@ -15,14 +15,21 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=14096c769ae0cbb5fcb94ec468be11b3 \
15DEPENDS += "zlib libpng" 15DEPENDS += "zlib libpng"
16BBCLASSEXTEND = "native" 16BBCLASSEXTEND = "native"
17 17
18PR = "r0" 18PR = "r1"
19 19
20PE = "1" 20PE = "1"
21 21
22IWMMXT = "--disable-arm-iwmmxt" 22IWMMXT = "--disable-arm-iwmmxt"
23LOONGSON_MMI = "--disable-loongson-mmi" 23LOONGSON_MMI = "--disable-loongson-mmi"
24NEON = " --disable-arm-neon "
25NEON_armv7a = " "
26NEON_armv7a-vfp-neon = " "
24 27
25EXTRA_OECONF="--disable-gtk ${IWMMXT} ${LOONGSON_MMI}" 28EXTRA_OECONF="--disable-gtk ${IWMMXT} ${LOONGSON_MMI} ${NEON}"
26 29
30SRC_URI += "\
31 file://0001-ARM-qemu-related-workarounds-in-cpu-features-detecti.patch \
32 file://0002-Generic-C-implementation-of-pixman_blt-with-overlapp.patch \
33"
27SRC_URI[md5sum] = "dd67154b23d88e6a75ad3a83f3052198" 34SRC_URI[md5sum] = "dd67154b23d88e6a75ad3a83f3052198"
28SRC_URI[sha256sum] = "cae9dc13727a84f11beb150c88d3a06ba114f82c52d68073c663c027e099123b" 35SRC_URI[sha256sum] = "cae9dc13727a84f11beb150c88d3a06ba114f82c52d68073c663c027e099123b"