RESOLVED FIXED 277702
[GTK][WPE][Skia] Use RGBA as the pixel format for texture backed SkSurfaces
https://bugs.webkit.org/show_bug.cgi?id=277702
Summary [GTK][WPE][Skia] Use RGBA as the pixel format for texture backed SkSurfaces
Miguel Gomez
Reported 2024-08-06 12:05:25 PDT
There are 2 places in the code where we're allocating texture backed SkSurfaces: - SkiaAcceleratedBufferPool, where we use them for tile rendering when the gpu backend is enabled. - ImageBufferSkiaAcceleratedBackend, where we use them for ImageBuffers (for accelerated canvas and ImageBitmap) In both of these cases, the SkSurfaces are created with pixelFormat BGRA, which is the default. The problem with this is that the underlying texture has RGBA format, which means that skia is constantly performing format conversions, which hurts the performance a lot. To avoid this, we should create the surfaces with RGBA format. This is pretty easy in the SkiaAcceleratedBufferPool, where the content of the surface is only accessed through the texture to update the tile textures during the composition, and the texture is always RGBA. For the ImageBuffer this is a bit trickier, as the content of the surface can be accessed in several ways (I think I'm not missing any): - through the texture during the call to swapBuffersIfNeeded. No problem here as the texture is RGBA. - through ImageBuffer::getPixelBuffer() and ImageBuffer::putPixelBuffer(). In both cases we need to convert the format of the pixels as needed. - by painting the contents of the ImageBuffer into a GraphicsContext, which is done through skia, so skia takes care of the format conversions when needed. I'll create a patch based on these assumptions and check whether there's some case that I might be missing.
Attachments
Miguel Gomez
Comment 1 2024-08-06 12:13:53 PDT
EWS
Comment 2 2024-08-08 06:05:54 PDT
Committed 281985@main (50cb029965f1): <https://commits.webkit.org/281985@main> Reviewed commits have been landed. Closing PR #31799 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.