Bug 226384

Summary: Make ImageBuffer be able to put pixels directly into its backend from another ImageBuffer
Product: WebKit Reporter: Said Abou-Hallawa <sabouhallawa>
Component: Layout and RenderingAssignee: Said Abou-Hallawa <sabouhallawa>
Status: NEW    
Severity: Normal CC: bfulgham, dino, ews-watchlist, kondapallykalyan, sam, simon.fraser, webkit-bug-importer, zalan
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch
ews-feeder: commit-queue-
Patch
none
Patch
none
Patch
none
Patch
none
Patch
ews-feeder: commit-queue-
Patch sabouhallawa: review?

Said Abou-Hallawa
Reported 2021-05-28 11:36:02 PDT
This can replace the call to ImageBuffer::draw() where alpha blending or scaling is required, for example the call in SourceGraphic::platformApplySoftware().
Attachments
Patch (3.86 KB, patch)
2021-05-28 11:38 PDT, Said Abou-Hallawa
no flags
Patch (19.34 KB, patch)
2021-05-28 13:32 PDT, Said Abou-Hallawa
no flags
Patch (19.34 KB, patch)
2021-05-28 15:53 PDT, Said Abou-Hallawa
ews-feeder: commit-queue-
Patch (19.34 KB, patch)
2021-05-28 16:04 PDT, Said Abou-Hallawa
no flags
Patch (56.73 KB, patch)
2021-05-29 14:06 PDT, Said Abou-Hallawa
no flags
Patch (61.81 KB, patch)
2021-05-29 14:24 PDT, Said Abou-Hallawa
no flags
Patch (35.43 KB, patch)
2021-05-31 04:43 PDT, Said Abou-Hallawa
no flags
Patch (35.55 KB, patch)
2021-05-31 05:33 PDT, Said Abou-Hallawa
ews-feeder: commit-queue-
Patch (35.58 KB, patch)
2021-05-31 05:46 PDT, Said Abou-Hallawa
sabouhallawa: review?
Said Abou-Hallawa
Comment 1 2021-05-28 11:37:26 PDT
I meant: ...where alpha blending or scaling is NOT required.
Said Abou-Hallawa
Comment 2 2021-05-28 11:38:24 PDT
Simon Fraser (smfr)
Comment 3 2021-05-28 11:39:40 PDT
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?
Simon Fraser (smfr)
Comment 4 2021-05-28 11:41:40 PDT
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?
Said Abou-Hallawa
Comment 5 2021-05-28 11:44:23 PDT
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.
Said Abou-Hallawa
Comment 6 2021-05-28 11:49:50 PDT
This code can be optimized more if we copy from the source backend to the destination backend directly without going through the PixelBuffer.
Said Abou-Hallawa
Comment 7 2021-05-28 12:45:53 PDT
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().
Said Abou-Hallawa
Comment 8 2021-05-28 13:32:59 PDT
Said Abou-Hallawa
Comment 9 2021-05-28 15:53:26 PDT
Said Abou-Hallawa
Comment 10 2021-05-28 16:04:39 PDT
Sam Weinig
Comment 11 2021-05-29 09:09:35 PDT
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?
Said Abou-Hallawa
Comment 12 2021-05-29 14:06:51 PDT
Said Abou-Hallawa
Comment 13 2021-05-29 14:11:13 PDT
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.
Said Abou-Hallawa
Comment 14 2021-05-29 14:24:00 PDT
Said Abou-Hallawa
Comment 15 2021-05-31 04:43:41 PDT
Said Abou-Hallawa
Comment 16 2021-05-31 05:33:58 PDT
Said Abou-Hallawa
Comment 17 2021-05-31 05:46:42 PDT
Radar WebKit Bug Importer
Comment 18 2021-06-04 11:37:53 PDT
Note You need to log in before you can comment on or make changes to this bug.