Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

@knopp
Copy link
Member

@knopp knopp commented Dec 17, 2023

Fixes flutter/flutter#49757

This PR synchronises updates with display refresh allowing for true 120hz repaint. It also enforces frame pacing resulting in smoother experience at both 60hz and 120hz.

If you had to change anything in the flutter/tests repo, include a link to the migration guide as per the breaking change policy.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide and the C++, Objective-C, Java style guides.
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or the PR is test-exempt. See testing the engine for instructions on writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the CLA.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@flutter-dashboard

This comment was marked as outdated.

@knopp knopp force-pushed the macos_display_link branch from 4189a33 to b60b239 Compare December 20, 2023 11:23
@knopp knopp changed the title WIP [macOS] Use CVDisplayLink to drive repaint [macOS] Use CVDisplayLink to drive repaint Dec 20, 2023
@knopp knopp force-pushed the macos_display_link branch 2 times, most recently from 9423f12 to e06c2c6 Compare December 20, 2023 19:51
@knopp
Copy link
Member Author

knopp commented Dec 21, 2023

@cbracken, I think this is in good enough shape for review.

@knopp knopp force-pushed the macos_display_link branch 2 times, most recently from 4d508d2 to c579a92 Compare December 25, 2023 13:49
@lesnitsky
Copy link

@knopp is anything blocking this PR?

@knopp
Copy link
Member Author

knopp commented Feb 1, 2024

@knopp is anything blocking this PR?

Not that I know of, possibly a bandwidth issue. @cbracken ?

@loic-sharma
Copy link
Member

@knopp Chris is out sick and may be delayed in reviewing this. Apologies for the delay.

Copy link
Member

@cbracken cbracken left a comment

Choose a reason for hiding this comment

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

A few more quick comments.


- (void)onVSync:(uintptr_t)baton {
@synchronized(_vsyncWaiters) {
FlutterVSyncWaiter* waiter = [_vsyncWaiters objectForKey:@(kFlutterImplicitViewId)];
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 assuming we'll need to generalise this for multi-views, in which case, you'll want to add a TODO here to wire up the proper view ID with an issue link. You may need to file a new subissue under flutter/flutter#142845 if nothing existing fits.

Copy link
Member Author

@knopp knopp Feb 21, 2024

Choose a reason for hiding this comment

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

I added a TODO for this. Right now it seems a bit unclear how exactly vsync is going to work with multiview. We might not have a viewId available.

At least for the multiview MVP we'll probably use some heuristic for this - i.e. if views are on different displays use waiter for view on primary display, or with display with higher refresh. We'll cross that bridge when we get there, but either way this should be a minor change.

@knopp knopp force-pushed the macos_display_link branch 2 times, most recently from b9c3e77 to 5c2c131 Compare February 26, 2024 13:28
Copy link
Member

@cbracken cbracken left a comment

Choose a reason for hiding this comment

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

LGTM stamp from a Japanese personal seal

Awesome - thanks so much for your patience on this one! Looks great! Ship it! 🚀

if (screen != nil) {
// https://developer.apple.com/documentation/appkit/nsscreen/1388360-devicedescription?language=objc
_display_id = (CGDirectDisplayID)[
[[screen deviceDescription] objectForKey:@"NSScreenNumber"] unsignedIntValue];
Copy link
Member

Choose a reason for hiding this comment

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

Sure would have been nice if they'd provided a const NSString for this key! Thanks for the doc link to explain it.

#include "flutter/fml/synchronization/waitable_event.h"
#include "flutter/testing/testing.h"

#import <AppKit/AppKit.h>
Copy link
Member

Choose a reason for hiding this comment

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

nit: standard C/Obj-C headers like this go after the associated header (FlutterDisplayLink.h) but before the local flutter headers.

At some point we'll get round do adding a better header lint, though the associated header is sometimes tricky to figure out.

@alterhuman
Copy link

Is there any possibility of this getting merged again?

@knopp
Copy link
Member Author

knopp commented Mar 13, 2024

Is there any possibility of this getting merged again?

#51210

@alterhuman
Copy link

@knopp thank you so much for this! Can't wait to see the difference. Very excited.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Desktop app frame rate isn't synced to display

5 participants