summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJihCheng Chiu <jih-cheng.chiu@mediatek.com>2019-04-02 20:50:58 +0800
committerDenis Hsu <denis.hsu@mediatek.com>2019-12-17 04:09:43 +0000
commitee2538c104f85f3ceeaf90b1dcb1149a9e590ed3 (patch)
treebdb7307d7b4d1ab2b7c33dddc7da55de9e38b8a8
parente377b272429fef443b0f498568cbccf111950ba0 (diff)
downloadnative-ee2538c104f85f3ceeaf90b1dcb1149a9e590ed3.tar.gz
Change the position of addAndGetFrameTimestamps when queueBuffer
BufferQueueProducer's addAndGetFrameTimestamps() call Layer to add a new time record. When SurfaceFlinger latch buffer, it will fill related information into the new record. Nevertheless, queueBuffer call onFrameAvailable() before addAndGetFrameTimestamps(). SurfaceFlinger main thread may latch buffer before this thread add a new time record. Then it cause that main thread can not fill related information into the record. Therefore addAndGetFrameTimestamps() should be called before call onFrameAvailable(). Bug: 146193345 Test: run cts-on-gsi -m CtsDeqpTestCases -t dEQP-EGL.functional.get_frame_timestamps#rgba8888_depth_stencil Change-Id: Ie54480b7f8626d4cfa7f9a131f3e4fdcf211915d
-rw-r--r--libs/gui/BufferQueueProducer.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/libs/gui/BufferQueueProducer.cpp b/libs/gui/BufferQueueProducer.cpp
index 9c311a314f..0354965a9b 100644
--- a/libs/gui/BufferQueueProducer.cpp
+++ b/libs/gui/BufferQueueProducer.cpp
@@ -972,6 +972,17 @@ status_t BufferQueueProducer::queueBuffer(int slot,
item.mGraphicBuffer.clear();
}
+ // Update and get FrameEventHistory.
+ nsecs_t postedTime = systemTime(SYSTEM_TIME_MONOTONIC);
+ NewFrameEventsEntry newFrameEventsEntry = {
+ currentFrameNumber,
+ postedTime,
+ requestedPresentTimestamp,
+ std::move(acquireFenceTime)
+ };
+ addAndGetFrameTimestamps(&newFrameEventsEntry,
+ getFrameTimestamps ? &output->frameTimestamps : nullptr);
+
// Call back without the main BufferQueue lock held, but with the callback
// lock held so we can ensure that callbacks occur in order
@@ -1001,17 +1012,6 @@ status_t BufferQueueProducer::queueBuffer(int slot,
mCallbackCondition.notify_all();
}
- // Update and get FrameEventHistory.
- nsecs_t postedTime = systemTime(SYSTEM_TIME_MONOTONIC);
- NewFrameEventsEntry newFrameEventsEntry = {
- currentFrameNumber,
- postedTime,
- requestedPresentTimestamp,
- std::move(acquireFenceTime)
- };
- addAndGetFrameTimestamps(&newFrameEventsEntry,
- getFrameTimestamps ? &output->frameTimestamps : nullptr);
-
// Wait without lock held
if (connectedApi == NATIVE_WINDOW_API_EGL) {
// Waiting here allows for two full buffers to be queued but not a