diff options
| -rw-r--r-- | meta/recipes-graphics/xorg-lib/pixman/0001-ARM-qemu-related-workarounds-in-cpu-features-detecti.patch | 135 | ||||
| -rw-r--r-- | meta/recipes-graphics/xorg-lib/pixman_0.44.2.bb | 4 |
2 files changed, 1 insertions, 138 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 deleted file mode 100644 index 35faafea5b..0000000000 --- a/meta/recipes-graphics/xorg-lib/pixman/0001-ARM-qemu-related-workarounds-in-cpu-features-detecti.patch +++ /dev/null | |||
| @@ -1,135 +0,0 @@ | |||
| 1 | From 0beed8c190b27a07e7f1145a46a7ca8a75864263 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: =?UTF-8?q?Andreas=20M=C3=BCller?= <schnitzeltony@googlemail.com> | ||
| 3 | Date: Thu, 23 Aug 2012 18:10:57 +0200 | ||
| 4 | Subject: [PATCH] ARM: qemu related workarounds in cpu features detection code | ||
| 5 | MIME-Version: 1.0 | ||
| 6 | Content-Type: text/plain; charset=UTF-8 | ||
| 7 | Content-Transfer-Encoding: 8bit | ||
| 8 | |||
| 9 | This was ported from meta-oe's patch [1]. The original pixman patch is found | ||
| 10 | at [2]. | ||
| 11 | |||
| 12 | [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 | ||
| 13 | [2] http://lists.freedesktop.org/archives/pixman/2011-January/000906.html | ||
| 14 | |||
| 15 | Upstream-Status: Inappropriate [other] qemu fix | ||
| 16 | |||
| 17 | Signed-off-by: Andreas Müller <schnitzeltony@googlemail.com> | ||
| 18 | --- | ||
| 19 | pixman/pixman-arm.c | 77 ++++++++++++++++++++++++++++++++++++--------- | ||
| 20 | 1 file changed, 62 insertions(+), 15 deletions(-) | ||
| 21 | |||
| 22 | diff --git a/pixman/pixman-arm.c b/pixman/pixman-arm.c | ||
| 23 | index d271e96..8f6e241 100644 | ||
| 24 | --- a/pixman/pixman-arm.c | ||
| 25 | +++ b/pixman/pixman-arm.c | ||
| 26 | @@ -128,16 +128,34 @@ detect_cpu_features (void) | ||
| 27 | #include <sys/types.h> | ||
| 28 | #include <sys/stat.h> | ||
| 29 | #include <sys/mman.h> | ||
| 30 | +#include <sys/utsname.h> | ||
| 31 | #include <fcntl.h> | ||
| 32 | #include <string.h> | ||
| 33 | #include <elf.h> | ||
| 34 | |||
| 35 | +/* | ||
| 36 | + * The whole CPU capabilities detection is a bit ugly: when running in | ||
| 37 | + * userspace qemu, we see /proc/self/auxv from the host system. To make | ||
| 38 | + * everything even worse, the size of each value is 64-bit when running | ||
| 39 | + * on a 64-bit host system. So the data is totally bogus because we expect | ||
| 40 | + * 32-bit values. As AT_PLATFORM value is used as a pointer, it may cause | ||
| 41 | + * segfault (null pointer dereference on x86-64 host). So in order to be | ||
| 42 | + * on a safe side, we require that AT_PLATFORM value is found only once, | ||
| 43 | + * and it has non-zero value (this is still not totally reliable for a big | ||
| 44 | + * endian 64-bit host system running qemu and may theoretically fail). | ||
| 45 | + */ | ||
| 46 | +#define ARM_HWCAP_VFP 64 | ||
| 47 | +#define ARM_HWCAP_NEON 4096 | ||
| 48 | + | ||
| 49 | static arm_cpu_features_t | ||
| 50 | detect_cpu_features (void) | ||
| 51 | { | ||
| 52 | arm_cpu_features_t features = 0; | ||
| 53 | Elf32_auxv_t aux; | ||
| 54 | int fd; | ||
| 55 | + uint32_t hwcap = 0; | ||
| 56 | + const char *plat = NULL; | ||
| 57 | + int plat_cnt = 0; | ||
| 58 | |||
| 59 | fd = open ("/proc/self/auxv", O_RDONLY); | ||
| 60 | if (fd >= 0) | ||
| 61 | @@ -146,30 +164,59 @@ detect_cpu_features (void) | ||
| 62 | { | ||
| 63 | if (aux.a_type == AT_HWCAP) | ||
| 64 | { | ||
| 65 | - uint32_t hwcap = aux.a_un.a_val; | ||
| 66 | - | ||
| 67 | - /* hardcode these values to avoid depending on specific | ||
| 68 | - * versions of the hwcap header, e.g. HWCAP_NEON | ||
| 69 | - */ | ||
| 70 | - if ((hwcap & 64) != 0) | ||
| 71 | - features |= ARM_VFP; | ||
| 72 | - /* this flag is only present on kernel 2.6.29 */ | ||
| 73 | - if ((hwcap & 4096) != 0) | ||
| 74 | - features |= ARM_NEON; | ||
| 75 | + hwcap = aux.a_un.a_val; | ||
| 76 | } | ||
| 77 | else if (aux.a_type == AT_PLATFORM) | ||
| 78 | { | ||
| 79 | - const char *plat = (const char*) aux.a_un.a_val; | ||
| 80 | - | ||
| 81 | - if (strncmp (plat, "v7l", 3) == 0) | ||
| 82 | + plat = (const char*) aux.a_un.a_val; | ||
| 83 | + plat_cnt++; | ||
| 84 | + } | ||
| 85 | + } | ||
| 86 | + close (fd); | ||
| 87 | + if (plat == NULL || plat_cnt != 1 || *plat != 'v') | ||
| 88 | + { | ||
| 89 | + /* | ||
| 90 | + * Something seems to be really wrong, most likely we are | ||
| 91 | + * running under qemu. Let's use machine type from "uname" for | ||
| 92 | + * CPU capabilities detection: | ||
| 93 | + * http://www.mail-archive.com/qemu-devel at nongnu.org/msg22212.html | ||
| 94 | + */ | ||
| 95 | + struct utsname u; | ||
| 96 | + hwcap = 0; /* clear hwcap, because it is bogus */ | ||
| 97 | + if (uname (&u) == 0) | ||
| 98 | + { | ||
| 99 | + if (strcmp (u.machine, "armv7l") == 0) | ||
| 100 | + { | ||
| 101 | features |= (ARM_V7 | ARM_V6); | ||
| 102 | - else if (strncmp (plat, "v6l", 3) == 0) | ||
| 103 | + hwcap |= ARM_HWCAP_VFP; /* qemu is supposed to emulate vfp */ | ||
| 104 | + hwcap |= ARM_HWCAP_NEON; /* qemu is supposed to emulate neon */ | ||
| 105 | + } | ||
| 106 | + else if (strcmp (u.machine, "armv6l") == 0) | ||
| 107 | + { | ||
| 108 | features |= ARM_V6; | ||
| 109 | + hwcap |= ARM_HWCAP_VFP; /* qemu is supposed to emulate vfp */ | ||
| 110 | + } | ||
| 111 | } | ||
| 112 | } | ||
| 113 | - close (fd); | ||
| 114 | + else if (strncmp (plat, "v7l", 3) == 0) | ||
| 115 | + { | ||
| 116 | + features |= (ARM_V7 | ARM_V6); | ||
| 117 | + } | ||
| 118 | + else if (strncmp (plat, "v6l", 3) == 0) | ||
| 119 | + { | ||
| 120 | + features |= ARM_V6; | ||
| 121 | + } | ||
| 122 | } | ||
| 123 | |||
| 124 | + /* hardcode these values to avoid depending on specific | ||
| 125 | + * versions of the hwcap header, e.g. HWCAP_NEON | ||
| 126 | + */ | ||
| 127 | + if ((hwcap & ARM_HWCAP_VFP) != 0) | ||
| 128 | + features |= ARM_VFP; | ||
| 129 | + /* this flag is only present on kernel 2.6.29 */ | ||
| 130 | + if ((hwcap & ARM_HWCAP_NEON) != 0) | ||
| 131 | + features |= ARM_NEON; | ||
| 132 | + | ||
| 133 | return features; | ||
| 134 | } | ||
| 135 | |||
diff --git a/meta/recipes-graphics/xorg-lib/pixman_0.44.2.bb b/meta/recipes-graphics/xorg-lib/pixman_0.44.2.bb index 9e2a102a9b..2e5bb172f5 100644 --- a/meta/recipes-graphics/xorg-lib/pixman_0.44.2.bb +++ b/meta/recipes-graphics/xorg-lib/pixman_0.44.2.bb | |||
| @@ -7,9 +7,7 @@ HOMEPAGE = "http://www.pixman.org" | |||
| 7 | SECTION = "x11/libs" | 7 | SECTION = "x11/libs" |
| 8 | DEPENDS = "zlib" | 8 | DEPENDS = "zlib" |
| 9 | 9 | ||
| 10 | SRC_URI = "https://www.cairographics.org/releases/${BP}.tar.gz \ | 10 | SRC_URI = "https://www.cairographics.org/releases/${BP}.tar.gz" |
| 11 | file://0001-ARM-qemu-related-workarounds-in-cpu-features-detecti.patch \ | ||
| 12 | " | ||
| 13 | SRC_URI[sha256sum] = "6349061ce1a338ab6952b92194d1b0377472244208d47ff25bef86fc71973466" | 11 | SRC_URI[sha256sum] = "6349061ce1a338ab6952b92194d1b0377472244208d47ff25bef86fc71973466" |
| 14 | 12 | ||
| 15 | # see http://cairographics.org/releases/ - only even minor versions are stable | 13 | # see http://cairographics.org/releases/ - only even minor versions are stable |
