This can replace the call to ImageBuffer::draw() where alpha blending or scaling is required, for example the call in SourceGraphic::platformApplySoftware().
I meant: ...where alpha blending or scaling is NOT required.
Created attachment 430032 [details] Patch
Comment on attachment 430032 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=430032&action=review > Source/WebCore/platform/graphics/ImageBuffer.cpp:195 > + if (auto pixelBuffer = sourceImage.getPixelBuffer(format, srcRect)) For buffers with GPU backing (IOSurfaces) does this trigger readback?
Comment on attachment 430032 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=430032&action=review > Source/WebCore/platform/graphics/ImageBuffer.cpp:187 > + if (resolutionScale() != sourceImage.resolutionScale()) { Doesn't this also need to check color profiles and maybe more?
Comment on attachment 430032 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=430032&action=review >> Source/WebCore/platform/graphics/ImageBuffer.cpp:195 >> + if (auto pixelBuffer = sourceImage.getPixelBuffer(format, srcRect)) > > For buffers with GPU backing (IOSurfaces) does this trigger readback? Oh yes. I was thinking about filters in WebProcess. For GPUP case, I think we need to create a DL item which can only be used if both source and destination are in GPUP.
This code can be optimized more if we copy from the source backend to the destination backend directly without going through the PixelBuffer.
Comment on attachment 430032 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=430032&action=review >> Source/WebCore/platform/graphics/ImageBuffer.cpp:187 >> + if (resolutionScale() != sourceImage.resolutionScale()) { > > Doesn't this also need to check color profiles and maybe more? I think getPixelBuffer() will take care of these. The source PixelBufferFormat below is set to get the pixels in the destination colorSpace() and pixelFormat().
Created attachment 430046 [details] Patch
Created attachment 430065 [details] Patch
Created attachment 430066 [details] Patch
Comment on attachment 430066 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=430066&action=review > Source/WebCore/platform/graphics/displaylists/DisplayListItems.h:2088 > + PutImageBuffer(RenderingResourceIdentifier imageBufferIdentifier, const IntPoint& destPoint) Does anything need to be done to ensure the sourceImage is not mutated before this can happen?
Created attachment 430110 [details] Patch
Comment on attachment 430066 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=430066&action=review >> Source/WebCore/platform/graphics/displaylists/DisplayListItems.h:2088 >> + PutImageBuffer(RenderingResourceIdentifier imageBufferIdentifier, const IntPoint& destPoint) > > Does anything need to be done to ensure the sourceImage is not mutated before this can happen? Yes you are right. PutImageBuffer should be a synchronous message after making sure all the pending items in both source and destination ImageBuffers are flushed to their backends.
Created attachment 430111 [details] Patch
Created attachment 430196 [details] Patch
Created attachment 430198 [details] Patch
Created attachment 430199 [details] Patch
<rdar://problem/78878491>