-
Notifications
You must be signed in to change notification settings - Fork 342
Add support for GL_EXT_robustness #2705
Comments
On amdgpu, a manual GPU reset can be triggered with |
You will have to trash renderer state and also client buffer textures. This means that you will need to keep a wl-shm client buffer referenced even after uploading data to the opengl texture. |
Support for robustness could look like this:
|
Indeed. We can't re-upload the buffer after we've released the buffer, because the client might be in the process of rendering to it, so its contents can be garbage. |
This might be slightly more complicated: we need compositors to destroy their old GL state before we destroy the EGL context, and re-create it after we've established a new EGL context. We might need two events (meh API), or to keep the old EGL context alive up to |
Beware though, there are applications in the wild that assume the compositor will release a shm buffer after uploading its data to an opengl texture, most prominent example is Firefox. https://bugzilla.mozilla.org/show_bug.cgi?id=1693472 |
Oh, wow. That's pretty gross. |
Is there no way around this? I completely agree that clients cannot assume a buffer is released immediately. But it does enable very nice optimizations when it is released immediately, especially considering rendering is done on the CPU. Being able to recover from GPU resets is of course an extremely nice thing to have. It just seems somewhat weird to incur this kind of performance penalty for something that should, ideally, never happen. But I guess one could argue that performance critical applications should use GL, not shm... |
One way around this would be to add a protocol to let the compositor ask the client to submit a new frame. Non-immediate release shouldn't have too much of a CPU usage cost, I think? It does have a memory cost though. |
How about sending a configure to all surfaces? That is likely to provoke a new frame. Granted, it's not guaranteed to work, but clients might not use a dedicated recovery protocol either, so a backup plan might be in order... |
Clients can choose between a couple of strategies I think.
("damage" refering to the client's internal damage tracking) For reference, foot currently does 2), but I'm going to test 3). I should have some performance numbers after that (see https://codeberg.org/dnkl/foot/issues/478).
Both alternatives crossed my mind as well. I think a new protocol would be more robust? But like @kennylevinsen said, perhaps a configure event can be used as a fallback mechanism for clients not implementing the new protocol? |
Yeah, but some clients might just realize the configure event doesn't change anything, and ack it without attaching a new buffer. For clients that don't support the "please redraw" protocol, we could always hold the
This seems like the best solution. |
Here are some initial numbers from the foot PR that implements (3). While the PR still needs more testing, I believe the performance numbers are close to what we'll see in the end: Sway 1.6, wlroots 0.13.0 Times are in microseconds (µs). Numbers in parentheses is the time taken to “prepare” the buffer before applying the current frame’s damage (hence it’s always zero in the “Immediate release” column). Not covered here: ignoring old buffer content and instead re-rendering the entire frame (on this setup they range from ~3000-5000µs). edit: since this wasn't mentioned anywhere; this table shows the average rendering time for a single frame.
Observations:
Footnotes
|
Would allow us to recover from GPU resets. We'll need to trash all of our renderer state and re-create it.
See:
wlroots has migrated to gitlab.freedesktop.org. This issue has been moved to:
https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/2705
The text was updated successfully, but these errors were encountered: