Changeset 141333 in webkit


Ignore:
Timestamp:
Jan 30, 2013 3:34:57 PM (11 years ago)
Author:
timothy_horton@apple.com
Message:

[mac] ImageBuffer should create accelerated buffers for small canvases, but we shouldn't force them to create compositing layers
https://bugs.webkit.org/show_bug.cgi?id=107804
<rdar://problem/11752381>

Reviewed by Simon Fraser.

Make all canvases IOSurface-backed if requested, instead of having a size threshold
under which we won't use accelerated canvas.

Make requiresCompositingForCanvas take the size of the canvas into account, using
the threshold which was previously in ImageBuffer to determine whether or not a
canvas should be forced into a compositing layer.

This improves canvas performance on some benchmarks
(http://www.mikechambers.com/html5/javascript/QuadTree/examples/collision.html, for example)
significantly, in cases where canvases which fall below the size limit
(and thus are unaccelerated) are being drawn rapidly into either accelerated
tiles or another accelerated canvas, by preventing excessive copying to/from the GPU.

  • platform/graphics/cg/ImageBufferCG.cpp:

(WebCore):
(WebCore::ImageBuffer::ImageBuffer):

  • rendering/RenderLayerCompositor.cpp:

(WebCore::RenderLayerCompositor::requiresCompositingForCanvas):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r141332 r141333  
     12013-01-30  Tim Horton  <timothy_horton@apple.com>
     2
     3        [mac] ImageBuffer should create accelerated buffers for small canvases, but we shouldn't force them to create compositing layers
     4        https://bugs.webkit.org/show_bug.cgi?id=107804
     5        <rdar://problem/11752381>
     6
     7        Reviewed by Simon Fraser.
     8
     9        Make all canvases IOSurface-backed if requested, instead of having a size threshold
     10        under which we won't use accelerated canvas.
     11
     12        Make requiresCompositingForCanvas take the size of the canvas into account, using
     13        the threshold which was previously in ImageBuffer to determine whether or not a
     14        canvas should be forced into a compositing layer.
     15
     16        This improves canvas performance on some benchmarks
     17        (http://www.mikechambers.com/html5/javascript/QuadTree/examples/collision.html, for example)
     18        significantly, in cases where canvases which fall below the size limit
     19        (and thus are unaccelerated) are being drawn rapidly into either accelerated
     20        tiles or another accelerated canvas, by preventing excessive copying to/from the GPU.
     21
     22        * platform/graphics/cg/ImageBufferCG.cpp:
     23        (WebCore):
     24        (WebCore::ImageBuffer::ImageBuffer):
     25        * rendering/RenderLayerCompositor.cpp:
     26        (WebCore::RenderLayerCompositor::requiresCompositingForCanvas):
     27
    1282013-01-30  Alec Flett  <alecflett@chromium.org>
    229
  • trunk/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp

    r137397 r141333  
    6363#if USE(IOSURFACE_CANVAS_BACKING_STORE)
    6464static const int maxIOSurfaceDimension = 4096;
    65 static const int minIOSurfaceArea = 50 * 100;
    6665
    6766static RetainPtr<IOSurfaceRef> createIOSurface(const IntSize& size)
     
    137136
    138137#if USE(IOSURFACE_CANVAS_BACKING_STORE)
    139     if (width.unsafeGet() >= maxIOSurfaceDimension || height.unsafeGet() >= maxIOSurfaceDimension || (width * height).unsafeGet() < minIOSurfaceArea)
     138    if (width.unsafeGet() >= maxIOSurfaceDimension || height.unsafeGet() >= maxIOSurfaceDimension)
    140139        accelerateRendering = false;
    141140#else
  • trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp

    r141330 r141333  
    8181#endif
    8282
     83#if !PLATFORM(MAC) && !PLATFORM(IOS)
     84#define WTF_USE_COMPOSITING_FOR_SMALL_CANVASES 1
     85#endif
     86
     87static const int canvasAreaThresholdRequiringCompositing = 50 * 100;
     88
    8389namespace WebCore {
    8490
     
    19071913    if (renderer->isCanvas()) {
    19081914        HTMLCanvasElement* canvas = static_cast<HTMLCanvasElement*>(renderer->node());
    1909         return canvas->renderingContext() && canvas->renderingContext()->isAccelerated();
     1915#if USE(COMPOSITING_FOR_SMALL_CANVASES)
     1916        bool isCanvasLargeEnoughToForceCompositing = true;
     1917#else
     1918        bool isCanvasLargeEnoughToForceCompositing = canvas->size().area() >= canvasAreaThresholdRequiringCompositing;
     1919#endif
     1920        return canvas->renderingContext() && canvas->renderingContext()->isAccelerated() && (canvas->renderingContext()->is3d() || isCanvasLargeEnoughToForceCompositing);
    19101921    }
    19111922    return false;
Note: See TracChangeset for help on using the changeset viewer.