diff options
author | Leon Scroggins III <scroggo@google.com> | 2018-05-23 16:12:32 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-05-23 20:49:41 +0000 |
commit | 1530f390087e48bd88981eeee69086ef9a52c243 (patch) | |
tree | 762d53a8e096c862c8920f0a8109d3952ef3d1df /src/codec | |
parent | 5dd3fccb3c7d9fce2663803a1284734237d8546d (diff) |
Make DNG decodes single threaded on Android
Bug: 78878033
Test: testWarpedDng in CtsGraphicsTestCases
Previously this was set to 4 threads. For some images, this requires
allocating close to 2 GB of memory. This is not something we can support
on all devices. Unfortunately, we cannot tell the difference between
images that will allocate so much memory, so just use one thread all the
time.
Change-Id: I9fb9a65af97efd63fac8f6b282525ff3b650968d
Reviewed-on: https://skia-review.googlesource.com/129840
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
Auto-Submit: Leon Scroggins <scroggo@google.com>
Diffstat (limited to 'src/codec')
-rw-r--r-- | src/codec/SkRawCodec.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/codec/SkRawCodec.cpp b/src/codec/SkRawCodec.cpp index bc3efcbf5f..9eea78cf4b 100644 --- a/src/codec/SkRawCodec.cpp +++ b/src/codec/SkRawCodec.cpp @@ -134,14 +134,12 @@ public: uint32 PerformAreaTaskThreads() override { #ifdef SK_BUILD_FOR_ANDROID - // According to https://codereview.chromium.org/1634763002/diff/20001/src/codec/SkRawCodec.cpp#newcode71, - // having more tasks than CPU threads typically helps performance due - // to uneven task runtime. Today's Android devices tend to only have two - // cores, so above two should be enough. Too many threads raises the risk - // of running out of memory, as each task may allocate a large amount of - // memory, so keep this low. This value allows a marlin to decode a - // memory-intensive dng file successfully. - return 4; + // Only use 1 thread. DNGs with the warp effect require a lot of memory, + // and the amount of memory required scales linearly with the number of + // threads. The sample used in CTS requires over 500 MB, so even two + // threads is significantly expensive. There is no good way to tell + // whether the image has the warp effect. + return 1; #else return kMaxMPThreads; #endif |