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

Unified Diff: third_party/WebKit/Source/platform/graphics/ExpensiveCanvasHeuristicParameters.h

Issue 2903053002: Removing canvas rendering mode switching feature (Closed)
Patch Set: fix test failure Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/graphics/ExpensiveCanvasHeuristicParameters.h
diff --git a/third_party/WebKit/Source/platform/graphics/ExpensiveCanvasHeuristicParameters.h b/third_party/WebKit/Source/platform/graphics/ExpensiveCanvasHeuristicParameters.h
deleted file mode 100644
index 18fea7254e8aa70a6b93bc884a47c21dee972c7d..0000000000000000000000000000000000000000
--- a/third_party/WebKit/Source/platform/graphics/ExpensiveCanvasHeuristicParameters.h
+++ /dev/null
@@ -1,216 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef ExpensiveCanvasHeuristicParameters_h
-#define ExpensiveCanvasHeuristicParameters_h
-
-namespace blink {
-
-namespace ExpensiveCanvasHeuristicParameters {
-
-enum {
- // Layer promotion heuristic parameters
- //======================================
-
- // FIXME (crbug.com/463239):
- // The Layer promotion heuristics should go away after slimming paint
- // is completely phased in and display list canvases are modified to
- // use a lightweight layering primitive instead of the
- // SkCanvas::saveLayer.
-
- // Heuristic: Canvases that are overdrawn beyond this factor in a
- // single frame are promoted to a direct composited layer so that
- // their contents not be re-rasterized by the compositor when the
- // containing layer is the object of a paint invalidation.
- kExpensiveOverdrawThreshold = 3,
-
- kExpensivePathPointCount = 50,
-
- kSVGImageSourcesAreExpensive = 1,
-
- kConcavePathsAreExpensive = 1,
-
- kComplexClipsAreExpensive = 1,
-
- kBlurredShadowsAreExpensive = 1,
-
- // Heuristic: When drawing a source image that has more pixels than
- // the destination canvas by the following factor or more, the draw
- // is considered expensive.
- kExpensiveImageSizeRatio = 4,
-
- // Display list fallback heuristic parameters
- //============================================
-
- // Frames ending with more than this number of levels remaining
- // on the state stack at the end of a frame are too expensive to
- // remain in display list mode. This criterion is motivated by an
- // O(N) cost in carying over state from one frame to the next when
- // in display list mode. The value of this parameter should be high
- // enough to almost never kick in other than for cases with unmatched
- // save()/restore() calls are low enough to kick in before state
- // management becomes measurably expensive.
- kExpensiveRecordingStackDepth = 50,
-
- // GPU vs. display list heuristic parameters
- //===========================================
-
- // Pixel count beyond which we should always prefer to use display
- // lists. Rationale: The allocation of large textures for canvas
- // tends to starve the compositor, and increase the probability of
- // failure of subsequent allocations required for double buffering.
- kPreferDisplayListOverGpuSizeThreshold = 8096 * 4096,
-
- // Disable Acceleration heuristic parameters
- //===========================================
-
- // When drawing very large images to canvases, there is a point where
- // GPU acceleration becomes inefficient due to texture upload overhead,
- // especially when the image is large enough that it is likely to
- // monopolize the texture cache, and when it is being downsized to the
- // point that few of the upload texels are actually sampled. When both
- // of these conditions are met, we disable acceleration.
- kDrawImageTextureUploadSoftSizeLimit = 4096 * 4096,
- kDrawImageTextureUploadSoftSizeLimitScaleThreshold = 4,
- kDrawImageTextureUploadHardSizeLimit = 8192 * 8192,
-
- // GPU readback prevention heuristics
- //====================================
-
- kGPUReadbackForcesNoAcceleration = 1,
-
- // When gpu readback is successively invoked in following number of frames,
- // we disable gpu acceleration to avoid the high cost of gpu readback.
- kGPUReadbackMinSuccessiveFrames = 3,
-
- // When a canvas is used as a source image, if its destination is
- // non-accelerated and the source canvas is accelerated, a readback
- // from the gpu is necessary. This option causes the source canvas to
- // switch to non-accelerated when this situation is encountered to
- // prevent future canvas-to-canvas draws from requiring a readback.
- kDisableAccelerationToAvoidReadbacks = 0,
-
- // See description of DisableAccelerationToAvoidReadbacks. This is the
- // opposite strategy : accelerate the destination canvas. If both
- // EnableAccelerationToAvoidReadbacks and
- // DisableAccelerationToAvoidReadbacks are specified, we try to enable
- // acceleration on the destination first. If that does not succeed,
- // we disable acceleration on the source canvas. Either way, future
- // readbacks are prevented.
- kEnableAccelerationToAvoidReadbacks = 1,
-
-}; // enum
-
-// Constants and Coefficients for 2D Canvas Dynamic Rendering Mode Switching
-// =========================================================================
-
-// Approximate relative costs of different types of operations for the
-// accelerated rendering pipeline and the recording rendering pipeline.
-// These costs were estimated experimentally using the tools located in the
-// third_party/WebKit/Source/modules/canvas2d/performance_analysis directory.
-
-// The RenderingModeCostIndex enum is used to access the heuristic coefficients
-// that correspond to a given rendering mode. For example,
-// FillRectFixedCost[RecordingModeIndex] is the estimated fixed cost for
-// FillRect in recording mode.
-enum RenderingModeCostIndex {
- kRecordingModeIndex = 0,
- kAcceleratedModeIndex = 1,
- kNumRenderingModesCostIndexes = 2
-};
-
-const float kFillRectFixedCost[kNumRenderingModesCostIndexes] = {6.190e-03f,
- 7.715e-03f};
-const float kFillConvexPathFixedCost[kNumRenderingModesCostIndexes] = {
- 1.251e-02f, 1.231e-02f};
-const float kFillNonConvexPathFixedCost[kNumRenderingModesCostIndexes] = {
- 1.714e-02f, 4.497e-02f};
-const float kFillTextFixedCost[kNumRenderingModesCostIndexes] = {1.119e-02f,
- 2.203e-02f};
-
-const float kStrokeRectFixedCost[kNumRenderingModesCostIndexes] = {1.485e-02f,
- 7.287e-03f};
-const float kStrokePathFixedCost[kNumRenderingModesCostIndexes] = {2.390e-02f,
- 5.125e-02f};
-const float kStrokeTextFixedCost[kNumRenderingModesCostIndexes] = {1.149e-02f,
- 1.742e-02f};
-
-const float kFillRectVariableCostPerArea[kNumRenderingModesCostIndexes] = {
- 2.933e-07f, 2.188e-09f};
-const float kFillConvexPathVariableCostPerArea[kNumRenderingModesCostIndexes] =
- {7.871e-07f, 1.608e-07f};
-const float
- kFillNonConvexPathVariableCostPerArea[kNumRenderingModesCostIndexes] = {
- 8.336e-07f, 1.384e-06f};
-const float kFillTextVariableCostPerArea[kNumRenderingModesCostIndexes] = {
- 1.411e-06f, 0.0f};
-
-const float kStrokeRectVariableCostPerArea[kNumRenderingModesCostIndexes] = {
- 9.882e-07f, 0.0f};
-const float kStrokePathVariableCostPerArea[kNumRenderingModesCostIndexes] = {
- 1.583e-06f, 2.401e-06f};
-const float kStrokeTextVariableCostPerArea[kNumRenderingModesCostIndexes] = {
- 1.530e-06f, 6.699e-07f};
-
-const float kPatternFillTypeFixedCost[kNumRenderingModesCostIndexes] = {
- 1.377e-02f, 1.035e-02f};
-const float kLinearGradientFillTypeFixedCost[kNumRenderingModesCostIndexes] = {
- 7.694e-03f, 6.900e-03f};
-const float kRadialGradientFillTypeFixedCost[kNumRenderingModesCostIndexes] = {
- 2.260e-02f, 7.193e-03f};
-
-const float kPatternFillTypeVariableCostPerArea[kNumRenderingModesCostIndexes] =
- {6.080e-07f, 0.0f};
-const float
- kLinearGradientFillVariableCostPerArea[kNumRenderingModesCostIndexes] = {
- 9.635e-07f, 0.0f};
-const float
- kRadialGradientFillVariableCostPerArea[kNumRenderingModesCostIndexes] = {
- 6.662e-06f, 0.0f};
-
-const float kShadowFixedCost[kNumRenderingModesCostIndexes] = {2.502e-02f,
- 2.274e-02f};
-const float kShadowVariableCostPerAreaTimesShadowBlurSquared
- [kNumRenderingModesCostIndexes] = {6.856e-09f, 0.0f};
-
-const float kPutImageDataFixedCost[kNumRenderingModesCostIndexes] = {
- 1.209e-03f, 1.885e-02f};
-const float kPutImageDataVariableCostPerArea[kNumRenderingModesCostIndexes] = {
- 6.231e-06f, 4.116e-06f};
-
-const float kDrawSVGImageFixedCost[kNumRenderingModesCostIndexes] = {
- 1.431e-01f, 2.958e-01f};
-const float kDrawPNGImageFixedCost[kNumRenderingModesCostIndexes] = {
- 1.278e-02f, 1.306e-02f};
-
-const float kDrawSVGImageVariableCostPerArea[kNumRenderingModesCostIndexes] = {
- 1.030e-05f, 4.463e-06f};
-const float kDrawPNGImageVariableCostPerArea[kNumRenderingModesCostIndexes] = {
- 1.727e-06f, 0.0f};
-
-// Two conditions must be met before the isAccelerationOptimalForCanvasContent
-// heuristics recommends switching out of the accelerated mode:
-// 1. The difference in estimated cost per frame is larger than
-// MinCostPerFrameImprovementToSuggestDisableAcceleration. This ensures
-// that the overhead involved in a switch of rendering mode and the risk of
-// making a wrong decision are justified by a large expected increased
-// performance.
-// 2. The percent reduction in rendering cost is larger than
-// MinPercentageImprovementToSuggestDisableAcceleration. This ensures that
-// there is a high level of confidence that the performance would be
-// improved in recording mode.
-const float kMinCostPerFrameImprovementToSuggestDisableAcceleration = 15.0f;
-const float kMinPercentageImprovementToSuggestDisableAcceleration = 30.0f;
-
-// Minimum number of frames that need to be rendered
-// before the rendering pipeline may be switched. Having this set
-// to more than 1 increases the sample size of usage data before a
-// decision is made, improving the accuracy of heuristics.
-const int kMinFramesBeforeSwitch = 3;
-
-} // namespace ExpensiveCanvasHeuristicParameters
-
-} // namespace blink
-
-#endif

Powered by Google App Engine
This is Rietveld 408576698