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

Window: Revert swap forced sync (#4219) as it causes performance issue #6578

Merged
merged 1 commit into from
Dec 21, 2019
Merged

Window: Revert swap forced sync (#4219) as it causes performance issue #6578

merged 1 commit into from
Dec 21, 2019

Conversation

quitegreensky
Copy link
Contributor

@quitegreensky quitegreensky commented Nov 1, 2019

#4219

These commits actually cause fps regression. I found this by doing some version comparisons. looking at getting this revert will solve the issue.

@welcome
Copy link

welcome bot commented Nov 1, 2019

Thanks for opening your first pull request here! 💖 Please check out our contributing guidelines.

@@ -2252,6 +2252,13 @@ def _get_line_options(self):

def _create_line_label(self, text, hint=False):
# Create a label from a text, using line options

Copy link
Member

Choose a reason for hiding this comment

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

what this have to do with the actual issue?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops! the last two commits are not related to issue. My mistake!

Copy link
Member

Choose a reason for hiding this comment

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

Then could you remove this commit if it's not related. Also try to squash your changes so it's only one commit.

kivy/uix/textinput.py Outdated Show resolved Hide resolved
@akshayaurora
Copy link
Member

@quitegreensky how much of a regression? Can you add some data?

@quitegreensky
Copy link
Contributor Author

@quitegreensky how much of a regression? Can you add some data?

The whole story began from #2002. There are all informations here.

Copy link
Member

@AndreMiras AndreMiras left a comment

Choose a reason for hiding this comment

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

Thanks for looking into it and giving a try.
FYI there was an attempt to revert it in #6242
Let's see what comes up this time

@@ -2252,6 +2252,13 @@ def _get_line_options(self):

def _create_line_label(self, text, hint=False):
# Create a label from a text, using line options

Copy link
Member

Choose a reason for hiding this comment

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

Then could you remove this commit if it's not related. Also try to squash your changes so it's only one commit.

with nogil:
SDL_GL_SwapWindow(win)
cgl.glFinish()
SDL_GL_SwapWindow(self.win)
Copy link
Member

Choose a reason for hiding this comment

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

I'm actually curious to know which change/line specifically made the regression and why

@matham
Copy link
Member

matham commented Nov 7, 2019

I'm worried about merging this, given that we didn't merge the last request to revert for the reasons stated there. We could maybe disable it on mobile, but that feels hacky.

Either way, it would be good to get confirmation that specifically reverting this commit fixes the fps issues.

@akshayaurora
Copy link
Member

akshayaurora commented Nov 8, 2019

It seems the original fix #4219 was for a specific situation that caused a blocking of the main app when using multiple background threads, and getting a gl block due to swap being deferred by default by the drivers.

Calling glFinish() ensured the swap on previous line happened immediately, however this also leads to a general slowdown as mentioned by a few people #6242 and in current thread.

@matham @tito how about this be made a compile time option?

For people that know what they are doing they could enable this, we could add information about it in the doc.

@matham
Copy link
Member

matham commented Nov 8, 2019

If we can confirm that disabling glfinish fixes the issue, then unless someone has better ideas why having glfinish would lead to a unnecessary slowdown, I think a compile, or runtime option is the only solution I can think of.

It's not great, hence why I thought it was hacky. Because when someone new to kivy runs into this issue, since it'll use glfinish by default, they probably won't know to lookup this issue and workaround. And they'd just assume it's a kivy problem.

Perhaps disabling glfinish by default is a better option? And have a config option to turn it on?

Update sdl2.pxi
@akshayaurora
Copy link
Member

Perhaps disabling glfinish by default is a better option? And have a config option to turn it on?

I would assume that this makes much more sense. However Let's add some real tests to the argument. Right now it's just user reports that too not with reproducible apps. Having tests we can refer to would make it easier to judge the issue.

Is this issue only on android? Does it effect iOS? Desktops?

We probably should have these tests in kivy test suit even if they might not run every time?

@inclement
Copy link
Member

inclement commented Nov 9, 2019

I'm strongly in favour of reverting this, it looks to me like we're taking a huge performance hit to improve a relatively rare use case. We can still improve it later.
I note that #4219 sat for over 3 years before eventually being merged, and people started complaining very shortly afterwards. I think that's strong evidence that #4219 fixes much less than it breaks.

Edit: Also, this is really a big deal on Android. As already linked, kivy/python-for-android#2002 has an excellent simple test application demonstrating the performance drops. If we don't merge this to Kivy fairly soon, I'm thinking to have p4a patch it out, it's that bad.

@AndreMiras
Copy link
Member

Thanks for your feedback on this @inclement
I'm actually already patching it on p4a for one project even though I didn't notice a big difference on my devices AndreMiras/EtherollApp@c064fd0

@matham matham merged commit 7de0314 into kivy:master Dec 21, 2019
@welcome
Copy link

welcome bot commented Dec 21, 2019

Congrats on merging your first pull request! 🎉🎉🎉

@matham
Copy link
Member

matham commented Dec 21, 2019

Ok, I merged it. I guess if someone wants to implement a config option that optionally enables the original patch they are welcome.

AndreMiras added a commit to AndreMiras/EtherollApp that referenced this pull request May 27, 2020
Kivy 4219 revert was applied upstream via:
kivy/kivy#6578
eth-abi, eth-account and web3 recipes are no longer required as we found
a way to make F-Droid build with Python 3.6.
gevent recipe got fixed p4a upstream.
AndreMiras added a commit to AndreMiras/EtherollApp that referenced this pull request May 27, 2020
Kivy 4219 revert was applied upstream via:
kivy/kivy#6578
eth-abi, eth-account and web3 recipes are no longer required as we found
a way to make F-Droid build with Python 3.6.
gevent recipe got fixed p4a upstream.
@matham matham added this to the 2.0.0 milestone Oct 28, 2020
@matham matham changed the title Revert #4219 as it causes performance issue Window: Revert swap forced sync (#4219) as it causes performance issue Dec 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants