Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebGPU update presentation data asynchronously #27154

Merged
merged 1 commit into from Jul 3, 2020

Conversation

kunalmohan
Copy link
Collaborator

@kunalmohan kunalmohan commented Jul 2, 2020

This PR aims to make updating Webrender presentation data non-blocking.
A callback is passed to the buffer_map_async() fn wherein the data is read and a message sent to the server itself to write the data into the shared PresentationData struct object.

r?@kvark


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix #___ (GitHub issue number if applicable)
  • There are tests for these changes OR
  • These changes do not require tests because ___

@highfive
Copy link

highfive commented Jul 2, 2020

Heads up! This PR modifies the following files:

  • @asajeffrey: components/script/dom/gpucanvascontext.rs
  • @KiChjang: components/script/dom/gpucanvascontext.rs

@highfive
Copy link

highfive commented Jul 2, 2020

warning Warning warning

  • These commits modify unsafe code. Please review it carefully!
  • These commits modify script code, but no tests are modified. Please consider adding a test!

@kunalmohan
Copy link
Collaborator Author

kunalmohan commented Jul 2, 2020

I am facing one problem here. Inside the buffer_map_async() callback, sender doesn't send the UpdateWebRenderData message. There's no panic or error too. The control doesn't get past that code block responsible to send that message.

(There are some debug logs here which I'll remove once this problem gets solved)

kvark
kvark approved these changes Jul 2, 2020
Copy link
Member

@kvark kvark left a comment

Looks reasonable

components/webgpu/lib.rs Outdated Show resolved Hide resolved
components/webgpu/lib.rs Outdated Show resolved Hide resolved
components/webgpu/lib.rs Outdated Show resolved Hide resolved
@kunalmohan
Copy link
Collaborator Author

kunalmohan commented Jul 3, 2020

The error was probably due to the data-carrying capacity of IpcSender. Reading the data in UpdateWebRenderData instead of sending it over from the async callback solved the issue.

I have also edited the buffer data exchange between content process and server to use IpcSharedMemory instead of Vec in BufferMapAsync and UnmapBuffer.

@kunalmohan kunalmohan marked this pull request as ready for review Jul 3, 2020
@kunalmohan kunalmohan added this to In progress in WebGPU MVP via automation Jul 3, 2020
Copy link
Member

@kvark kvark left a comment

Much nicer! One concern though

components/webgpu/lib.rs Show resolved Hide resolved
kvark
kvark approved these changes Jul 3, 2020
@kvark
Copy link
Member

kvark commented Jul 3, 2020

@bors-servo r+

@bors-servo
Copy link
Contributor

bors-servo commented Jul 3, 2020

📌 Commit b672b78 has been approved by kvark

@bors-servo
Copy link
Contributor

bors-servo commented Jul 3, 2020

Testing commit b672b78 with merge 39060ca...

bors-servo added a commit that referenced this issue Jul 3, 2020
WebGPU update presentation data asynchronously

<!-- Please describe your changes on the following line: -->
This PR aims to make updating Webrender presentation data non-blocking.
A callback is passed to the `buffer_map_async()` fn wherein the data is read and a message sent to the server itself to write the data into the shared `PresentationData` struct object.

r?@kvark

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [ ] These changes fix #___ (GitHub issue number if applicable)

<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because ___

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
@bors-servo
Copy link
Contributor

bors-servo commented Jul 3, 2020

💔 Test failed - status-taskcluster

@jdm
Copy link
Member

jdm commented Jul 3, 2020

bors-servo added a commit that referenced this issue Jul 3, 2020
WebGPU update presentation data asynchronously

<!-- Please describe your changes on the following line: -->
This PR aims to make updating Webrender presentation data non-blocking.
A callback is passed to the `buffer_map_async()` fn wherein the data is read and a message sent to the server itself to write the data into the shared `PresentationData` struct object.

r?@kvark

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [ ] These changes fix #___ (GitHub issue number if applicable)

<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because ___

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
@bors-servo
Copy link
Contributor

bors-servo commented Jul 3, 2020

Testing commit b672b78 with merge b3a351d...

@bors-servo
Copy link
Contributor

bors-servo commented Jul 3, 2020

💔 Test failed - status-taskcluster

@bors-servo
Copy link
Contributor

bors-servo commented Jul 3, 2020

Testing commit b672b78 with merge 7fafd91...

@bors-servo
Copy link
Contributor

bors-servo commented Jul 3, 2020

☀️ Test successful - status-taskcluster
Approved by: kvark
Pushing 7fafd91 to master...

@bors-servo bors-servo merged commit 7fafd91 into servo:master Jul 3, 2020
2 checks passed
WebGPU MVP automation moved this from In progress to Done Jul 3, 2020
@kunalmohan kunalmohan deleted the async-presentation branch Jul 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
WebGPU MVP
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

5 participants