| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2009 The Android Open Source Project | 2 * Copyright 2009 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 "SkBitmapFilter_opts_SSE2.h" | 8 #include "SkBitmapFilter_opts_SSE2.h" |
| 9 #include "SkBitmapProcState_opts_SSE2.h" | 9 #include "SkBitmapProcState_opts_SSE2.h" |
| 10 #include "SkBitmapProcState_opts_SSSE3.h" | 10 #include "SkBitmapProcState_opts_SSSE3.h" |
| 11 #include "SkBlitMask.h" | 11 #include "SkBlitMask.h" |
| 12 #include "SkBlitRect_opts_SSE2.h" | 12 #include "SkBlitRect_opts_SSE2.h" |
| 13 #include "SkBlitRow.h" | 13 #include "SkBlitRow.h" |
| 14 #include "SkBlitRow_opts_SSE2.h" | 14 #include "SkBlitRow_opts_SSE2.h" |
| 15 #include "SkBlitRow_opts_SSE4.h" |
| 15 #include "SkBlurImage_opts_SSE2.h" | 16 #include "SkBlurImage_opts_SSE2.h" |
| 16 #include "SkMorphology_opts.h" | 17 #include "SkMorphology_opts.h" |
| 17 #include "SkMorphology_opts_SSE2.h" | 18 #include "SkMorphology_opts_SSE2.h" |
| 18 #include "SkRTConf.h" | 19 #include "SkRTConf.h" |
| 19 #include "SkUtils.h" | 20 #include "SkUtils.h" |
| 20 #include "SkUtils_opts_SSE2.h" | 21 #include "SkUtils_opts_SSE2.h" |
| 21 #include "SkXfermode.h" | 22 #include "SkXfermode.h" |
| 22 #include "SkXfermode_proccoeff.h" | 23 #include "SkXfermode_proccoeff.h" |
| 23 | 24 |
| 24 #if defined(_MSC_VER) && defined(_WIN64) | 25 #if defined(_MSC_VER) && defined(_WIN64) |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 | 76 |
| 76 /* Fetch the SIMD level directly from the CPU, at run-time. | 77 /* Fetch the SIMD level directly from the CPU, at run-time. |
| 77 * Only checks the levels needed by the optimizations in this file. | 78 * Only checks the levels needed by the optimizations in this file. |
| 78 */ | 79 */ |
| 79 static int get_SIMD_level() { | 80 static int get_SIMD_level() { |
| 80 int cpu_info[4] = { 0 }; | 81 int cpu_info[4] = { 0 }; |
| 81 | 82 |
| 82 getcpuid(1, cpu_info); | 83 getcpuid(1, cpu_info); |
| 83 if ((cpu_info[2] & (1<<20)) != 0) { | 84 if ((cpu_info[2] & (1<<20)) != 0) { |
| 84 return SK_CPU_SSE_LEVEL_SSE42; | 85 return SK_CPU_SSE_LEVEL_SSE42; |
| 86 } else if ((cpu_info[2] & (1<<19)) != 0) { |
| 87 return SK_CPU_SSE_LEVEL_SSE41; |
| 85 } else if ((cpu_info[2] & (1<<9)) != 0) { | 88 } else if ((cpu_info[2] & (1<<9)) != 0) { |
| 86 return SK_CPU_SSE_LEVEL_SSSE3; | 89 return SK_CPU_SSE_LEVEL_SSSE3; |
| 87 } else if ((cpu_info[3] & (1<<26)) != 0) { | 90 } else if ((cpu_info[3] & (1<<26)) != 0) { |
| 88 return SK_CPU_SSE_LEVEL_SSE2; | 91 return SK_CPU_SSE_LEVEL_SSE2; |
| 89 } else { | 92 } else { |
| 90 return 0; | 93 return 0; |
| 91 } | 94 } |
| 92 } | 95 } |
| 93 | 96 |
| 94 /* Verify that the requested SIMD level is supported in the build. | 97 /* Verify that the requested SIMD level is supported in the build. |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 }; | 202 }; |
| 200 | 203 |
| 201 SkBlitRow::Proc SkBlitRow::PlatformProcs565(unsigned flags) { | 204 SkBlitRow::Proc SkBlitRow::PlatformProcs565(unsigned flags) { |
| 202 if (supports_simd(SK_CPU_SSE_LEVEL_SSE2)) { | 205 if (supports_simd(SK_CPU_SSE_LEVEL_SSE2)) { |
| 203 return platform_16_procs[flags]; | 206 return platform_16_procs[flags]; |
| 204 } else { | 207 } else { |
| 205 return NULL; | 208 return NULL; |
| 206 } | 209 } |
| 207 } | 210 } |
| 208 | 211 |
| 209 static SkBlitRow::Proc32 platform_32_procs[] = { | 212 static SkBlitRow::Proc32 platform_32_procs_SSE2[] = { |
| 210 NULL, // S32_Opaque, | 213 NULL, // S32_Opaque, |
| 211 S32_Blend_BlitRow32_SSE2, // S32_Blend, | 214 S32_Blend_BlitRow32_SSE2, // S32_Blend, |
| 212 S32A_Opaque_BlitRow32_SSE2, // S32A_Opaque | 215 S32A_Opaque_BlitRow32_SSE2, // S32A_Opaque |
| 213 S32A_Blend_BlitRow32_SSE2, // S32A_Blend, | 216 S32A_Blend_BlitRow32_SSE2, // S32A_Blend, |
| 214 }; | 217 }; |
| 215 | 218 |
| 219 #if defined(SK_ATT_ASM_SUPPORTED) |
| 220 static SkBlitRow::Proc32 platform_32_procs_SSE4[] = { |
| 221 NULL, // S32_Opaque, |
| 222 S32_Blend_BlitRow32_SSE2, // S32_Blend, |
| 223 S32A_Opaque_BlitRow32_SSE4_asm, // S32A_Opaque |
| 224 S32A_Blend_BlitRow32_SSE2, // S32A_Blend, |
| 225 }; |
| 226 #endif |
| 227 |
| 216 SkBlitRow::Proc32 SkBlitRow::PlatformProcs32(unsigned flags) { | 228 SkBlitRow::Proc32 SkBlitRow::PlatformProcs32(unsigned flags) { |
| 229 #if defined(SK_ATT_ASM_SUPPORTED) |
| 230 if (supports_simd(SK_CPU_SSE_LEVEL_SSE41)) { |
| 231 return platform_32_procs_SSE4[flags]; |
| 232 } else |
| 233 #endif |
| 217 if (supports_simd(SK_CPU_SSE_LEVEL_SSE2)) { | 234 if (supports_simd(SK_CPU_SSE_LEVEL_SSE2)) { |
| 218 return platform_32_procs[flags]; | 235 return platform_32_procs_SSE2[flags]; |
| 219 } else { | 236 } else { |
| 220 return NULL; | 237 return NULL; |
| 221 } | 238 } |
| 222 } | 239 } |
| 223 | 240 |
| 224 SkBlitRow::ColorProc SkBlitRow::PlatformColorProc() { | 241 SkBlitRow::ColorProc SkBlitRow::PlatformColorProc() { |
| 225 if (supports_simd(SK_CPU_SSE_LEVEL_SSE2)) { | 242 if (supports_simd(SK_CPU_SSE_LEVEL_SSE2)) { |
| 226 return Color32_SSE2; | 243 return Color32_SSE2; |
| 227 } else { | 244 } else { |
| 228 return NULL; | 245 return NULL; |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 } else { | 387 } else { |
| 371 return SkPlatformXfermodeFactory_impl(rec, mode); | 388 return SkPlatformXfermodeFactory_impl(rec, mode); |
| 372 } | 389 } |
| 373 } | 390 } |
| 374 | 391 |
| 375 SkXfermodeProc SkPlatformXfermodeProcFactory(SkXfermode::Mode mode); | 392 SkXfermodeProc SkPlatformXfermodeProcFactory(SkXfermode::Mode mode); |
| 376 | 393 |
| 377 SkXfermodeProc SkPlatformXfermodeProcFactory(SkXfermode::Mode mode) { | 394 SkXfermodeProc SkPlatformXfermodeProcFactory(SkXfermode::Mode mode) { |
| 378 return NULL; | 395 return NULL; |
| 379 } | 396 } |
| OLD | NEW |