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

Tearing in embedded mode #13

Closed
Plagman opened this issue Jan 21, 2020 · 6 comments · Fixed by #55
Closed

Tearing in embedded mode #13

Plagman opened this issue Jan 21, 2020 · 6 comments · Fixed by #55
Labels
next Probably a good next thing to fix?

Comments

@Plagman
Copy link
Member

Plagman commented Jan 21, 2020

On DC at least, sometimes there's crazy tearing. We know we need to import a fence, so not too unexpected, but you'd think implicit sync would take care of it.

@Plagman Plagman added the next Probably a good next thing to fix? label May 1, 2020
@Plagman
Copy link
Member Author

Plagman commented May 1, 2020

Lots of tearing when the games are set to vsync = off. I think even if we dont' tie the internal cadence of the game's rendering to vblank when they have vsync = off, the output should not tear, so we're missing something to hold onto the game's buffer for as long as it's on screen maybe.

@emersion
Copy link
Collaborator

emersion commented May 5, 2020

so we're missing something to hold onto the game's buffer for as long as it's on screen maybe.

Yes. wlroots will send a wl_buffer.release event as soon as the game submits a new buffer. Compositors that need to hold on to the buffer for longer need to reference the buffer with wlr_buffer_lock.

This should only cause issues with direct scan-out though. Composition should work fine without wlr_buffer_lock.

Will investigate.

@emersion
Copy link
Collaborator

emersion commented May 5, 2020

This should only cause issues with direct scan-out though. Composition should work fine without wlr_buffer_lock.

Well, since threads are involved, scratch that.

@Plagman
Copy link
Member Author

Plagman commented May 5, 2020

OK - usually direct scanout is the preferred path in embedded so that would be consistent with what you initially said. Sounds like we'll want to lock the buffer until we have a replacement already scanned out or composited in all cases, then.

Does locking the buffer feed back into the WSI interfaces of the application at the other end? Eg. if we lock a buffer and all the other ones are busy, will the app's SwapBuffers() or AcquireNextImage() block until we unlock it?

@emersion
Copy link
Collaborator

emersion commented May 5, 2020

Does locking the buffer feed back into the WSI interfaces of the application at the other end? Eg. if we lock a buffer and all the other ones are busy, will the app's SwapBuffers() or AcquireNextImage() block until we unlock it?

Correct, clients can't start re-using the buffer before wl_buffer.release. See e.g. https://gitlab.freedesktop.org/mesa/mesa/-/blob/master/src/egl/drivers/dri2/platform_wayland.c#L238

@Plagman
Copy link
Member Author

Plagman commented May 14, 2020

Right now I can observe tearing for a few seconds after toggling off the overlay (in embedded mode with a SteamOS-style overlay, eg. gamescope -e -- steam -tenfoot -steamos). That makes us transition from scanning out our composited buffer to direct scanout, but unclear why tearing is only observed immediately after that. It stops after a second or two. If the game has vsync on, that doesn't seem to happen as much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
next Probably a good next thing to fix?
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants