[webkit-changes] [WebKit/WebKit] 203eb4: [Skia] Add support for multi-threaded CPU rendering

Nikolas Zimmermann noreply at github.com
Thu Feb 22 03:18:07 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 203eb419d8226c5a5214c7f637b4529964f5a434
      https://github.com/WebKit/WebKit/commit/203eb419d8226c5a5214c7f637b4529964f5a434
  Author: Nikolas Zimmermann <nzimmermann at igalia.com>
  Date:   2024-02-22 (Thu, 22 Feb 2024)

  Changed paths:
    M Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h
    M Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayerSkia.cpp
    M Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp
    M Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h

  Log Message:
  -----------
  [Skia] Add support for multi-threaded CPU rendering
https://bugs.webkit.org/show_bug.cgi?id=269450

Reviewed by Carlos Garcia Campos.

Currently CoordinatedGraphicsLayer::paintTile() creates an Nicosia::Un-
cceleratedBuffer, paints the GraphicsLayer into it and returns the
finished buffer. The resulting Nicosia::Buffers are collected and will
be used later on in the ThreadedCompositor to swap the tile buffers.

Each tile is painted sequentially using the same procedure. To better
exploit multicores, we record a DisplayList (which should be faster
than painting), and then post tasks to a WorkerPool, to replay the
DisplayList and perform the drawing. With that concept, painting of
tiles happens in parallel. The buffer-consuming code in
CoordinatedBackingStoreTile::swapBuffers() properly waits for painting
completion before it attempts to access the pixel data (in the CPU
backend case) - therefore we can easily parallelize the tile painting,
just like it has been done in the Cairo case, but re-using the
cross-platform display list recording/replaying approach instead of a
custom NicosiaCairoOperationRecorder-like class.

This improves MotionMark performance, even on desktop, when CPU painting
is used. The improvement does not scale linear with the number of threads
used - not all tiles are equally "occupied", and thus some benefit more
from doing non-sequential painting, others not.

Covered by existing tests.

* Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
* Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayerSkia.cpp:
(WebCore::CoordinatedGraphicsLayer::paintTile):
* Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
(WebKit::skiaNumberOfCpuPaintingThreads):
(WebKit::CompositingCoordinator::CompositingCoordinator):
(WebKit::CompositingCoordinator::invalidate):
* Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:

Canonical link: https://commits.webkit.org/275170@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list