Bug 901208 - Fix Skia for ARM v4t. r=derf, a=bajaj
authorMike Hommey <mh+mozilla@glandium.org>
Tue, 20 Aug 2013 09:14:01 +0900
changeset 153868 f4ed497d794bf8e0daf7ea7024ad06511f455bed
parent 153867 3667169831cb73527a3372dac7ad405a91d15880
child 153869 7be7bbac0064fe4dea3f0a607b320bd51971460f
push id2859
push userakeybl@mozilla.com
push dateMon, 16 Sep 2013 19:14:59 +0000
treeherdermozilla-beta@87d3c51cd2bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersderf, bajaj
bugs901208
milestone25.0a2
Bug 901208 - Fix Skia for ARM v4t. r=derf, a=bajaj
gfx/skia/patches/0026-Bug-901208-Fix-ARM-v4t.patch
gfx/skia/src/opts/SkBlitRow_opts_arm.cpp
new file mode 100644
--- /dev/null
+++ b/gfx/skia/patches/0026-Bug-901208-Fix-ARM-v4t.patch
@@ -0,0 +1,83 @@
+diff --git a/gfx/skia/src/opts/SkBlitRow_opts_arm.cpp b/gfx/skia/src/opts/SkBlitRow_opts_arm.cpp
+--- a/gfx/skia/src/opts/SkBlitRow_opts_arm.cpp
++++ b/gfx/skia/src/opts/SkBlitRow_opts_arm.cpp
+@@ -26,66 +26,78 @@ static void S32A_D565_Opaque(uint16_t* S
+     asm volatile (
+                   "1:                                   \n\t"
+                   "ldr     r3, [%[src]], #4             \n\t"
+                   "cmp     r3, #0xff000000              \n\t"
+                   "blo     2f                           \n\t"
+                   "and     r4, r3, #0x0000f8            \n\t"
+                   "and     r5, r3, #0x00fc00            \n\t"
+                   "and     r6, r3, #0xf80000            \n\t"
++#ifdef SK_ARM_HAS_EDSP
+                   "pld     [r1, #32]                    \n\t"
++#endif
+                   "lsl     r3, r4, #8                   \n\t"
+                   "orr     r3, r3, r5, lsr #5           \n\t"
+                   "orr     r3, r3, r6, lsr #19          \n\t"
+                   "subs    %[count], %[count], #1       \n\t"
+                   "strh    r3, [%[dst]], #2             \n\t"
+                   "bne     1b                           \n\t"
+                   "b       4f                           \n\t"
+                   "2:                                   \n\t"
+                   "lsrs    r7, r3, #24                  \n\t"
+                   "beq     3f                           \n\t"
+                   "ldrh    r4, [%[dst]]                 \n\t"
+                   "rsb     r7, r7, #255                 \n\t"
+                   "and     r6, r4, #0x001f              \n\t"
+-#if SK_ARM_ARCH == 6
++#if SK_ARM_ARCH <= 6
+                   "lsl     r5, r4, #21                  \n\t"
+                   "lsr     r5, r5, #26                  \n\t"
+ #else
+                   "ubfx    r5, r4, #5, #6               \n\t"
+ #endif
++#ifdef SK_ARM_HAS_EDSP
+                   "pld     [r0, #16]                    \n\t"
++#endif
+                   "lsr     r4, r4, #11                  \n\t"
+ #ifdef SK_ARM_HAS_EDSP
+                   "smulbb  r6, r6, r7                   \n\t"
+                   "smulbb  r5, r5, r7                   \n\t"
+                   "smulbb  r4, r4, r7                   \n\t"
+ #else
+                   "mul     r6, r6, r7                   \n\t"
+                   "mul     r5, r5, r7                   \n\t"
+                   "mul     r4, r4, r7                   \n\t"
+ #endif
++#if SK_ARM_ARCH >= 6
+                   "uxtb    r7, r3, ROR #16              \n\t"
+                   "uxtb    ip, r3, ROR #8               \n\t"
++#else
++                  "mov     ip, #0xff                    \n\t"
++                  "and     r7, ip, r3, ROR #16          \n\t"
++                  "and     ip, ip, r3, ROR #8           \n\t"
++#endif
+                   "and     r3, r3, #0xff                \n\t"
+                   "add     r6, r6, #16                  \n\t"
+                   "add     r5, r5, #32                  \n\t"
+                   "add     r4, r4, #16                  \n\t"
+                   "add     r6, r6, r6, lsr #5           \n\t"
+                   "add     r5, r5, r5, lsr #6           \n\t"
+                   "add     r4, r4, r4, lsr #5           \n\t"
+                   "add     r6, r7, r6, lsr #5           \n\t"
+                   "add     r5, ip, r5, lsr #6           \n\t"
+                   "add     r4, r3, r4, lsr #5           \n\t"
+                   "lsr     r6, r6, #3                   \n\t"
+                   "and     r5, r5, #0xfc                \n\t"
+                   "and     r4, r4, #0xf8                \n\t"
+                   "orr     r6, r6, r5, lsl #3           \n\t"
+                   "orr     r4, r6, r4, lsl #8           \n\t"
+                   "strh    r4, [%[dst]], #2             \n\t"
++#ifdef SK_ARM_HAS_EDSP
+                   "pld     [r1, #32]                    \n\t"
++#endif
+                   "subs    %[count], %[count], #1       \n\t"
+                   "bne     1b                           \n\t"
+                   "b       4f                           \n\t"
+                   "3:                                   \n\t"
+                   "subs    %[count], %[count], #1       \n\t"
+                   "add     %[dst], %[dst], #2           \n\t"
+                   "bne     1b                           \n\t"
+                   "4:                                   \n\t"
--- a/gfx/skia/src/opts/SkBlitRow_opts_arm.cpp
+++ b/gfx/skia/src/opts/SkBlitRow_opts_arm.cpp
@@ -26,66 +26,78 @@ static void S32A_D565_Opaque(uint16_t* S
     asm volatile (
                   "1:                                   \n\t"
                   "ldr     r3, [%[src]], #4             \n\t"
                   "cmp     r3, #0xff000000              \n\t"
                   "blo     2f                           \n\t"
                   "and     r4, r3, #0x0000f8            \n\t"
                   "and     r5, r3, #0x00fc00            \n\t"
                   "and     r6, r3, #0xf80000            \n\t"
+#ifdef SK_ARM_HAS_EDSP
                   "pld     [r1, #32]                    \n\t"
+#endif
                   "lsl     r3, r4, #8                   \n\t"
                   "orr     r3, r3, r5, lsr #5           \n\t"
                   "orr     r3, r3, r6, lsr #19          \n\t"
                   "subs    %[count], %[count], #1       \n\t"
                   "strh    r3, [%[dst]], #2             \n\t"
                   "bne     1b                           \n\t"
                   "b       4f                           \n\t"
                   "2:                                   \n\t"
                   "lsrs    r7, r3, #24                  \n\t"
                   "beq     3f                           \n\t"
                   "ldrh    r4, [%[dst]]                 \n\t"
                   "rsb     r7, r7, #255                 \n\t"
                   "and     r6, r4, #0x001f              \n\t"
-#if SK_ARM_ARCH == 6
+#if SK_ARM_ARCH <= 6
                   "lsl     r5, r4, #21                  \n\t"
                   "lsr     r5, r5, #26                  \n\t"
 #else
                   "ubfx    r5, r4, #5, #6               \n\t"
 #endif
+#ifdef SK_ARM_HAS_EDSP
                   "pld     [r0, #16]                    \n\t"
+#endif
                   "lsr     r4, r4, #11                  \n\t"
 #ifdef SK_ARM_HAS_EDSP
                   "smulbb  r6, r6, r7                   \n\t"
                   "smulbb  r5, r5, r7                   \n\t"
                   "smulbb  r4, r4, r7                   \n\t"
 #else
                   "mul     r6, r6, r7                   \n\t"
                   "mul     r5, r5, r7                   \n\t"
                   "mul     r4, r4, r7                   \n\t"
 #endif
+#if SK_ARM_ARCH >= 6
                   "uxtb    r7, r3, ROR #16              \n\t"
                   "uxtb    ip, r3, ROR #8               \n\t"
+#else
+                  "mov     ip, #0xff                    \n\t"
+                  "and     r7, ip, r3, ROR #16          \n\t"
+                  "and     ip, ip, r3, ROR #8           \n\t"
+#endif
                   "and     r3, r3, #0xff                \n\t"
                   "add     r6, r6, #16                  \n\t"
                   "add     r5, r5, #32                  \n\t"
                   "add     r4, r4, #16                  \n\t"
                   "add     r6, r6, r6, lsr #5           \n\t"
                   "add     r5, r5, r5, lsr #6           \n\t"
                   "add     r4, r4, r4, lsr #5           \n\t"
                   "add     r6, r7, r6, lsr #5           \n\t"
                   "add     r5, ip, r5, lsr #6           \n\t"
                   "add     r4, r3, r4, lsr #5           \n\t"
                   "lsr     r6, r6, #3                   \n\t"
                   "and     r5, r5, #0xfc                \n\t"
                   "and     r4, r4, #0xf8                \n\t"
                   "orr     r6, r6, r5, lsl #3           \n\t"
                   "orr     r4, r6, r4, lsl #8           \n\t"
                   "strh    r4, [%[dst]], #2             \n\t"
+#ifdef SK_ARM_HAS_EDSP
                   "pld     [r1, #32]                    \n\t"
+#endif
                   "subs    %[count], %[count], #1       \n\t"
                   "bne     1b                           \n\t"
                   "b       4f                           \n\t"
                   "3:                                   \n\t"
                   "subs    %[count], %[count], #1       \n\t"
                   "add     %[dst], %[dst], #2           \n\t"
                   "bne     1b                           \n\t"
                   "4:                                   \n\t"