[webkit-changes] [WebKit/WebKit] 57ed72: [GPU Process] Optimize clipping to a rounded rect
Simon Fraser
noreply at github.com
Tue May 23 08:22:12 PDT 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 57ed72ad03ad9c23eaf455a2393d9190210535df
https://github.com/WebKit/WebKit/commit/57ed72ad03ad9c23eaf455a2393d9190210535df
Author: Simon Fraser <simon.fraser at apple.com>
Date: 2023-05-23 (Tue, 23 May 2023)
Changed paths:
M Source/WebCore/platform/graphics/BifurcatedGraphicsContext.cpp
M Source/WebCore/platform/graphics/BifurcatedGraphicsContext.h
M Source/WebCore/platform/graphics/displaylists/DisplayList.cpp
M Source/WebCore/platform/graphics/displaylists/DisplayListItemBuffer.cpp
M Source/WebCore/platform/graphics/displaylists/DisplayListItemType.cpp
M Source/WebCore/platform/graphics/displaylists/DisplayListItemType.h
M Source/WebCore/platform/graphics/displaylists/DisplayListItems.cpp
M Source/WebCore/platform/graphics/displaylists/DisplayListItems.h
M Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp
M Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h
M Source/WebCore/platform/graphics/displaylists/DisplayListRecorderImpl.cpp
M Source/WebCore/platform/graphics/displaylists/DisplayListRecorderImpl.h
M Source/WebCore/rendering/GlyphDisplayListCache.cpp
M Source/WebKit/GPUProcess/graphics/RemoteDisplayListRecorder.cpp
M Source/WebKit/GPUProcess/graphics/RemoteDisplayListRecorder.h
M Source/WebKit/GPUProcess/graphics/RemoteDisplayListRecorder.messages.in
M Source/WebKit/WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.cpp
M Source/WebKit/WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.h
Log Message:
-----------
[GPU Process] Optimize clipping to a rounded rect
https://bugs.webkit.org/show_bug.cgi?id=257181
rdar://109695331
Reviewed by Wenson Hsieh.
GraphicsContext::clipRoundedRect() turns the rounded rect into a Path, and clips to that.
CoreGraphics has an optimization for when the path is known to be a rounded rect, but only
if that CGPath is constructed using `CGPathAddRoundedRect()`.
However, with GPU process rendering, we lose this information in the path; we hit
`Path::applySlowCase()` which turns the rounded rect path into Beziers, which is what we
send to the GPU Process.
We've already optimized this for fills via `fillRoundedRect()`, which sends a FloatRoundedRect
to the GPU process, so do the same for clip, adding `clipRoundedRect()` and `clipOutRoundedRect()`,
which get new DisplayList items.
The perf test attached to the bug goes from about 48fps to 60fps with this change.
* Source/WebCore/platform/graphics/BifurcatedGraphicsContext.cpp:
(WebCore::BifurcatedGraphicsContext::clipRoundedRect):
(WebCore::BifurcatedGraphicsContext::clipOutRoundedRect):
* Source/WebCore/platform/graphics/BifurcatedGraphicsContext.h:
* Source/WebCore/platform/graphics/displaylists/DisplayList.cpp:
(WebCore::DisplayList::DisplayList::append):
* Source/WebCore/platform/graphics/displaylists/DisplayListItemBuffer.cpp:
(WebCore::DisplayList::ItemHandle::apply):
(WebCore::DisplayList::ItemHandle::destroy):
(WebCore::DisplayList::ItemHandle::safeCopy const):
* Source/WebCore/platform/graphics/displaylists/DisplayListItemType.cpp:
(WebCore::DisplayList::sizeOfItemInBytes):
(WebCore::DisplayList::isDrawingItem):
(WebCore::DisplayList::isInlineItem):
* Source/WebCore/platform/graphics/displaylists/DisplayListItemType.h:
* Source/WebCore/platform/graphics/displaylists/DisplayListItems.cpp:
(WebCore::DisplayList::ClipRoundedRect::apply const):
(WebCore::DisplayList::ClipOutRoundedRect::apply const):
(WebCore::DisplayList::operator<<):
(WebCore::DisplayList::dumpItem):
(WebCore::DisplayList::dumpItemHandle):
* Source/WebCore/platform/graphics/displaylists/DisplayListItems.h:
(WebCore::DisplayList::ClipRoundedRect::ClipRoundedRect):
(WebCore::DisplayList::ClipRoundedRect::rect const):
(WebCore::DisplayList::ClipOutRoundedRect::ClipOutRoundedRect):
(WebCore::DisplayList::ClipOutRoundedRect::rect const):
* Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp:
(WebCore::DisplayList::Recorder::clipRoundedRect):
(WebCore::DisplayList::Recorder::clipOutRoundedRect):
* Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h:
* Source/WebCore/platform/graphics/displaylists/DisplayListRecorderImpl.cpp:
(WebCore::DisplayList::RecorderImpl::recordClipRoundedRect):
(WebCore::DisplayList::RecorderImpl::recordClipOutRoundedRect):
* Source/WebCore/platform/graphics/displaylists/DisplayListRecorderImpl.h:
* Source/WebCore/rendering/GlyphDisplayListCache.cpp:
(WebCore::canShareDisplayListWithItem):
* Source/WebKit/GPUProcess/graphics/RemoteDisplayListRecorder.cpp:
(WebKit::RemoteDisplayListRecorder::clipRoundedRect):
(WebKit::RemoteDisplayListRecorder::clipOutRoundedRect):
* Source/WebKit/GPUProcess/graphics/RemoteDisplayListRecorder.h:
* Source/WebKit/GPUProcess/graphics/RemoteDisplayListRecorder.messages.in:
* Source/WebKit/WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.cpp:
(WebKit::RemoteDisplayListRecorderProxy::transformToColorSpace):
(WebKit::RemoteDisplayListRecorderProxy::recordClipRoundedRect):
(WebKit::RemoteDisplayListRecorderProxy::recordClipOutRoundedRect):
* Source/WebKit/WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.h:
Canonical link: https://commits.webkit.org/264419@main
More information about the webkit-changes
mailing list