Skip to content

Bezier demo does not hit 60fps #17889

Closed
Closed

Description

@eseidelGoogle

I've not tested it myself, but this came in through another customer.

Here is the example:
https://github.com/eseidelGoogle/bezier_perf

There also is likely a bug in either my integration code or the original sample as it does not redraw correctly while animating. If you hit the "p" key in flutter run (or any other key which forces a redraw) you can see it's actually animating, just not redrawing.

@HansMuller might see the redraw bug off the top of his head.

@chinmaygarde volunteered to take a look at the perf.

Activity

  1. added this to the bucket5 milestone on May 24, 2018
  2. self-assigned this
    on May 24, 2018
  3. eseidelGoogle commented on May 24, 2018

    @eseidelGoogle
    ContributorAuthor

    If you set the blur value to something other than 0.0 the animation shows up. I haven't looked into the details of why.

  4. HansMuller commented on May 24, 2018

    @HansMuller
    Contributor

    Here's a version that animates: https://gist.github.com/HansMuller/d3470c74d6c677075b6e1705e8ea8da0

    I noticed a few odd things about the code although I doubt any of them would have a significant performance impact:

    • The code doesn't use const types where it could or, as far as I can tell, cache constant values like _getLogoPath().
    • To animate BezierPaint() pass along "curve" as its repaint Listenable (call super(repaint: curve)).

    At the moment, I don't have time to look into this in more detail.

  5. eseidelGoogle commented on May 29, 2018

    @eseidelGoogle
    ContributorAuthor

    Learn anything @chinmaygarde?

  6. chinmaygarde commented on May 29, 2018

    @chinmaygarde
    Contributor

    Note: This is using the reduced test case posted by Hans above.

    Update: This appears to be a surprisingly slow edge case in the GPU renderer. Switching to the software renderer for this specific scene makes Flutter comfortably meet its frame budget. This is a
    trace of scene using the slow GPU renderer
    and this one traces the same scene with the software renderer.

    Slow:
    screen shot 2018-05-29 at 4 14 35 pm

    Fast:
    screen shot 2018-05-29 at 4 14 28 pm

    In the slow GPU trace, the renderer seems to be creating a bitmap texture for subsequent upload. The scribble into this texture seems to be taking an extremely long time as shown. There are two surprising outcomes here. We should not be doing a per frame texture allocation, scribble and upload. Also, the scribble done by the software renderer is way faster than that in the GPU renderer.

    The offending call seems to be the TextureOp in virtual bool GrRenderTargetOpList::onExecute(GrOpFlushState *):
    screen shot 2018-05-29 at 4 16 53 pm

    We have the issue isolated. The fix is not clear ATM. But this scene should be easy to render in a performant manner once this issue is fixed.

    Just an update.

  7. eseidelGoogle commented on May 29, 2018

    @eseidelGoogle
    ContributorAuthor

    Thank you @chinmaygarde!

  8. chinmaygarde commented on May 29, 2018

    @chinmaygarde
    Contributor
  9. chinmaygarde commented on May 30, 2018

    @chinmaygarde
    Contributor

    More update: Marking the path as volatile (setIsVolatile) and disabling the fAllowPathMaskCaching GrContext option did not seem to help. Traces for this are here.

  10. chinmaygarde commented on May 30, 2018

    @chinmaygarde
    Contributor

    SKP Trace for the scene as requested.

  11. brianosman commented on May 30, 2018

    @brianosman
    Contributor
  12. bsalomon commented on May 30, 2018

    @bsalomon
    Contributor

    What device reproduces the slowness?

  13. chinmaygarde commented on May 30, 2018

    @chinmaygarde
    Contributor

    Those traces were captured on an iPhone 8.

  14. 21 remaining items

  15. liyuqian commented on Oct 5, 2018

    @liyuqian
    Contributor

    With the new CCPR, this is no longer an issue as we're always fast even if we don't setIsVolatile:

    image

  16. windrunner414 commented on Apr 10, 2019

    @windrunner414

    I found that using the bezier curve was still very slow.
    #27453 is there any way to solve it? i converted dart to native java it's very smooth.but in flutter is very slow

  17. csmartdalton86 commented on Apr 10, 2019

    @csmartdalton86

    CCPR is temporarily disabled and an MSAA implementation is in the works. It should land within the next few weeks, at which time bezier curves will be fast again.

  18. windrunner414 commented on Apr 10, 2019

    @windrunner414

    @csmartdalton86 sounds great.I will test it after land

  19. windrunner414 commented on Apr 14, 2019

    @windrunner414

    @csmartdalton86 hi.when was CCPR disabled? I found this issue in february(stable1.0). ccpr may be disabled last month?Is my issue caused by it?

  20. liyuqian commented on Apr 15, 2019

    @liyuqian
    Contributor

    Yes, CCPR is only disabled recently, but I'm not sure whether it's enabled in Flutter v1.0. It has only been enabled by default probably a few months ago. @csmartdalton86 : can you please provide a commit in Skia that enables CCPR by default for all (or most) paths?

  21. csmartdalton86 commented on Apr 15, 2019

    @csmartdalton86

    Looks like it was disabled March 18:

    https://skia-review.googlesource.com/c/skia/+/201938

    CCPR was enabled some time last year, so in February it should have been enabled.

    @windrunner414, do you have a specific bezier drawing case in mind that you can share for us to look at?

  22. liyuqian commented on Apr 16, 2019

    @liyuqian
    Contributor

    @csmartdalton86 : v1.0 was released last year and it was cut on 5391447 which was in November last year. So it would be nice to check that CCPR was enabled at that time.

    Meanwhile, @windrunner414 , can you please post a sample Flutter app (which hopefully only has a single main.dart file) that includes your slow bezier path drawing so we can debug locally to see if it's CCPR or something else?

  23. csmartdalton86 commented on Apr 16, 2019

    @csmartdalton86

    CCPR was enabled on June 24, 2018.

    https://skia-review.googlesource.com/c/skia/+/137207

    Stroking was implemented on September 3, 2018:

    https://skia-review.googlesource.com/c/skia/+/151188

  24. liyuqian commented on Apr 16, 2019

    @liyuqian
    Contributor

    Thanks @csmartdalton86 ! So it should definitely be there in v1.0. We'll need more information about the path to see why it's slow, @windrunner414 .

  25. windrunner414 commented on Apr 16, 2019

    @windrunner414

    @liyuqian @csmartdalton86 you can see #27453.
    I write the details in it

  26. windrunner414 commented on Apr 16, 2019

    @windrunner414

    This is a very simple example, which is much more complicated in my book reader app.
    I write a native app use similar code (only convert dart to java) is very smooth in Samsung galaxy note3 but the flutter app is pretty janky

  27. github-actions commented on Aug 15, 2021

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  28. locked as resolved and limited conversation to collaborators on Aug 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    c: performanceRelates to speed or footprint issues (see "perf:" labels)dependency: skiaSkia team may need to help us

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions