Don't poll WebGPU from a timer
Categories
(Core :: Graphics: WebGPU, defect, P3)
Tracking
()
People
(Reporter: jimb, Unassigned)
References
(Blocks 1 open bug)
Details
Right now, when Firefox creates a PWebGPU
IPDL parent, the WebGPUParent
constructor starts a timer thread calling wgpu_core::global::device::Global::poll_all_devices
, to respond to the completion of work on the GPU. This polling runs ten times a second, and probably has an unacceptable impact on battery life.
Instead, creating a WebGPUParent
should start a separate thread that polls the wgpu devices only as necessary. Submitting a command buffer to a queue should dispatch a runnable to that thread (in classic Gecko style, using nsIEventTarget::Dispatch
or something like it) that calls Global::device_poll
, passing Maintain::WaitForSubmissionIndex
with the submission index returned by the submission. This will cause the thread to block until the GPU has completed the submitted work.
Various other WebGPU operations require calling device_poll
as well, and these can be handled by sending the thread appropriate runnables.
This approach should ensure that WebGPU consumes the CPU's attention only when we are actually waiting for work.
Reporter | ||
Updated•7 months ago
|
Reporter | ||
Updated•4 months ago
|
Description
•