aboutsummaryrefslogtreecommitdiffhomepage
path: root/third_party/zlib
diff options
context:
space:
mode:
authorGravatar Mike Klein <mtklein@chromium.org>2017-03-22 22:50:02 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-03-23 13:36:31 +0000
commitec3bdbb63950917edbc9315dac7bb390da2b321d (patch)
treedc790def94ba95cb11631c8ad6a21922c0e30b32 /third_party/zlib
parent4f358be6b72cca97856b3f59d83448650d359d93 (diff)
Turn on x86-specific code when building zlib.
The zlib source we DEPS in for testing has been patched with x86 optimizations, some requring SSE2, some SSE4.2, and some PCLMULQDQ (between SSE4.2 and AVX). Might as well turn them on? zlib actually boils everything down into one do-we-have-everything bit. That's a little weird... I don't see any real reason not to use fill_window_sse() on a machine with SSE2 but not SSE4.2. Whatever. While tweaking libpng settings is really where it's at to make PNG encoding faster, this is kind of a nice little cherry on top. Won't help people who are using their own zlib, of course. BUG=skia:6409 Change-Id: I459689069f7559365a66d0d29b33664907704d8e Reviewed-on: https://skia-review.googlesource.com/10033 Reviewed-by: Matt Sarett <msarett@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
Diffstat (limited to 'third_party/zlib')
-rw-r--r--third_party/zlib/BUILD.gn25
1 files changed, 24 insertions, 1 deletions
diff --git a/third_party/zlib/BUILD.gn b/third_party/zlib/BUILD.gn
index 00eb327590..3f9bc5c7c8 100644
--- a/third_party/zlib/BUILD.gn
+++ b/third_party/zlib/BUILD.gn
@@ -17,6 +17,9 @@ if (skia_use_system_zlib) {
third_party("zlib") {
public_include_dirs = [ "../externals/zlib" ]
+ deps = [
+ ":zlib_x86",
+ ]
sources = [
"../externals/zlib/adler32.c",
"../externals/zlib/compress.c",
@@ -30,10 +33,30 @@ if (skia_use_system_zlib) {
"../externals/zlib/inffast.c",
"../externals/zlib/inflate.c",
"../externals/zlib/inftrees.c",
- "../externals/zlib/simd_stub.c",
"../externals/zlib/trees.c",
"../externals/zlib/uncompr.c",
"../externals/zlib/zutil.c",
]
}
}
+
+third_party("zlib_x86") {
+ public_include_dirs = []
+ if (target_cpu == "x86" || target_cpu == "x64") {
+ sources = [
+ "../externals/zlib/crc_folding.c",
+ "../externals/zlib/fill_window_sse.c",
+ "../externals/zlib/x86.c",
+ ]
+ if (!is_win) {
+ cflags_c = [
+ "-msse4.2",
+ "-mpclmul",
+ ]
+ }
+ } else {
+ sources = [
+ "../externals/zlib/simd_stub.c",
+ ]
+ }
+}