senorblanco@chromium.org | 4e75355 | 2009-11-16 21:09:00 +0000 | [diff] [blame] | 1 | /* |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 2 | * Copyright 2009 The Android Open Source Project |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
senorblanco@chromium.org | 4e75355 | 2009-11-16 21:09:00 +0000 | [diff] [blame] | 6 | */ |
| 7 | |
commit-bot@chromium.org | 8c4953c | 2014-04-30 14:58:46 +0000 | [diff] [blame] | 8 | #include "SkBitmapFilter_opts_SSE2.h" |
senorblanco@chromium.org | dc7de74 | 2009-11-30 20:00:29 +0000 | [diff] [blame] | 9 | #include "SkBitmapProcState_opts_SSE2.h" |
tomhudson@google.com | 95ad155 | 2012-02-14 18:28:54 +0000 | [diff] [blame] | 10 | #include "SkBitmapProcState_opts_SSSE3.h" |
humper | 4f96ab3 | 2014-06-27 11:27:03 -0700 | [diff] [blame] | 11 | #include "SkBitmapScaler.h" |
reed@google.com | 58af9a6 | 2011-10-12 13:43:52 +0000 | [diff] [blame] | 12 | #include "SkBlitMask.h" |
commit-bot@chromium.org | 8c4953c | 2014-04-30 14:58:46 +0000 | [diff] [blame] | 13 | #include "SkBlitRow.h" |
senorblanco@chromium.org | 4e75355 | 2009-11-16 21:09:00 +0000 | [diff] [blame] | 14 | #include "SkBlitRow_opts_SSE2.h" |
henrik.smiding | 3bb195e | 2014-06-27 08:03:17 -0700 | [diff] [blame] | 15 | #include "SkBlitRow_opts_SSE4.h" |
mtklein | c09e2af | 2014-10-13 12:48:16 -0700 | [diff] [blame] | 16 | #include "SkLazyPtr.h" |
commit-bot@chromium.org | 8c4953c | 2014-04-30 14:58:46 +0000 | [diff] [blame] | 17 | #include "SkRTConf.h" |
senorblanco@chromium.org | 4e75355 | 2009-11-16 21:09:00 +0000 | [diff] [blame] | 18 | |
tomhudson@google.com | ea85494 | 2012-05-17 15:09:17 +0000 | [diff] [blame] | 19 | #if defined(_MSC_VER) && defined(_WIN64) |
| 20 | #include <intrin.h> |
| 21 | #endif |
| 22 | |
commit-bot@chromium.org | ce4402c | 2014-05-12 14:16:19 +0000 | [diff] [blame] | 23 | /* This file must *not* be compiled with -msse or any other optional SIMD |
| 24 | extension, otherwise gcc may generate SIMD instructions even for scalar ops |
| 25 | (and thus give an invalid instruction on Pentium3 on the code below). |
| 26 | For example, only files named *_SSE2.cpp in this directory should be |
| 27 | compiled with -msse2 or higher. */ |
senorblanco@chromium.org | 4e75355 | 2009-11-16 21:09:00 +0000 | [diff] [blame] | 28 | |
tomhudson@google.com | 95ad155 | 2012-02-14 18:28:54 +0000 | [diff] [blame] | 29 | |
commit-bot@chromium.org | 8c4953c | 2014-04-30 14:58:46 +0000 | [diff] [blame] | 30 | /* Function to get the CPU SSE-level in runtime, for different compilers. */ |
senorblanco@chromium.org | 4e75355 | 2009-11-16 21:09:00 +0000 | [diff] [blame] | 31 | #ifdef _MSC_VER |
| 32 | static inline void getcpuid(int info_type, int info[4]) { |
tomhudson@google.com | ea85494 | 2012-05-17 15:09:17 +0000 | [diff] [blame] | 33 | #if defined(_WIN64) |
| 34 | __cpuid(info, info_type); |
| 35 | #else |
senorblanco@chromium.org | 4e75355 | 2009-11-16 21:09:00 +0000 | [diff] [blame] | 36 | __asm { |
| 37 | mov eax, [info_type] |
| 38 | cpuid |
| 39 | mov edi, [info] |
| 40 | mov [edi], eax |
| 41 | mov [edi+4], ebx |
| 42 | mov [edi+8], ecx |
| 43 | mov [edi+12], edx |
| 44 | } |
tomhudson@google.com | ea85494 | 2012-05-17 15:09:17 +0000 | [diff] [blame] | 45 | #endif |
senorblanco@chromium.org | 4e75355 | 2009-11-16 21:09:00 +0000 | [diff] [blame] | 46 | } |
commit-bot@chromium.org | ce4402c | 2014-05-12 14:16:19 +0000 | [diff] [blame] | 47 | #elif defined(__x86_64__) |
tomhudson@google.com | 95ad155 | 2012-02-14 18:28:54 +0000 | [diff] [blame] | 48 | static inline void getcpuid(int info_type, int info[4]) { |
| 49 | asm volatile ( |
| 50 | "cpuid \n\t" |
| 51 | : "=a"(info[0]), "=b"(info[1]), "=c"(info[2]), "=d"(info[3]) |
| 52 | : "a"(info_type) |
| 53 | ); |
| 54 | } |
| 55 | #else |
senorblanco@chromium.org | 4e75355 | 2009-11-16 21:09:00 +0000 | [diff] [blame] | 56 | static inline void getcpuid(int info_type, int info[4]) { |
| 57 | // We save and restore ebx, so this code can be compatible with -fPIC |
| 58 | asm volatile ( |
| 59 | "pushl %%ebx \n\t" |
| 60 | "cpuid \n\t" |
| 61 | "movl %%ebx, %1 \n\t" |
| 62 | "popl %%ebx \n\t" |
| 63 | : "=a"(info[0]), "=r"(info[1]), "=c"(info[2]), "=d"(info[3]) |
| 64 | : "a"(info_type) |
senorblanco@chromium.org | 4e75355 | 2009-11-16 21:09:00 +0000 | [diff] [blame] | 65 | ); |
| 66 | } |
| 67 | #endif |
tomhudson@google.com | 95ad155 | 2012-02-14 18:28:54 +0000 | [diff] [blame] | 68 | |
commit-bot@chromium.org | 8c4953c | 2014-04-30 14:58:46 +0000 | [diff] [blame] | 69 | //////////////////////////////////////////////////////////////////////////////// |
| 70 | |
commit-bot@chromium.org | ce4402c | 2014-05-12 14:16:19 +0000 | [diff] [blame] | 71 | /* Fetch the SIMD level directly from the CPU, at run-time. |
| 72 | * Only checks the levels needed by the optimizations in this file. |
commit-bot@chromium.org | 443c0a6 | 2014-05-08 15:27:52 +0000 | [diff] [blame] | 73 | */ |
mtklein | c09e2af | 2014-10-13 12:48:16 -0700 | [diff] [blame] | 74 | namespace { // get_SIMD_level() technically must have external linkage, so no static. |
| 75 | int* get_SIMD_level() { |
| 76 | int cpu_info[4] = { 0, 0, 0, 0 }; |
commit-bot@chromium.org | 443c0a6 | 2014-05-08 15:27:52 +0000 | [diff] [blame] | 77 | getcpuid(1, cpu_info); |
mtklein | c09e2af | 2014-10-13 12:48:16 -0700 | [diff] [blame] | 78 | |
halcanary | 385fe4d | 2015-08-26 13:07:48 -0700 | [diff] [blame] | 79 | int* level = new int; |
mtklein | c09e2af | 2014-10-13 12:48:16 -0700 | [diff] [blame] | 80 | |
commit-bot@chromium.org | ce4402c | 2014-05-12 14:16:19 +0000 | [diff] [blame] | 81 | if ((cpu_info[2] & (1<<20)) != 0) { |
mtklein | c09e2af | 2014-10-13 12:48:16 -0700 | [diff] [blame] | 82 | *level = SK_CPU_SSE_LEVEL_SSE42; |
henrik.smiding | 3bb195e | 2014-06-27 08:03:17 -0700 | [diff] [blame] | 83 | } else if ((cpu_info[2] & (1<<19)) != 0) { |
mtklein | c09e2af | 2014-10-13 12:48:16 -0700 | [diff] [blame] | 84 | *level = SK_CPU_SSE_LEVEL_SSE41; |
commit-bot@chromium.org | ce4402c | 2014-05-12 14:16:19 +0000 | [diff] [blame] | 85 | } else if ((cpu_info[2] & (1<<9)) != 0) { |
mtklein | c09e2af | 2014-10-13 12:48:16 -0700 | [diff] [blame] | 86 | *level = SK_CPU_SSE_LEVEL_SSSE3; |
commit-bot@chromium.org | ce4402c | 2014-05-12 14:16:19 +0000 | [diff] [blame] | 87 | } else if ((cpu_info[3] & (1<<26)) != 0) { |
mtklein | c09e2af | 2014-10-13 12:48:16 -0700 | [diff] [blame] | 88 | *level = SK_CPU_SSE_LEVEL_SSE2; |
commit-bot@chromium.org | ce4402c | 2014-05-12 14:16:19 +0000 | [diff] [blame] | 89 | } else { |
mtklein | c09e2af | 2014-10-13 12:48:16 -0700 | [diff] [blame] | 90 | *level = 0; |
commit-bot@chromium.org | ce4402c | 2014-05-12 14:16:19 +0000 | [diff] [blame] | 91 | } |
mtklein | c09e2af | 2014-10-13 12:48:16 -0700 | [diff] [blame] | 92 | return level; |
commit-bot@chromium.org | 443c0a6 | 2014-05-08 15:27:52 +0000 | [diff] [blame] | 93 | } |
mtklein | c09e2af | 2014-10-13 12:48:16 -0700 | [diff] [blame] | 94 | } // namespace |
| 95 | |
| 96 | SK_DECLARE_STATIC_LAZY_PTR(int, gSIMDLevel, get_SIMD_level); |
commit-bot@chromium.org | ce4402c | 2014-05-12 14:16:19 +0000 | [diff] [blame] | 97 | |
| 98 | /* Verify that the requested SIMD level is supported in the build. |
| 99 | * If not, check if the platform supports it. |
| 100 | */ |
| 101 | static inline bool supports_simd(int minLevel) { |
| 102 | #if defined(SK_CPU_SSE_LEVEL) |
| 103 | if (minLevel <= SK_CPU_SSE_LEVEL) { |
| 104 | return true; |
| 105 | } else |
commit-bot@chromium.org | 443c0a6 | 2014-05-08 15:27:52 +0000 | [diff] [blame] | 106 | #endif |
commit-bot@chromium.org | ce4402c | 2014-05-12 14:16:19 +0000 | [diff] [blame] | 107 | { |
| 108 | #if defined(SK_BUILD_FOR_ANDROID_FRAMEWORK) |
| 109 | /* For the Android framework we should always know at compile time if the device |
| 110 | * we are building for supports SSSE3. The one exception to this rule is on the |
| 111 | * emulator where we are compiled without the -mssse3 option (so we have no |
| 112 | * SSSE3 procs) but can be run on a host machine that supports SSSE3 |
| 113 | * instructions. So for that particular case we disable our SSSE3 options. |
| 114 | */ |
| 115 | return false; |
| 116 | #else |
mtklein | c09e2af | 2014-10-13 12:48:16 -0700 | [diff] [blame] | 117 | return minLevel <= *gSIMDLevel.get(); |
commit-bot@chromium.org | ce4402c | 2014-05-12 14:16:19 +0000 | [diff] [blame] | 118 | #endif |
| 119 | } |
tomhudson@google.com | 95ad155 | 2012-02-14 18:28:54 +0000 | [diff] [blame] | 120 | } |
| 121 | |
commit-bot@chromium.org | 8c4953c | 2014-04-30 14:58:46 +0000 | [diff] [blame] | 122 | //////////////////////////////////////////////////////////////////////////////// |
| 123 | |
humper | 4f96ab3 | 2014-06-27 11:27:03 -0700 | [diff] [blame] | 124 | void SkBitmapScaler::PlatformConvolutionProcs(SkConvolutionProcs* procs) { |
commit-bot@chromium.org | ce4402c | 2014-05-12 14:16:19 +0000 | [diff] [blame] | 125 | if (supports_simd(SK_CPU_SSE_LEVEL_SSE2)) { |
reed@google.com | fed04b3 | 2013-09-05 20:31:17 +0000 | [diff] [blame] | 126 | procs->fExtraHorizontalReads = 3; |
| 127 | procs->fConvolveVertically = &convolveVertically_SSE2; |
| 128 | procs->fConvolve4RowsHorizontally = &convolve4RowsHorizontally_SSE2; |
| 129 | procs->fConvolveHorizontally = &convolveHorizontally_SSE2; |
| 130 | procs->fApplySIMDPadding = &applySIMDPadding_SSE2; |
humper@google.com | 138ebc3 | 2013-07-19 20:20:04 +0000 | [diff] [blame] | 131 | } |
| 132 | } |
| 133 | |
commit-bot@chromium.org | 8c4953c | 2014-04-30 14:58:46 +0000 | [diff] [blame] | 134 | //////////////////////////////////////////////////////////////////////////////// |
| 135 | |
senorblanco@chromium.org | dc7de74 | 2009-11-30 20:00:29 +0000 | [diff] [blame] | 136 | void SkBitmapProcState::platformProcs() { |
commit-bot@chromium.org | 4b9b456 | 2014-04-28 15:07:50 +0000 | [diff] [blame] | 137 | /* Every optimization in the function requires at least SSE2 */ |
commit-bot@chromium.org | ce4402c | 2014-05-12 14:16:19 +0000 | [diff] [blame] | 138 | if (!supports_simd(SK_CPU_SSE_LEVEL_SSE2)) { |
commit-bot@chromium.org | 4b9b456 | 2014-04-28 15:07:50 +0000 | [diff] [blame] | 139 | return; |
| 140 | } |
qiankun.miao | 60f3c65 | 2014-12-04 06:27:03 -0800 | [diff] [blame] | 141 | const bool ssse3 = supports_simd(SK_CPU_SSE_LEVEL_SSSE3); |
commit-bot@chromium.org | c398f71 | 2014-04-23 20:07:19 +0000 | [diff] [blame] | 142 | |
commit-bot@chromium.org | 4b9b456 | 2014-04-28 15:07:50 +0000 | [diff] [blame] | 143 | /* Check fSampleProc32 */ |
| 144 | if (fSampleProc32 == S32_opaque_D32_filter_DX) { |
qiankun.miao | 60f3c65 | 2014-12-04 06:27:03 -0800 | [diff] [blame] | 145 | if (ssse3) { |
commit-bot@chromium.org | 4b9b456 | 2014-04-28 15:07:50 +0000 | [diff] [blame] | 146 | fSampleProc32 = S32_opaque_D32_filter_DX_SSSE3; |
| 147 | } else { |
commit-bot@chromium.org | c398f71 | 2014-04-23 20:07:19 +0000 | [diff] [blame] | 148 | fSampleProc32 = S32_opaque_D32_filter_DX_SSE2; |
commit-bot@chromium.org | 4b9b456 | 2014-04-28 15:07:50 +0000 | [diff] [blame] | 149 | } |
| 150 | } else if (fSampleProc32 == S32_opaque_D32_filter_DXDY) { |
qiankun.miao | 60f3c65 | 2014-12-04 06:27:03 -0800 | [diff] [blame] | 151 | if (ssse3) { |
commit-bot@chromium.org | 4b9b456 | 2014-04-28 15:07:50 +0000 | [diff] [blame] | 152 | fSampleProc32 = S32_opaque_D32_filter_DXDY_SSSE3; |
| 153 | } |
| 154 | } else if (fSampleProc32 == S32_alpha_D32_filter_DX) { |
qiankun.miao | 60f3c65 | 2014-12-04 06:27:03 -0800 | [diff] [blame] | 155 | if (ssse3) { |
commit-bot@chromium.org | 4b9b456 | 2014-04-28 15:07:50 +0000 | [diff] [blame] | 156 | fSampleProc32 = S32_alpha_D32_filter_DX_SSSE3; |
| 157 | } else { |
commit-bot@chromium.org | c398f71 | 2014-04-23 20:07:19 +0000 | [diff] [blame] | 158 | fSampleProc32 = S32_alpha_D32_filter_DX_SSE2; |
| 159 | } |
commit-bot@chromium.org | 4b9b456 | 2014-04-28 15:07:50 +0000 | [diff] [blame] | 160 | } else if (fSampleProc32 == S32_alpha_D32_filter_DXDY) { |
qiankun.miao | 60f3c65 | 2014-12-04 06:27:03 -0800 | [diff] [blame] | 161 | if (ssse3) { |
commit-bot@chromium.org | 4b9b456 | 2014-04-28 15:07:50 +0000 | [diff] [blame] | 162 | fSampleProc32 = S32_alpha_D32_filter_DXDY_SSSE3; |
commit-bot@chromium.org | c398f71 | 2014-04-23 20:07:19 +0000 | [diff] [blame] | 163 | } |
senorblanco@chromium.org | dc7de74 | 2009-11-30 20:00:29 +0000 | [diff] [blame] | 164 | } |
tomhudson@google.com | 06a7313 | 2012-02-22 18:30:43 +0000 | [diff] [blame] | 165 | |
commit-bot@chromium.org | 4b9b456 | 2014-04-28 15:07:50 +0000 | [diff] [blame] | 166 | /* Check fSampleProc16 */ |
| 167 | if (fSampleProc16 == S32_D16_filter_DX) { |
qiankun.miao | 72b0c05 | 2014-12-10 07:21:35 -0800 | [diff] [blame] | 168 | if (ssse3) { |
| 169 | fSampleProc16 = S32_D16_filter_DX_SSSE3; |
| 170 | } else { |
| 171 | fSampleProc16 = S32_D16_filter_DX_SSE2; |
| 172 | } |
qiankun.miao | 60f3c65 | 2014-12-04 06:27:03 -0800 | [diff] [blame] | 173 | } else if (ssse3 && fSampleProc16 == S32_D16_filter_DXDY) { |
| 174 | fSampleProc16 = S32_D16_filter_DXDY_SSSE3; |
commit-bot@chromium.org | 4b9b456 | 2014-04-28 15:07:50 +0000 | [diff] [blame] | 175 | } |
tomhudson@google.com | 5efaf26 | 2012-02-28 15:41:49 +0000 | [diff] [blame] | 176 | |
commit-bot@chromium.org | 4b9b456 | 2014-04-28 15:07:50 +0000 | [diff] [blame] | 177 | /* Check fMatrixProc */ |
| 178 | if (fMatrixProc == ClampX_ClampY_filter_scale) { |
| 179 | fMatrixProc = ClampX_ClampY_filter_scale_SSE2; |
| 180 | } else if (fMatrixProc == ClampX_ClampY_nofilter_scale) { |
| 181 | fMatrixProc = ClampX_ClampY_nofilter_scale_SSE2; |
| 182 | } else if (fMatrixProc == ClampX_ClampY_filter_affine) { |
| 183 | fMatrixProc = ClampX_ClampY_filter_affine_SSE2; |
| 184 | } else if (fMatrixProc == ClampX_ClampY_nofilter_affine) { |
| 185 | fMatrixProc = ClampX_ClampY_nofilter_affine_SSE2; |
| 186 | } |
senorblanco@chromium.org | dc7de74 | 2009-11-30 20:00:29 +0000 | [diff] [blame] | 187 | } |
| 188 | |
commit-bot@chromium.org | 8c4953c | 2014-04-30 14:58:46 +0000 | [diff] [blame] | 189 | //////////////////////////////////////////////////////////////////////////////// |
| 190 | |
henrik.smiding | 4e65473 | 2015-02-10 09:42:33 -0800 | [diff] [blame] | 191 | static const SkBlitRow::Proc16 platform_16_procs[] = { |
commit-bot@chromium.org | 39ce33a | 2014-02-24 04:23:39 +0000 | [diff] [blame] | 192 | S32_D565_Opaque_SSE2, // S32_D565_Opaque |
commit-bot@chromium.org | 4759107 | 2014-02-19 03:09:52 +0000 | [diff] [blame] | 193 | NULL, // S32_D565_Blend |
| 194 | S32A_D565_Opaque_SSE2, // S32A_D565_Opaque |
| 195 | NULL, // S32A_D565_Blend |
commit-bot@chromium.org | 2758047 | 2014-03-07 03:25:32 +0000 | [diff] [blame] | 196 | S32_D565_Opaque_Dither_SSE2, // S32_D565_Opaque_Dither |
commit-bot@chromium.org | 4759107 | 2014-02-19 03:09:52 +0000 | [diff] [blame] | 197 | NULL, // S32_D565_Blend_Dither |
commit-bot@chromium.org | fe089b3 | 2014-03-07 13:24:42 +0000 | [diff] [blame] | 198 | S32A_D565_Opaque_Dither_SSE2, // S32A_D565_Opaque_Dither |
commit-bot@chromium.org | 4759107 | 2014-02-19 03:09:52 +0000 | [diff] [blame] | 199 | NULL, // S32A_D565_Blend_Dither |
| 200 | }; |
| 201 | |
reed | a7f1191 | 2015-01-13 13:51:00 -0800 | [diff] [blame] | 202 | SkBlitRow::Proc16 SkBlitRow::PlatformFactory565(unsigned flags) { |
commit-bot@chromium.org | ce4402c | 2014-05-12 14:16:19 +0000 | [diff] [blame] | 203 | if (supports_simd(SK_CPU_SSE_LEVEL_SSE2)) { |
commit-bot@chromium.org | 8c4953c | 2014-04-30 14:58:46 +0000 | [diff] [blame] | 204 | return platform_16_procs[flags]; |
| 205 | } else { |
| 206 | return NULL; |
| 207 | } |
| 208 | } |
| 209 | |
henrik.smiding | 70840cb | 2015-03-20 09:20:46 -0700 | [diff] [blame] | 210 | static const SkBlitRow::ColorProc16 platform_565_colorprocs_SSE2[] = { |
| 211 | Color32A_D565_SSE2, // Color32A_D565, |
henrik.smiding | 4e65473 | 2015-02-10 09:42:33 -0800 | [diff] [blame] | 212 | NULL, // Color32A_D565_Dither |
| 213 | }; |
| 214 | |
reed | a7f1191 | 2015-01-13 13:51:00 -0800 | [diff] [blame] | 215 | SkBlitRow::ColorProc16 SkBlitRow::PlatformColorFactory565(unsigned flags) { |
henrik.smiding | 70840cb | 2015-03-20 09:20:46 -0700 | [diff] [blame] | 216 | /* If you're thinking about writing an SSE4 version of this, do check it's |
| 217 | * actually faster on Atom. Our original SSE4 version was slower than this |
| 218 | * SSE2 version on Silvermont, and only marginally faster on a Core i7, |
| 219 | * mainly due to the MULLD timings. |
| 220 | */ |
| 221 | if (supports_simd(SK_CPU_SSE_LEVEL_SSE2)) { |
| 222 | return platform_565_colorprocs_SSE2[flags]; |
henrik.smiding | 4e65473 | 2015-02-10 09:42:33 -0800 | [diff] [blame] | 223 | } else { |
| 224 | return NULL; |
| 225 | } |
reed | a7f1191 | 2015-01-13 13:51:00 -0800 | [diff] [blame] | 226 | } |
| 227 | |
henrik.smiding | 4e65473 | 2015-02-10 09:42:33 -0800 | [diff] [blame] | 228 | static const SkBlitRow::Proc32 platform_32_procs_SSE2[] = { |
senorblanco@chromium.org | 4e75355 | 2009-11-16 21:09:00 +0000 | [diff] [blame] | 229 | NULL, // S32_Opaque, |
| 230 | S32_Blend_BlitRow32_SSE2, // S32_Blend, |
| 231 | S32A_Opaque_BlitRow32_SSE2, // S32A_Opaque |
| 232 | S32A_Blend_BlitRow32_SSE2, // S32A_Blend, |
| 233 | }; |
| 234 | |
henrik.smiding | 4e65473 | 2015-02-10 09:42:33 -0800 | [diff] [blame] | 235 | static const SkBlitRow::Proc32 platform_32_procs_SSE4[] = { |
henrik.smiding | 3bb195e | 2014-06-27 08:03:17 -0700 | [diff] [blame] | 236 | NULL, // S32_Opaque, |
| 237 | S32_Blend_BlitRow32_SSE2, // S32_Blend, |
stephana | 4bf1ce2 | 2015-02-02 10:02:48 -0800 | [diff] [blame] | 238 | S32A_Opaque_BlitRow32_SSE4, // S32A_Opaque |
henrik.smiding | 3bb195e | 2014-06-27 08:03:17 -0700 | [diff] [blame] | 239 | S32A_Blend_BlitRow32_SSE2, // S32A_Blend, |
| 240 | }; |
henrik.smiding | 3bb195e | 2014-06-27 08:03:17 -0700 | [diff] [blame] | 241 | |
commit-bot@chromium.org | 8c4953c | 2014-04-30 14:58:46 +0000 | [diff] [blame] | 242 | SkBlitRow::Proc32 SkBlitRow::PlatformProcs32(unsigned flags) { |
henrik.smiding | 3bb195e | 2014-06-27 08:03:17 -0700 | [diff] [blame] | 243 | if (supports_simd(SK_CPU_SSE_LEVEL_SSE41)) { |
| 244 | return platform_32_procs_SSE4[flags]; |
| 245 | } else |
commit-bot@chromium.org | ce4402c | 2014-05-12 14:16:19 +0000 | [diff] [blame] | 246 | if (supports_simd(SK_CPU_SSE_LEVEL_SSE2)) { |
henrik.smiding | 3bb195e | 2014-06-27 08:03:17 -0700 | [diff] [blame] | 247 | return platform_32_procs_SSE2[flags]; |
commit-bot@chromium.org | 4759107 | 2014-02-19 03:09:52 +0000 | [diff] [blame] | 248 | } else { |
| 249 | return NULL; |
| 250 | } |
senorblanco@chromium.org | 4e75355 | 2009-11-16 21:09:00 +0000 | [diff] [blame] | 251 | } |
| 252 | |
commit-bot@chromium.org | 8c4953c | 2014-04-30 14:58:46 +0000 | [diff] [blame] | 253 | //////////////////////////////////////////////////////////////////////////////// |
reed@google.com | 981d479 | 2011-03-09 12:55:47 +0000 | [diff] [blame] | 254 | |
tomhudson@google.com | d6770e6 | 2012-02-14 16:01:15 +0000 | [diff] [blame] | 255 | SkBlitMask::BlitLCD16RowProc SkBlitMask::PlatformBlitRowProcs16(bool isOpaque) { |
commit-bot@chromium.org | ce4402c | 2014-05-12 14:16:19 +0000 | [diff] [blame] | 256 | if (supports_simd(SK_CPU_SSE_LEVEL_SSE2)) { |
tomhudson@google.com | d6770e6 | 2012-02-14 16:01:15 +0000 | [diff] [blame] | 257 | if (isOpaque) { |
| 258 | return SkBlitLCD16OpaqueRow_SSE2; |
| 259 | } else { |
| 260 | return SkBlitLCD16Row_SSE2; |
| 261 | } |
| 262 | } else { |
| 263 | return NULL; |
| 264 | } |
| 265 | |
| 266 | } |
commit-bot@chromium.org | 8c4953c | 2014-04-30 14:58:46 +0000 | [diff] [blame] | 267 | |
commit-bot@chromium.org | cba7378 | 2014-05-29 15:57:47 +0000 | [diff] [blame] | 268 | SkBlitMask::RowProc SkBlitMask::PlatformRowProcs(SkColorType, SkMask::Format, RowFlags) { |
reed@google.com | e901b4c | 2011-11-14 21:56:45 +0000 | [diff] [blame] | 269 | return NULL; |
| 270 | } |