Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(316)

Side by Side Diff: src/core/SkOpts.cpp

Issue 1884683002: SkFloatConvert (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
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 "SkHalf.h" 8 #include "SkHalf.h"
9 #include "SkOnce.h" 9 #include "SkOnce.h"
10 #include "SkOpts.h" 10 #include "SkOpts.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 #endif 57 #endif
58 #elif !defined(SK_ARM_HAS_NEON) && \ 58 #elif !defined(SK_ARM_HAS_NEON) && \
59 defined(SK_CPU_ARM32) && \ 59 defined(SK_CPU_ARM32) && \
60 defined(SK_BUILD_FOR_ANDROID) && \ 60 defined(SK_BUILD_FOR_ANDROID) && \
61 !defined(SK_BUILD_FOR_ANDROID_FRAMEWORK) 61 !defined(SK_BUILD_FOR_ANDROID_FRAMEWORK)
62 #include <cpu-features.h> 62 #include <cpu-features.h>
63 #endif 63 #endif
64 64
65 namespace SkOpts { 65 namespace SkOpts {
66 66
67 bool has_f16c = false;
68
67 // Define default function pointer values here... 69 // Define default function pointer values here...
68 // If our global compile options are set high enough, these defaults might e ven be 70 // If our global compile options are set high enough, these defaults might e ven be
69 // CPU-specialized, e.g. a typical x86-64 machine might start with SSE2 defa ults. 71 // CPU-specialized, e.g. a typical x86-64 machine might start with SSE2 defa ults.
70 // They'll still get a chance to be replaced with even better ones, e.g. usi ng SSE4.1. 72 // They'll still get a chance to be replaced with even better ones, e.g. usi ng SSE4.1.
71 decltype(create_xfermode) create_xfermode = sk_default::create_xfermode; 73 decltype(create_xfermode) create_xfermode = sk_default::create_xfermode;
72 decltype(color_cube_filter_span) color_cube_filter_span = sk_default::color_ cube_filter_span; 74 decltype(color_cube_filter_span) color_cube_filter_span = sk_default::color_ cube_filter_span;
73 75
74 decltype(box_blur_xx) box_blur_xx = sk_default::box_blur_xx; 76 decltype(box_blur_xx) box_blur_xx = sk_default::box_blur_xx;
75 decltype(box_blur_xy) box_blur_xy = sk_default::box_blur_xy; 77 decltype(box_blur_xy) box_blur_xy = sk_default::box_blur_xy;
76 decltype(box_blur_yx) box_blur_yx = sk_default::box_blur_yx; 78 decltype(box_blur_yx) box_blur_yx = sk_default::box_blur_yx;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 cpuid(abcd); 123 cpuid(abcd);
122 if (abcd[2] & (1<< 9)) { Init_ssse3(); } 124 if (abcd[2] & (1<< 9)) { Init_ssse3(); }
123 if (abcd[2] & (1<<19)) { Init_sse41(); } 125 if (abcd[2] & (1<<19)) { Init_sse41(); }
124 if (abcd[2] & (1<<20)) { Init_sse42(); } 126 if (abcd[2] & (1<<20)) { Init_sse42(); }
125 127
126 // AVX detection's kind of a pain. This is cribbed from Chromium. 128 // AVX detection's kind of a pain. This is cribbed from Chromium.
127 if ( ( abcd[2] & (7<<26)) == (7<<26) && // Check bits 26-28 of ecx a re all set, 129 if ( ( abcd[2] & (7<<26)) == (7<<26) && // Check bits 26-28 of ecx a re all set,
128 (xgetbv(0) & 6 ) == 6 ){ // and check the OS support s XSAVE. 130 (xgetbv(0) & 6 ) == 6 ){ // and check the OS support s XSAVE.
129 Init_avx(); 131 Init_avx();
130 132
133 if (abcd[2] & (1<<29)) {
134 has_f16c = true;
135 }
136
131 // AVX2 additionally needs bit 5 set on ebx after calling cpuid(7). 137 // AVX2 additionally needs bit 5 set on ebx after calling cpuid(7).
132 uint32_t abcd7[] = {0,0,0,0}; 138 uint32_t abcd7[] = {0,0,0,0};
133 cpuid7(abcd7); 139 cpuid7(abcd7);
134 if (abcd7[1] & (1<<5)) { Init_avx2(); } 140 if (abcd7[1] & (1<<5)) { Init_avx2(); }
135 } 141 }
136 142
137 #elif !defined(SK_ARM_HAS_NEON) && \ 143 #elif !defined(SK_ARM_HAS_NEON) && \
138 defined(SK_CPU_ARM32) && \ 144 defined(SK_CPU_ARM32) && \
139 defined(SK_BUILD_FOR_ANDROID) && \ 145 defined(SK_BUILD_FOR_ANDROID) && \
140 !defined(SK_BUILD_FOR_ANDROID_FRAMEWORK) 146 !defined(SK_BUILD_FOR_ANDROID_FRAMEWORK)
141 if (android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) { Init_neon (); } 147 if (android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) { Init_neon (); }
142 #endif 148 #endif
143 } 149 }
144 150
145 SK_DECLARE_STATIC_ONCE(gInitOnce); 151 SK_DECLARE_STATIC_ONCE(gInitOnce);
146 void Init() { SkOnce(&gInitOnce, init); } 152 void Init() { SkOnce(&gInitOnce, init); }
147 153
148 #if SK_ALLOW_STATIC_GLOBAL_INITIALIZERS 154 #if SK_ALLOW_STATIC_GLOBAL_INITIALIZERS
149 static struct AutoInit { 155 static struct AutoInit {
150 AutoInit() { Init(); } 156 AutoInit() { Init(); }
151 } gAutoInit; 157 } gAutoInit;
152 #endif 158 #endif
153 } 159 }
OLDNEW
« src/core/SkOpts.h ('K') | « src/core/SkOpts.h ('k') | src/core/SkXfermodeU64.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698