-
Notifications
You must be signed in to change notification settings - Fork 6k
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
[android] set presentation time via eglPresentationTimeANDROID #33881
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 (don't just cc him here, he won't see it! He's on Discord!). 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. |
Attempt to reland: flutter#29727 TODO: 1. This isn't right in the cases where the frame has been resubmitted. 2. This hasn't been wired for impeller yet.
eb7178e
to
19c63af
Compare
On a test application, this was seen to reduce the total time spent in cc: @dnfield |
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.
It'd be great to have some kind of test for this, especially if we have to special case resubmit frames.
shell/common/rasterizer.cc
Outdated
@@ -604,6 +604,9 @@ RasterStatus Rasterizer::DrawToSurfaceUnsafe( | |||
} | |||
|
|||
SurfaceFrame::SubmitInfo submit_info; | |||
// TODO (kaushikiska): this can be in the past and might need to get snapped | |||
// to future as this frame could have been resubmitted. | |||
submit_info.presentation_time = frame_timings_recorder.GetVsyncTargetTime(); |
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.
Bug?
Should we avoid setting this if it's a resubmit?
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.
filed an issue. for now i'll set this only if it is > now()
, I think it should be the case for majority of frames. Once the issue is addressed we can snap this to the next vsync target time,.
shell/gpu/gpu_surface_gl_impeller.cc
Outdated
@@ -63,6 +63,8 @@ std::unique_ptr<SurfaceFrame> GPUSurfaceGLImpeller::AcquireFrame( | |||
GLPresentInfo present_info = { | |||
.fbo_id = 0, | |||
.damage = std::nullopt, | |||
// TODO (kaushikiska): wire-up presentation time to impeller backend. |
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.
Bug?
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.
done!
@@ -60,6 +60,17 @@ void LogLastEGLError() { | |||
FML_LOG(ERROR) << "Unknown EGL Error"; | |||
} | |||
|
|||
namespace { | |||
|
|||
static bool HasExtension(const char* extensions, const char* name) { |
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.
We have this method in like 3 or 4 places now. Or maybe we will with the swiftshader patch. We should consider moving it somewhere common
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.
@dnfield i think this is out of scope for this PR. Will refactor this later if that is ok.
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.
SGTM
Done! Added tests for cases where the frame is submitted in the future vs in past. |
thread_host.raster_thread->GetTaskRunner(), | ||
thread_host.ui_thread->GetTaskRunner(), | ||
thread_host.io_thread->GetTaskRunner()); | ||
MockDelegate delegate; |
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.
nit: use NiceMock<MockDelegate>
(using ::testing::NiceMock
) so this doesn't spam output about unused calls, here and elsewhere.
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.
nice! flutter/flutter#105631, i think we want to use it everywhere in this file.
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'm updating the rest of the file in #33890 which is currently stuck on Fuchsia weirdness.
if (HasExtension(extensions, "EGL_ANDROID_presentation_time")) { | ||
presentation_time_proc_ = | ||
reinterpret_cast<PFNEGLPRESENTATIONTIMEANDROIDPROC>( | ||
eglGetProcAddress("eglPresentationTimeANDROID")); |
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.
For future us: this was the big part of what was missing last time.
When I tested this locally, I hacked in a defintiion of this method and saw improvements. I then refactored things to actually do the proc lookup and put the extension name instead of the method name here, which resulted in no improvements (and slight regressions!).
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 with nit
…er#33881) Attempt to reland: flutter#29727 with some fixes.
Could this change have been responsible for the improvement to 99%-ile raster times in backdrop_filter_perf? |
Attempt to reland: #29727
TODO: