- Relationships (‘<==>’ means ‘is one-to-one with’)
- GPU process <==>
RemoteTextureMap RemoteTextureOwnerClient<==>WebGPUParent(and thusWebGPUChild)TextureOwner<==>CanvasContext, when configured
- GPU process <==>
- Tracking
TextureOwner- has various queues of
TextureDataHolder, a struct ofTextureHost(?)TextureData(?)SharedResourceWrapper, an enum ofgl::SharedSurfacewebgpu::ExternalTexture
- has various queues of
RemoteTextureMapRemoteTextureMap::Getreturns the singleton- keys are (pid, owner) pairs:
- pid is a child process pid
- owner is an id allocated in that pid
- values are
TextureOwner
RemoteTextureOwnerClienttracks groups ofTextureOwnerobjects- mostly a front end for
RemoteTextureMapthat can operate on the group, or individual members
- mostly a front end for
WebGPUParent::mRemoteTextureOwneris itsRemoteTextureOwnerClient
- Adding
TextureOwnerobjectsmozilla::webgpu::CanvasContext::Configure- allocates a fresh
layers::RemoteTextureOwnerId(saved asmRemoteTextureOwnerId) - calls
mozilla::webgpu::Device::InitSwapChainpassing that owner id - calls
SendDeviceCreateSwapChain, passing that owner id - ***** IPC BOUNDARY *****
RecvDeviceCreateSwapChain- ensures this
WebGPUParenthas aRemoteTextureOwnerClient - calls
RemoteTextureOwnerClient::RegisterTextureOwnerfor the new owner id - calls
RemoteTextureMap::RegisterTextureOwner - poof, now the
CanvasContexthas aTextureOwnerunder itsmRemoteTextureOwnerId
- ensures this
- allocates a fresh
- Removing
TextureOwnerobjectsCanvasContext::UnconfigurecallsSendSwapChainDrop, passingmRemoteTextureOwnerId- ***** IPC BOUNDARY *****
WebGPUParent::RecvSwapChainDrop- calls
RemoteTextureOwnerClient::UnregisterTextureOwner- calls
RemoteTextureMap::UnregisterTextureOwner- carefully interacts with compositor, but does eventually
remove the entry from
RemoteTextureMap::mTextureOwnersand destroy it poof
- carefully interacts with compositor, but does eventually
remove the entry from
- calls
- calls
- Adding
RemoteTextureOwnerClientobjectsRecvDeviceCreateSwapChainensures theWebGPUParenthas one, in the process of creating the ~TextureOwner~a
- Removing
RemoteTextureOwnerClientobjectsWebGPUParent::ActorDestroy- calls
RemoteTextureOwnerClient::UnregisterAllTextureOwners- which calls
RemoteTextureMap::UnregisterTextureOwners, passing the client’s set of owners- which does the same as
UnregisterTextureOwner(singular), but only acquires the lock once
- which does the same as
- which calls
- assigns nullptr to
mRemoteTextureOwnerto free it
- calls
- Initializing the
RemoteTextureMap- only initialized in the dedicated GPU process or in the main
process if the dedicated GPU process is disabled, by calling
RemoteTextureMap::Init
- only initialized in the dedicated GPU process or in the main
process if the dedicated GPU process is disabled, by calling
Created
August 14, 2025 14:51
-
-
Save jimblandy/d9f58ffa61a5c3d4a2fdcf71e684eb34 to your computer and use it in GitHub Desktop.
Notes on Firefox's remote texture architecture
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment