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

Unified Diff: cc/output/ca_layer_overlay.cc

Issue 2351343002: Disable CA compositor if there are too many quads. (Closed)
Patch Set: Only look at RPDQs. Created 4 years, 3 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
« no previous file with comments | « no previous file | cc/output/overlay_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/output/ca_layer_overlay.cc
diff --git a/cc/output/ca_layer_overlay.cc b/cc/output/ca_layer_overlay.cc
index a37e56481ad56735cf4a58b0ac954a7fb1c1e38e..c949d259156fb89b204acb80ee368b69bf0b7d92 100644
--- a/cc/output/ca_layer_overlay.cc
+++ b/cc/output/ca_layer_overlay.cc
@@ -17,6 +17,13 @@ namespace cc {
namespace {
+// If there are too many RenderPassDrawQuads, we shouldn't use Core Animation to
+// present them as individual layers, since that potentially doubles the amount
+// of work needed to present them. cc has to blit them into an IOSurface, and
+// then Core Animation has to blit them to the final surface.
+// https://crbug.com/636884.
+const int kTooManyRenderPassDrawQuads = 30;
+
// This enum is used for histogram states and should only have new values added
// to the end before COUNT.
enum CALayerResult {
@@ -43,6 +50,7 @@ enum CALayerResult {
CA_LAYER_FAILED_RENDER_PASS_MASK,
CA_LAYER_FAILED_RENDER_PASS_FILTER_OPERATION,
CA_LAYER_FAILED_RENDER_PASS_SORTING_CONTEXT_ID,
+ CA_LAYER_FAILED_TOO_MANY_RENDER_PASS_DRAW_QUADS,
CA_LAYER_FAILED_COUNT,
};
@@ -159,7 +167,8 @@ class CALayerOverlayProcessor {
const gfx::RectF& display_rect,
const DrawQuad* quad,
CALayerOverlay* ca_layer_overlay,
- bool* skip) {
+ bool* skip,
+ bool* render_pass_draw_quad) {
if (quad->shared_quad_state->blend_mode != SkXfermode::kSrcOver_Mode)
return CA_LAYER_FAILED_QUAD_BLEND_MODE;
@@ -200,6 +209,7 @@ class CALayerOverlayProcessor {
ca_layer_overlay->bounds_rect = gfx::RectF(quad->rect);
+ *render_pass_draw_quad = quad->material == DrawQuad::RENDER_PASS;
switch (quad->material) {
case DrawQuad::TEXTURE_CONTENT:
return FromTextureQuad(resource_provider,
@@ -254,17 +264,27 @@ bool ProcessForCALayerOverlays(ResourceProvider* resource_provider,
CALayerResult result = CA_LAYER_SUCCESS;
ca_layer_overlays->reserve(quad_list.size());
+ int render_pass_draw_quad_count = 0;
CALayerOverlayProcessor processor;
for (auto it = quad_list.BackToFrontBegin(); it != quad_list.BackToFrontEnd();
++it) {
const DrawQuad* quad = *it;
CALayerOverlay ca_layer;
bool skip = false;
+ bool render_pass_draw_quad = false;
result = processor.FromDrawQuad(resource_provider, display_rect, quad,
- &ca_layer, &skip);
+ &ca_layer, &skip, &render_pass_draw_quad);
if (result != CA_LAYER_SUCCESS)
break;
+ if (render_pass_draw_quad) {
+ ++render_pass_draw_quad_count;
+ if (render_pass_draw_quad_count > kTooManyRenderPassDrawQuads) {
+ result = CA_LAYER_FAILED_TOO_MANY_RENDER_PASS_DRAW_QUADS;
+ break;
+ }
+ }
+
if (skip)
continue;
« no previous file with comments | « no previous file | cc/output/overlay_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698