Bug 1699224 - Part 5. Unmap shared surfaces if memory pressured during resource updates. r=jrmuizel
Before we start a resource update, we should check if we are virtual memory pressured (32-bit Windows only). If so, pre-emptively unmap shared surfaces until the pressure is relieved to try to avoid OOMs elsewhere. This only applies to the GPU process because the parent process actively watches its own memory pressure and dispatches a low-memory event which our expiration tracker is an observer for. Differential Revision: https://phabricator.services.mozilla.com/D109441
This commit is contained in:
@@ -485,8 +485,13 @@ bool WebRenderBridgeParent::UpdateResources(
|
||||
wr::ShmSegmentsReader reader(aSmallShmems, aLargeShmems);
|
||||
UniquePtr<ScheduleSharedSurfaceRelease> scheduleRelease;
|
||||
|
||||
if (!aResourceUpdates.IsEmpty()) {
|
||||
GPUParent::MaybeFlushMemory();
|
||||
while (GPUParent::MaybeFlushMemory()) {
|
||||
// If the GPU process has memory pressure, preemptively unmap some of our
|
||||
// shared memory images. If we are in the parent process, the expiration
|
||||
// tracker itself will listen for the memory pressure event.
|
||||
if (!SharedSurfacesParent::AgeAndExpireOneGeneration()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto& cmd : aResourceUpdates) {
|
||||
|
||||
Reference in New Issue
Block a user