-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Prevent stale frames from being drawn / always ensure up-to-date contents in webview #3668
base: main
Are you sure you want to change the base?
Conversation
At key points where external changes enter the webview, stale images might get rendered. This ensures that a frame showing current state is always shown.
Didn't notice a difference or issues testing this, and it looks harmless to include. Will leave it to @dae though. |
I presume the answer is yes, but could you confirm the issue you're trying to address also exists when the software driver is enabled? My understanding of this rendering issue is that for most people, they either won't see the problem, or only see it with particular video drivers. The changes in this PR would thus make things better for a relatively small portion of the userbase, so it would be nice not to impose a performance penalty on unaffected users. You've placed .update() calls in four separate locations. In your testing, were all locations required, or did you add some "just in case"? If you experiment with scheduling an .update() for a few seconds after JavaScript is evaluated, instead of calling .update() immediately, does the corrupt display refresh correctly after those seconds elapse? |
Apologies for the late reply, I am currently preparing for my exams so I am currently slower to respond.
Yes, I have tried basically all driver configurations and run them for prolonged amount of times and they occured all across them, including software. Vulkan is the one where it occurs the least.
It shouldn't have a large penalty since it essentially just causes a second frame to be rendered when the webview is externally interacted with from python code. In essence this makes sure that a frame with the current state is being put to the screen.
I will look into that and verify and share my results here. As I said in the beginning I am currently preparing for my exams so it could take a bit, but maybe someone else can also reproduce the bug. I will also share the deck I am currently using (漢字.apkg.gz). The bug happens regularly on my Surface Pro 9 every about ~10-100 times in the |
Following up on #3656
Short description
At key points where external changes enter the webview, stale images might get rendered. This ensures that a frame showing current state is always shown.
What it solves
Sometimes previous or corrupted frames get rendered, only showing the current state of the page (i.e. the back of the card or the next card) when an action that causes a repaint is done by the user (for example: selecting text).
How it solves it
At key points where the webview is being interacted with externally, a full update (which includes a repaint) is done.
Potential implications for performance
While this ensures that no more stale frames get shown, it also causes full repaints to happen quite often and in addition to the render operations QWebEngineView might do on its own. I think this is negligible in my testing, but needs to be pointed out.
Request for comments
In my testing this solved the issue, and this time it seems to do so reliably, however, please leave feedback or opinions on this. It is also a bit of a wooden-hammer-approach, but it does fix the issue.