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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/ExpensiveCanvasHeuristicParameters.h

Issue 2210123002: Improved heuristic for disable acceleration. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef ExpensiveCanvasHeuristicParameters_h 5 #ifndef ExpensiveCanvasHeuristicParameters_h
6 #define ExpensiveCanvasHeuristicParameters_h 6 #define ExpensiveCanvasHeuristicParameters_h
7 7
8 namespace blink { 8 namespace blink {
9 9
10 namespace ExpensiveCanvasHeuristicParameters { 10 namespace ExpensiveCanvasHeuristicParameters {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 GetImageDataForcesNoAcceleration = 1, 68 GetImageDataForcesNoAcceleration = 1,
69 69
70 }; // enum 70 }; // enum
71 71
72 72
73 // Constants and Coefficients for 2D Canvas Dynamic Rendering Mode Switching 73 // Constants and Coefficients for 2D Canvas Dynamic Rendering Mode Switching
74 // ========================================================================= 74 // =========================================================================
75 75
76 // Approximate relative costs of different types of operations for the 76 // Approximate relative costs of different types of operations for the
77 // accelerated rendering pipeline and the recording rendering pipeline. 77 // accelerated rendering pipeline and the recording rendering pipeline.
78 // These costs were estimated experimentally based on the performance 78 // These costs were estimated experimentally using the tools located in the
79 // of each pipeline in the animometer benchmark. Multiple factors influence 79 // third_party/WebKit/Source/modules/canvas2d/performance_analysis directory.
80 // the true cost of each type of operation, including:
81 // - The hardware configuration
82 // - Version of the project
83 // - Additional details about the operation:
84 // - Subtype of operation (png vs svg image, arc vs line...)
85 // - Scale
86 // - Associated effects (patterns, gradients...)
87 // The coefficients are equal to 1/n, where n is equal to the number of calls
88 // of a type that can be performed in each frame while maintaining
89 // 50 frames per second. They were estimated using the animometer benchmark.
90 80
91 const double AcceleratedDrawPathApproximateCost = 0.004; 81 // The RenderingModeCostIndex enum is used to access the heuristic coefficients that correspond
92 const double AcceleratedGetImageDataApproximateCost = 0.1; 82 // to a given rendering mode. For exmaple, FillRectFixedCost[RecordingModeIndex] is the estimated
93 const double AcceleratedDrawImageApproximateCost = 0.002; 83 // fixed cost for FillRect in recording mode.
84 enum RenderingModeCostIndex {
85 RecordingModeIndex = 0,
86 AcceleratedModeIndex = 1,
87 NumRederingModesCostIdexes = 2
88 };
94 89
95 const double RecordingDrawPathApproximateCost = 0.0014; 90 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.
96 const double UnacceleratedGetImageDataApproximateCost = 0.001; // This cost is for non-display-list mode after fallback. 91 const double FillConvexPathFixedCost[NumRederingModesCostIdexes] = {1.251e-02, 1 .231e-02};
97 const double RecordingDrawImageApproximateCost = 0.004; 92 const double FillNonConvexPathFixedCost[NumRederingModesCostIdexes] = {1.714e-02 , 4.497e-02};
93 const double FillTextFixedCost[NumRederingModesCostIdexes] = {1.119e-02, 2.203e- 02};
98 94
99 // Coefficient used in the isAccelerationOptimalForCanvasContent 95 const double StrokeRectFixedCost[NumRederingModesCostIdexes] = {1.485e-02, 7.287 e-03};
100 // heuristic to create a bias in the output. 96 const double StrokePathFixedCost[NumRederingModesCostIdexes] = {2.390e-02, 5.125 e-02};
101 // If set to a value greater than 1, it creates a bias towards suggesting accele ration. 97 const double StrokeTextFixedCost[NumRederingModesCostIdexes] = {1.149e-02, 1.742 e-02};
102 // If set to a value smaller than 1, it creates a bias towards not suggesting ac celeration 98
103 // For example, if its value is 1.5, then disabling gpu acceleration will only b e suggested if 99 const double FillRectVariableCostPerArea[NumRederingModesCostIdexes] = {2.933e-0 7, 2.188e-09};
104 // recordingCost * 1.5 < acceleratedCost. 100 const double FillConvexPathVariableCostPerArea[NumRederingModesCostIdexes] = {7. 871e-07, 1.608e-07};
105 const double AcceleratedHeuristicBias = 1.5; 101 const double FillNonConvexPathVariableCostPerArea[NumRederingModesCostIdexes] = {8.336e-07, 1.384e-06};
102 const double FillTextVariableCostPerArea[NumRederingModesCostIdexes] = {1.411e-0 6, 0.0};
103
104 const double StrokeRectVariableCostPerArea[NumRederingModesCostIdexes] = {9.882e -07, 0.0};
105 const double StrokePathVariableCostPerArea[NumRederingModesCostIdexes] = {1.583e -06, 2.401e-06};
106 const double StrokeTextVariableCostPerArea[NumRederingModesCostIdexes] = {1.530e -06, 6.699e-07};
107
108 const double PatternFillTypeFixedCost[NumRederingModesCostIdexes] = {1.377e-02 , 1.035e-02};
109 const double LinearGradientFillTypeFixedCost[NumRederingModesCostIdexes] = {7.69 4e-03, 6.900e-03};
110 const double RadialGradientFillTypeFixedCost[NumRederingModesCostIdexes] = {2.26 0e-02, 7.193e-03};
111
112 const double PatternFillTypeVariableCostPerArea[NumRederingModesCostIdexes] = {6 .080e-07, 0.0};
113 const double LinearGradientFillVariableCostPerArea[NumRederingModesCostIdexes] = {9.635e-07, 0.0};
114 const double RadialGradientFillVariableCostPerArea[NumRederingModesCostIdexes] = {6.662e-06, 0.0};
115
116 const double ShadowFixedCost[NumRederingModesCostIdexes] = {2.502e-02, 2.274e-02 };
117 const double ShadowVariableCostPerAreaTimesShadowBlurSquared[NumRederingModesCos tIdexes] = {6.856e-09, 0.0};
118
119 const double PutImageDataFixedCost[NumRederingModesCostIdexes] = {1.209e-03, 1.8 85e-02};
120 const double PutImageDataVariableCostPerArea[NumRederingModesCostIdexes] = {6.23 1e-06, 4.116e-06};
121
122 const double DrawSVGImageFixedCost[NumRederingModesCostIdexes] = {1.431e-01, 2.9 58e-01};
123 const double DrawPNGImageFixedCost[NumRederingModesCostIdexes] = {1.278e-02, 1.3 06e-02};
124
125 const double DrawSVGImageVariableCostPerArea[NumRederingModesCostIdexes] = {1.03 0e-05, 4.463e-06};
126 const double DrawPNGImageVariableCostPerArea[NumRederingModesCostIdexes] = {1.72 7e-06, 0.0};
127
128 // Two conditions must be met before the isAccelerationOptimalForCanvasContent h euristics recommends
129 // switching out of the accelerated mode.
130 // 1. The difference in estimated cost per frame is larger than MinCostPerFram eImprovementToSuggestDisableAcceleration.
131 // This ensures that the overhead involved in a switch of rendering mode an d the risk of making a wrong decision
132 // are justified by a large expected increased performance.
133 // 2. The percent reduction in rendering cost is larger than MinPercentageImpr ovementToSuggestDisableAcceleration.
134 // This ensures that there is a high level of confidence that the performan ce would be improved in recording mode.
135 const double MinCostPerFrameImprovementToSuggestDisableAcceleration = 15;
136 const double MinPercentageImprovementToSuggestDisableAcceleration = 30;
106 137
107 // Minimum number of frames that need to be rendered 138 // Minimum number of frames that need to be rendered
108 // before the rendering pipeline may be switched. Having this set 139 // before the rendering pipeline may be switched. Having this set
109 // to more than 1 increases the sample size of usage data before a 140 // to more than 1 increases the sample size of usage data before a
110 // decision is made, improving the accuracy of heuristics. 141 // decision is made, improving the accuracy of heuristics.
111 const int MinFramesBeforeSwitch = 3; 142 const int MinFramesBeforeSwitch = 3;
112 143
113 } // namespace ExpensiveCanvasHeuristicParameters 144 } // namespace ExpensiveCanvasHeuristicParameters
114 145
115 } // namespace blink 146 } // namespace blink
116 147
117 #endif 148 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698