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