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

[Android] Get the right frame_budget when device frame_rate is not 60 #30924

Merged
merged 2 commits into from
Jan 27, 2022

Conversation

eggfly
Copy link
Member

@eggfly eggfly commented Jan 19, 2022

It fixes:

Change the logic to query device refresh rate from FlutterJNI every time.

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 Hixie said 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.

Sorry, something went wrong.

@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat.

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@eggfly eggfly changed the title [Android] Get the right frame_budget when device frame_rate is not 60 WIP: [Android] Get the right frame_budget when device frame_rate is not 60 Jan 19, 2022
@eggfly eggfly force-pushed the fix_frame_budget branch 4 times, most recently from fae42ee to 408d2e3 Compare January 20, 2022 07:10
@eggfly eggfly changed the title WIP: [Android] Get the right frame_budget when device frame_rate is not 60 [Android] Get the right frame_budget when device frame_rate is not 60 Jan 20, 2022
@eggfly eggfly requested review from flar, zanderso and ds84182 January 20, 2022 13:09
@flar flar removed their request for review January 20, 2022 19:07
@eggfly eggfly force-pushed the fix_frame_budget branch 3 times, most recently from 40fd16e to 4d09123 Compare January 21, 2022 07:10
@eggfly eggfly removed the request for review from flar January 21, 2022 07:13
Comment on lines 19 to 26
/// The update type that is passed to the Stopwatch's constructor.
enum FrameBudgetUpdateType {
/// Update the latest frame budget value from refresh rate everytime.
/// See: `DisplayManager::GetMainDisplayRefreshRate`
kUpdateEverytime,
/// Using the default value `fml::kDefaultFrameBudget` (60 fps)
kOnShotValue,
};
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we really need this? Why not just always pass in the rasterizer as a delegate and then call GetFrameBudget on it every time?

Copy link
Member Author

Choose a reason for hiding this comment

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

Do we really need this? Why not just always pass in the rasterizer as a delegate and then call GetFrameBudget on it every time?

@dnfield I tried to make only a delegate in the GetFrameBudget() logic, and I need to find a place and memory to store the FixedRefreshRateDelegate instance. A "0 - params" constructor of CompositorContext and some unit tests need the fixed version like FixedRefreshRateStopWatch. Do you have any advice to make the code better and more pretty?

@eggfly eggfly requested a review from dnfield January 24, 2022 13:16
Copy link
Contributor

@dnfield dnfield left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -300,10 +313,6 @@ void CounterValues::Visualize(SkCanvas* canvas, const SkRect& rect) const {
canvas->drawRect(marker_rect, paint);
}

int64_t CounterValues::GetCurrentValue() const {
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems like a drive by removal of unused code?

Copy link
Contributor

Choose a reason for hiding this comment

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

(which is fine by just making sure I understand and I'm not getting confused by GitHub's diff presentation)

Copy link
Member Author

Choose a reason for hiding this comment

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

@dnfield Yes, it's a removal of unused code.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
platform-android waiting for tree to go green This PR is approved and tested, but waiting for the tree to be green to land.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants