canvas2d: Fix canvas resource thrashing with an intermediate canvas.
If a canvas is used as an intermediate for drawing to the displayed canvas multiple times in a frame, then a ref to its backing texture is retained in the displayed canvas' paint recording. This triggers a copy-on-write and a buffer allocation each time this intermediate canvas is updated for a new draw. The above allocation can be avoided by ordering the GPU work to write to and read from the intermediate canvas' buffer correctly and reuse the buffer for each update to this intermediate canvas. CanvasResourceProviderSharedImage did this optimization earlier by flushing skia prior to triggering a copy-on-write. But after disabling deferral for texture backed images, the draw for that texture is never flushed to skia until the displayed canvas' paint recording is flushed. This change brings back the optimization by flushing a canvas' recording each time a texture backed image is drawn to it. R=fserb@chromium.org, bsalomon@google.com Bug: 1030108 Change-Id: Id46fa8399f64a4c724c9f51e5cb4927b7e97d747 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2040028Reviewed-by:Fernando Serboncini <fserb@chromium.org> Reviewed-by:
Aaron Krajeski <aaronhk@chromium.org> Commit-Queue: Fernando Serboncini <fserb@chromium.org> Auto-Submit: Khushal <khushalsagar@chromium.org> Cr-Commit-Position: refs/heads/master@{#740005}
Showing
Please register or sign in to comment