Chromium Code Reviews| 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 50a022e181d6410e810500203dea0568823d9729..146611609684be409c06138b08aa4ffb98f6a0d3 100644 |
| --- a/third_party/WebKit/Source/platform/graphics/ExpensiveCanvasHeuristicParameters.h |
| +++ b/third_party/WebKit/Source/platform/graphics/ExpensiveCanvasHeuristicParameters.h |
| @@ -75,34 +75,65 @@ enum { |
| // 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 coefficients are equal to 1/n, where n is equal to the number of calls |
| -// of a type that can be performed in each frame while maintaining |
| -// 50 frames per second. They were estimated using the animometer benchmark. |
| - |
| -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; |
| +// These costs were estimated experimentally using the tools located in the |
| +// third_party/WebKit/Source/modules/canvas2d/performance_analysis directory. |
| + |
| +// The RenderingModeCostIndex enum is used to access the heuristic coefficients that correspond |
| +// to a given rendering mode. For exmaple, FillRectFixedCost[RecordingModeIndex] is the estimated |
| +// fixed cost for FillRect in recording mode. |
| +enum RenderingModeCostIndex { |
| + RecordingModeIndex = 0, |
| + AcceleratedModeIndex = 1, |
| + NumRederingModesCostIdexes = 2 |
| +}; |
| + |
| +const double FillRectFixedCost[NumRederingModesCostIdexes] = {6.190e-03, 7.715e-03}; |
|
Justin Novosad
2016/08/04 15:53:17
let's make these floats.
sebastienlc
2016/08/04 16:36:27
Done.
|
| +const double FillConvexPathFixedCost[NumRederingModesCostIdexes] = {1.251e-02, 1.231e-02}; |
| +const double FillNonConvexPathFixedCost[NumRederingModesCostIdexes] = {1.714e-02, 4.497e-02}; |
| +const double FillTextFixedCost[NumRederingModesCostIdexes] = {1.119e-02, 2.203e-02}; |
| + |
| +const double StrokeRectFixedCost[NumRederingModesCostIdexes] = {1.485e-02, 7.287e-03}; |
| +const double StrokePathFixedCost[NumRederingModesCostIdexes] = {2.390e-02, 5.125e-02}; |
| +const double StrokeTextFixedCost[NumRederingModesCostIdexes] = {1.149e-02, 1.742e-02}; |
| + |
| +const double FillRectVariableCostPerArea[NumRederingModesCostIdexes] = {2.933e-07, 2.188e-09}; |
| +const double FillConvexPathVariableCostPerArea[NumRederingModesCostIdexes] = {7.871e-07, 1.608e-07}; |
| +const double FillNonConvexPathVariableCostPerArea[NumRederingModesCostIdexes] = {8.336e-07, 1.384e-06}; |
| +const double FillTextVariableCostPerArea[NumRederingModesCostIdexes] = {1.411e-06, 0.0}; |
| + |
| +const double StrokeRectVariableCostPerArea[NumRederingModesCostIdexes] = {9.882e-07, 0.0}; |
| +const double StrokePathVariableCostPerArea[NumRederingModesCostIdexes] = {1.583e-06, 2.401e-06}; |
| +const double StrokeTextVariableCostPerArea[NumRederingModesCostIdexes] = {1.530e-06, 6.699e-07}; |
| + |
| +const double PatternFillTypeFixedCost[NumRederingModesCostIdexes] = {1.377e-02 , 1.035e-02}; |
| +const double LinearGradientFillTypeFixedCost[NumRederingModesCostIdexes] = {7.694e-03, 6.900e-03}; |
| +const double RadialGradientFillTypeFixedCost[NumRederingModesCostIdexes] = {2.260e-02, 7.193e-03}; |
| + |
| +const double PatternFillTypeVariableCostPerArea[NumRederingModesCostIdexes] = {6.080e-07, 0.0}; |
| +const double LinearGradientFillVariableCostPerArea[NumRederingModesCostIdexes] = {9.635e-07, 0.0}; |
| +const double RadialGradientFillVariableCostPerArea[NumRederingModesCostIdexes] = {6.662e-06, 0.0}; |
| + |
| +const double ShadowFixedCost[NumRederingModesCostIdexes] = {2.502e-02, 2.274e-02}; |
| +const double ShadowVariableCostPerAreaTimesShadowBlurSquared[NumRederingModesCostIdexes] = {6.856e-09, 0.0}; |
| + |
| +const double PutImageDataFixedCost[NumRederingModesCostIdexes] = {1.209e-03, 1.885e-02}; |
| +const double PutImageDataVariableCostPerArea[NumRederingModesCostIdexes] = {6.231e-06, 4.116e-06}; |
| + |
| +const double DrawSVGImageFixedCost[NumRederingModesCostIdexes] = {1.431e-01, 2.958e-01}; |
| +const double DrawPNGImageFixedCost[NumRederingModesCostIdexes] = {1.278e-02, 1.306e-02}; |
| + |
| +const double DrawSVGImageVariableCostPerArea[NumRederingModesCostIdexes] = {1.030e-05, 4.463e-06}; |
| +const double DrawPNGImageVariableCostPerArea[NumRederingModesCostIdexes] = {1.727e-06, 0.0}; |
| + |
| +// Two conditions must be met before the isAccelerationOptimalForCanvasContent heuristics recommends |
| +// switching out of the accelerated mode. |
| +// 1. The difference in estimated cost per frame is larger than MinCostPerFrameImprovementToSuggestDisableAcceleration. |
| +// This ensures that the overhead involved in a switch of rendering mode and the risk of making a wrong decision |
| +// are justified by a large expected increased performance. |
| +// 2. The percent reduction in rendering cost is larger than MinPercentageImprovementToSuggestDisableAcceleration. |
| +// This ensures that there is a high level of confidence that the performance would be improved in recording mode. |
| +const double MinCostPerFrameImprovementToSuggestDisableAcceleration = 15; |
| +const double MinPercentageImprovementToSuggestDisableAcceleration = 30; |
| // Minimum number of frames that need to be rendered |
| // before the rendering pipeline may be switched. Having this set |