Send syncStatus and return FrameCommitCallback in FrameCallback
FrameCallback sends back the syncStatus and allows the caller to return a FrameCommitCallback. This is so the caller can evaluate the results of the sync and determine if it wants to continue waiting for a commit callback. In cases, where the sync has failed, there will never be a commit callback so the caller can avoid waiting. This is partically helpful for VRI because it wants to sync with a frame that will draw, but also doesn't want to get stuck indefinitely waiting on the callback. VRI can check the syncStatus and only handle blast sync and/or reportDraw when its determined that a draw will happen. This allows VRI to remove frameCompleteCallback since it can now wait until a buffer has drawn instead of when the vsync has completed. This makes sure it waits on FrameDropped since that result indicates HWUI will draw on the next vsync Test: BlastSync Bug: 200284684 Change-Id: Ic6e2f08ea21ac8a1634a3389c927fcb68ede3f7b
This commit is contained in:
@@ -158,7 +158,8 @@ void DrawFrameTask::run() {
|
||||
|
||||
// Grab a copy of everything we need
|
||||
CanvasContext* context = mContext;
|
||||
std::function<void(int64_t)> frameCallback = std::move(mFrameCallback);
|
||||
std::function<std::function<void(bool)>(int32_t, int64_t)> frameCallback =
|
||||
std::move(mFrameCallback);
|
||||
std::function<void()> frameCompleteCallback = std::move(mFrameCompleteCallback);
|
||||
mFrameCallback = nullptr;
|
||||
mFrameCompleteCallback = nullptr;
|
||||
@@ -173,8 +174,13 @@ void DrawFrameTask::run() {
|
||||
|
||||
// Even if we aren't drawing this vsync pulse the next frame number will still be accurate
|
||||
if (CC_UNLIKELY(frameCallback)) {
|
||||
context->enqueueFrameWork(
|
||||
[frameCallback, frameNr = context->getFrameNumber()]() { frameCallback(frameNr); });
|
||||
context->enqueueFrameWork([frameCallback, context, syncResult = mSyncResult,
|
||||
frameNr = context->getFrameNumber()]() {
|
||||
auto frameCommitCallback = std::move(frameCallback(syncResult, frameNr));
|
||||
if (frameCommitCallback) {
|
||||
context->addFrameCommitListener(std::move(frameCommitCallback));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
nsecs_t dequeueBufferDuration = 0;
|
||||
|
||||
Reference in New Issue
Block a user