[webkit-changes] [WebKit/WebKit] 6b5c45: ImageBuffer flushing is redundant

Kimmo Kinnunen noreply at github.com
Tue Mar 21 05:38:21 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 6b5c45e49165c4e9143be25face31c9c105ba84b
      https://github.com/WebKit/WebKit/commit/6b5c45e49165c4e9143be25face31c9c105ba84b
  Author: Kimmo Kinnunen <kkinnunen at apple.com>
  Date:   2023-03-21 (Tue, 21 Mar 2023)

  Changed paths:
    M Source/WebCore/platform/graphics/ImageBuffer.cpp
    M Source/WebCore/platform/graphics/ImageBuffer.h
    M Source/WebKit/GPUProcess/graphics/RemoteDisplayListRecorder.cpp
    M Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.cpp
    M Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.cpp
    M Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h
    M Tools/TestWebKitAPI/Tests/WebCore/ImageBufferTests.cpp

  Log Message:
  -----------
  ImageBuffer flushing is redundant
https://bugs.webkit.org/show_bug.cgi?id=252990
rdar://105973502

Reviewed by Simon Fraser.

Overall, flushing is needed to ensure that deferred rendering is done
before read from / write to via *external access* happens. This is means
any defferring: either CG asynchronous rendering or IPC -based rendering.
The conditions for both are identical.

For local rendering, flushing is relevant only when rendering to a
IOSurface via the asynchronous CGContext implementation. For this case,
the *external access* is when:
1. The rendered contents is read through the bitmap by locking the
   IOSurface. This is possible with getImageData() and when drawing
   to bitmap contents from explicit bitmap context mapped from the
   IOSurface.
2. The rendering is altered by a write through the locked IOSurface.
   This is possible with putImageData().
3. The rendered contents is rendered to in GPUP side with asynchronous CG
   implementation and is read through the IOSurface by the WP-side
   asynchronous CG implementation.

Move the flushes to:
i) ImageBufferIOSurfaceBackend for the local process external access points:
   getImageData, putImageData.
ii) RemoteImageBufferProxy for the GPUP-WP external access points:
   draw in GPUP, read from WP via asynchronous CG.

In the future, these will be moved fully into the respective backends when
RemoteImageBufferProxy is removed.

Remove ImageBuffer::flushContext(). It is the same as
ImageBuffer::flushDrawingContext().

For ImageBufferShareableMappedIOSurfaceBackend it also flushed the
WP-side context for the IOSurface. This is not used for any drawing,
so it is pointless to be flushed. It is only used for creating
the WP-side CGImage of the IOSurface.

* Source/WebCore/platform/graphics/ImageBuffer.cpp:
(WebCore::ImageBuffer::clipToMask):
(WebCore::ImageBuffer::convertToLuminanceMask):
(WebCore::ImageBuffer::getPixelBuffer const):
(WebCore::ImageBuffer::putPixelBuffer):
(WebCore::ImageBuffer::flushContext): Deleted.
* Source/WebCore/platform/graphics/ImageBuffer.h:
* Source/WebKit/GPUProcess/graphics/RemoteDisplayListRecorder.cpp:
(WebKit::RemoteDisplayListRecorder::flushContext):
* Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.cpp:
(WebKit::RemoteGraphicsContextGL::paintPixelBufferToImageBuffer):
* Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.cpp:
(WebKit::RemoteImageBufferProxy::flushContext): Deleted.
* Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
* Tools/TestWebKitAPI/Tests/WebCore/ImageBufferTests.cpp:
(TestWebKitAPI::TEST):

Canonical link: https://commits.webkit.org/261915@main




More information about the webkit-changes mailing list