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

42 Коммитов

Автор SHA1 Сообщение Дата
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
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 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 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 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 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
Nicolas Silva 8829006db0 Bug 1780792 - Move the buffer creation code in Buffer.cpp. r=jimb
No funcitonal change here, I like to have the code maintaining and depending on the same invariants to be in the same place.

Depends on D151616

Differential Revision: https://phabricator.services.mozilla.com/D151617
2022-08-10 15:55:05 +00:00
Nicolas Silva 6c728ff882 Bug 1777535 - Use unsafe shmems. r=jimb
This commit makes WebGPU buffers use unsafe shmems.
Instead of relying on moving the shmem back and forth between the two processes to ensure thread safety, we instead rely on the validation done on both sides. The upside is that it makes it much easier to implement said validation correctly.

In the interest of splitting the buffer mapping rework into small-ish commits, this one puts some structural pieces in place but doesn't necessarily do justice to the final implementation:
 - The validation itself is coming in subsequent patches in this series.
 - Mapping sub-ranges of the buffer was somewhat implemented in some parts of the parent code and not in others, and was fairly broken as a whole. This commit always maps the entire buffer and proper logic for sub-ranges is coming in another commit.

The main things this commit does put in place:
 - Each mappable buffer is associated with a Shmem that is accessible to both sides.
 - On the child side, if a buffer is not mappable, then Buffer::mShmem is in its default state (it doesn't point to any shared memory segment).
 - On the parent side, if a buffer is not mappable it does not have an entry in mSharedMemoryMap.
 - The shmem is always created by the child and destroyed by the parent.

Depends on D151615

Differential Revision: https://phabricator.services.mozilla.com/D151616
2022-08-10 15:55:03 +00:00
Marian-Vasile Laza 1c166e5dae Backed out 22 changesets (bug 1780792, bug 1778713, bug 1771254, bug 1777535) for causing bustages on WebGPUParent.h. CLOSED TREE
Backed out changeset 84974dbb4d3f (bug 1780792)
Backed out changeset 5bef755ea09b (bug 1777535)
Backed out changeset 6de84921e7d0 (bug 1780792)
Backed out changeset 89450745f60b (bug 1777535)
Backed out changeset de8da0f89c50 (bug 1777535)
Backed out changeset 24707519fe7b (bug 1771254)
Backed out changeset fe75bdc54a31 (bug 1777535)
Backed out changeset aa8e1c7f727f (bug 1777535)
Backed out changeset f674057a477f (bug 1777535)
Backed out changeset b4210142bf82 (bug 1780792)
Backed out changeset 326511661875 (bug 1780792)
Backed out changeset 6178c6dd5c31 (bug 1780792)
Backed out changeset 219760e8c20e (bug 1777535)
Backed out changeset e312cdad1fee (bug 1777535)
Backed out changeset 446e62674d9d (bug 1777535)
Backed out changeset d2f4d878d51f (bug 1777535)
Backed out changeset 85ac57add037 (bug 1777535)
Backed out changeset 4c512a0c05a9 (bug 1780792)
Backed out changeset 6f732421a0b4 (bug 1777535)
Backed out changeset 0da5289fe5a9 (bug 1777535)
Backed out changeset c19a35a62ed4 (bug 1778713)
Backed out changeset 61e4e8e63a3e (bug 1771254)
2022-08-10 15:04:12 +03:00
Nicolas Silva 5e679c66a6 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 11:38:58 +00:00
Nicolas Silva 0f1f96bcd1 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 11:38:58 +00:00
Nicolas Silva 1a98d9e824 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 11:38:55 +00:00
Nicolas Silva 1e4e43530c 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 11:38:55 +00:00
Nicolas Silva c87019923a 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 11:38:54 +00:00
Nicolas Silva 90aab927a5 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 11:38:54 +00:00
Nicolas Silva 148b56eef8 Bug 1780792 - Move the buffer creation code in Buffer.cpp. r=jimb
No funcitonal change here, I like to have the code maintaining and depending on the same invariants to be in the same place.

Depends on D151616

Differential Revision: https://phabricator.services.mozilla.com/D151617
2022-08-10 11:38:53 +00:00
Nicolas Silva 1dae6e0bba Bug 1777535 - Use unsafe shmems. r=jimb
This commit makes WebGPU buffers use unsafe shmems.
Instead of relying on moving the shmem back and forth between the two processes to ensure thread safety, we instead rely on the validation done on both sides. The upside is that it makes it much easier to implement said validation correctly.

In the interest of splitting the buffer mapping rework into small-ish commits, this one puts some structural pieces in place but doesn't necessarily do justice to the final implementation:
 - The validation itself is coming in subsequent patches in this series.
 - Mapping sub-ranges of the buffer was somewhat implemented in some parts of the parent code and not in others, and was fairly broken as a whole. This commit always maps the entire buffer and proper logic for sub-ranges is coming in another commit.

The main things this commit does put in place:
 - Each mappable buffer is associated with a Shmem that is accessible to both sides.
 - On the child side, if a buffer is not mappable, then Buffer::mShmem is in its default state (it doesn't point to any shared memory segment).
 - On the parent side, if a buffer is not mappable it does not have an entry in mSharedMemoryMap.
 - The shmem is always created by the child and destroyed by the parent.

Depends on D151615

Differential Revision: https://phabricator.services.mozilla.com/D151616
2022-08-10 11:38:53 +00:00
Jim Blandy ba3136ccd7 Bug 1771252: Check GPUBuffer.mapAsync 'mode' argument against buffer's usage. r=nical
Differential Revision: https://phabricator.services.mozilla.com/D150529
2022-06-29 16:43:19 +00:00
Andrew Osmond 4b37a00d47 Bug 1689834. r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D146102
2022-05-17 14:14:12 +00:00
Molnar Sandor 8713e0bf9c Backed out changeset db25bd6ef77e (bug 1689834) for causing build bustages in webgpu/Buffer.cpp. CLOSED TREE 2022-05-17 03:58:25 +03:00
Andrew Osmond 2fd8458561 Bug 1689834. r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D146102
2022-05-17 00:34:13 +00:00
Dzmitry Malyshau 2e592c660f Bug 1704911 - Fix Shmem circulation for buffers that are both mappable and mapped at creation r=jgilbert
We are now passing an extra flag on Unmap to keep the shmem around.
Previously, we'd be freeing the Shmem accidentally on buffers that are writable and mapped at creation.
We also add a bit of logging on the WebGPUParent side.

Differential Revision: https://phabricator.services.mozilla.com/D112264
2021-04-16 22:32:44 +00:00
Simon Giesecke 760cc7e936 Bug 1679522 - Fix include directives and forward declarations. r=andi,necko-reviewers,jgilbert
- Add missing include directives and forward declarations.
- Remove some extra include directives.
- Add missing namespace qualifications.
- Move include directives out of namespace in toolkit/xre/GlobalSemaphore.h

Differential Revision: https://phabricator.services.mozilla.com/D98894
2021-03-25 10:19:44 +00:00
Dzmitry Malyshau 5668f013a9 Bug 1622846 - WebGPU new mapping API r=webidl,jgilbert,smaug
This PR updates wgpu to 64ae59072d
It has a number of things (API updates, correctness fixes, etc), but the biggest part is the new mapping API.

Differential Revision: https://phabricator.services.mozilla.com/D92636
2020-10-19 17:19:12 +00:00
Dorel Luca 9ca588da3e Backed out changeset 13bb2d007f1f (bug 1622846) for Build bustage on android. CLOSED TREE 2020-10-19 19:28:27 +03:00
Dzmitry Malyshau 84fe9a5693 Bug 1622846 - WebGPU new mapping API r=webidl,jgilbert,smaug
This PR updates wgpu to 64ae59072d
It has a number of things (API updates, correctness fixes, etc), but the biggest part is the new mapping API.

Differential Revision: https://phabricator.services.mozilla.com/D92636
2020-10-19 15:08:55 +00:00
Dzmitry Malyshau f84ef4af83 Bug 1622846 - WebGPU dummy destroy() and optional stencil states r=webidl,smaug
Differential Revision: https://phabricator.services.mozilla.com/D71201
2020-04-16 19:28:22 +00:00
Dzmitry Malyshau 45898087b9 Bug 1629851 - Avoid WebGPU buffer flush on reads r=jgilbert
Differential Revision: https://phabricator.services.mozilla.com/D70866

--HG--
extra : moz-landing-system : lando
2020-04-14 21:26:45 +00:00
Dzmitry Malyshau be7fae486d Bug 1609175 - WebGPU bind groups and compute pipelines r=jgilbert,webidl,smaug,bzbarsky
Adds support for bind groups and compute pipelines
The end goal of this PR is to run the compute example.

Differential Revision: https://phabricator.services.mozilla.com/D60746

--HG--
extra : moz-landing-system : lando
2020-01-24 16:27:09 +00:00
Noemi Erli 835cec6cf9 Backed out changeset 136b3044f6a6 (bug 1609175) for causing build bustages in WebGPUChild.cpp CLOSED TREE 2020-01-24 17:20:31 +02:00
Dzmitry Malyshau 73eff15f2c Bug 1609175 - WebGPU bind groups and compute pipelines r=jgilbert,webidl,smaug,bzbarsky
Adds support for bind groups and compute pipelines
The end goal of this PR is to run the compute example.

Differential Revision: https://phabricator.services.mozilla.com/D60746

--HG--
extra : moz-landing-system : lando
2020-01-24 05:05:34 +00:00
Dzmitry Malyshau df4fc33667 Bug 1596128 - WebGPU compute passes r=jgilbert,webidl,bzbarsky
Update third party dependencies
WebGPU command encoder creation
WebGPU CommandBuffer creation and submission
WebGPU Compute pass recording

Differential Revision: https://phabricator.services.mozilla.com/D59896

--HG--
rename : gfx/wgpu/wgpu-core/src/device.rs => gfx/wgpu/wgpu-core/src/device/mod.rs
extra : moz-landing-system : lando
2020-01-22 07:31:51 +00:00
Dzmitry Malyshau 69c53e713c Bug 1600929 - WebGPU buffer creation and mapping r=jgilbert,bzbarsky
This is the basic functionality needed to work with buffers.
What it doesn't have:
  - ability to re-map the buffer for writing
  - async writing map
  - most of the validation

Differential Revision: https://phabricator.services.mozilla.com/D55656

--HG--
extra : moz-landing-system : lando
2019-12-10 17:07:18 +00:00
Razvan Maries c59654e8be Backed out changeset 2968e233f172 (bug 1600929) for hazzard bustages on Device.cpp. CLOSED TREE 2019-12-10 01:26:09 +02:00
Dzmitry Malyshau b3d867ca6e Bug 1600929 - WebGPU buffer creation and mapping r=jgilbert,bzbarsky
This is the basic functionality needed to work with buffers.
What it doesn't have:
  - ability to re-map the buffer for writing
  - async writing map
  - most of the validation

Differential Revision: https://phabricator.services.mozilla.com/D55656

--HG--
extra : moz-landing-system : lando
2019-12-09 21:43:13 +00:00
Dzmitry Malyshau b91906eeac Bug 1581710 - Update WebGPU IDL bindings r=jgilbert,bzbarsky
This mostly updates the bindings to the current state.
No actual logic backing them yet.

*Note*: the IDL does *not* need to be checked for matching the upstream spec precisely at this stage. The upstream is evolving, we just need to update in order to start integrating the implementation. What needs to be checked is - how C++ represents the IDL, esp with regards to derived classes, events, and hierarchies.

The trickiest points, arguably, are:
  - WebGPU -> GPU prefix change
  - the goop for interfaces that are not final

Differential Revision: https://phabricator.services.mozilla.com/D46166

--HG--
rename : dom/webgpu/InputState.cpp => dom/webgpu/DeviceLostInfo.cpp
rename : dom/webgpu/Fence.h => dom/webgpu/DeviceLostInfo.h
rename : dom/webgpu/BlendState.cpp => dom/webgpu/OutOfMemoryError.cpp
rename : dom/webgpu/LogEntry.h => dom/webgpu/OutOfMemoryError.h
rename : dom/webgpu/BindGroup.h => dom/webgpu/ProgrammablePassEncoder.cpp
rename : dom/webgpu/BlendState.cpp => dom/webgpu/RenderBundle.cpp
rename : dom/webgpu/BlendState.h => dom/webgpu/RenderBundle.h
rename : dom/webgpu/AttachmentState.cpp => dom/webgpu/ValidationError.cpp
rename : dom/webgpu/AttachmentState.h => dom/webgpu/ValidationError.h
extra : moz-landing-system : lando
2019-10-02 16:46:03 +00:00
Brindusan Cristian 8416452282 Backed out changeset 1ca9b7056c58 (bug 1581710) for mochitest failures at test_enabled.html. CLOSED TREE
--HG--
rename : dom/webgpu/ValidationError.cpp => dom/webgpu/AttachmentState.cpp
rename : dom/webgpu/ValidationError.h => dom/webgpu/AttachmentState.h
rename : dom/webgpu/RenderBundle.cpp => dom/webgpu/BlendState.cpp
rename : dom/webgpu/RenderBundle.h => dom/webgpu/BlendState.h
rename : dom/webgpu/DeviceLostInfo.cpp => dom/webgpu/InputState.cpp
rename : dom/webgpu/OutOfMemoryError.h => dom/webgpu/LogEntry.h
2019-10-02 06:04:25 +03:00
Dzmitry Malyshau 068927599a Bug 1581710 - Update WebGPU IDL bindings r=jgilbert,bzbarsky
This mostly updates the bindings to the current state.
No actual logic backing them yet.

*Note*: the IDL does *not* need to be checked for matching the upstream spec precisely at this stage. The upstream is evolving, we just need to update in order to start integrating the implementation. What needs to be checked is - how C++ represents the IDL, esp with regards to derived classes, events, and hierarchies.

The trickiest points, arguably, are:
  - WebGPU -> GPU prefix change
  - the goop for interfaces that are not final

Differential Revision: https://phabricator.services.mozilla.com/D46166

--HG--
rename : dom/webgpu/InputState.cpp => dom/webgpu/DeviceLostInfo.cpp
rename : dom/webgpu/Fence.h => dom/webgpu/DeviceLostInfo.h
rename : dom/webgpu/BlendState.cpp => dom/webgpu/OutOfMemoryError.cpp
rename : dom/webgpu/LogEntry.h => dom/webgpu/OutOfMemoryError.h
rename : dom/webgpu/BindGroup.h => dom/webgpu/ProgrammablePassEncoder.cpp
rename : dom/webgpu/BlendState.cpp => dom/webgpu/RenderBundle.cpp
rename : dom/webgpu/BlendState.h => dom/webgpu/RenderBundle.h
rename : dom/webgpu/AttachmentState.cpp => dom/webgpu/ValidationError.cpp
rename : dom/webgpu/AttachmentState.h => dom/webgpu/ValidationError.h
extra : moz-landing-system : lando
2019-10-02 01:42:07 +00:00
Tooru Fujisawa 7983faeb5d Bug 1511393 - Use c-basic-offset: 2 in Emacs mode line for C/C++ code. r=nbp 2018-12-01 04:52:05 +09:00
Sylvestre Ledru 265e672179 Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
# ignore-this-changeset

--HG--
extra : amend_source : 4d301d3b0b8711c4692392aa76088ba7fd7d1022
2018-11-30 11:46:48 +01:00
Jeff Gilbert a574f2ae1f Bug 1469376 - Initial stubs for WebGPU sketch API. - r=kvark,qdot
MozReview-Commit-ID: 3MZLQDNpHBk

--HG--
extra : rebase_source : 4495aae52f283286ecafcc3217811d306097b9b6
2018-06-13 10:43:48 -07:00