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

Unified Diff: cc/playback/raster_source.cc

Issue 2179003003: cc: disable denorm handling before calling into Skia's filter code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add the "flush to zero" flag as well. Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/playback/raster_source.cc
diff --git a/cc/playback/raster_source.cc b/cc/playback/raster_source.cc
index f38f9dd08ff7c8dcdd74f8f239360860c9879aa0..c2fd7fcf9f8444a44f960d4feff5e3be9284edeb 100644
--- a/cc/playback/raster_source.cc
+++ b/cc/playback/raster_source.cc
@@ -5,6 +5,9 @@
#include "cc/playback/raster_source.h"
#include <stddef.h>
+#ifdef __SSE__
+#include <xmmintrin.h>
+#endif
#include "base/trace_event/trace_event.h"
#include "cc/base/region.h"
@@ -73,6 +76,12 @@ void RasterSource::PlaybackToCanvas(SkCanvas* raster_canvas,
if (!canvas_playback_rect.IsEmpty() &&
!raster_bounds.intersect(gfx::RectToSkIRect(canvas_playback_rect)))
return;
+#ifdef __SSE__
+ // Turn on "subnormals are zero" and "flush to zero" CSR flags for
+ // performance.
+ unsigned int csr = _mm_getcsr();
+ _mm_setcsr(csr | 0x8040);
+#endif
piman 2016/07/25 20:28:40 This may be needed in more places - e.g. software
raster_canvas->save();
raster_canvas->translate(-canvas_bitmap_rect.x(), -canvas_bitmap_rect.y());
@@ -80,6 +89,9 @@ void RasterSource::PlaybackToCanvas(SkCanvas* raster_canvas,
raster_canvas->scale(contents_scale, contents_scale);
PlaybackToCanvas(raster_canvas, settings);
raster_canvas->restore();
+#ifdef __SSE__
+ _mm_setcsr(csr);
+#endif
}
void RasterSource::PlaybackToCanvas(SkCanvas* raster_canvas,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698