Bug 1189593 - Only use SSE2 in image::Downscaler if we're running on an SSE2-capable machine. r=tn
authorSeth Fowler <mark.seth.fowler@gmail.com>
Thu, 30 Jul 2015 19:48:22 -0700
changeset 287233 4a0e7714b3ce5c964598dda08b988ed67d4059ac
parent 287232 3f05126269cbbd385f6aa43263a2637cc78d7427
child 287234 fb2a27db76bc5a570c482cb900fa439402c74a9d
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstn
bugs1189593
milestone42.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1189593 - Only use SSE2 in image::Downscaler if we're running on an SSE2-capable machine. r=tn
image/Downscaler.cpp
--- a/image/Downscaler.cpp
+++ b/image/Downscaler.cpp
@@ -5,16 +5,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "Downscaler.h"
 
 #include <algorithm>
 #include <ctime>
 #include "gfxPrefs.h"
 #include "image_operations.h"
+#include "mozilla/SSE.h"
 #include "convolver.h"
 #include "skia/include/core/SkTypes.h"
 
 using std::max;
 using std::swap;
 
 namespace mozilla {
 namespace image {
@@ -154,17 +155,17 @@ Downscaler::CommitRow()
   GetFilterOffsetAndLength(mYFilter, mCurrentOutLine,
                            &filterOffset, &filterLength);
 
   int32_t inLineToRead = filterOffset + mLinesInBuffer;
   MOZ_ASSERT(mCurrentInLine <= inLineToRead, "Reading past end of input");
   if (mCurrentInLine == inLineToRead) {
     skia::ConvolveHorizontally(mRowBuffer.get(), *mXFilter,
                                mWindow[mLinesInBuffer++], mHasAlpha,
-                               /* use_sse2 = */ true);
+                               supports_sse2());
   }
 
   MOZ_ASSERT(mCurrentOutLine < mTargetSize.height,
              "Writing past end of output");
 
   while (mLinesInBuffer == filterLength) {
     DownscaleInputLine();
 
@@ -221,17 +222,17 @@ Downscaler::DownscaleInputLine()
   MOZ_ASSERT(mCurrentOutLine < mYFilter->num_values());
   auto filterValues =
     mYFilter->FilterForValue(mCurrentOutLine, &filterOffset, &filterLength);
 
   uint8_t* outputLine =
     &mOutputBuffer[mCurrentOutLine * mTargetSize.width * sizeof(uint32_t)];
   skia::ConvolveVertically(static_cast<const FilterValue*>(filterValues),
                            filterLength, mWindow.get(), mXFilter->num_values(),
-                           outputLine, mHasAlpha, /* use_sse2 = */ true);
+                           outputLine, mHasAlpha, supports_sse2());
 
   mCurrentOutLine += 1;
 
   if (mCurrentOutLine == mTargetSize.height) {
     // We're done.
     return;
   }