Bug 219873 - [GPUProcess] Bump QoS to UserInteractive for real-time audio rendering thread
Summary: [GPUProcess] Bump QoS to UserInteractive for real-time audio rendering thread
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Audio (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL: https://developer.apple.com/library/a...
Keywords: InRadar
Depends on:
Blocks: 219818
  Show dependency treegraph
 
Reported: 2020-12-14 14:12 PST by Chris Dumez
Modified: 2020-12-14 15:46 PST (History)
12 users (show)

See Also:


Attachments
Patch (14.57 KB, patch)
2020-12-14 14:29 PST, Chris Dumez
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (14.64 KB, patch)
2020-12-14 14:35 PST, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2020-12-14 14:12:57 PST
Bump QoS to UserInteractive for real-time audio rendering thread. We create our own thread on WebContent side when the GPU Process is enabled since the CoreAudio rendering thread lives in the GPU Process. To ensure the same quality of service, we need to make sure the thread we create gets very high QoS.
Comment 1 Chris Dumez 2020-12-14 14:29:30 PST
Created attachment 416194 [details]
Patch
Comment 2 Chris Dumez 2020-12-14 14:35:18 PST
Created attachment 416196 [details]
Patch
Comment 3 Peng Liu 2020-12-14 14:38:14 PST
Comment on attachment 416196 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=416196&action=review

> Source/WTF/ChangeLog:8
> +        Add QOS parameter to the Thread construct (similarly to WorkQueue) so that the caller can

Maybe priority is a better name for the parameter?
Comment 4 Chris Dumez 2020-12-14 14:41:17 PST
(In reply to Peng Liu from comment #3)
> Comment on attachment 416196 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=416196&action=review
> 
> > Source/WTF/ChangeLog:8
> > +        Add QOS parameter to the Thread construct (similarly to WorkQueue) so that the caller can
> 
> Maybe priority is a better name for the parameter?

QoS (quality of service) is the naming on our platforms. The concept of process/thread priority also exists on our platforms but has a different meaning. As a result, I wouldn't want to conflate the 2. Also note that I am merely following the pattern in WorkQueue, not introducing a new concept in this patch.
Comment 5 Geoffrey Garen 2020-12-14 15:17:33 PST
Comment on attachment 416196 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=416196&action=review

> Source/WebCore/Modules/webaudio/AudioWorkletThread.cpp:69
> +    }, ThreadType::Audio, m_parameters.isAudioContextRealTime ? Thread::QOS::UserInteractive : Thread::QOS::Default);

What's the non-realtime case for audio?

> Source/WebCore/worklets/WorkletParameters.h:40
> +    bool isAudioContextRealTime;

Where does this get initialized?
Comment 6 Chris Dumez 2020-12-14 15:23:25 PST
(In reply to Geoffrey Garen from comment #5)
> Comment on attachment 416196 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=416196&action=review
> 
> > Source/WebCore/Modules/webaudio/AudioWorkletThread.cpp:69
> > +    }, ThreadType::Audio, m_parameters.isAudioContextRealTime ? Thread::QOS::UserInteractive : Thread::QOS::Default);
> 
> What's the non-realtime case for audio?

When you construct an OfflineAudioContext (instead of an AudioContext), audio is rendered offline into a buffer instead of in real time on the speakers.

> 
> > Source/WebCore/worklets/WorkletParameters.h:40
> > +    bool isAudioContextRealTime;
> 
> Where does this get initialized?

Yes, it is, based on whether or not the AudioContext is offline or not, which answers your question above.
Comment 7 Chris Dumez 2020-12-14 15:24:13 PST
Comment on attachment 416196 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=416196&action=review

> Source/WebCore/Modules/webaudio/AudioWorkletMessagingProxy.cpp:57
> +        worklet.audioContext() ? !worklet.audioContext()->isOfflineContext() : false

For Geoff, this is where the isAudioContextRealTime flag gets initialized.
Comment 8 Geoffrey Garen 2020-12-14 15:40:24 PST
👍🏻
Comment 9 EWS 2020-12-14 15:44:58 PST
Committed r270806: <https://trac.webkit.org/changeset/270806>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 416196 [details].
Comment 10 Radar WebKit Bug Importer 2020-12-14 15:46:11 PST
<rdar://problem/72317707>