New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 726462 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: May 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 1
Type: Bug



Sign in to add a comment

Reduce canvas memory consumption on low end devices

Project Member Reported by junov@chromium.org, May 25 2017

Issue description

Opportunities to investigate:

* Measure memory footprint of accelerated vs non-accelerated 2D canvas, adjust heuristics accordingly.
* Reduce size of skia’s ganesh cache. ALREADY DONE
* Disable deferred rendering in Canvas2DLayerBridge (to avoid locking large resources)
* Disable display-list-2d-canvas (to avoid locking large resources), or perhaps enable it more (to avoid backing store allocation)?  Probably needs an heuristic.
* Reduce size of CanvasFontCache
* Disable sw<->hw switches
* Flush GrContext frequently (after drawImage calls?)
* Reduce bit depth (GL_RGBA4 , or GL_RGB565, depending on need for alpha).  Will result in color banding.  Not sure if skia can handle this.

 
Labels: LowMemory
@junov, is low end device regarding to the ones in Android? Is chromebook one of the low end devices?

Comment 3 by junov@chromium.org, May 26 2017

This issue is targetting devices that are flagged as low end by base::SysInfo::IsLowEndDevice().

Project Member

Comment 4 by bugdroid1@chromium.org, May 26 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/e5f7fdd10814d38c50e90700d2cf67fec0b8bcd2

commit e5f7fdd10814d38c50e90700d2cf67fec0b8bcd2
Author: junov <junov@chromium.org>
Date: Fri May 26 20:47:26 2017

Reduce Canvas FontCache size on low end devices

BUG= 726462 

Review-Url: https://codereview.chromium.org/2907843002
Cr-Commit-Position: refs/heads/master@{#475117}

[modify] https://crrev.com/e5f7fdd10814d38c50e90700d2cf67fec0b8bcd2/third_party/WebKit/Source/core/html/canvas/CanvasFontCache.cpp

Project Member

Comment 6 by bugdroid1@chromium.org, May 26 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/0fd268c608f2d2967c81b1deb1b521848ce2039a

commit 0fd268c608f2d2967c81b1deb1b521848ce2039a
Author: junov <junov@chromium.org>
Date: Fri May 26 22:53:17 2017

Disable display list 2d canvas on low-end devices

BUG= 726462 

Review-Url: https://codereview.chromium.org/2905903003
Cr-Commit-Position: refs/heads/master@{#475171}

[modify] https://crrev.com/0fd268c608f2d2967c81b1deb1b521848ce2039a/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp

Comment 7 by junov@chromium.org, May 29 2017

Status: Fixed (was: Assigned)
I have optimized as far as I could for M61.  Here are the statuses of the various approaches that have been considered:

* Measure memory footprint of accelerated vs non-accelerated 2D canvas, adjust heuristics accordingly.
Outcome: disabling acceleration provides very modest RAM saving, at a high cost in terms of performance. Not worth it.

* Reduce size of skia’s ganesh cache.
Outcome: Done.  Cache size reduced from 96 to 48MB on low-end devices.
CL: https://codereview.chromium.org/2836063003/
* Disable deferred rendering in Canvas2DLayerBridge (to avoid locking large resources)
Outcome: Done. Save about 20% RAM on sprite based demos. CL: https://chromium-review.googlesource.com/516808
* Disable display-list-2d-canvas (to avoid locking large resources), or perhaps enable it more (to avoid backing store allocation)?  Probably needs an heuristic.
Outcome: Done. CL: https://codereview.chromium.org/2905903003
* Reduce size of CanvasFontCache
Outcome: Done. CL: https://codereview.chromium.org/2907843002
* Disable sw<->hw switches
Outcome: Rendering mode switch only have a transient memory cost and if there is not enough RAM to perform the switch, the switch is simply aborted. The current state of things seems acceptable.
* Flush GrContext frequently (after drawImage calls?)
Outcome: this was already achieved indirectly by reducing the limit of the ganesh cache size.  It turns out that resources locked by deferred draw opreations count against the cache limit, and flushes are automatically triggered when the limit is reached.
* Reduce bit depth (GL_RGBA4 , or GL_RGB565, depending on need for alpha).  Will result in color banding.  Not sure if skia can handle this.
Outcome: Abandoined. Attempted to implement this, but skia is lacking 4-4-4-4 format support for some of the draw and conversion operations that are required by 2D canvas.  Also, we realized that the loss of precision may be intolerable for several important use cases, such as apps that do image pre-processing (e.g. resizing) on the client side before uploading to the cloud. 

Comment 8 by klo...@chromium.org, Jun 28 2017

Cc: klo...@chromium.org
Quick question, for ganesh cache limit. Is it only for Canvas 2D? Or it will affect the normal page rendering.

Comment 9 by junov@chromium.org, Jul 4 2017

The ganesh cache limit was only changed on the context that is used by 2D canvas. The ganesh context used by the compositor (for gpu rasterization) is independent of this.

Sign in to add a comment