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

Changeset 270605 in webkit


Ignore:
Timestamp:
Dec 9, 2020, 3:01:08 PM (6 years ago)
Author:
Said Abou-Hallawa
Message:

[GPU Process]: Recording an in-process ImageBuffer drawing has to convert it to a NativeImage first
https://bugs.webkit.org/show_bug.cgi?id=219705

Reviewed by Wenson Hsieh.

Source/WebCore:

We will allow GraphicsContext::drawImageBuffer() to proceed with the
painting code path if the ImageBuffer is not a RemoteImageBuffer. In this
case ImageBuffer::draw() extracts a NativeImage from the ImageBuffer and
calls GraphicsContext::drawNativeImage() which will send the NativeImage
to GPUP.

  • platform/graphics/GraphicsContext.cpp:

(WebCore::GraphicsContext::drawImageBuffer):

  • platform/graphics/GraphicsContextImpl.h:

(WebCore::GraphicsContextImpl::canDrawImageBuffer const):

  • platform/graphics/displaylists/DisplayListRecorder.cpp:

(WebCore::DisplayList::Recorder::canDrawImageBuffer const):

  • platform/graphics/displaylists/DisplayListRecorder.h:

(WebCore::DisplayList::Recorder::Delegate::isCachedImageBuffer const):

Source/WebKit:

Override the virtual method isCachedImageBuffer() which in this case
answers the question: is this a remote ImageBuffer or not?

  • WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
Location:
trunk/Source
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r270598 r270605  
     12020-12-09  Said Abou-Hallawa  <said@apple.com>
     2
     3        [GPU Process]: Recording an in-process ImageBuffer drawing has to convert it to a NativeImage first
     4        https://bugs.webkit.org/show_bug.cgi?id=219705
     5
     6        Reviewed by Wenson Hsieh.
     7
     8        We will allow GraphicsContext::drawImageBuffer() to proceed with the
     9        painting code path if the ImageBuffer is not a RemoteImageBuffer. In this
     10        case ImageBuffer::draw() extracts a NativeImage from the ImageBuffer and
     11        calls GraphicsContext::drawNativeImage() which will send the NativeImage
     12        to GPUP.
     13
     14        * platform/graphics/GraphicsContext.cpp:
     15        (WebCore::GraphicsContext::drawImageBuffer):
     16        * platform/graphics/GraphicsContextImpl.h:
     17        (WebCore::GraphicsContextImpl::canDrawImageBuffer const):
     18        * platform/graphics/displaylists/DisplayListRecorder.cpp:
     19        (WebCore::DisplayList::Recorder::canDrawImageBuffer const):
     20        * platform/graphics/displaylists/DisplayListRecorder.h:
     21        (WebCore::DisplayList::Recorder::Delegate::isCachedImageBuffer const):
     22
    1232020-12-09  John Wilander  <wilander@apple.com>
    224
  • trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp

    r269753 r270605  
    804804        return;
    805805
    806     if (m_impl) {
     806    if (m_impl && m_impl->canDrawImageBuffer(image)) {
    807807        m_impl->drawImageBuffer(image, destination, source, options);
    808808        return;
  • trunk/Source/WebCore/platform/graphics/GraphicsContextImpl.h

    r269753 r270605  
    4040
    4141    virtual bool hasPlatformContext() const = 0;
     42    virtual bool canDrawImageBuffer(const ImageBuffer&) const { return true; }
    4243    virtual PlatformGraphicsContext* platformContext() const = 0;
    4344
  • trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp

    r269753 r270605  
    138138}
    139139
     140bool Recorder::canDrawImageBuffer(const ImageBuffer& imageBuffer) const
     141{
     142    return !m_delegate || m_delegate->isCachedImageBuffer(imageBuffer);
     143}
     144
    140145void Recorder::clearShadow()
    141146{
  • trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h

    r270478 r270605  
    6868        virtual void didAppendItemOfType(ItemType) { }
    6969        virtual void cacheNativeImage(NativeImage&) { }
     70        virtual bool isCachedImageBuffer(const ImageBuffer&) const { return false; }
    7071    };
    7172
     
    7576    friend class DrawGlyphsRecorder;
    7677    bool hasPlatformContext() const override { return false; }
     78    bool canDrawImageBuffer(const ImageBuffer&) const override;
    7779    PlatformGraphicsContext* platformContext() const override { return nullptr; }
    7880
  • trunk/Source/WebKit/ChangeLog

    r270601 r270605  
     12020-12-09  Said Abou-Hallawa  <said@apple.com>
     2
     3        [GPU Process]: Recording an in-process ImageBuffer drawing has to convert it to a NativeImage first
     4        https://bugs.webkit.org/show_bug.cgi?id=219705
     5
     6        Reviewed by Wenson Hsieh.
     7
     8        Override the virtual method isCachedImageBuffer() which in this case
     9        answers the question: is this a remote ImageBuffer or not?
     10
     11        * WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
     12
    1132020-12-09  Per Arne Vollan  <pvollan@apple.com>
    214
  • trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h

    r270529 r270605  
    188188        if (m_remoteRenderingBackendProxy)
    189189            m_remoteRenderingBackendProxy->remoteResourceCacheProxy().cacheNativeImage(image);
     190    }
     191
     192    bool isCachedImageBuffer(const WebCore::ImageBuffer& imageBuffer) const override
     193    {
     194        if (!m_remoteRenderingBackendProxy)
     195            return false;
     196        auto cachedImageBuffer = m_remoteRenderingBackendProxy->remoteResourceCacheProxy().cachedImageBuffer(imageBuffer.renderingResourceIdentifier());
     197        ASSERT(!cachedImageBuffer || cachedImageBuffer == &imageBuffer);
     198        return cachedImageBuffer;
    190199    }
    191200
Note: See TracChangeset for help on using the changeset viewer.