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

Unified Diff: third_party/WebKit/Source/platform/graphics/ExpensiveCanvasHeuristicParameters.h

Issue 2141793002: Improving canvas 2D performance by switching graphics rendering pipeline. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use canvas2dFixedRenderingModeEnabled flag to disable feature in some tests and fix async issue. 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
Index: third_party/WebKit/Source/platform/graphics/ExpensiveCanvasHeuristicParameters.h
diff --git a/third_party/WebKit/Source/platform/graphics/ExpensiveCanvasHeuristicParameters.h b/third_party/WebKit/Source/platform/graphics/ExpensiveCanvasHeuristicParameters.h
index c69af79ad79cbd5e1a8301b0cb68d63984d62872..adfbace42edef227816ffe16a1e775f3e55b8287 100644
--- a/third_party/WebKit/Source/platform/graphics/ExpensiveCanvasHeuristicParameters.h
+++ b/third_party/WebKit/Source/platform/graphics/ExpensiveCanvasHeuristicParameters.h
@@ -69,6 +69,46 @@ enum {
}; // enum
+
+// Constants and Coefficients for 2D Canvas Dynamic Rendering Mode Switching
+// =========================================================================
+
+// Approximate relative costs of different types of operations for the
+// accelerated rendering pipeline and the recording rendering pipeline.
+// These costs were estimated experimentally based on the performance
+// of each pipeline in the animometer benchmark. Multiple factors influence
+// the true cost of each type of operation, including:
+// - The hardware configuration
+// - Version of the project
+// - Additional details about the operation:
+// - Subtype of operation (png vs svg image, arc vs line...)
+// - Scale
+// - Associated effects (patterns, gradients...)
+// The methodology for calculating/updating these coefficients can be found here:
+// https://docs.google.com/a/google.com/document/d/11pfwfyTb6cxLiNbhpVzO5Bx_s9_dPzljYmUS9OJ6FPk/edit?usp=sharing
Justin Novosad 2016/07/18 14:22:43 Not ideal to refer to a google doc here. Would be
sebastienlc 2016/07/18 20:43:07 Done. The way that the coefficients are estimated
+
+const double AcceleratedDrawPathApproximateCost = 0.004;
+const double AcceleratedGetImageDataApproximateCost = 0.1;
+const double AcceleratedDrawImageApproximateCost = 0.002;
+
+const double RecordingDrawPathApproximateCost = 0.0014;
+const double UnacceleratedGetImageDataApproximateCost = 0.001; // This cost is for non-display-list mode after fallback.
+const double RecordingDrawImageApproximateCost = 0.004;
+
+// Coefficient used in the isAccelerationOptimalForCanvasContent
+// heuristic to create a bias in the output.
+// If set to a value greater than 1, it creates a bias towards suggesting acceleration.
+// If set to a value smaller than 1, it creates a bias towards not suggesting acceleration
+// For example, if its value is 1.5, then disabling gpu acceleration will only be suggested if
+// recordingCost * 1.5 < acceleratedCost.
+const double AcceleratedHeuristicBias = 1.5;
+
+// Minimum number of frames that need to be rendered
+// before the rendering pipeline may be switched. Having this set
+// to more than 1 increases the sample size of usage data before a
+// decision is made, improving the accuracy of heuristics.
+const int MinFramesBeforeSwitch = 3;
+
} // namespace ExpensiveCanvasHeuristicParameters
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698