Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 564c069cbcdae6529295d16c47268be95d040c3e
https://github.com/WebKit/WebKit/commit/564c069cbcdae6529295d16c47268be95d040c3e
Author: Dan Glastonbury <[email protected]>
Date: 2026-06-03 (Wed, 03 Jun 2026)
Changed paths:
M Source/WebCore/platform/graphics/ColorTypes.h
M Source/WebCore/platform/graphics/PathSegmentData.cpp
M Source/WebCore/platform/graphics/PathSegmentData.h
M Source/WebKit/GPUProcess/graphics/PathSegment.serialization.in
M Source/WebKit/GPUProcess/graphics/RemoteGraphicsContext.cpp
M Source/WebKit/GPUProcess/graphics/RemoteGraphicsContext.h
M Source/WebKit/GPUProcess/graphics/RemoteGraphicsContext.messages.in
M Source/WebKit/Scripts/webkit/messages.py
M Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextProxy.cpp
M Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextProxy.h
M Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.cpp
M Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h
M Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp
M Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h
M Source/WebKit/WebProcess/GPU/graphics/RemoteSnapshotRecorderProxy.cpp
Log Message:
-----------
[MotionMark 1.3] Batch canvas line stroke IPC messages to reduce per-line
decode overhead
https://bugs.webkit.org/show_bug.cgi?id=315554
rdar://177927925
Reviewed by Simon Fraser and Kimmo Kinnunen.
The canvas-lines subtest sends any many StrokeLineWithColorAndThickness IPC
messages per frame as possible. Each message incurs stream decode/dispatch
overhead and, on the GPU side, constructs a full Path object only to immediately
detect it's a single line segment and call CGContextStrokeLineSegments. The Path
construction and destruction per message is pure waste.
Buffer up to 64 consecutive single-line strokes in RemoteGraphicsContextProxy
and flush them as a single StrokeLinesWithColorAndThickness batch message. On
the GPU side, the batch handler iterates directly over the lines calling
CGContextStrokeLineSegments without constructing any Path objects, skipping
redundant color/thickness state changes between consecutive lines with matching
attributes.
The existing single-line strokeLine handler is also optimized to call
CGContextStrokeLineSegments directly, bypassing Path construction. To preserve
correctness when stroke state involves a pattern or gradient,
GraphicsContextCG::strokeLine applies the pattern before stroking, and falls
back through GraphicsContext::strokeLine (which routes through strokePath)
when a gradient is set, mirroring the single-line fast path inside strokePath.
Buffering only works if pending lines are flushed before anything observes the
canvas contents. RemoteGraphicsContextProxy::send() always flushes pending
lines first; a private sendRaw() helper performs the IPC without flushing and
is what flushPendingLines() calls, eliminating recursion.
RemoteImageBufferProxy::
send/sendSync flush before image-buffer-targeted messages (PutPixelBuffer,
FlushContextSync, CopyNativeImage, etc.). getPixelBuffer flushes explicitly
because its non-mappable branch routes through RemoteRenderingBackendProxy's
connection, bypassing the proxy's own send hooks.
recordResourceUse(ImageBuffer&)
flushes the source buffer's pending lines after isCached() confirms the buffer
is one of our proxies, so cross-buffer draws (drawImageBuffer, drawPattern,
clipToImageBuffer, drawFilteredImageBuffer) see its up-to-date contents.
* Source/WebCore/platform/graphics/ColorTypes.h:
(WebCore::PackedColor::RGBA::operator ==):
* Source/WebCore/platform/graphics/PathSegmentData.cpp:
(WebCore::operator<<):
* Source/WebCore/platform/graphics/PathSegmentData.h:
* Source/WebKit/GPUProcess/graphics/PathSegment.serialization.in:
* Source/WebKit/GPUProcess/graphics/RemoteGraphicsContext.cpp:
(WebKit::RemoteGraphicsContext::strokeLinesWithColorAndThickness):
(WebKit::RemoteGraphicsContext::strokeLineWithColorAndThickness): Deleted.
* Source/WebKit/GPUProcess/graphics/RemoteGraphicsContext.h:
* Source/WebKit/GPUProcess/graphics/RemoteGraphicsContext.messages.in:
* Source/WebKit/Scripts/webkit/messages.py:
(types_that_cannot_be_forward_declared):
(headers_for_type):
* Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextProxy.cpp:
(WebKit::RemoteGraphicsContextProxy::send):
(WebKit::RemoteGraphicsContextProxy::save):
(WebKit::RemoteGraphicsContextProxy::restore):
(WebKit::RemoteGraphicsContextProxy::translate):
(WebKit::RemoteGraphicsContextProxy::rotate):
(WebKit::RemoteGraphicsContextProxy::scale):
(WebKit::RemoteGraphicsContextProxy::setCTM):
(WebKit::RemoteGraphicsContextProxy::concatCTM):
(WebKit::RemoteGraphicsContextProxy::setLineCap):
(WebKit::RemoteGraphicsContextProxy::setLineDash):
(WebKit::RemoteGraphicsContextProxy::setLineJoin):
(WebKit::RemoteGraphicsContextProxy::setMiterLimit):
(WebKit::RemoteGraphicsContextProxy::clip):
(WebKit::RemoteGraphicsContextProxy::clipRoundedRect):
(WebKit::RemoteGraphicsContextProxy::clipOut):
(WebKit::RemoteGraphicsContextProxy::clipOutRoundedRect):
(WebKit::RemoteGraphicsContextProxy::clipToImageBuffer):
(WebKit::RemoteGraphicsContextProxy::clipPath):
(WebKit::RemoteGraphicsContextProxy::resetClip):
(WebKit::RemoteGraphicsContextProxy::drawFilteredImageBuffer):
(WebKit::RemoteGraphicsContextProxy::drawGlyphsImmediate):
(WebKit::RemoteGraphicsContextProxy::drawDisplayList):
(WebKit::RemoteGraphicsContextProxy::drawImageBuffer):
(WebKit::RemoteGraphicsContextProxy::drawNativeImage):
(WebKit::RemoteGraphicsContextProxy::drawSystemImage):
(WebKit::RemoteGraphicsContextProxy::drawPattern):
(WebKit::RemoteGraphicsContextProxy::beginTransparencyLayer):
(WebKit::RemoteGraphicsContextProxy::endTransparencyLayer):
(WebKit::RemoteGraphicsContextProxy::drawRect):
(WebKit::RemoteGraphicsContextProxy::drawLine):
(WebKit::RemoteGraphicsContextProxy::drawLinesForText):
(WebKit::RemoteGraphicsContextProxy::drawDotsForDocumentMarker):
(WebKit::RemoteGraphicsContextProxy::drawEllipse):
(WebKit::RemoteGraphicsContextProxy::drawPath):
(WebKit::RemoteGraphicsContextProxy::drawFocusRing):
(WebKit::RemoteGraphicsContextProxy::fillPath):
(WebKit::RemoteGraphicsContextProxy::fillRect):
(WebKit::RemoteGraphicsContextProxy::fillRoundedRect):
(WebKit::RemoteGraphicsContextProxy::fillRectWithRoundedHole):
(WebKit::RemoteGraphicsContextProxy::fillEllipse):
(WebKit::RemoteGraphicsContextProxy::drawVideoFrame):
(WebKit::RemoteGraphicsContextProxy::strokePath):
(WebKit::RemoteGraphicsContextProxy::strokeRect):
(WebKit::RemoteGraphicsContextProxy::strokeEllipse):
(WebKit::RemoteGraphicsContextProxy::bufferLine):
(WebKit::RemoteGraphicsContextProxy::sendPendingDraws):
(WebKit::RemoteGraphicsContextProxy::clearRect):
(WebKit::RemoteGraphicsContextProxy::drawControlPart):
(WebKit::RemoteGraphicsContextProxy::applyStrokePattern):
(WebKit::RemoteGraphicsContextProxy::applyFillPattern):
(WebKit::RemoteGraphicsContextProxy::applyDeviceScaleFactor):
(WebKit::RemoteGraphicsContextProxy::beginPage):
(WebKit::RemoteGraphicsContextProxy::endPage):
(WebKit::RemoteGraphicsContextProxy::setURLForRect):
(WebKit::RemoteGraphicsContextProxy::recordResourceUse):
(WebKit::RemoteGraphicsContextProxy::inlineStrokeStateIfBatchable):
(WebKit::RemoteGraphicsContextProxy::appendStateChangeItemForInlineStrokeIfNecessary):
Deleted.
* Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextProxy.h:
(WebKit::RemoteGraphicsContextProxy::sendPendingDrawsIfNecessary):
(WebKit::RemoteGraphicsContextProxy::consumeHasDrawn):
* Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.cpp:
(WebKit::RemoteImageBufferProxy::copyNativeImage const):
(WebKit::RemoteImageBufferProxy::filteredNativeImage):
(WebKit::RemoteImageBufferProxy::getPixelBuffer const):
(WebKit::RemoteImageBufferProxy::putPixelBuffer):
(WebKit::RemoteImageBufferProxy::convertToLuminanceMask):
(WebKit::RemoteImageBufferProxy::transformToColorSpace):
* Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
* Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp:
(WebKit::RemoteRenderingBackendProxy::cachedImageBuffer const):
(WebKit::RemoteRenderingBackendProxy::isCached const): Deleted.
* Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h:
* Source/WebKit/WebProcess/GPU/graphics/RemoteSnapshotRecorderProxy.cpp:
(WebKit::RemoteSnapshotRecorderProxy::drawSnapshotFrame):
Canonical link: https://commits.webkit.org/314520@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications