Граф коммитов

20 Коммитов

Автор SHA1 Сообщение Дата
sotaro df6f2ba3e7 Bug 1827578 - Async wait remote texture ready of offscreen canvas at WebRenderImageHost r=gfx-reviewers,lsalzman
It should be OK to wait remote texture ready of offscreen canvas at WebRenderImageHost. Offscreen canvas uses ImageBridge. And ImageBridge works asynchronously.

WebRenderImageHost::UseRemoteTexture() is split to WebRenderImageHost::PushPendingRemoteTexture() and WebRenderImageHost::UseRemoteTexture(). It is for handling RemoteTexture ready callback in WebRenderImageHost.

Differential Revision: https://phabricator.services.mozilla.com/D175226
2023-04-13 21:38:24 +00:00
sotaro 60dadf4f06 Bug 1827050 - Check if TextureOwner exists before DUMMY_TEXTURE check r=lsalzman
TextureOwner check needs to be done before DUMMY_TEXTURE check.

Crash happened because remoteTexture was nullptr in RemoteTextureMap::GetExternalImageIdOfRemoteTexture(). The remoteTexture was nullptr , since TextureOwner was already unregistered.

Differential Revision: https://phabricator.services.mozilla.com/D175087
2023-04-11 03:04:02 +00:00
sotaro 8c971ce95e Bug 1826280 - Add RemoteTexture async waiting capability r=gfx-reviewers,lsalzman
RenderThread::PushPendingRemoteTexture() notifies pending RemoteTextures to RenderThread. And RemoteTextureMap::CheckRemoteTextureReady() is used for checking if a RemoteTexture is ready. If the RemoteTexture is not ready during the function call, callback will be called when the RemoteTexture becomes ready.

RemoteTextureMap::GetExternalImageIdOfRemoteTextureSync() is changed to RemoteTextureMap::GetExternalImageIdOfRemoteTexture() and wait of RemoteTexture ready in the function is removed. The wait of RemoteTexture ready is done by the callback of the CheckRemoteTextureReady().

Differential Revision: https://phabricator.services.mozilla.com/D174732
2023-04-06 05:27:08 +00:00
sotaro 44518c888e Bug 1808818 - Add RemoteTextureOwnerClient::PushDummyTexture() for handling remote texture allocation failure r=gfx-reviewers,lsalzman
Push dummy texture when remote texture allocation is failed.

Differential Revision: https://phabricator.services.mozilla.com/D166516
2023-01-11 22:23:01 +00:00
sotaro b6776d53b6 Bug 1808644 - Modify RemoteTextureMap as to reuse gl::SharedSurfaces by using a queue r=gfx-reviewers,lsalzman
On Android emulator, android fence sync is not supported. It caused the problem. Current RemoteTextureMap re-use gl::SharedSurface as stack. It seemed to cause the problem. If the recycling is done as queue, timing of it's recycling can be delayed.

By using queue, recycling of gl::SharedSurface works same as to non-RemoteTextureMap.

Differential Revision: https://phabricator.services.mozilla.com/D166018
2023-01-05 05:47:15 +00:00
sotaro 954c16acec Bug 1805209 - Use RemoteTexture for WebGPU r=gfx-reviewers,lsalzman
WebGPU uses CompositableInProcessManager to push TextureHost directly from WebGPUParent to WebRender. But CompositableInProcessManager plumbing has a problem and caused Bug 1805209.

gecko already has a similar mechanism, called RemoteTextureMap. It is used in oop WebGL. If WebGPU uses RemoteTextureMap instead of CompositableInProcessManager, both WebGPU and oop WebGL use same mechanism.

WebGPUParent pushes a new texture to RemoteTextureMap. The RemoteTextureMap notifies the pushed texture to WebRenderImageHost.

Before the change, only one TextureHost is used for one swap chain. With the change, multiple TextureHosts are used for one swap chain with recycling.

The changes are followings.

- Use RemoteTextureMap instead of CompositableInProcessManager.
- Use RemoteTextureOwnerId instead of CompositableHandle.
- Use WebRenderCanvasData instead of WebRenderInProcessImageData.
- Add remote texture pushed callback functionality to RemoteTextureMap. With it, RemoteTextureMap notifies a new pushed remote texture to WebRenderImageHost.
- Remove CompositableInProcessManager.

Differential Revision: https://phabricator.services.mozilla.com/D164890
2022-12-23 20:41:02 +00:00
sotaro 02d18ed8c1 Bug 1776885 - Add capability of async remote texture on WebGL if CanvasRenderThread is used r=gfx-reviewers,lsalzman
The remote texture is processed asynchronously, but the WebGL rendering results are rendered synchronously with WebRender transaction by WebRender.

Async remote texture support is enabled only when CanvasRenderThread is used. This is to simplify implementation.

In async mode, remote texture of current RemoteTextureId might not be created yet when WebRenderImageHost::UseRemoteTexture() is called. In this case, RemoteTextureHostWrapper uses its own external image ID, otherwise the RemoteTextureHostWrapper uses compatible old remote texture for creating wr display list. RenderTextureHostWrapper calls RemoteTextureMap::GetExternalImageIdOfRemoteTextureSync() before is ussage. The GetExternalImageIdOfRemoteTextureSync() synchronously waits until remote texture becomes ready. The wait works since WebGL IPC handling is always done in CanvasRenderThread in async mode.

PWebGLChild::SendGetFrontBuffer() triggers sync IPC. It is called to ensure the compatible remote texture in RemoteTextureMap during RemoteTextureMap::GetRemoteTextureForDisplayList() call.

Differential Revision: https://phabricator.services.mozilla.com/D162971
2022-12-07 02:24:57 +00:00
Stanca Serban d0ad6a0b22 Backed out changeset d78a41db7a82 (bug 1776885) for causing reftests failures in ReleaseCompositableRef. CLOSED TREE 2022-12-06 17:34:12 +02:00
sotaro e23cea6ac1 Bug 1776885 - Add capability of async remote texture on WebGL if CanvasRenderThread is used r=gfx-reviewers,lsalzman
The remote texture is processed asynchronously, but the WebGL rendering results are rendered synchronously with WebRender transaction by WebRender.

Async remote texture support is enabled only when CanvasRenderThread is used. This is to simplify implementation.

In async mode, remote texture of current RemoteTextureId might not be created yet when WebRenderImageHost::UseRemoteTexture() is called. In this case, RemoteTextureHostWrapper uses its own external image ID, otherwise the RemoteTextureHostWrapper uses compatible old remote texture for creating wr display list. RenderTextureHostWrapper calls RemoteTextureMap::GetExternalImageIdOfRemoteTextureSync() before is ussage. The GetExternalImageIdOfRemoteTextureSync() synchronously waits until remote texture becomes ready. The wait works since WebGL IPC handling is always done in CanvasRenderThread in async mode.

PWebGLChild::SendGetFrontBuffer() triggers sync IPC. It is called to ensure the compatible remote texture in RemoteTextureMap during RemoteTextureMap::GetRemoteTextureForDisplayList() call.

Differential Revision: https://phabricator.services.mozilla.com/D162971
2022-12-06 13:56:19 +00:00
sotaro 6b45a3fe5d Bug 1795050 - Set mResetLayer = true in ClientWebGLContext::Event_webglcontextrestored() r=gfx-reviewers,lsalzman
There was still a timing that hit the assert. When ClientWebGLContext::Event_webglcontextrestored() was called just before ClientWebGLContext::UpdateWebRenderCanvasData() the assert was failed.

Differential Revision: https://phabricator.services.mozilla.com/D161243
2022-11-05 04:14:31 +00:00
sotaro 87a37cfd91 Bug 1790188 - Fix releasing CompositableRef of mLatestTextureHost r=lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D157067
2022-09-12 03:49:02 +00:00
sotaro ee73cfe360 Bug 1789658 - Keep gl::SharedSurface/TextureData alive if remote texture's TextureHost is still in use by WebRender r=lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D156774
2022-09-08 14:27:44 +00:00
sotaro 525fcfea38 Bug 1781740 - Split RemoteTexture to RemoteTextureHostWrapper and actual remote texture's TextureHost r=gfx-reviewers,lsalzman
Preparation of Bug 1776885.

RemoteTextureMap is simplified. It expects that pref webgl.out-of-process.async-present.force-sync is true. Additional async remote texture ipc handling is going to be added at Bug 1776885.

- RemoteTextureHostWrapper wraps TextureHost of remote texture. It expose remote texture to WebRender. It notifies end of WebRender usage to the wrapped remote texture's TextureHost.
- Remote texture's TextureHost is created on WebGL ipc thread during pushing to RemoteTextureMap . End of usage of the remote texture is decided by using compositable ref of remote texture's TextureHost. The compositable ref is updated with holding RemoteTextureMap::mMutex.

Differential Revision: https://phabricator.services.mozilla.com/D152845
2022-09-07 00:58:34 +00:00
sotaro 259a76ce48 Bug 1786440 - Remove assert from RemoteTextureMap::UnregisterTextureConsumer() r=gfx-reviewers,lsalzman
Assert failure happens when RemoteTextureMap::UnregisterTextureConsumer() is called during shutdown. The assert could be removed since UnregisterTextureConsumer() works on non-compositor thread.

And the function is going to be removed by Bug 1781740.

Differential Revision: https://phabricator.services.mozilla.com/D155440
2022-08-24 04:29:19 +00:00
Lee Salzman 1f50b3d9b8 Bug 1777426 - Ensure MemoryTextureData frees memory when owned by RemoteTextureMap. r=aosmond,gfx-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D151422
2022-07-12 06:56:21 +00:00
Lee Salzman 1d9820a99d Bug 1777426 - Support fast readbacks in CopyToSwapChain with async present. r=sotaro,jgilbert
Currently CopyToSwapChain creates spurious copies of the back buffer when SharedSurfaces aren't exportable (= ToSurfaceDescriptor returns Nothing from SharedSurface_Basic). These then later get read back into a CPU memory buffer when PresentFrontBufferToCompositor is used to send the buffer to RemoteTextureMap. This has associated performance and memory costs.

Conceptually, we want Present/CopyToSwapChain to just do the right thing and automatically push buffers to RemoteTextureMap, rather than secondarily needing a hidden call to PresentFrontBufferToCompositor. Then we can get rid of the need to create front buffers whose only purpose is to shuttle data to PresentFrontBufferToCompositor which then shuttles it RemoteTextureMap.

This patch achieves this by refactoring the guts of PresentFrontBufferToCompositor into Present/CopyToSwapChain. The remote texture ids are sent along inside SwapChainOptions if async present is enabled. Those remote texture ids are cached in ClientWebGLContext so that GetFrontBuffer can return them without any subsequent need for an IPDL call.

On the parent side, CopyToSwapChain will now notice if async present is to be used and if a SurfaceFactory does not generate SharedSurfaces that can be exported. In that case it cuts out the middle man and reads from the WebGLFramebuffer's back buffer directly into a CPU buffer to send to RemoteTextureMap.

This also adds a forceAsyncPresent option to SwapChainOptions so that in the future we can have a separate pref for Accelerated Canvas2D that will allow enabling async present independent of the global WebGL pref.

Differential Revision: https://phabricator.services.mozilla.com/D150720
2022-07-12 06:56:19 +00:00
sotaro dd2b6633a9 Bug 1777657 - Remove SurfaceDescriptor from WebRenderTextureHost constructor r=gfx-reviewers,lsalzman
SurfaceDescriptor is not used anymore in WebRenderTextureHost constructor.

Differential Revision: https://phabricator.services.mozilla.com/D150853
2022-07-02 00:06:00 +00:00
sotaro a807c798e9 Bug 1712486 - Add async front buffer posting for out-of-process WebGL r=jgilbert,lsalzman,gfx-reviewers
The async front buffer posting is going to be enabled by another bug.

Async IPC was added for async front buffer posting for out-of-process WebGL.
Client does not use TextureClient for storing SurfaceDescriptor.
It works basically same way as to in-process WebGL around nsDisplayCanvas, WebRenderCanvasData, WebRenderCommandBuilder and WebRenderBridgeParent.
SharedSurfaces of SurfaceDescriptorD3D10 are kept alive during their usage. It is for keeping a shread handle valid.
Copied data buffers of SharedShurface_Basics are kept alive during their usage. It is for keeping RenderBufferTextureHost valid.

Differential Revision: https://phabricator.services.mozilla.com/D150197
2022-06-29 09:32:29 +00:00
Norisz Fay f70f5a4b0f Backed out changeset af98fb4ff148 (bug 1712486) for causing build bustages on LayersSurfaces CLOSED TREE 2022-06-29 09:06:45 +03:00
sotaro 8a8d04cce2 Bug 1712486 - Add async front buffer posting for out-of-process WebGL r=jgilbert,lsalzman,gfx-reviewers
The async front buffer posting is going to be enabled by another bug.

Async IPC was added for async front buffer posting for out-of-process WebGL.
Client does not use TextureClient for storing SurfaceDescriptor.
It works basically same way as to in-process WebGL around nsDisplayCanvas, WebRenderCanvasData, WebRenderCommandBuilder and WebRenderBridgeParent.
SharedSurfaces of SurfaceDescriptorD3D10 are kept alive during their usage. It is for keeping a shread handle valid.
Copied data buffers of SharedShurface_Basics are kept alive during their usage. It is for keeping RenderBufferTextureHost valid.

Differential Revision: https://phabricator.services.mozilla.com/D150197
2022-06-29 05:05:47 +00:00