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

[ANGLE] Don't lose Metal-backed contexts for non-fatal errors #17573

Merged
merged 1 commit into from
Sep 8, 2023

Conversation

djg
Copy link
Contributor

@djg djg commented Sep 8, 2023

e1280c4

[ANGLE] Don't lose Metal-backed contexts for non-fatal errors
https://bugs.webkit.org/show_bug.cgi?id=261313
rdar://115152037

Reviewed by Kimmo Kinnunen.

Since Bug 257584, Any errors from Metal command buffer submission are treated as
causing a lost device.

MTLCommandBufferErrorNotPermitted is a non-fatal error that is reported when a
page with active WebGL moves to the background on iPhoneOS/iPadOS. This error is
ignored to avoid needlessly losing all WebGL contexts since they can't be
recovered once lost and need to be recreated.

* Source/ThirdParty/ANGLE/changes.diff:
* Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/mtl_command_buffer.mm:
(rx::mtl::CommandQueue::onCommandBufferCompleted):

Canonical link: https://commits.webkit.org/267784@main

9c90757

Misc iOS, tvOS & watchOS macOS Linux Windows
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe ✅ 🛠 wincairo
✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug 🧪 wpe-wk2
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ❌ 🛠 gtk
✅ 🧪 ios-wk2-wpt ✅ 🧪 mac-wk1 ✅ 🧪 gtk-wk2
✅ 🧪 api-ios ✅ 🧪 mac-wk2 ✅ 🧪 api-gtk
✅ 🛠 tv ✅ 🧪 mac-AS-debug-wk2
✅ 🛠 tv-sim
✅ 🛠 🧪 merge ✅ 🛠 watch
✅ 🛠 watch-sim

@djg djg self-assigned this Sep 8, 2023
@djg djg added the ANGLE Bugs related to the ANGLE project label Sep 8, 2023
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Sep 8, 2023
Copy link
Contributor

@kkinnunen-apple kkinnunen-apple left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is that the submit is lossy.
For example, if we submit work that should signal an event and the system responds "not permitted" and we drop the queue to floor then the waiter will time out.

So we need to devise a way to do something useful.

I'm not sure OpenGL as an API bends to such a direction where the flushed commands aren't executed.

We should guarantee that we are not submitting work while backgrounded.

Some work related to this patch is still needed, but I'm not sure what's the strategy.

@djg djg requested a review from grorg September 8, 2023 06:17
@djg
Copy link
Contributor Author

djg commented Sep 8, 2023

This is a stop gap until we can guarantee that we are not submitting work while backgrounded.

The reasoning being we were submitting work in the background previously and ignore any error returned. This means that for your example, we have always been dropping the queue on the floor and not signalling the event.

Copy link
Contributor

@kkinnunen-apple kkinnunen-apple left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@djg djg removed the merging-blocked Applied to prevent a change from being merged label Sep 8, 2023
@djg djg force-pushed the angle/not-all-metal-errors branch from fa895ab to 9c90757 Compare September 8, 2023 07:13
@djg djg added the merge-queue Applied to send a pull request to merge-queue label Sep 8, 2023
https://bugs.webkit.org/show_bug.cgi?id=261313
rdar://115152037

Reviewed by Kimmo Kinnunen.

Since Bug 257584, Any errors from Metal command buffer submission are treated as
causing a lost device.

MTLCommandBufferErrorNotPermitted is a non-fatal error that is reported when a
page with active WebGL moves to the background on iPhoneOS/iPadOS. This error is
ignored to avoid needlessly losing all WebGL contexts since they can't be
recovered once lost and need to be recreated.

* Source/ThirdParty/ANGLE/changes.diff:
* Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/mtl_command_buffer.mm:
(rx::mtl::CommandQueue::onCommandBufferCompleted):

Canonical link: https://commits.webkit.org/267784@main
@webkit-commit-queue
Copy link
Collaborator

Committed 267784@main (e1280c4): https://commits.webkit.org/267784@main

Reviewed commits have been landed. Closing PR #17573 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit e1280c4 into WebKit:main Sep 8, 2023
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Sep 8, 2023
@djg djg deleted the angle/not-all-metal-errors branch October 4, 2023 22:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ANGLE Bugs related to the ANGLE project
Projects
None yet
5 participants