NEW 285260
Introduce ImmutableImageBuffer
https://bugs.webkit.org/show_bug.cgi?id=285260
Summary Introduce ImmutableImageBuffer
Said Abou-Hallawa
Reported 2024-12-30 23:24:31 PST
ImageBuffer is a drawing target. Its life cycle is usually split into two consecutive phases: (1) destination phase and (2) source phase. In the destination phase, something is drawn to the ImageBuffer. Usually a fragment of the document is drawn to ImageBuffer. In the source phase, the ImageBuffer is used as an image which can be drawn to another destination drawing target. We can call the ImageBuffer after the destination phase is finished: `ImmutableImageBuffer`. The canvas ImageBuffer is a special case because it does not work as described above. The drawing to this ImageBuffer and drawing the ImageBuffer itself can be interleaved. So this ImageBuffer will always be `MutableImageBuffer` or for now `ImageBuffer`. Recording DisplayListItems which reference MutableImageBuffers such as DrawImageBuffer and ClipToImageBuffer is problematic. The MutableImageBuffers can change between recording these items and replaying them back. The fix is to clone these MutableImageBuffers when recording these DisplayListItems. Cloning the MutableImageBuffers is expensive. If new versions of these drawing methods are introduced for ImmutableImageBuffers, this cloning will not be needed. So the caller side should be changed to have references to ImmutableImageBuffers if this is this case. ImmutableImageBuffer should be the base class of ImageBuffer. ImmutableImageBuffer does not provide any function that can change the backend. ImageBuffer will provide the `context()` and the `putPixelBuffer()` functions. It is nicer to have ImageBuffer the base class and MutableImageBuffer is the superclass. But this can be changed later because it is more involved change. All the GPUProcess RemoteImageBuffers will stay mutable because they are controlled by the WebProcess. If WebProcess stores an ImageBuffer as ImmutableImageBuffer, its backend will never be changed even if its backend is remote or shared.
Attachments
Radar WebKit Bug Importer
Comment 1 2024-12-30 23:25:12 PST
Said Abou-Hallawa
Comment 2 2024-12-30 23:33:49 PST
Note You need to log in before you can comment on or make changes to this bug.