⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 269159 in webkit


Ignore:
Timestamp:
Oct 29, 2020, 11:35:59 AM (6 years ago)
Author:
Said Abou-Hallawa
Message:

REGRESSION(269065): [GPU Process]: Order of drawing has to be preserved when drawing a canvas to another canvas
https://bugs.webkit.org/show_bug.cgi?id=218324

Reviewed by Simon Fraser.

Source/WebCore:

Allow DisplayList::Recorder::Delegate to take an action after appending
a DisplayList::Item to its DisplayList::DisplayList.

Test: fast/canvas/canvas-draw-canvas-on-canvas-flushing-order.html

  • platform/graphics/displaylists/DisplayListRecorder.cpp:

(WebCore::DisplayList::Recorder::didAppendItem):
(WebCore::DisplayList::Recorder::appendItemAndUpdateExtent):
(WebCore::DisplayList::Recorder::appendItem):

  • platform/graphics/displaylists/DisplayListRecorder.h:

(WebCore::DisplayList::Recorder::Delegate::didAppendItem):

Source/WebKit:

When drawing an ImageBuffer to another ImageBuffer, the DrawingContext of
the source and the destination ImageBuffers have to be flushed immediately.
Otherwise an older version or a newer version of the source ImageBuffer
might be drawn to the destination ImageBuffer.

  • WebProcess/GPU/graphics/RemoteImageBufferProxy.h:

LayoutTests:

  • fast/canvas/canvas-draw-canvas-on-canvas-flushing-order-expected.html: Added.
  • fast/canvas/canvas-draw-canvas-on-canvas-flushing-order.html: Added.
Location:
trunk
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r269155 r269159  
     12020-10-29  Said Abou-Hallawa  <said@apple.com>
     2
     3        REGRESSION(269065): [GPU Process]: Order of drawing has to be preserved when drawing a canvas to another canvas
     4        https://bugs.webkit.org/show_bug.cgi?id=218324
     5
     6        Reviewed by Simon Fraser.
     7
     8        * fast/canvas/canvas-draw-canvas-on-canvas-flushing-order-expected.html: Added.
     9        * fast/canvas/canvas-draw-canvas-on-canvas-flushing-order.html: Added.
     10
    1112020-10-29  Noam Rosenthal  <noam@webkit.org>
    212
  • trunk/Source/WebCore/ChangeLog

    r269155 r269159  
     12020-10-29  Said Abou-Hallawa  <said@apple.com>
     2
     3        REGRESSION(269065): [GPU Process]: Order of drawing has to be preserved when drawing a canvas to another canvas
     4        https://bugs.webkit.org/show_bug.cgi?id=218324
     5
     6        Reviewed by Simon Fraser.
     7
     8        Allow DisplayList::Recorder::Delegate to take an action after appending
     9        a DisplayList::Item to its DisplayList::DisplayList.
     10
     11        Test: fast/canvas/canvas-draw-canvas-on-canvas-flushing-order.html
     12
     13        * platform/graphics/displaylists/DisplayListRecorder.cpp:
     14        (WebCore::DisplayList::Recorder::didAppendItem):
     15        (WebCore::DisplayList::Recorder::appendItemAndUpdateExtent):
     16        (WebCore::DisplayList::Recorder::appendItem):
     17        * platform/graphics/displaylists/DisplayListRecorder.h:
     18        (WebCore::DisplayList::Recorder::Delegate::didAppendItem):
     19
    1202020-10-29  Noam Rosenthal  <noam@webkit.org>
    221
  • trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp

    r269092 r269159  
    126126}
    127127
     128void Recorder::didAppendItem(const Item& item)
     129{
     130    if (m_delegate)
     131        m_delegate->didAppendItem(item);
     132}
     133
    128134void Recorder::updateState(const GraphicsContextState& state, GraphicsContextState::StateChangeFlags flags)
    129135{
     
    448454void Recorder::appendItemAndUpdateExtent(Ref<DrawingItem>&& item)
    449455{
    450     auto& newItem = appendItem(WTFMove(item));
     456    DrawingItem& newItem = item.get();
     457    appendItem(WTFMove(item));
    451458    updateItemExtent(newItem);
    452459}
    453460
    454 template<typename ItemType>
    455 ItemType& Recorder::appendItem(Ref<ItemType>&& item)
    456 {
     461void Recorder::appendItem(Ref<Item>&& item)
     462{
     463    Item& newItem = item.get();
    457464    willAppendItem(item.get());
    458     return downcast<ItemType>(m_displayList.append(WTFMove(item)));
     465    m_displayList.append(WTFMove(item));
     466    didAppendItem(newItem);
    459467}
    460468
  • trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h

    r269092 r269159  
    6969        virtual bool lockRemoteImageBuffer(WebCore::ImageBuffer&) { return false; }
    7070        virtual void willAppendItem(const Item&) { };
     71        virtual void didAppendItem(const Item&) { };
    7172    };
    7273
     
    148149    FloatRect roundToDevicePixels(const FloatRect&, GraphicsContext::RoundingMode) override;
    149150
    150     template<typename ItemType>
    151     ItemType& appendItem(Ref<ItemType>&&);
     151    void appendItem(Ref<Item>&&);
    152152    void willAppendItem(const Item&);
     153    void didAppendItem(const Item&);
    153154
    154155    void appendStateChangeItem(const GraphicsContextStateChange&, GraphicsContextState::StateChangeFlags);
  • trunk/Source/WebKit/ChangeLog

    r269154 r269159  
     12020-10-29  Said Abou-Hallawa  <said@apple.com>
     2
     3        REGRESSION(269065): [GPU Process]: Order of drawing has to be preserved when drawing a canvas to another canvas
     4        https://bugs.webkit.org/show_bug.cgi?id=218324
     5
     6        Reviewed by Simon Fraser.
     7
     8        When drawing an ImageBuffer to another ImageBuffer, the DrawingContext of
     9        the source and the destination ImageBuffers have to be flushed immediately.
     10        Otherwise an older version or a newer version of the source ImageBuffer
     11        might be drawn to the destination ImageBuffer.
     12
     13        * WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
     14
    1152020-10-29  Ryan Haddad  <ryanhaddad@apple.com>
    216
  • trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h

    r269123 r269159  
    165165        if (!m_remoteRenderingBackendProxy)
    166166            return false;
    167         return m_remoteRenderingBackendProxy->remoteResourceCacheProxy().lockRemoteImageBufferForRemoteClient(imageBuffer, m_renderingResourceIdentifier);
     167        if (!m_remoteRenderingBackendProxy->remoteResourceCacheProxy().lockRemoteImageBufferForRemoteClient(imageBuffer, m_renderingResourceIdentifier))
     168            return false;
     169        imageBuffer.flushDrawingContext();
     170        return true;
    168171    }
    169172
     
    179182    }
    180183
     184    void didAppendItem(const WebCore::DisplayList::Item& item) override
     185    {
     186        if (item.type() == WebCore::DisplayList::ItemType::DrawImageBuffer)
     187            flushDrawingContext();
     188    }
     189
    181190    DisplayListFlushIdentifier m_sentFlushIdentifier;
    182191    DisplayListFlushIdentifier m_receivedFlushIdentifier;
Note: See TracChangeset for help on using the changeset viewer.