- Relationships (‘<==>’ means ‘is one-to-one with’)
    - GPU process <==> RemoteTextureMap
- RemoteTextureOwnerClient<==>- WebGPUParent(and thus- WebGPUChild)
- TextureOwner<==>- CanvasContext, when configured
 
- GPU process <==> 
- Tracking
    - TextureOwner- has various queues of
            - TextureDataHolder, a struct of- TextureHost(?)
- TextureData(?)
- SharedResourceWrapper, an enum of- gl::SharedSurface
- webgpu::ExternalTexture
 
 
 
 
- has various queues of
            
- RemoteTextureMap- RemoteTextureMap::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 of- TextureOwnerobjects- mostly a front end for RemoteTextureMapthat can operate on the group, or individual members
 
- mostly a front end for 
- WebGPUParent::mRemoteTextureOwneris its- RemoteTextureOwnerClient
 
- Adding TextureOwnerobjects- mozilla::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 TextureOwnerobjects- CanvasContext::Unconfigurecalls- SendSwapChainDrop, passing- mRemoteTextureOwnerId
- ***** 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 RemoteTextureOwnerClientobjects- RecvDeviceCreateSwapChainensures the- WebGPUParenthas one, in the process of creating the ~TextureOwner~a
 
- Removing RemoteTextureOwnerClientobjects- WebGPUParent::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