| OLD | NEW |
| 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 Loading... |
| 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 = 0, // Disabled for crbug.com/626188 | 68 GetImageDataForcesNoAcceleration = 0, // Disabled for crbug.com/626188 |
| 69 | 69 |
| 70 }; // enum | 70 }; // enum |
| 71 | 71 |
| 72 |
| 73 // Constants and Coefficients for 2D Canvas Dynamic Rendering Mode Switching |
| 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 // 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 |
| 91 const double AcceleratedDrawPathApproximateCost = 0.004; |
| 92 const double AcceleratedGetImageDataApproximateCost = 0.1; |
| 93 const double AcceleratedDrawImageApproximateCost = 0.002; |
| 94 |
| 95 const double RecordingDrawPathApproximateCost = 0.0014; |
| 96 const double UnacceleratedGetImageDataApproximateCost = 0.001; // This cost is
for non-display-list mode after fallback. |
| 97 const double RecordingDrawImageApproximateCost = 0.004; |
| 98 |
| 99 // Coefficient used in the isAccelerationOptimalForCanvasContent |
| 100 // heuristic to create a bias in the output. |
| 101 // If set to a value greater than 1, it creates a bias towards suggesting accele
ration. |
| 102 // If set to a value smaller than 1, it creates a bias towards not suggesting ac
celeration |
| 103 // For example, if its value is 1.5, then disabling gpu acceleration will only b
e suggested if |
| 104 // recordingCost * 1.5 < acceleratedCost. |
| 105 const double AcceleratedHeuristicBias = 1.5; |
| 106 |
| 107 // Minimum number of frames that need to be rendered |
| 108 // before the rendering pipeline may be switched. Having this set |
| 109 // to more than 1 increases the sample size of usage data before a |
| 110 // decision is made, improving the accuracy of heuristics. |
| 111 const int MinFramesBeforeSwitch = 3; |
| 112 |
| 72 } // namespace ExpensiveCanvasHeuristicParameters | 113 } // namespace ExpensiveCanvasHeuristicParameters |
| 73 | 114 |
| 74 } // namespace blink | 115 } // namespace blink |
| 75 | 116 |
| 76 #endif | 117 #endif |
| OLD | NEW |