Commit graph

84 commits

Author SHA1 Message Date
sotaro
55fec64917 Bug 1891132 - Add check if config exists in CanvasContext::MaybeQueueSwapChainPresent() r=webgpu-reviewers,teoxoy
After calling CanvasContext::Unconfigure(), swap chain is dropped. It is not necessary to handle SwapChainPresent.

Differential Revision: https://phabricator.services.mozilla.com/D207826
2024-04-18 11:27:18 +00:00
Nicolas Silva
d66485ea0f Bug 1889873 - Remove IsOpen in favor of CanSend. r=webgpu-reviewers,teoxoy
They are the same and the latter is more self explanatory.
The patch also addresses a couple of Cleanup methods where I forgot to check the bridge pointer.

Differential Revision: https://phabricator.services.mozilla.com/D206785
2024-04-05 15:59:38 +00:00
sotaro
22fa535fac Bug 1843891 - Enable to present WebGPU without readback with DX12 on Windows r=webgpu-reviewers,nical
Differential Revision: https://phabricator.services.mozilla.com/D190250
2024-03-22 04:13:28 +00:00
sotaro
2a00464a2e Bug 1885500 - Disable using external texture in swap chain when webrender does not use hardware acceleration r=webgpu-reviewers,nical
On Windows, external texture in swap chain requests compositor device. But when gpu process is disabled as fallback and webrender does not use hardware accceleration, parent process does not have the compositor device. Then it seems better to disable external texture in swap chain when WebRender does not use hardware acceleration.

Differential Revision: https://phabricator.services.mozilla.com/D204869
2024-03-21 00:06:42 +00:00
Lee Salzman
f07311c7ab Bug 1877010 - Track forwarder transaction ids for RemoteTextureMap with WebGL and WebGPU. r=sotaro
Differential Revision: https://phabricator.services.mozilla.com/D199876
2024-01-30 15:44:04 +00:00
sotaro
69307a27c1 Bug 1876430 - Remove obsoleted comment in CanvasContext::GetFrontBuffer() r=gfx-reviewers,lsalzman
Bug 1869931 removed RemoteTexture push callback, then comment in CanvasContext::GetFrontBuffer() becomes obsoleted.

Differential Revision: https://phabricator.services.mozilla.com/D199595
2024-01-25 03:57:27 +00:00
sotaro
6f9048f788 Bug 1869931 - Remove RemoteTexture push callback r=gfx-reviewers,lsalzman
WebGPU rendering needs to be synchronized to dom like WebGL and canvas 2D. But the current rendering is not synchronized to dom.

Differential Revision: https://phabricator.services.mozilla.com/D197326
2024-01-23 17:17:01 +00:00
sotaro
d305040887 Bug 1863474 - Add a capability of handling ID3D11Fence and ID3D12Fence handling to WebGPU r=webgpu-reviewers,nical
This is preparation for Bug 1843891.

ID3D11Fence and ID3D12Fence handling is necessary to interoperate between D3D11 and D3D12. Necessary fence value can be obtained from wgpu_server_queue_submit().

Differential Revision: https://phabricator.services.mozilla.com/D193619
2024-01-23 02:41:49 +00:00
Nicolas Silva
99c1c1bf48 Bug 1873047 - Generate a valid Texture object on the JS side even if IPC is down. r=webgpu-reviewers,ErichDonGubler
These JS proxies are always safe to create. The ids are validated on the other side so if the GPU process comes back up and we try to use the object (on a new device), it will generate an error as expected.

Depends on D197799

Differential Revision: https://phabricator.services.mozilla.com/D197800
2024-01-20 01:18:55 +00:00
sotaro
72c92eddb2 Bug 1869683 - Make CanvasContext::GetFrontBuffer() returns valid descriptor of remote texture r=webgpu-reviewers,nical
OffscreenCanvas WebGPU could deliver descriptor of remote texture like other canvases since it uses async ImageContainer(via ImageBridge). Then when CanvasContext::SwapChainPresent() returns valid descritptor of remote texture, the descriptor is delivered correctly to WebRenderImageHost like other canvases with offscreen canvas.

Async wait and callback happen at WebRenderImageHost::UseRemoteTexture() since it uses async ImageContainer(via ImageBridge).

Differential Revision: https://phabricator.services.mozilla.com/D196249
2023-12-14 01:37:56 +00:00
sotaro
e0e4d38af2 Bug 1869692 - Handle a case that WebGPU rendering happens before CanvasContext::InitializeCanvasRenderer() call r=webgpu-reviewers,nical
By Bug 1858361 fix, first WebGPU rendering becomes not rendered. It happens because CanvasContext::MaybeQueueSwapChainPresent() is called before CanvasContext::InitializeCanvasRenderer().

The change handles it.

Differential Revision: https://phabricator.services.mozilla.com/D196253
2023-12-13 11:34:46 +00:00
sotaro
438f910bc0 Bug 1858361 - Call CanvasContext::SwapChainPresent() from ShareableCanvasRenderer::UpdateCompositableClient() r=gfx-reviewers,nical
Call CanvasContext::SwapChainPresent()  from ShareableCanvasRenderer::UpdateCompositableClient() like other canvas implementations.

Current WebGPU implementation does not handle presenting swap chain of offscreen canvas. It is going to be handled by another bug.

Differential Revision: https://phabricator.services.mozilla.com/D196141
2023-12-12 10:45:51 +00:00
Nicolas Silva
a59c5ae75d Bug 1860958 - Implement Texture::Destroy. r=webgpu-reviewers,jimb
Differential Revision: https://phabricator.services.mozilla.com/D192080
2023-11-22 14:15:34 +00:00
Natalia Csoregi
000c9b4bb4 Backed out 4 changesets (bug 1861985, bug 1860958, bug 1865364) for causing bustage due to CommandEncoder. CLOSED TREE
Backed out changeset 3d6b04449863 (bug 1865364)
Backed out changeset 1e35eb31a789 (bug 1861985)
Backed out changeset e3f53b794c1d (bug 1861985)
Backed out changeset d676e8a3a515 (bug 1860958)
2023-11-22 13:52:44 +02:00
Nicolas Silva
056636220b Bug 1860958 - Implement Texture::Destroy. r=webgpu-reviewers,jimb
Differential Revision: https://phabricator.services.mozilla.com/D192080
2023-11-22 10:57:57 +00:00
Cristian Tuns
b428472b9e Backed out 3 changesets (bug 1861985, bug 1860958) for causing build bustages in RefPtr.h CLOSED TREE
Backed out changeset 13f07117425f (bug 1861985)
Backed out changeset 0bdc4c60018e (bug 1861985)
Backed out changeset 5e6f2b2e19c6 (bug 1860958)
2023-11-21 14:07:35 -05:00
Nicolas Silva
3710042ff0 Bug 1860958 - Implement Texture::Destroy. r=webgpu-reviewers,jimb
Differential Revision: https://phabricator.services.mozilla.com/D192080
2023-11-21 18:16:24 +00:00
Nicolas Silva
c8f4b69bcd Bug 1865311 - Fix inconsistent destroy/drop naming in webgpu IPC. r=webgpu-reviewers,ErichDonGubler
Differential Revision: https://phabricator.services.mozilla.com/D193894
2023-11-17 20:11:22 +00:00
Brad Werth
5b918272ea Bug 1816731 Part 1: Prevent configuration of a WebGPU context for a too-big canvas. r=webgpu-reviewers,ErichDonGubler
Differential Revision: https://phabricator.services.mozilla.com/D193567
2023-11-17 16:11:40 +00:00
sotaro
40d51bef58 Bug 1860921 - Revert Texture::Destroy() and add Texture::ForceDestroy() r=webgpu-reviewers,nical
This is a short term fix. Long term fix needs to be done by Bug 1860958.
Presenting WebGPU without readback needs a way to destroy Texture. Then Texture::ForceDestroy() is added for it.

Differential Revision: https://phabricator.services.mozilla.com/D191829
2023-10-25 09:43:58 +00:00
sotaro
e8b67b7765 Bug 1856787 - Add a capability to present WebGPU without readback on Windows r=webgpu-reviewers,nical
For presenting WebGPU without readback, wgpu does rendering to ExternalTexture. Then the ExternalTexture is pushed to RemoteTextureMap for present.

With DX12, ExternalTextureD3D11 is implemented for gecko side implementation. ExternalTextureWgpu holds necessary resource that is necessary by wgpu. ExternalTextureWgpu is created and destroyed by gecko side's ExternalTexture.

Presenting current texture starts at CanvasContext::SwapChainPresent(). CanvasContext::SwapChainPresent() posts current texture for present. And the current texture is set invalid, since the texture is going to be posted to WebRender. Next CanvasContext::GetCurrentTexture() call creates a new texture of swap chain.

WebGPUParent::RecvSwapChainPresent() receives present request. It pushes to RemoteTextureMap for presenting.

TextureRaw is recycled with ExternalTexture recycling.

Differential Revision: https://phabricator.services.mozilla.com/D190249
2023-10-24 04:04:07 +00:00
sotaro
fa82ebd5e1 Bug 1852485 - Present WebGPU by using DX11 texture in swap chain with readback on Windows r=webgpu-reviewers,nical
The change is preparation for Bug 1843891.
Current gecko uses a internal texture for SwapChain's texture. This bug changes as to use external dx11 texture for WebGPU dx12 backend on Windows.

WebGPUParent allocates dx11 texture for SwapChain's texture of dx12 backend WebGPU. wgpu uses the dx11 texture as ID3D12Resource. The readback for presenting to WebRender still exists.
The change handles only RBGA format.

Differential Revision: https://phabricator.services.mozilla.com/D187870
2023-09-17 18:42:07 +00:00
Cosmin Sabou
3290ce6472 Backed out changeset ba49d9bdc665 (bug 1852485) for causing non-unified build bustages at ExternalTextureD3D11.cpp. 2023-09-15 16:21:08 +03:00
sotaro
a8dfa5bebe Bug 1852485 - Present WebGPU by using DX11 texture in swap chain with readback on Windows r=webgpu-reviewers,nical
The change is preparation for Bug 1843891.
Current gecko uses a internal texture for SwapChain's texture. This bug changes as to use external dx11 texture for WebGPU dx12 backend on Windows.

WebGPUParent allocates dx11 texture for SwapChain's texture of dx12 backend WebGPU. wgpu uses the dx11 texture as ID3D12Resource. The readback for presenting to WebRender still exists.
The change handles only RBGA format.

Differential Revision: https://phabricator.services.mozilla.com/D187870
2023-09-15 11:14:51 +00:00
Erich Gubler
8f58a93aab Bug 1828123: refactor(webgpu): rename GPUCanvasContext.configure's descriptor arg. to configuration to match spec. r=webgpu-reviewers,webidl,teoxoy,saschanaz,smaug
Depends on D185102

Differential Revision: https://phabricator.services.mozilla.com/D185103
2023-08-11 17:07:07 +00:00
Tim Huang
07cbc511d5 Bug 1816189 - Part 4: Add random noise when extracting data from canvas element when canvas randomization is enabled. r=tjr,lsalzman
This patch introduces random noises to data extraction functions of
canvas element and offscreen canvas. The random noise is based on the
random key of the cookieJarSettings and the image data itself.

The random noises would interfere the ability of fingerprinters that
use canvas data to fingerprint users. The random noise will make unique
canvas finerprint to for every browsing session. Therefore, fingerprinter
cannot use canvas fingerprint to tracker individuals across browsing
sessions.

Differential Revision: https://phabricator.services.mozilla.com/D175499
2023-05-08 14:04:35 +00:00
Kelsey Gilbert
84aed13d07 Bug 1826682 - Re-Configure() webgpu canvases on resize. r=webgpu-reviewers,nical,ErichDonGubler
Differential Revision: https://phabricator.services.mozilla.com/D176884
2023-05-03 21:30:16 +00:00
Kelsey Gilbert
f11a202eea Bug 1826678 - Add webgpu CanvasContext.canvas backlink. r=gfx-reviewers,webidl,jimb,smaug,ErichDonGubler
Differential Revision: https://phabricator.services.mozilla.com/D174831
2023-04-13 19:15:00 +00:00
Kelsey Gilbert
ff02e04b0e Bug 1814091 - Move CanvasContext.getPreferredFormat to GPU.getPreferredCanvasFormat. r=gfx-reviewers,jimb,emilio
This reflects a change in the spec.

Differential Revision: https://phabricator.services.mozilla.com/D174792
2023-04-06 00:11:01 +00:00
Cristian Tuns
ab8d86a07e Backed out changeset 721a7c52f1ab (bug 1814091) for causing wpt failures in cts.https.html CLOSED TREE 2023-04-05 19:10:16 -04:00
Kelsey Gilbert
4d9ea58f49 Bug 1814091 - Move CanvasContext.getPreferredFormat to GPU.getPreferredCanvasFormat. r=gfx-reviewers,jimb,emilio
This reflects a change in the spec.

Differential Revision: https://phabricator.services.mozilla.com/D174792
2023-04-05 22:02:47 +00:00
Kelsey Gilbert
eaf3360db2 Bug 1812932 - Add size outvar to GetImageBuffer. r=gfx-reviewers,bradwerth
Differential Revision: https://phabricator.services.mozilla.com/D171764
2023-03-21 18:05:09 +00:00
Cristina Horotan
34c1361f96 Backed out changeset 7657d29cd872 (bug 1812932) for causing bc failures at browser_view_image.js CLOSED TREE 2023-03-07 09:26:40 +02:00
Kelsey Gilbert
0f88607820 Bug 1812932 - Add size outvar to GetImageBuffer. r=gfx-reviewers,bradwerth
Differential Revision: https://phabricator.services.mozilla.com/D171764
2023-03-07 04:52:04 +00:00
Jim Blandy
b204c76991 Bug 1813719: Remove size attribute from GPUCanvasConfiguration. r=jgilbert,emilio
In [gpuweb#2826](https://github.com/gpuweb/gpuweb/pull/2826), the
`size` attribute was removed from `GPUCanvasConfiguration`. Since the
fuzzers have discovered that the `size` attribute is a fun toy to play
with, it's time to update Firefox to match the spec.

Differential Revision: https://phabricator.services.mozilla.com/D168575
2023-02-01 18:32:31 +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
Kagami Sascha Rosylight
54d369d804 Bug 1768189 - Part 41: Apply modernize-concat-nested-namespaces to dom/webgpu/BindGroup.h ... r=andi
Depends on D145776

Differential Revision: https://phabricator.services.mozilla.com/D145777
2022-05-09 20:41:19 +00:00
Andrew Osmond
6e033cd6a3 Bug 1709951 - Make WebGPU handle GPU process loss. r=gfx-reviewers,webidl,jgilbert,smaug
Differential Revision: https://phabricator.services.mozilla.com/D143247
2022-04-27 21:13:21 +00:00
Andrew Osmond
6921ea66d8 Bug 1765816 - Expose front buffer canvas contents when painting for Firefox Screenshots for WebGPU. r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D144868
2022-04-27 18:27:37 +00:00
Andrew Osmond
bdc5c410a4 Bug 1755704 - Part 2. Implement stubbed out surface related WebGPU canvas methods. r=gfx-reviewers,lsalzman
This patch hooks up the improved CanvasManagerChild::GetSnapshot method
to the WebGPU canvas context object in order to do readbacks for various
DOM facing methods such as ConvertToBlob and for Firefox Screenshots.

Differential Revision: https://phabricator.services.mozilla.com/D144309
2022-04-27 16:05:28 +00:00
Andrew Osmond
ddc415daba Bug 1755704 - Part 1. Add support for reading back the front buffer for WebGPU. r=gfx-reviewers,lsalzman
This reworks the CanvasManagerChild::GetSnapshot method to work with
WebGPU. This will allow it to be called for a WebGPU context from any
thread, which is useful for screenshots.

Differential Revision: https://phabricator.services.mozilla.com/D144308
2022-04-27 16:05:28 +00:00
Csoregi Natalia
8f3654680c Backed out 3 changesets (bug 1755704, bug 1765816) for causing reftest failures on webgl-color-test.html
Backed out changeset 2f074e2385d4 (bug 1765816)
Backed out changeset cd0b9e084bcd (bug 1755704)
Backed out changeset 39a846e43162 (bug 1755704)
2022-04-24 02:33:33 +03:00
Andrew Osmond
c55d373481 Bug 1755704 - Part 2. Implement stubbed out surface related WebGPU canvas methods. r=gfx-reviewers,lsalzman
This patch hooks up the improved CanvasManagerChild::GetSnapshot method
to the WebGPU canvas context object in order to do readbacks for various
DOM facing methods such as ConvertToBlob and for Firefox Screenshots.

Differential Revision: https://phabricator.services.mozilla.com/D144309
2022-04-23 16:45:10 +00:00
Andrew Osmond
382feb7053 Bug 1755704 - Part 1. Add support for reading back the front buffer for WebGPU. r=gfx-reviewers,lsalzman
This reworks the CanvasManagerChild::GetSnapshot method to work with
WebGPU. This will allow it to be called for a WebGPU context from any
thread, which is useful for screenshots.

Differential Revision: https://phabricator.services.mozilla.com/D144308
2022-04-23 16:45:10 +00:00
Molnar Sandor
86256102b3 Backed out 3 changesets (bug 1765816, bug 1755704) for causing bp hybrid bustages. CLOSED TREE
Backed out changeset 505897037daf (bug 1765816)
Backed out changeset bc4e2999a2a7 (bug 1755704)
Backed out changeset 26b11a2833b0 (bug 1755704)
2022-04-22 18:03:57 +03:00
Andrew Osmond
c9e7d96bfe Bug 1755704 - Part 2. Implement stubbed out surface related WebGPU canvas methods. r=gfx-reviewers,lsalzman
This patch hooks up the improved CanvasManagerChild::GetSnapshot method
to the WebGPU canvas context object in order to do readbacks for various
DOM facing methods such as ConvertToBlob and for Firefox Screenshots.

Differential Revision: https://phabricator.services.mozilla.com/D144309
2022-04-22 15:05:43 +00:00
Andrew Osmond
720de7a009 Bug 1755704 - Part 1. Add support for reading back the front buffer for WebGPU. r=gfx-reviewers,lsalzman
This reworks the CanvasManagerChild::GetSnapshot method to work with
WebGPU. This will allow it to be called for a WebGPU context from any
thread, which is useful for screenshots.

Differential Revision: https://phabricator.services.mozilla.com/D144308
2022-04-22 15:05:42 +00:00
Andrew Osmond
3fe3f7ca98 Bug 1753302 - Part 1. Integrate WebGPU with OffscreenCanvas plumbing. r=gfx-reviewers,jgilbert
Differential Revision: https://phabricator.services.mozilla.com/D141491
2022-04-04 16:42:02 +00:00
Andrew Osmond
c18a944c15 Bug 1754978 - Part 2. Switch WebGPU to use async image pipelines for display. r=kvark
This patch removes more main thread dependencies from the content side
of WebGPU. Instead of issuing a resource update for an external image,
we now use an async image pipeline in conjunction with
CompositableInProcessManager from part 1. This allows us to update the
HTMLCanvasElement bound to the WebGPU device without having to go
through the main thread, or even the content process after the swap
chain update / readback has been requested.

Differential Revision: https://phabricator.services.mozilla.com/D138887
2022-02-18 15:59:13 +00:00
Iulian Moraru
3dbfe82835 Backed out 2 changesets (bug 1754978) for causing valgrind bustages.
Backed out changeset 491a985fc34a (bug 1754978)
Backed out changeset 98983bf9eaed (bug 1754978)
2022-02-18 00:36:31 +02:00