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

Unable to match desired swap behavior #16

Open
LucasGGamerM opened this issue Apr 12, 2024 · 9 comments
Open

Unable to match desired swap behavior #16

LucasGGamerM opened this issue Apr 12, 2024 · 9 comments

Comments

@LucasGGamerM
Copy link

Everytime an animation lags I get the '"Unable to match desired swap behavior" log entry. It started happening after upgrading to appkit 1.2.10 (1.2.9 didn't have the issue), and I am still unable to debug the weird animation hiccups that usually happen in the ripple animations. Do you have any clue as for where this issue might be originating, considering that the Mastodon app doesn't have it?

Thank you!

@grishka
Copy link
Owner

grishka commented Apr 13, 2024

I've also seen this line many times but I'm unable to find it in AOSP. Maybe it comes from a proprietary GPU driver 🤔

@grishka
Copy link
Owner

grishka commented Apr 13, 2024

I found it, there's a "the" in there

@LucasGGamerM
Copy link
Author

Yes, it happens both in emulators and in on a lot of people's phones (including mine), and the weird thing is that it just straight up doesn't happen on the Mastodon app. Do you have any clue as for what could be the culprit?

@grishka
Copy link
Owner

grishka commented Apr 13, 2024

I have no idea, it would require diving deep into libhwui, e.g. at least when and from where that function is called and what "preserve buffer" means. It may also be only happening in debug builds (debuggable=true), those just run slower than release builds in general.

@LucasGGamerM
Copy link
Author

The only thing that bothers me is that the only time it happens is during the ripple animations, which just stop in the middle and look terrible.

It's a weird problem to have 😔

@grishka
Copy link
Owner

grishka commented Apr 13, 2024

AFAIK ripple animations render on the render thread. A native-only thread that an app can't run any of its own code on, that is responsible for actually drawing things with OpenGL (and I believe Vulkan in some more recent Android versions on some devices). So it might be a bug in Android itself?

The only reason I can think of why it might want to switch surfaces (does this end up calling eglMakeCurrent?) is when you have more than one window in your app process. So it would draw into one window, then switch to the surface for the other one and draw it. Any overlays (popup menus, toasts, etc) count as separate windows too. It makes sense because there's only one render thread regardless of how many windows you have. But this is only a speculation that I'm too lazy to test.

@LucasGGamerM
Copy link
Author

It's a nice clue to have, however I am not sure the reason for this ripple animation lag to start happening right after upgrading appkit from 1.2.9 to 1.2.10

Maybe it's another variable I am not considering?

@grishka
Copy link
Owner

grishka commented Apr 13, 2024

I'm not sure it's related to appkit. It most probably isn't.

@LucasGGamerM
Copy link
Author

In any case, you are a more experienced developer than me. Do you have any directions for where I should look for troubleshooting this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants