-
Notifications
You must be signed in to change notification settings - Fork 919
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
Throttle RedrawRequested
#2896
Throttle RedrawRequested
#2896
Conversation
That's basically what I'm using for testing now https://github.com/kchibisov/glutin/tree/test-winit. Similar changes could be done to |
9091f46
to
a21b4ea
Compare
I think it could be good to focus on one platform at a time with updating how RedrawRequested is throttled. So maybe just look at the Wayland changes. I have essentially implemented some of this for Windows in my pump_events branch, because I found it overly convoluted to try and maintain the old logic that was buffering redraw requests to be dispatched after MainEventsCleared. I think it could also be good to add the present_notification API via a completely separate PR. Conceptually I would see the present_notification API as way for Winit to get feedback about when the application renders which might be useful for a variety of use cases but in the short term it happens it provides a solution for letting the Wayland backend use frame callbacks. So it's only indirectly related to throttling - it's needed for throttling on Wayland because otherwise it can't use frame callbacks but that feels like an implementation detail for the Wayland backend. The stubbed macos change here also e.g. doesn't consider that |
I'll do 2 commits in this PR, because otherwise we'll add an API without a real use.
I just tested whether they work at all, but they don't, I'll revert them all together, because I think I'll focus mostly on docs in this PR. |
yeah, makes sense
Just to note that I at least made some updates to docs in the pump_events branch. Maybe you could base on top of my pump_events branch to avoid conflicts? |
a21b4ea
to
12eb090
Compare
I've added just some basic docs, we could improve them with your work ofc, they shouldn't overlap from what I could say. |
This is ready for review wrt docs. @daxpedda if you want to send |
12eb090
to
b6c34d9
Compare
I think it would be best to rename Just going by the name I think I would expect to call Especially for the initial Wayland use case where the backend wants an opportunity to insert a frame callback before the |
1e669fa
to
ae6e85a
Compare
I've renamed the method. @rib is this good for now? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Web backend implemented and approved.
Small question about the documentation.
8558d09
to
301686f
Compare
301686f
to
5f4c1b9
Compare
@daxpedda could you recheck that I've rebased correctly web? |
One thing I was wanted to double check here @kchibisov is whether you have tested how apps behave if they omit the It would be good to be clear on whether this is now a hard requirement or whether the backend can reliably only enable throttling once it has seen that the application has called |
They will get instant redraw, so sounds fine to me, that's what they get before. |
That's a way to communicate to winit that you'll present to the window. While it's a no-op for now, it'll be used to throttle drawing.
Throttle RedrawRequested events by the frame callbacks, so the users could render at the display refresh rate.
5f4c1b9
to
f971acd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Web is fine, thanks @kchibisov.
Fixes #2412.
The docs are also not updated and it would be nice to have software example showing FPS it's rendering it right now.
--
Wayland done and it works.