[webkit-changes] [WebKit/WebKit] 7be7a6: WebKit.GPU using an average of 57% CPU (2.0W estim...

Jean-Yves Avenard noreply at github.com
Tue Feb 27 16:04:08 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 7be7a65a49c17c990afe62c11528e99ef6ccfaf4
      https://github.com/WebKit/WebKit/commit/7be7a65a49c17c990afe62c11528e99ef6ccfaf4
  Author: Jean-Yves Avenard <jya at apple.com>
  Date:   2024-02-27 (Tue, 27 Feb 2024)

  Changed paths:
    M Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm

  Log Message:
  -----------
  WebKit.GPU using an average of 57% CPU (2.0W estimated impact) for 2.1 hrs [+7%/hr]
https://bugs.webkit.org/show_bug.cgi?id=270154
rdar://122916282

Reviewed by Eric Carlson.

When the AVSampleBufferDisplaLayer notified the SourceBufferPrivateAVObjC that is was
ready for more data, we checked via SourceBufferPrivate::isReadyForMoreSamples().

If we had previously been interrupted with a layerRequiresFlushToResumeDecodingChanged
error, and until we flushed the renderer, isReadyForMoreSamples() would have returned false
and iwe would then immediately request the layer to notify us when ready again.
Prior 268283 at main, requesting the AVSBDL to notify us if it was ready for more sample
was the right thing to do.
However, now that there's a flush pending, what it would do is make the AVSBDL call
us immediately. This caused the code to run in an unlimited loop.

We add a check if flushing is required and abort early if so.

The ability to reproduce the case and to simulate is not possible with the current
infrastructure. Problem was found through log analysis and code review only.

* Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
(WebCore::SourceBufferPrivateAVFObjC::flushIfNeeded): Add logging for when we are actually
flushing the SourceBuffer. Not having logging made the investigation difficult as we had log
that the AVSBDL required flushing, but no information about if we had log flushed or not
(which can happen in two cases: page became visible again, or play() was called)
(WebCore::SourceBufferPrivateAVFObjC::notifyClientWhenReadyForMoreSamples):

Canonical link: https://commits.webkit.org/275415@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