| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 The Android Open Source Project | 2 * Copyright 2012 The Android Open Source Project |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "SkBlitRow_opts_arm.h" | |
| 9 | |
| 10 #include "SkBlitMask.h" | 8 #include "SkBlitMask.h" |
| 11 #include "SkBlitRow.h" | 9 #include "SkBlitRow.h" |
| 12 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
| 13 #include "SkDither.h" | 11 #include "SkDither.h" |
| 14 #include "SkMathPriv.h" | 12 #include "SkMathPriv.h" |
| 15 #include "SkUtils.h" | 13 #include "SkUtils.h" |
| 14 #include "SkUtilsArm.h" |
| 16 | 15 |
| 17 #include "SkCachePreload_arm.h" | 16 #include "SkCachePreload_arm.h" |
| 18 | 17 |
| 18 // Define USE_NEON_CODE to indicate that we need to build NEON routines |
| 19 #define USE_NEON_CODE (!SK_ARM_NEON_IS_NONE) |
| 20 |
| 21 // Define USE_ARM_CODE to indicate that we need to build ARM routines |
| 22 #define USE_ARM_CODE (!SK_ARM_NEON_IS_ALWAYS) |
| 23 |
| 24 #if USE_NEON_CODE |
| 25 #include "SkBlitRow_opts_arm_neon.h" |
| 26 #endif |
| 27 |
| 19 #if USE_ARM_CODE | 28 #if USE_ARM_CODE |
| 20 | 29 |
| 21 static void S32A_D565_Opaque(uint16_t* SK_RESTRICT dst, | 30 static void S32A_D565_Opaque(uint16_t* SK_RESTRICT dst, |
| 22 const SkPMColor* SK_RESTRICT src, int count, | 31 const SkPMColor* SK_RESTRICT src, int count, |
| 23 U8CPU alpha, int /*x*/, int /*y*/) { | 32 U8CPU alpha, int /*x*/, int /*y*/) { |
| 24 SkASSERT(255 == alpha); | 33 SkASSERT(255 == alpha); |
| 25 | 34 |
| 26 asm volatile ( | 35 asm volatile ( |
| 27 "1: \n\t" | 36 "1: \n\t" |
| 28 "ldr r3, [%[src]], #4 \n\t" | 37 "ldr r3, [%[src]], #4 \n\t" |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 /* ----------------- */ | 187 /* ----------------- */ |
| 179 "str r7, [%[dst]], #4 \n\t" /* *dst = r7, increme
nt dst by one (times 4) */ | 188 "str r7, [%[dst]], #4 \n\t" /* *dst = r7, increme
nt dst by one (times 4) */ |
| 180 /* ----------------- */ | 189 /* ----------------- */ |
| 181 | 190 |
| 182 "3: \n\t" /* <exit> */ | 191 "3: \n\t" /* <exit> */ |
| 183 : [dst] "+r" (dst), [src] "+r" (src), [count] "+r" (count) | 192 : [dst] "+r" (dst), [src] "+r" (src), [count] "+r" (count) |
| 184 : | 193 : |
| 185 : "cc", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "ip", "memo
ry" | 194 : "cc", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "ip", "memo
ry" |
| 186 ); | 195 ); |
| 187 } | 196 } |
| 188 #endif // USE_ARM_CODE | |
| 189 | 197 |
| 190 /* | 198 /* |
| 191 * ARM asm version of S32A_Blend_BlitRow32 | 199 * ARM asm version of S32A_Blend_BlitRow32 |
| 192 */ | 200 */ |
| 193 // This version is also used by the NEON procs table, so always compile it | |
| 194 void S32A_Blend_BlitRow32_arm(SkPMColor* SK_RESTRICT dst, | 201 void S32A_Blend_BlitRow32_arm(SkPMColor* SK_RESTRICT dst, |
| 195 const SkPMColor* SK_RESTRICT src, | 202 const SkPMColor* SK_RESTRICT src, |
| 196 int count, U8CPU alpha) { | 203 int count, U8CPU alpha) { |
| 197 asm volatile ( | 204 asm volatile ( |
| 198 "cmp %[count], #0 \n\t" /* comparing count wi
th 0 */ | 205 "cmp %[count], #0 \n\t" /* comparing count wi
th 0 */ |
| 199 "beq 3f \n\t" /* if zero exit */ | 206 "beq 3f \n\t" /* if zero exit */ |
| 200 | 207 |
| 201 "mov r12, #0xff \n\t" /* load the 0xff mask
in r12 */ | 208 "mov r12, #0xff \n\t" /* load the 0xff mask
in r12 */ |
| 202 "orr r12, r12, r12, lsl #16 \n\t" /* convert it to 0xff
00ff in r12 */ | 209 "orr r12, r12, r12, lsl #16 \n\t" /* convert it to 0xff
00ff in r12 */ |
| 203 | 210 |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 "3: \n\t" /* <exit> */ | 331 "3: \n\t" /* <exit> */ |
| 325 : [dst] "+r" (dst), [src] "+r" (src), [count] "+r" (count), [a
lpha] "+r" (alpha) | 332 : [dst] "+r" (dst), [src] "+r" (src), [count] "+r" (count), [a
lpha] "+r" (alpha) |
| 326 : | 333 : |
| 327 : "cc", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12
", "memory" | 334 : "cc", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12
", "memory" |
| 328 ); | 335 ); |
| 329 | 336 |
| 330 } | 337 } |
| 331 | 338 |
| 332 /////////////////////////////////////////////////////////////////////////////// | 339 /////////////////////////////////////////////////////////////////////////////// |
| 333 | 340 |
| 334 #if USE_ARM_CODE | 341 static const SkBlitRow::Proc sk_blitrow_platform_565_procs_arm[] = { |
| 335 const SkBlitRow::Proc sk_blitrow_platform_565_procs_arm[] = { | |
| 336 // no dither | 342 // no dither |
| 337 // NOTE: For the functions below, we don't have a special version | 343 // NOTE: For the functions below, we don't have a special version |
| 338 // that assumes that each source pixel is opaque. But our S32A is | 344 // that assumes that each source pixel is opaque. But our S32A is |
| 339 // still faster than the default, so use it. | 345 // still faster than the default, so use it. |
| 340 S32A_D565_Opaque, // S32_D565_Opaque | 346 S32A_D565_Opaque, // S32_D565_Opaque |
| 341 NULL, // S32_D565_Blend | 347 NULL, // S32_D565_Blend |
| 342 S32A_D565_Opaque, // S32A_D565_Opaque | 348 S32A_D565_Opaque, // S32A_D565_Opaque |
| 343 NULL, // S32A_D565_Blend | 349 NULL, // S32A_D565_Blend |
| 344 | 350 |
| 345 // dither | 351 // dither |
| 346 NULL, // S32_D565_Opaque_Dither | 352 NULL, // S32_D565_Opaque_Dither |
| 347 NULL, // S32_D565_Blend_Dither | 353 NULL, // S32_D565_Blend_Dither |
| 348 NULL, // S32A_D565_Opaque_Dither | 354 NULL, // S32A_D565_Opaque_Dither |
| 349 NULL, // S32A_D565_Blend_Dither | 355 NULL, // S32A_D565_Blend_Dither |
| 350 }; | 356 }; |
| 351 | 357 |
| 352 const SkBlitRow::Proc32 sk_blitrow_platform_32_procs_arm[] = { | 358 static const SkBlitRow::Proc32 sk_blitrow_platform_32_procs_arm[] = { |
| 353 NULL, // S32_Opaque, | 359 NULL, // S32_Opaque, |
| 354 NULL, // S32_Blend, | 360 NULL, // S32_Blend, |
| 355 S32A_Opaque_BlitRow32_arm, // S32A_Opaque, | 361 S32A_Opaque_BlitRow32_arm, // S32A_Opaque, |
| 356 S32A_Blend_BlitRow32_arm // S32A_Blend | 362 S32A_Blend_BlitRow32_arm // S32A_Blend |
| 357 }; | 363 }; |
| 358 #endif | 364 |
| 365 #endif // USE_ARM_CODE |
| 359 | 366 |
| 360 SkBlitRow::Proc SkBlitRow::PlatformProcs565(unsigned flags) { | 367 SkBlitRow::Proc SkBlitRow::PlatformProcs565(unsigned flags) { |
| 361 return SK_ARM_NEON_WRAP(sk_blitrow_platform_565_procs_arm)[flags]; | 368 return SK_ARM_NEON_WRAP(sk_blitrow_platform_565_procs_arm)[flags]; |
| 362 } | 369 } |
| 363 | 370 |
| 364 SkBlitRow::Proc32 SkBlitRow::PlatformProcs32(unsigned flags) { | 371 SkBlitRow::Proc32 SkBlitRow::PlatformProcs32(unsigned flags) { |
| 365 return SK_ARM_NEON_WRAP(sk_blitrow_platform_32_procs_arm)[flags]; | 372 return SK_ARM_NEON_WRAP(sk_blitrow_platform_32_procs_arm)[flags]; |
| 366 } | 373 } |
| 367 | 374 |
| 368 /////////////////////////////////////////////////////////////////////////////// | 375 /////////////////////////////////////////////////////////////////////////////// |
| (...skipping 10 matching lines...) Expand all Loading... |
| 379 | 386 |
| 380 SkBlitMask::BlitLCD16RowProc SkBlitMask::PlatformBlitRowProcs16(bool isOpaque) { | 387 SkBlitMask::BlitLCD16RowProc SkBlitMask::PlatformBlitRowProcs16(bool isOpaque) { |
| 381 return NULL; | 388 return NULL; |
| 382 } | 389 } |
| 383 | 390 |
| 384 SkBlitMask::RowProc SkBlitMask::PlatformRowProcs(SkBitmap::Config dstConfig, | 391 SkBlitMask::RowProc SkBlitMask::PlatformRowProcs(SkBitmap::Config dstConfig, |
| 385 SkMask::Format maskFormat, | 392 SkMask::Format maskFormat, |
| 386 RowFlags flags) { | 393 RowFlags flags) { |
| 387 return NULL; | 394 return NULL; |
| 388 } | 395 } |
| OLD | NEW |