Title: [285055] trunk/Source
- Revision
- 285055
- Author
- [email protected]
- Date
- 2021-10-29 14:45:39 -0700 (Fri, 29 Oct 2021)
Log Message
Source/WebCore:
Avoid sending video data to Web process for canvas.drawImage(video)
https://bugs.webkit.org/show_bug.cgi?id=230766
<rdar://problem/83576009>
Reviewed by Simon Fraser.
Using nativeImageForCurrentTime() to get the image to paint on to the
canvas results in a ShareableBitmap being created to send to the
Web process, the identifier for which we then send back to the GPU
process for the drawImage() call. But if we use
paintCurrentFrameInContext(), this uses the PaintFrameForMedia
message, which just sends the MediaPlayer ID and avoids the bitmap
creation.
* html/canvas/CanvasRenderingContext2DBase.cpp:
(WebCore::CanvasRenderingContext2DBase::drawImage):
* platform/graphics/ImageBuffer.h:
(WebCore::ImageBuffer::isRemote const):
Source/WebKit:
Avoid sending video data to Web process for canvas.drawImage(video).
https://bugs.webkit.org/show_bug.cgi?id=230766
<rdar://problem/83576009>
Reviewed by Simon Fraser.
* WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (285054 => 285055)
--- trunk/Source/WebCore/ChangeLog 2021-10-29 21:42:50 UTC (rev 285054)
+++ trunk/Source/WebCore/ChangeLog 2021-10-29 21:45:39 UTC (rev 285055)
@@ -1,3 +1,24 @@
+2021-10-29 Cameron McCormack <[email protected]>
+
+ Avoid sending video data to Web process for canvas.drawImage(video)
+ https://bugs.webkit.org/show_bug.cgi?id=230766
+ <rdar://problem/83576009>
+
+ Reviewed by Simon Fraser.
+
+ Using nativeImageForCurrentTime() to get the image to paint on to the
+ canvas results in a ShareableBitmap being created to send to the
+ Web process, the identifier for which we then send back to the GPU
+ process for the drawImage() call. But if we use
+ paintCurrentFrameInContext(), this uses the PaintFrameForMedia
+ message, which just sends the MediaPlayer ID and avoids the bitmap
+ creation.
+
+ * html/canvas/CanvasRenderingContext2DBase.cpp:
+ (WebCore::CanvasRenderingContext2DBase::drawImage):
+ * platform/graphics/ImageBuffer.h:
+ (WebCore::ImageBuffer::isRemote const):
+
2021-10-29 Antti Koivisto <[email protected]>
Allow :is/:where after all pseudo elements
Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp (285054 => 285055)
--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp 2021-10-29 21:42:50 UTC (rev 285054)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp 2021-10-29 21:45:39 UTC (rev 285055)
@@ -1677,17 +1677,19 @@
checkOrigin(&video);
#if USE(CG)
- if (auto image = video.nativeImageForCurrentTime()) {
- c->drawNativeImage(*image, FloatSize(video.videoWidth(), video.videoHeight()), dstRect, srcRect);
+ if (!canvasBase().buffer()->isRemote()) {
+ if (auto image = video.nativeImageForCurrentTime()) {
+ c->drawNativeImage(*image, FloatSize(video.videoWidth(), video.videoHeight()), dstRect, srcRect);
- if (isEntireBackingStoreDirty())
- didDraw(std::nullopt);
- else if (rectContainsCanvas(dstRect))
- didDrawEntireCanvas();
- else
- didDraw(dstRect);
+ if (isEntireBackingStoreDirty())
+ didDraw(std::nullopt);
+ else if (rectContainsCanvas(dstRect))
+ didDrawEntireCanvas();
+ else
+ didDraw(dstRect);
- return { };
+ return { };
+ }
}
#endif
Modified: trunk/Source/WebCore/platform/graphics/ImageBuffer.h (285054 => 285055)
--- trunk/Source/WebCore/platform/graphics/ImageBuffer.h 2021-10-29 21:42:50 UTC (rev 285054)
+++ trunk/Source/WebCore/platform/graphics/ImageBuffer.h 2021-10-29 21:45:39 UTC (rev 285055)
@@ -71,6 +71,7 @@
virtual RenderingMode renderingMode() const = 0;
virtual bool canMapBackingStore() const = 0;
+ virtual bool isRemote() const { return false; }
virtual RenderingResourceIdentifier renderingResourceIdentifier() const { return { }; }
virtual GraphicsContext& context() const = 0;
Modified: trunk/Source/WebKit/ChangeLog (285054 => 285055)
--- trunk/Source/WebKit/ChangeLog 2021-10-29 21:42:50 UTC (rev 285054)
+++ trunk/Source/WebKit/ChangeLog 2021-10-29 21:45:39 UTC (rev 285055)
@@ -1,3 +1,13 @@
+2021-10-29 Cameron McCormack <[email protected]>
+
+ Avoid sending video data to Web process for canvas.drawImage(video).
+ https://bugs.webkit.org/show_bug.cgi?id=230766
+ <rdar://problem/83576009>
+
+ Reviewed by Simon Fraser.
+
+ * WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
+
2021-10-29 Alex Christensen <[email protected]>
Fix internal macOS build after r285047
Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h (285054 => 285055)
--- trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h 2021-10-29 21:42:50 UTC (rev 285054)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h 2021-10-29 21:45:39 UTC (rev 285055)
@@ -95,6 +95,8 @@
ASSERT(m_sentFlushIdentifier == targetFlushIdentifier);
}
+ bool isRemote() const final { return true; }
+
protected:
RemoteImageBufferProxy(const WebCore::ImageBufferBackend::Parameters& parameters, RemoteRenderingBackendProxy& remoteRenderingBackendProxy)
: BaseConcreteImageBuffer(parameters)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes