Hey everyone,
Nathan and I have been digging into the
OneCopyRasterBufferProvider and it seems like the flow isn't what we expected it to be. The context is
crbug.com/984045 about avoiding additional copies that came up on this
patch.
We assumed the idea was to raster into shared memory and upload directly to tile resources that can be used for compositing. But the flow we're seeing in the code is as follows:
1) The renderer uses skia to raster a tile into shared memory using a GMB. We try to do partial raster here if we can reuse an old buffer (
here).
2) The renderer notifies the GPU of the shm update using SharedImageInterface::UpdateSharedImage
here. This is important since the next time a caller tries to BeginAccess on the GL representation for this GMB's shared image, it will trigger a texture upload
here.
3) The renderer uses CopySubTexture to trigger uploading the update in shared memory to the destination texture (
here). This call copies chunks at a time which I assumed was so the upload was interruptible service side?
Another interesting thing here was that we copy the full tile even for the partial raster case which I didn't expect.
3) On the GPU service side, CopySubTexture lands
here for the GL case which uploads to the tile resource. But another upload was already triggered when read access was opened for the GMB backed image
here. So we're doing multiple uploads of this memory to different textures.
The passthrough case doesn't have any special handling for GMBs so we get a GPU->GPU copy
here, after an upload similarly triggered by read access on the shared image.
So did the one copy path regress with redundant uploads/copies somewhere along the way, or are we missing something here? Also, is the skia copy code-path in CopySubTexture any different from the passthrough one in the current code?
Thanks.
Khushal