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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 // management becomes measurably expensive. | 53 // management becomes measurably expensive. |
54 ExpensiveRecordingStackDepth = 50, | 54 ExpensiveRecordingStackDepth = 50, |
55 | 55 |
56 // GPU vs. display list heuristic parameters | 56 // GPU vs. display list heuristic parameters |
57 //=========================================== | 57 //=========================================== |
58 | 58 |
59 // Pixel count beyond which we should always prefer to use display | 59 // Pixel count beyond which we should always prefer to use display |
60 // lists. Rationale: The allocation of large textures for canvas | 60 // lists. Rationale: The allocation of large textures for canvas |
61 // tends to starve the compositor, and increase the probability of | 61 // tends to starve the compositor, and increase the probability of |
62 // failure of subsequent allocations required for double buffering. | 62 // failure of subsequent allocations required for double buffering. |
63 PreferDisplayListOverGpuSizeThreshold = 4096 * 4096, | 63 PreferDisplayListOverGpuSizeThreshold = 8096 * 4096, |
64 | 64 |
65 // Disable Acceleration heuristic parameters | 65 // Disable Acceleration heuristic parameters |
66 //=========================================== | 66 //=========================================== |
67 | 67 |
68 GetImageDataForcesNoAcceleration = 1, | |
69 | |
70 // When a canvas is used as a source image, if its destination is | |
71 // non-accelerated and the source canvas is accelerated, a readback | |
72 // from the gpu is necessary. This option causes the source canvas to | |
73 // switch to non-accelerated when this situation is encountered to | |
74 // prevent future canvas-to-canvas draws from requiring a readback. | |
75 DisableAccelerationToAvoidReadbacks = 1, | |
76 | |
77 // When drawing very large images to canvases, there is a point where | 68 // When drawing very large images to canvases, there is a point where |
78 // GPU acceleration becomes inefficient due to texture upload overhead, | 69 // GPU acceleration becomes inefficient due to texture upload overhead, |
79 // especially when the image is large enough that it is likely to | 70 // especially when the image is large enough that it is likely to |
80 // monopolize the texture cache, and when it is being downsized to the | 71 // monopolize the texture cache, and when it is being downsized to the |
81 // point that few of the upload texels are actually sampled. When both | 72 // point that few of the upload texels are actually sampled. When both |
82 // of these conditions are met, we disable acceleration. | 73 // of these conditions are met, we disable acceleration. |
83 DrawImageTextureUploadSoftSizeLimit = 4096 * 4096, | 74 DrawImageTextureUploadSoftSizeLimit = 4096 * 4096, |
84 DrawImageTextureUploadSoftSizeLimitScaleThreshold = 4, | 75 DrawImageTextureUploadSoftSizeLimitScaleThreshold = 4, |
85 DrawImageTextureUploadHardSizeLimit = 8192 * 8192, | 76 DrawImageTextureUploadHardSizeLimit = 8192 * 8192, |
86 | 77 |
| 78 // GPU readback prevention heuristics |
| 79 //==================================== |
| 80 |
| 81 GetImageDataForcesNoAcceleration = 1, |
| 82 |
| 83 // When a canvas is used as a source image, if its destination is |
| 84 // non-accelerated and the source canvas is accelerated, a readback |
| 85 // from the gpu is necessary. This option causes the source canvas to |
| 86 // switch to non-accelerated when this situation is encountered to |
| 87 // prevent future canvas-to-canvas draws from requiring a readback. |
| 88 DisableAccelerationToAvoidReadbacks = 0, |
| 89 |
| 90 // See description of DisableAccelerationToAvoidReadbacks. This is the |
| 91 // opposite strategy : accelerate the destination canvas. If both |
| 92 // EnableAccelerationToAvoidReadbacks and |
| 93 // DisableAccelerationToAvoidReadbacks are specified, we try to enable |
| 94 // acceleration on the destination first. If that does not succeed, |
| 95 // we disable acceleration on the source canvas. Either way, future |
| 96 // readbacks are prevented. |
| 97 EnableAccelerationToAvoidReadbacks = 1, |
| 98 |
87 }; // enum | 99 }; // enum |
88 | 100 |
89 // Constants and Coefficients for 2D Canvas Dynamic Rendering Mode Switching | 101 // Constants and Coefficients for 2D Canvas Dynamic Rendering Mode Switching |
90 // ========================================================================= | 102 // ========================================================================= |
91 | 103 |
92 // Approximate relative costs of different types of operations for the | 104 // Approximate relative costs of different types of operations for the |
93 // accelerated rendering pipeline and the recording rendering pipeline. | 105 // accelerated rendering pipeline and the recording rendering pipeline. |
94 // These costs were estimated experimentally using the tools located in the | 106 // These costs were estimated experimentally using the tools located in the |
95 // third_party/WebKit/Source/modules/canvas2d/performance_analysis directory. | 107 // third_party/WebKit/Source/modules/canvas2d/performance_analysis directory. |
96 | 108 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 // before the rendering pipeline may be switched. Having this set | 202 // before the rendering pipeline may be switched. Having this set |
191 // to more than 1 increases the sample size of usage data before a | 203 // to more than 1 increases the sample size of usage data before a |
192 // decision is made, improving the accuracy of heuristics. | 204 // decision is made, improving the accuracy of heuristics. |
193 const int MinFramesBeforeSwitch = 3; | 205 const int MinFramesBeforeSwitch = 3; |
194 | 206 |
195 } // namespace ExpensiveCanvasHeuristicParameters | 207 } // namespace ExpensiveCanvasHeuristicParameters |
196 | 208 |
197 } // namespace blink | 209 } // namespace blink |
198 | 210 |
199 #endif | 211 #endif |
OLD | NEW |