-
Notifications
You must be signed in to change notification settings - Fork 6k
Enable partial repaint for Android/OpenGL #29591
Conversation
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. |
Related flutter/flutter#33939 |
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.
Overall the direction looks good. Can we add some unit tests to android_context_gl_unittests.cc
? Looks like as of 20ec34e we not have the capacity to run these tests on Android host devices.
@@ -105,10 +106,119 @@ static bool TeardownContext(EGLDisplay display, EGLContext context) { | |||
return true; | |||
} | |||
|
|||
class AndroidEGLSurfaceDamage { |
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.
any reason this class is forward declared rather than have the definition in android_context_gl.h
?
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.
I prefer not having to split it into header/implementation but don't have strong feelings about it, if you prefer the definition in header I can certainly do it.
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.
Did not mean to approve before. I think it's important to have unittests figured out.
9463f1b
to
51d5652
Compare
@iskakaushik was looking into gathering firm numbers on the effects of this patch in a large-ish application. Is there any progress to made here? |
@iskakaushik Were you able to gather the numbers? |
I’ve been spending the last couple of weeks attempting to get better traces on why DRM wasn’t showing as much performance improvement on Android devices as it was for iOS. I wanted to summarize my findings so far. In cases where there are transitions, having partial repaint enabled is causing significant performance regression on Android when testing on internal benchmarks. Looking at Flutter Gallery Animations as an example in depth, I was able to see similar differences in performance, the key differences are:
The first theory I had was that maybe Taking a look further at the top causes of this regression, It seems to me that we might be using raster cache more effectively when DRM is not enabled. This is based on the counts in the table below. Also, the
I’ve gathered more metrics here that I plan on looking at once I figure out the raster cache issue. Most of the metrics are worse than without enabling DRM, but I'm only investigating the ones with significant differences as some of the others might be due to the environment as well. These benchmarks were run on a Pixel 4 XL device. I ran the Flutter gallery transitions benchmarks. Command for reference is (working dir:
@knopp, @chinmaygarde would appreciate any thoughts here as well. |
6ca4ef0
to
291a519
Compare
291a519
to
dc74809
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.
LGTM!
Was the solution to flutter/flutter#96310 disabling on older devices? |
@zanderso I wasn't able to consistently reproduce the regression on my Pixel 4 XL device, and did not see it on another device I own. I'm wondering if it is due to my setup / environment issues. The current plan is to land this patch and monitor the benchmarks to see if there are any noticeable regressions in the build/raster time or raster cache usage, in which case I plan on reverting the change. Disabling on older devices is due to glitches caused by their implementations of the required OpenGL extensions. I will file an issue for this. |
@gaaclarke this week's sheriff to keep an eye on SkiaPerf when this rolls into the framework. |
8a035ef
to
6e2b31e
Compare
FYI this landed in flutter/flutter in flutter/flutter#96941. So far no regressions or improvements flagged by SkiaPerf. |
Interesting... So do you find out the actual cause why it does not have improvements? (The iOS pr sounds very performant) |
Partial repaint improves performance in very specific cases, where only small part of screen is being updated (i.e. spinner or a cursor). I don't think there are currently any benchmarks focusing on that. I did submit a PR for one, but it got a bit stale. |
This reverts commit 57a067c.
@@ -105,10 +109,135 @@ static bool TeardownContext(EGLDisplay display, EGLContext context) { | |||
return true; | |||
} | |||
|
|||
class AndroidEGLSurfaceDamage { | |||
public: | |||
void init(EGLDisplay display, EGLContext context) { |
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.
context
isn't used below. was the plan to use it in the future?
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.
Not really. I think I just overlooked it.
Pre-launch Checklist
writing and running engine tests.
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.