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

Side by Side 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: Addressing comments 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 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 // failure of subsequent allocations required for double buffering. 62 // failure of subsequent allocations required for double buffering.
63 PreferDisplayListOverGpuSizeThreshold = 4096 * 4096, 63 PreferDisplayListOverGpuSizeThreshold = 4096 * 4096,
64 64
65 // Disable Acceleration heuristic parameters 65 // Disable Acceleration heuristic parameters
66 //=========================================== 66 //===========================================
67 67
68 GetImageDataForcesNoAcceleration = 1, 68 GetImageDataForcesNoAcceleration = 1,
69 69
70 }; // enum 70 }; // enum
71 71
72
73 // Constants and Coefficients for 2D Canvas Dynamic Rendering Mode
74 // ===============================================================
75
76 // Approximate relative costs of different types of operations for the
77 // accelerated rendering pipeline and the recording rendering pipeline.
78 // These costs were estimated experimentally based on the performance
79 // of each pipeline in the animometer benchmark. Multiple factors influence
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
88 const double AcceleratedDrawPathApproximateCost = 0.004;
Stephen White 2016/07/14 18:53:05 Could you put the methodology you used to create t
sebastienlc 2016/07/14 22:26:53 Done.
89 const double AcceleratedGetImageDataApproximateCost = 0.1;
90 const double AcceleratedDrawImageApproximateCost = 0.002;
91
92 const double RecordingDrawPathApproximateCost = 0.0014;
Stephen White 2016/07/14 18:53:05 Bikeshedding on names a bit: I'm not sure I like t
sebastienlc 2016/07/14 22:26:53 Done.
93 const double RecordingGetImageDataApproximateCost = 0.001;
Stephen White 2016/07/14 18:53:04 I'm a little confused about GetImageData in "Recor
sebastienlc 2016/07/14 22:26:53 Done.
94 const double RecordingDrawImageApproximateCost = 0.004;
95
96 // Coefficient used in the isAccelerationOptimalForCanvasContent
97 // heuristic to create a bias in the output.
98 // If set to a value greater than 1, it creates a bias towards suggesting accele ration.
99 // If set to a value smaller than 1, it creates a bias towards not suggesting ac celeration
100 // For example, if its value is 1.5, then disabling gpu acceleration will only b e suggested if
101 // recordingCost * 1.5 < acceleratedCost.
102 const double AcceleratedHeuristicBias = 1.5;
103
104 // Minimum number of frames that need to be rendered
105 // before the rendering pipeline may be switched. Having this set
106 // to more than 1 increases the sample size of usage data before a
107 // decision is made, improving the accuracy of heuristics.
108 const int MinFramesBeforeSwitch = 3;
109
72 } // namespace ExpensiveCanvasHeuristicParameters 110 } // namespace ExpensiveCanvasHeuristicParameters
73 111
74 } // namespace blink 112 } // namespace blink
75 113
76 #endif 114 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698