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

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: Disable trackDrawCall when Canvas 2D Dynamic Rendering Mode Switching is disabled 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
« no previous file with comments | « third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2DUsageTrackingTest.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 float FillRectFixedCost[NumRederingModesCostIdexes] = {6.190e-03f, 7.715e- 03f};
96 const double UnacceleratedGetImageDataApproximateCost = 0.001; // This cost is for non-display-list mode after fallback. 91 const float FillConvexPathFixedCost[NumRederingModesCostIdexes] = {1.251e-02f, 1 .231e-02f};
97 const double RecordingDrawImageApproximateCost = 0.004; 92 const float FillNonConvexPathFixedCost[NumRederingModesCostIdexes] = {1.714e-02f , 4.497e-02f};
93 const float FillTextFixedCost[NumRederingModesCostIdexes] = {1.119e-02f, 2.203e- 02f};
98 94
99 // Coefficient used in the isAccelerationOptimalForCanvasContent 95 const float StrokeRectFixedCost[NumRederingModesCostIdexes] = {1.485e-02f, 7.287 e-03f};
100 // heuristic to create a bias in the output. 96 const float StrokePathFixedCost[NumRederingModesCostIdexes] = {2.390e-02f, 5.125 e-02f};
101 // If set to a value greater than 1, it creates a bias towards suggesting accele ration. 97 const float StrokeTextFixedCost[NumRederingModesCostIdexes] = {1.149e-02f, 1.742 e-02f};
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 float FillRectVariableCostPerArea[NumRederingModesCostIdexes] = {2.933e-07 f, 2.188e-09f};
104 // recordingCost * 1.5 < acceleratedCost. 100 const float FillConvexPathVariableCostPerArea[NumRederingModesCostIdexes] = {7.8 71e-07f, 1.608e-07f};
105 const double AcceleratedHeuristicBias = 1.5; 101 const float FillNonConvexPathVariableCostPerArea[NumRederingModesCostIdexes] = { 8.336e-07f, 1.384e-06f};
102 const float FillTextVariableCostPerArea[NumRederingModesCostIdexes] = {1.411e-06 f, 0.0f};
103
104 const float StrokeRectVariableCostPerArea[NumRederingModesCostIdexes] = {9.882e- 07f, 0.0f};
105 const float StrokePathVariableCostPerArea[NumRederingModesCostIdexes] = {1.583e- 06f, 2.401e-06f};
106 const float StrokeTextVariableCostPerArea[NumRederingModesCostIdexes] = {1.530e- 06f, 6.699e-07f};
107
108 const float PatternFillTypeFixedCost[NumRederingModesCostIdexes] = {1.377e-02f, 1.035e-02f};
109 const float LinearGradientFillTypeFixedCost[NumRederingModesCostIdexes] = {7.694 e-03f, 6.900e-03f};
110 const float RadialGradientFillTypeFixedCost[NumRederingModesCostIdexes] = {2.260 e-02f, 7.193e-03f};
111
112 const float PatternFillTypeVariableCostPerArea[NumRederingModesCostIdexes] = {6. 080e-07f, 0.0f};
113 const float LinearGradientFillVariableCostPerArea[NumRederingModesCostIdexes] = {9.635e-07f, 0.0f};
114 const float RadialGradientFillVariableCostPerArea[NumRederingModesCostIdexes] = {6.662e-06f, 0.0f};
115
116 const float ShadowFixedCost[NumRederingModesCostIdexes] = {2.502e-02f, 2.274e-02 f};
117 const float ShadowVariableCostPerAreaTimesShadowBlurSquared[NumRederingModesCost Idexes] = {6.856e-09f, 0.0f};
118
119 const float PutImageDataFixedCost[NumRederingModesCostIdexes] = {1.209e-03f, 1.8 85e-02f};
120 const float PutImageDataVariableCostPerArea[NumRederingModesCostIdexes] = {6.231 e-06f, 4.116e-06f};
121
122 const float DrawSVGImageFixedCost[NumRederingModesCostIdexes] = {1.431e-01f, 2.9 58e-01f};
123 const float DrawPNGImageFixedCost[NumRederingModesCostIdexes] = {1.278e-02f, 1.3 06e-02f};
124
125 const float DrawSVGImageVariableCostPerArea[NumRederingModesCostIdexes] = {1.030 e-05f, 4.463e-06f};
126 const float DrawPNGImageVariableCostPerArea[NumRederingModesCostIdexes] = {1.727 e-06f, 0.0f};
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 float MinCostPerFrameImprovementToSuggestDisableAcceleration = 15.0f;
136 const float MinPercentageImprovementToSuggestDisableAcceleration = 30.0f;
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
« no previous file with comments | « third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2DUsageTrackingTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698