[webkit-changes] [WebKit/WebKit] f37c05: Refactor PlatformCALayer to support finishing the ...

Kimmo Kinnunen noreply at github.com
Tue Apr 4 23:49:49 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: f37c05e1232e7be8dca7ddebe2003a9b1d75948c
      https://github.com/WebKit/WebKit/commit/f37c05e1232e7be8dca7ddebe2003a9b1d75948c
  Author: Kimmo Kinnunen <kkinnunen at apple.com>
  Date:   2023-04-04 (Tue, 04 Apr 2023)

  Changed paths:
    M Source/WebCore/PlatformMac.cmake
    M Source/WebCore/SourcesCocoa.txt
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    R Source/WebCore/html/canvas/GPUCanvasContextCocoa.cpp
    M Source/WebCore/html/canvas/GPUCanvasContextCocoa.h
    A Source/WebCore/html/canvas/GPUCanvasContextCocoa.mm
    R Source/WebCore/platform/graphics/ca/PlatformCALayer.cpp
    M Source/WebCore/platform/graphics/ca/PlatformCALayer.h
    A Source/WebCore/platform/graphics/ca/PlatformCALayer.mm
    A Source/WebCore/platform/graphics/ca/PlatformCALayerDelegatedContents.h
    M Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.h
    M Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm
    M Source/WebCore/platform/graphics/cocoa/WebProcessGraphicsContextGLCocoa.mm
    M Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.h
    M Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.mm
    M Source/WebKit/SourcesCocoa.txt
    M Source/WebKit/WebKit.xcodeproj/project.pbxproj
    M Source/WebKit/WebProcess/GPU/graphics/cocoa/RemoteGraphicsContextGLProxyCocoa.mm
    R Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp
    M Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h
    A Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.mm
    M Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm

  Log Message:
  -----------
  Refactor PlatformCALayer to support finishing the delegated layer contents before compositing
https://bugs.webkit.org/show_bug.cgi?id=254988
rdar://107605713

Reviewed by Simon Fraser.

The WebKit compositor should wait for WebGL / WebGPU content to be finished
before proceeding to send that to the system compositor. Otherwise slow
WebGL content slows down the system user interface.

Refactor "delegated contents" feature of PlatformCALayer to be able to pass
objects that allow to do the above.

The structure will be:
- Each layer, i.e. WebGL or WebGPU context, has a Metal shared event that can
  be waited on.
- Each submitted frame, i.e. IOSurface, will be ready to be composited only
  after the shared event has received a signal with the "finished identifier".

Refactor the PlatformCALayer to support the above, but do not introduce any
new functionality in this patch.

Since Metal shared event is id<MTLSharedEvent>, Obj-C protocol, the
code that uses definitions of new structs in PlatformCALayerDelegatedContents.h
needs to also be real Obj-C code.
- Renames previously C++ caller GPUCanvasContextCocoa.cpp to GPUCanvasContextCocoa.mm
- Renames previously C++ callee PlatformCALayer.cpp to PlatformCALayer.mm

* Source/WebCore/PlatformMac.cmake:
* Source/WebCore/SourcesCocoa.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/html/canvas/GPUCanvasContextCocoa.h:
* Source/WebCore/html/canvas/GPUCanvasContextCocoa.mm: Renamed from Source/WebCore/html/canvas/GPUCanvasContextCocoa.cpp.
(WebCore::GPUCanvasContext::create):
(WebCore::GPUCanvasContextCocoa::create):
(WebCore::presentationContextDescriptor):
(WebCore::getCanvasWidth):
(WebCore::getCanvasHeight):
(WebCore::GPUCanvasContextCocoa::GPUCanvasContextCocoa):
(WebCore::GPUCanvasContextCocoa::reshape):
(WebCore::GPUCanvasContextCocoa::canvas):
(WebCore::GPUCanvasContextCocoa::configure):
(WebCore::GPUCanvasContextCocoa::unconfigure):
(WebCore::GPUCanvasContextCocoa::getCurrentTexture):
(WebCore::GPUCanvasContextCocoa::pixelFormat const):
(WebCore::GPUCanvasContextCocoa::colorSpace const):
(WebCore::GPUCanvasContextCocoa::layerContentsDisplayDelegate):
(WebCore::GPUCanvasContextCocoa::prepareForDisplay):
(WebCore::GPUCanvasContextCocoa::markContextChangedAndNotifyCanvasObservers):
* Source/WebCore/platform/graphics/ca/PlatformCALayer.h:
* Source/WebCore/platform/graphics/ca/PlatformCALayer.mm: Renamed from Source/WebCore/platform/graphics/ca/PlatformCALayer.cpp.
(WebCore::PlatformCALayer::PlatformCALayer):
(WebCore::PlatformCALayer::~PlatformCALayer):
(WebCore::PlatformCALayer::currentTimeToMediaTime):
(WebCore::PlatformCALayer::canHaveBackingStore const):
(WebCore::PlatformCALayer::drawRepaintIndicator):
(WebCore::PlatformCALayer::flipContext):
(WebCore::PlatformCALayer::drawTextAtPoint const):
(WebCore::PlatformCALayer::createCompatibleLayerOrTakeFromPool):
(WebCore::PlatformCALayer::moveToLayerPool):
(WebCore::PlatformCALayer::layerPool):
(WebCore::PlatformCALayer::clearContents):
(WebCore::PlatformCALayer::setDelegatedContentsFinishedEvent):
(WebCore::PlatformCALayer::setDelegatedContents):
(WebCore::PlatformCALayer::clearAcceleratedEffectsAndBaseValues):
(WebCore::PlatformCALayer::setAcceleratedEffectsAndBaseValues):
(WebCore::PlatformCALayer::dumpAdditionalProperties):
(WebCore::operator<<):
* Source/WebCore/platform/graphics/ca/PlatformCALayerDelegatedContents.h: Added.
* Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.h:
* Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
(WebCore::PlatformCALayerCocoa::setDelegatedContentsFinishedEvent):
(WebCore::PlatformCALayerCocoa::setDelegatedContents):
* Source/WebCore/platform/graphics/cocoa/WebProcessGraphicsContextGLCocoa.mm:
* Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.h:
* Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
(WebKit::RemoteLayerBackingStore::setDelegatedContentsFinishedEvent):
(WebKit::RemoteLayerBackingStore::setDelegatedContents):
(WebKit::RemoteLayerBackingStore::setContents): Deleted.
* Source/WebKit/WebProcess/GPU/graphics/cocoa/RemoteGraphicsContextGLProxyCocoa.mm:
* Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h:
* Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.mm:
(WebKit::PlatformCALayerRemote::setDelegatedContentsFinishedEvent):
(WebKit::PlatformCALayerRemote::setDelegatedContents):
* Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm:

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




More information about the webkit-changes mailing list