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

348 Коммитов

Автор SHA1 Сообщение Дата
Sebastian Hengst cc89ff0f66 Bug 1818379 - disable WebGPU's test_basic_canvas.worker.html because WebGPU in worker scopes got disabled in bug 1808820. r=saschanaz DONTBUILD
Differential Revision: https://phabricator.services.mozilla.com/D170861
2023-02-24 22:47:45 +00:00
Kelsey Gilbert 5098fc5842 Bug 1814745 - Don't require a browser restart to update dom.webgpu.enabled. r=jimb
about:support's feature table still shows blocklisting, just not whether
the pref is set.
If different from default, dom.webgpu.enabled still shows up in about:support under
"Important Modified Prefs" like normal.

Also renames "gfx.webgpu.force-enabled" to "gfx.webgpu.ignore-blocklist"
to reflect its functionality.

Differential Revision: https://phabricator.services.mozilla.com/D169007
2023-02-13 23:11:42 +00:00
Jim Blandy ca2aa52edc Bug 1810831: Handle detached ArrayBuffers in GPUQueue.writeBuffer and writeTexture. r=nical
Calling mozilla::dom::TypedArray_base::Data on a detached ArrayBuffer
returns null, so GPUQueue.writeBuffer or GPUQueue.writeTexture need to
be prepared for this case.

Consolidate validation code from mozilla::webgpu::Queue::WriteBuffer
and WriteTexture into a new function, GetBufferSourceDataAndSize, and
use that in both cases.

Differential Revision: https://phabricator.services.mozilla.com/D169117
2023-02-08 20:31:08 +00:00
Cristina Horotan 6a1a4da7bd Backed out changeset fd94ed7faa11 (bug 1810831) for build bustages at Queue.cpp on a CLOSED TREE 2023-02-08 17:35:51 +02:00
Jim Blandy d0397452a5 Bug 1810831: Handle detached ArrayBuffers in GPUQueue.writeBuffer and writeTexture. r=nical
Calling mozilla::dom::TypedArray_base::Data on a detached ArrayBuffer
returns null, so GPUQueue.writeBuffer or GPUQueue.writeTexture need to
be prepared for this case.

Consolidate validation code from mozilla::webgpu::Queue::WriteBuffer
and WriteTexture into a new function, GetBufferSourceDataAndSize, and
use that in both cases.

Differential Revision: https://phabricator.services.mozilla.com/D169117
2023-02-08 15:10:26 +00:00
Nicolas Silva 452651d391 Bug 1814848 - Update wgpu to revision 41de797c745d317e93b9cf50e7446faff7f65954. r=webgpu-reviewers,jimb a=reland CLOSED TREE
Differential Revision: https://phabricator.services.mozilla.com/D168928
2023-02-07 18:08:29 +00:00
Csoregi Natalia 435547cbe3 Backed out 3 changesets (bug 1814848) for causing address sanitizer fails in MOZ_Crash. CLOSED TREE
Backed out changeset 38ecc5076ab3 (bug 1814848)
Backed out changeset 7dd5ce12c5f3 (bug 1814848)
Backed out changeset 5c42f3352b26 (bug 1814848)
2023-02-07 23:10:17 +02:00
Nicolas Silva e45015e278 Bug 1814848 - Update wgpu to revision 41de797c745d317e93b9cf50e7446faff7f65954. r=webgpu-reviewers,jimb
Differential Revision: https://phabricator.services.mozilla.com/D168928
2023-02-07 18:08:29 +00:00
sotaro 5789f6df62 Bug 1814533 - Add IsRegistered() check in PresentCallback() r=gfx-reviewers,lsalzman
There is a case that SwapChain is destroyed between wgpu_server_buffer_map() and PresentCallback().

Differential Revision: https://phabricator.services.mozilla.com/D168912
2023-02-06 05:32:55 +00:00
Nika Layzell 1cbf30fe37 Bug 1812156 - Part 1: Fix some IPDL statements to use fully qualified names, r=necko-reviewers,valentin
These types were used in IPDL but were not fully qualified.

Differential Revision: https://phabricator.services.mozilla.com/D168877
2023-02-04 10:44:24 +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
Jim Blandy aed45347b7 Bug 1813127: Have GPURenderPassEncoder.setBlendConstant accept sequence<double> colors. r=nical,ErichDonGubler
Differential Revision: https://phabricator.services.mozilla.com/D168265
2023-02-01 18:16:20 +00:00
Cosmin Sabou cf44a6155b Backed out changeset ffba597a6455 (bug 1813127) for causing build bustages on RenderPassEncoder.cpp. CLOSED TREE 2023-01-31 20:31:45 +02:00
Jim Blandy 4832fa9ed3 Bug 1813127: Have GPURenderPassEncoder.setBlendConstant accept sequence<double> colors. r=nical,ErichDonGubler
Differential Revision: https://phabricator.services.mozilla.com/D168265
2023-01-31 16:14:13 +00:00
Jim Blandy 80239efd28 Bug 1799753: Use CopyUTF16toUTF8 for strings destined for `cow_label`. r=ErichDonGubler
In WebGPU, entry point names and labels from types like
`GPUComputePipelineDescriptor` eventually get turned into Rust `&str` values.

The prior code used `LossyCopyUTF16ToASCII` to produce `nsCString`s from the
`nsString`s received from the WebIDL bindings, and then passed the resulting
bytes to Rust `std::ffi::CStr::to_str`. Unfortunately, that "ASCII" actually
means Latin-1, so if the entry point named happened to be representable in
Latin-1 that happened not to be valid UTF-8, `wgpu_bindings::cow_label` would
return `None`, leading to a panic when unwrapped by
`wgpu_bindings::client::ProgrammableStageDescriptor::to_wgpu`.

The fix: just call `CopyUTF16ToUTF8` instead. This should always produce bytes
that `CStr::to_str` can consume. The WebIDL for WebGPU uses `USVString` for
entry point names and labels, so these values should never contain unpaired
surrogate code points, meaning that conversion should always succeed.

Differential Revision: https://phabricator.services.mozilla.com/D168188
2023-01-28 07:47:17 +00:00
Nicolas Silva 03eaaeceaf Bug 1811284 - Update wgpu to 24a904256e225b20b11fb30f914ef53212a2909e. r=webgpu-reviewers,ErichDonGubler,jimb
Differential Revision: https://phabricator.services.mozilla.com/D167276
2023-01-24 09:24:03 +00:00
Nicolas Silva 2f569d2277 Bug 1800430 - Remove more dead code. r=jgilbert,jimb
This was also supposed to be part of an earlier patch.

Differential Revision: https://phabricator.services.mozilla.com/D162004
2023-01-10 11:04:32 +00:00
Nicolas Silva f8f965745b Bug 1800430 - Remove some dead code. r=jimb
This was supposed to be part of an earlier patch but probably got lost during a rebase.

Differential Revision: https://phabricator.services.mozilla.com/D162003
2023-01-10 11:04: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
Nicolas Silva 4c5b1d34d3 Bug 1800430 - Port PWebGPU::QueueWriteAction to the new shmem classes. r=jgilbert
Differential Revision: https://phabricator.services.mozilla.com/D162002
2022-12-20 10:34:28 +00:00
Andrew McCreight ce28c41da0 Bug 1805931, part 2 - Automated removal of uses of ROOT and UNROOT CC macros. r=smaug
As of the prior patch, these are no longer needed. I removed
these with a script, then ran clang-format on the files, then
manually reverted a few unrelated changed from the formatter.

Differential Revision: https://phabricator.services.mozilla.com/D164829
2022-12-15 19:45:01 +00:00
Andrew McCreight dec541b90a Bug 1805931, part 1 - Declare Root and Unroot inline to save on boilerplate. r=smaug
Bug 181137 made ContentIteratorBase no longer refcounted, but
it did not remove this bit of CC boilerplate. With the inline
root, using this macro in a non-refcounted class is an error.

ObjectModel.h and ClientWebGLContext.cpp used macros to define
root and unroot, but that is no longer needed.

Differential Revision: https://phabricator.services.mozilla.com/D164828
2022-12-15 19:45:00 +00:00
Nicolas Silva 84411fce11 Bug 1795311 - Use the new shmem classes in the WebGPU buffer impl. r=jgilbert
Depends on D159398

Differential Revision: https://phabricator.services.mozilla.com/D159399
2022-11-10 15:52:32 +00:00
Cristian Tuns 239d775bde Backed out 2 changesets (bug 1795311) for causing build bustages on WebGPUParent.cpp CLOSED TREE
Backed out changeset 71697f876d88 (bug 1795311)
Backed out changeset 60b9bfda2e8b (bug 1795311)
2022-11-09 11:17:43 -05:00
Nicolas Silva ce2cb5783c Bug 1795311 - Use the new shmem classes in the WebGPU buffer impl. r=jgilbert
Depends on D159398

Differential Revision: https://phabricator.services.mozilla.com/D159399
2022-11-09 14:30:16 +00:00
Kelsey Gilbert 4e7b4b5647 Bug 1794956 - TransferToImageBitmap should reset bitmap but not state. r=gfx-reviewers,lsalzman
s/Reset/ResetBitmap/ and implement for WebGL and WebGPU.

Differential Revision: https://phabricator.services.mozilla.com/D159346
2022-10-16 22:52:40 +00:00
Iulian Moraru b3fd738eb1 Backed out 2 changesets (bug 1794956) for causing wpt failures on offscreencanvas.transfer.to.imagebitmap.html. CLOSED TREE
Backed out changeset 7b3067b086e6 (bug 1794956)
Backed out changeset 3abcf6ccf88a (bug 1794956)
2022-10-15 19:09:01 +03:00
Kelsey Gilbert 4253cbe5b3 Bug 1794956 - TransferToImageBitmap should reset bitmap but not state. r=gfx-reviewers,lsalzman
s/Reset/ResetBitmap/ and implement for WebGL and WebGPU.

Differential Revision: https://phabricator.services.mozilla.com/D159346
2022-10-15 09:01:46 +00:00
Kelsey Gilbert 61dc37049b Bug 1795193 - Remove unused chrome-only API MozGetIPCContext. r=gfx-reviewers,jrmuizel,emilio
And also remove SetIsIPC.

Differential Revision: https://phabricator.services.mozilla.com/D159351
2022-10-14 18:02:28 +00:00
Nicolas Silva 62d1d7906a Bug 1794406 - Report more specific error messages when buffer.mapAsync fails. r=jgilbert
Differential Revision: https://phabricator.services.mozilla.com/D158959
2022-10-12 17:09:01 +00:00
Nicolas Silva dd5aec24a5 Bug 1791877 - Work around zero-sized shmems in queue.writeBuffer. r=jimb,jgilbert
Just allocate the smallest possible shmem if needed, the same workaround exist when creating mappable buffers.
Also validate that the size is a multiple of 4 bytes to match the spec.

Differential Revision: https://phabricator.services.mozilla.com/D158965
2022-10-12 17:07:59 +00:00
Olli Pettay 93acdfad59 Bug 1777574, automate CC zone handling, r=mccr8
Differential Revision: https://phabricator.services.mozilla.com/D155084
2022-09-07 11:22:51 +00:00
Andrew Osmond 581c22e956 Bug 1677183 - Implement WebGPU's Queue.copyExternalImageToTexture. r=jgilbert,jimb,emilio
Differential Revision: https://phabricator.services.mozilla.com/D145269
2022-08-18 16:11:46 +00:00
Nicolas Silva 0f41553847 Bug 1780051 - Avoid crashing when taking an invalid array buffer in writeBuffer. r=jgilbert
Differential Revision: https://phabricator.services.mozilla.com/D154533
2022-08-16 14:03:27 +00:00
Nicolas Silva e7bb72d798 Bug 1777535 - Work around build issues. r=gfx-reviewers,lsalzman
I think that this issue was introduced by another series of patch (when we started passing nsACStrings as parameter in the bindings), but were hidden by unified builds.

Differential Revision: https://phabricator.services.mozilla.com/D154247
2022-08-10 15:55:12 +00:00
Nicolas Silva 39c0ae30ae Bug 1780792 - Remove unnecessary MapRequest constructor. r=jimb
Differential Revision: https://phabricator.services.mozilla.com/D152521
2022-08-10 15:55:11 +00:00
Nicolas Silva 6a27b6fc7f Bug 1777535 - Mapped at creation implies write access. r=jimb
Differential Revision: https://phabricator.services.mozilla.com/D152520
2022-08-10 15:55:11 +00:00
Nicolas Silva 8e0c3182c6 Bug 1780792 - Remove the public/private/public sandwich in Buffer.h. r=jimb
Depends on D152082

Differential Revision: https://phabricator.services.mozilla.com/D152093
2022-08-10 15:55:11 +00:00
Nicolas Silva b59239fdc3 Bug 1777535 - Ensure WebGPUParent outlives the map callback. r=jimb
Depends on D152081

Differential Revision: https://phabricator.services.mozilla.com/D152082
2022-08-10 15:55:10 +00:00
Nicolas Silva 76a812fef7 Bug 1777535 - Differentiate between destroying and dropping a buffer. r=jimb
The former frees resources but keeps the handle. It can be called multiple times. The latter destroys the handle. Any subsequent reference to the same buffer is a bug and will cause the GPU process to crash.

Depends on D152080

Differential Revision: https://phabricator.services.mozilla.com/D152081
2022-08-10 15:55:09 +00:00
Nicolas Silva dc27dd1a81 Bug 1771254 - Work around zero-sized shmems. r=jimb
Depends on D151703

Differential Revision: https://phabricator.services.mozilla.com/D152080
2022-08-10 15:55:09 +00:00
Nicolas Silva 4052fb5b08 Bug 1777535 - Don't crash when buffer_unmap returns an error. r=jimb
Depends on D151702

Differential Revision: https://phabricator.services.mozilla.com/D151703
2022-08-10 15:55:09 +00:00
Nicolas Silva aa764f309f Bug 1777535 - Validate mapAync mode on the parent side. r=jimb
Depends on D151632

Differential Revision: https://phabricator.services.mozilla.com/D151701
2022-08-10 15:55:08 +00:00
Nicolas Silva 971548a974 Bug 1780792 - Move the remaining buffer logic in Device.cpp into Buffer.cpp. r=jimb
Having the code in the same place makes it easier to follow. This made me realize that the validation of aMode in mapAsync has to move to the device side (fix coming in a followup).

Depends on D151631

Differential Revision: https://phabricator.services.mozilla.com/D151632
2022-08-10 15:55:08 +00:00
Nicolas Silva ea11e14b00 Bug 1780792 - use Buffer::GetDevice instead of mParent. r=jimb
Another cosmetic change. I've dabbled with IPDL actors too much to not think about WebGPUParent when reading "mParent". Also the parent-child relationship between Device and Buffer is not very obvious to me (nor is it part of the specification).
So I find that wrapping mParent in a GetDevice method to make the code easier to understand. It also makes it explicit that the parent pointer cannot be null.

Depends on D151630

Differential Revision: https://phabricator.services.mozilla.com/D151631
2022-08-10 15:55:07 +00:00
Nicolas Silva 15f2edabb7 Bug 1780792 - Remove Buffer::Mappable(). r=jimb
It is not used anywhere.

Depends on D151629

Differential Revision: https://phabricator.services.mozilla.com/D151630
2022-08-10 15:55:07 +00:00
Nicolas Silva 89ae7cbb9e Bug 1777535 - Simplify Buffer::Cleanup. r=jimb
Make sure to always clean up any potential content-side state and only avoid sending Destroy each time.

Depends on D151621

Differential Revision: https://phabricator.services.mozilla.com/D151629
2022-08-10 15:55:07 +00:00
Nicolas Silva 92f2f9d376 Bug 1777535 - Unmap the buffer in Destroy. r=jimb,emilio
Per spec, if a buffer is mapped in destory(), unmap() must be called.

Depends on D151620

Differential Revision: https://phabricator.services.mozilla.com/D151621
2022-08-10 15:55:06 +00:00
Nicolas Silva 2247de33ba Bug 1777535 - Validate getMappedRange against the actually mapped range. r=jimb
Depends on D151619

Differential Revision: https://phabricator.services.mozilla.com/D151620
2022-08-10 15:55:06 +00:00
Nicolas Silva cafc323604 Bug 1777535 - Track the buffer mapAsync promise. r=jimb
Per spec (and discussion with someone on the chromium side where spec is vague), the correct behavior should be:
 - MapAsync validation happens on the device timeline, so we should reject the promise in mapAsync on the content side if we run into an internal error not described by the spec.
 - Unmap immediately rejects all pending mapping promises on the content side (there can be multiple of them since we have to catch that error on the device timeline).

This patch tracks a single mapping promise at a time and immediately rejects on the content side any subseqent mapping
request made until unmap is called. This means our current implementation deviates slightly from the current state of
the spec in that:
 - The promise is rejected earlier on the content timeline,
 - If the first request fails, all subsequent requests will fail until either unmap or when the content side receives and processes the rejected
   promise, whereas Dawn's implementation would allow the first valid request to succed.

There was some confusion around the the use of uint64_t and size_t which probably originated at point where this code was working differently. This patch uses uint64_t (=BufferAddress) more consistently removing the need for some of the casting and overflow checks.
One notable change in the overall logic is that SetMapped is now called when the buffer is actually in the mapped state (before this patch it was called as soon as the buffer had a pending map request).

Depends on D151618

Differential Revision: https://phabricator.services.mozilla.com/D151619
2022-08-10 15:55:05 +00:00