Closed Bug 1795311 Opened 2 years ago Closed 2 years ago

A new shmem class with more flexible lifetime management

Categories

(Core :: Graphics, task, P3)

task

Tracking

()

RESOLVED FIXED
108 Branch
Tracking Status
firefox108 --- fixed

People

(Reporter: nical, Assigned: nical)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

ipc::Shmem lifetime is managed by the IPDL actors that create them and as a result are automatically deallocated along with the actors, including during abnormal IPDL shutdown (other process crashes).

This aspect does not quite click with how some of the graphics code want to use shmem. In particular there are places where we "wrap" objects around the shared memory such as draw targets or WebGPU buffers. In these cases we want the possibility for the shmem to outlive IPDL actors and simply get deallocated when there is no more references to the shmem in the process.

TODO:

  • Split the shmem class into the shmem mapping and the shmem handle.
  • allocation returns a Maybe<std::pair<ShmemHandle, ShmemMapping>>
  • move into the ipc namespace
  • rename into one of "UnsafeShmem", "RawShmem", or "SharedMemoryMapping/SharedMemoryHandle"
Attachment #9298646 - Attachment description: WIP: Bug 1795311 - (WIP) A new shared memory class with reference counting semantics. → Bug 1795311 - A new shared memory class with reference counting semantics. r=nika
Attachment #9298647 - Attachment description: WIP: Bug 1795311 - Use the reference counted shmem in the WebGPU buffer impl. → Bug 1795311 - Use the reference counted shmem in the WebGPU buffer impl. r=jimb,jgilbert
Blocks: 1797039
Attachment #9298647 - Attachment description: Bug 1795311 - Use the reference counted shmem in the WebGPU buffer impl. r=jimb,jgilbert → Bug 1795311 - Use the new shmem classes in the WebGPU buffer impl. r=jimb,jgilbert
Attachment #9298646 - Attachment description: Bug 1795311 - A new shared memory class with reference counting semantics. r=nika → Bug 1795311 - A new shared memory class with more flexible memory management. r=nika,jld
Pushed by nsilva@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/60b9bfda2e8b
A new shared memory class with more flexible memory management. r=nika,jld
https://hg.mozilla.org/integration/autoland/rev/71697f876d88
Use the new shmem classes in the WebGPU buffer impl. r=jgilbert

Backed out for causing build bustages on WebGPUParent.cpp

  • Backout link
  • Push with failures
  • Failure Log
  • Failure line: /builds/worker/fetches/sysroot-x86_64-linux-gnu/usr/include/c++/7/ext/new_allocator.h:136:4: error: use of deleted function 'mozilla::ipc::WritableSharedMemoryMapping::WritableSharedMemoryMapping(mozilla::ipc::WritableSharedMemoryMapping&&)'
    gmake[4]: *** [/builds/worker/checkouts/gecko/config/rules.mk:669: Unified_cpp_dom_webgpu0.o] Error 1
    /builds/worker/checkouts/gecko/dom/webgpu/ipc/WebGPUParent.cpp:367:70: error: use of deleted function 'mozilla::ipc::WritableSharedMemoryMapping::WritableSharedMemoryMapping(mozilla::ipc::WritableSharedMemoryMapping&&)'
    /builds/worker/checkouts/gecko/dom/webgpu/ipc/WebGPUParent.cpp:368:71: error: no matching function for call to 'std::unordered_map<long unsigned int, mozilla::webgpu::WebGPUParent::BufferMapData>::insert(std::pair<long unsigned int, mozilla::webgpu::WebGPUParent::BufferMapData>)'
Flags: needinfo?(nical.bugzilla)
Pushed by nsilva@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/3a19cc8f5a1e
A new shared memory class with more flexible memory management. r=nika,jld
https://hg.mozilla.org/integration/autoland/rev/57b736500aa2
Use the new shmem classes in the WebGPU buffer impl. r=jgilbert
Flags: needinfo?(nical.bugzilla)
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 108 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: