LAST_REFRESH_START,
GPU_COMPOSITION_DONE,
DISPLAY_PRESENT,
- DISPLAY_RETIRE,
DEQUEUE_READY,
RELEASE,
EVENT_COUNT, // Not an actual event.
bool hasAcquireInfo() const;
bool hasGpuCompositionDoneInfo() const;
bool hasDisplayPresentInfo() const;
- bool hasDisplayRetireInfo() const;
bool hasReleaseInfo() const;
bool hasDequeueReadyInfo() const;
// encountered help us determine if timestamps aren't available because
// a) we'll just never get them or b) they're not ready yet.
bool addPostCompositeCalled{false};
- bool addRetireCalled{false};
bool addReleaseCalled{false};
nsecs_t postedTime{TIMESTAMP_PENDING};
std::shared_ptr<FenceTime> acquireFence{FenceTime::NO_FENCE};
std::shared_ptr<FenceTime> gpuCompositionDoneFence{FenceTime::NO_FENCE};
std::shared_ptr<FenceTime> displayPresentFence{FenceTime::NO_FENCE};
- std::shared_ptr<FenceTime> displayRetireFence{FenceTime::NO_FENCE};
std::shared_ptr<FenceTime> releaseFence{FenceTime::NO_FENCE};
};
FenceTimeline mAcquireTimeline;
FenceTimeline mGpuCompositionDoneTimeline;
FenceTimeline mPresentTimeline;
- FenceTimeline mRetireTimeline;
FenceTimeline mReleaseTimeline;
};
const std::shared_ptr<FenceTime>& gpuCompositionDone,
const std::shared_ptr<FenceTime>& displayPresent,
const CompositorTiming& compositorTiming);
- void addRetire(uint64_t frameNumber,
- const std::shared_ptr<FenceTime>& displayRetire);
void addRelease(uint64_t frameNumber, nsecs_t dequeueReadyTime,
std::shared_ptr<FenceTime>&& release);
size_t mQueueOffset{0};
size_t mCompositionOffset{0};
- size_t mRetireOffset{0};
size_t mReleaseOffset{0};
int mCurrentConnectId{0};
uint64_t mFrameNumber{0};
bool mAddPostCompositeCalled{0};
- bool mAddRetireCalled{0};
bool mAddReleaseCalled{0};
nsecs_t mPostedTime{FrameEvents::TIMESTAMP_PENDING};
FenceTime::Snapshot mGpuCompositionDoneFence;
FenceTime::Snapshot mDisplayPresentFence;
- FenceTime::Snapshot mDisplayRetireFence;
FenceTime::Snapshot mReleaseFence;
// This is a static method with an auto return value so we can call
// it without needing const and non-const versions.
template <typename ThisT>
static inline auto allFences(ThisT fed) ->
- std::array<decltype(&fed->mReleaseFence), 4> {
+ std::array<decltype(&fed->mReleaseFence), 3> {
return {{
&fed->mGpuCompositionDoneFence, &fed->mDisplayPresentFence,
- &fed->mDisplayRetireFence, &fed->mReleaseFence
+ &fed->mReleaseFence
}};
}
};
virtual bool authenticateSurfaceTexture(
const sp<IGraphicBufferProducer>& surface) const = 0;
- /* Returns the frame timestamps supported by SurfaceFlinger.
- */
- virtual status_t getSupportedFrameTimestamps(
- std::vector<FrameEvent>* outSupported) const = 0;
-
/* set display power mode. depending on the mode, it can either trigger
* screen on, off or low power mode and wait for it to complete.
* requires ACCESS_SURFACE_FLINGER permission.
nsecs_t* outRequestedPresentTime, nsecs_t* outAcquireTime,
nsecs_t* outLatchTime, nsecs_t* outFirstRefreshStartTime,
nsecs_t* outLastRefreshStartTime, nsecs_t* outGlCompositionDoneTime,
- nsecs_t* outDisplayPresentTime, nsecs_t* outDisplayRetireTime,
- nsecs_t* outDequeueReadyTime, nsecs_t* outReleaseTime);
+ nsecs_t* outDisplayPresentTime, nsecs_t* outDequeueReadyTime,
+ nsecs_t* outReleaseTime);
status_t getWideColorSupport(bool* supported);
status_t getHdrSupport(bool* supported);
uint64_t mNextFrameNumber = 1;
uint64_t mLastFrameNumber = 0;
- // Mutable because ANativeWindow::query needs this class const.
- mutable bool mQueriedSupportedTimestamps;
- mutable bool mFrameTimestampsSupportsPresent;
- mutable bool mFrameTimestampsSupportsRetire;
-
// A cached copy of the FrameEventHistory maintained by the consumer.
bool mEnableFrameTimestamps = false;
std::unique_ptr<ProducerFrameEventHistory> mFrameEventHistory;
bool FrameEvents::hasLastRefreshStartInfo() const {
// The last refresh start time may continue to update until a new frame
- // is latched. We know we have the final value once the release or retire
- // info is set. See ConsumerFrameEventHistory::addRetire/Release.
- return addRetireCalled || addReleaseCalled;
+ // is latched. We know we have the final value once the release info is set.
+ return addReleaseCalled;
}
bool FrameEvents::hasDequeueReadyInfo() const {
return addPostCompositeCalled;
}
-bool FrameEvents::hasDisplayRetireInfo() const {
- // We may not get a displayRetire in addRetire for HWC2.
- return addRetireCalled;
-}
-
bool FrameEvents::hasReleaseInfo() const {
return addReleaseCalled;
}
acquireFence->getSignalTime();
gpuCompositionDoneFence->getSignalTime();
displayPresentFence->getSignalTime();
- displayRetireFence->getSignalTime();
releaseFence->getSignalTime();
}
!addPostCompositeCalled, *gpuCompositionDoneFence);
dumpFenceTime(outString, "Display Present \t",
!addPostCompositeCalled, *displayPresentFence);
- dumpFenceTime(outString, "Display Retire \t",
- !addRetireCalled, *displayRetireFence);
outString.appendFormat("--- DequeueReady \t");
if (FrameEvents::isValidTimestamp(dequeueReadyTime)) {
FrameEvents& frame = mFrames[d.mIndex];
frame.addPostCompositeCalled = d.mAddPostCompositeCalled != 0;
- frame.addRetireCalled = d.mAddRetireCalled != 0;
frame.addReleaseCalled = d.mAddReleaseCalled != 0;
frame.postedTime = d.mPostedTime;
frame.acquireFence = FenceTime::NO_FENCE;
frame.gpuCompositionDoneFence = FenceTime::NO_FENCE;
frame.displayPresentFence = FenceTime::NO_FENCE;
- frame.displayRetireFence = FenceTime::NO_FENCE;
frame.releaseFence = FenceTime::NO_FENCE;
// The consumer only sends valid frames.
frame.valid = true;
&frame.gpuCompositionDoneFence, d.mGpuCompositionDoneFence);
applyFenceDelta(&mPresentTimeline,
&frame.displayPresentFence, d.mDisplayPresentFence);
- applyFenceDelta(&mRetireTimeline,
- &frame.displayRetireFence, d.mDisplayRetireFence);
applyFenceDelta(&mReleaseTimeline,
&frame.releaseFence, d.mReleaseFence);
}
mAcquireTimeline.updateSignalTimes();
mGpuCompositionDoneTimeline.updateSignalTimes();
mPresentTimeline.updateSignalTimes();
- mRetireTimeline.updateSignalTimes();
mReleaseTimeline.updateSignalTimes();
}
}
}
-void ConsumerFrameEventHistory::addRetire(
- uint64_t frameNumber, const std::shared_ptr<FenceTime>& displayRetire) {
- FrameEvents* frame = getFrame(frameNumber, &mRetireOffset);
- if (frame == nullptr) {
- ALOGE_IF(mProducerWantsEvents, "addRetire: Did not find frame.");
- return;
- }
- frame->addRetireCalled = true;
- frame->displayRetireFence = displayRetire;
- mFramesDirty[mRetireOffset].setDirty<FrameEvent::DISPLAY_RETIRE>();
-}
-
void ConsumerFrameEventHistory::addRelease(uint64_t frameNumber,
nsecs_t dequeueReadyTime, std::shared_ptr<FenceTime>&& release) {
FrameEvents* frame = getFrame(frameNumber, &mReleaseOffset);
: mIndex(index),
mFrameNumber(frameTimestamps.frameNumber),
mAddPostCompositeCalled(frameTimestamps.addPostCompositeCalled),
- mAddRetireCalled(frameTimestamps.addRetireCalled),
mAddReleaseCalled(frameTimestamps.addReleaseCalled),
mPostedTime(frameTimestamps.postedTime),
mRequestedPresentTime(frameTimestamps.requestedPresentTime),
mDisplayPresentFence =
frameTimestamps.displayPresentFence->getSnapshot();
}
- if (dirtyFields.isDirty<FrameEvent::DISPLAY_RETIRE>()) {
- mDisplayRetireFence = frameTimestamps.displayRetireFence->getSnapshot();
- }
if (dirtyFields.isDirty<FrameEvent::RELEASE>()) {
mReleaseFence = frameTimestamps.releaseFence->getSnapshot();
}
constexpr size_t FrameEventsDelta::minFlattenedSize() {
return sizeof(FrameEventsDelta::mFrameNumber) +
- sizeof(uint8_t) + // mIndex
+ sizeof(uint16_t) + // mIndex
sizeof(uint8_t) + // mAddPostCompositeCalled
- sizeof(uint8_t) + // mAddRetireCalled
sizeof(uint8_t) + // mAddReleaseCalled
sizeof(FrameEventsDelta::mPostedTime) +
sizeof(FrameEventsDelta::mRequestedPresentTime) +
}
if (mIndex >= FrameEventHistory::MAX_FRAME_HISTORY ||
- mIndex > std::numeric_limits<uint8_t>::max()) {
+ mIndex > std::numeric_limits<uint16_t>::max()) {
return BAD_VALUE;
}
FlattenableUtils::write(buffer, size, mFrameNumber);
- // These are static_cast to uint8_t for alignment.
- FlattenableUtils::write(buffer, size, static_cast<uint8_t>(mIndex));
+ // These are static_cast to uint16_t/uint8_t for alignment.
+ FlattenableUtils::write(buffer, size, static_cast<uint16_t>(mIndex));
FlattenableUtils::write(
buffer, size, static_cast<uint8_t>(mAddPostCompositeCalled));
FlattenableUtils::write(
- buffer, size, static_cast<uint8_t>(mAddRetireCalled));
- FlattenableUtils::write(
buffer, size, static_cast<uint8_t>(mAddReleaseCalled));
FlattenableUtils::write(buffer, size, mPostedTime);
FlattenableUtils::read(buffer, size, mFrameNumber);
- // These were written as uint8_t for alignment.
- uint8_t temp = 0;
- FlattenableUtils::read(buffer, size, temp);
- mIndex = temp;
+ // These were written as uint16_t/uint8_t for alignment.
+ uint16_t temp16 = 0;
+ FlattenableUtils::read(buffer, size, temp16);
+ mIndex = temp16;
if (mIndex >= FrameEventHistory::MAX_FRAME_HISTORY) {
return BAD_VALUE;
}
- FlattenableUtils::read(buffer, size, temp);
- mAddPostCompositeCalled = static_cast<bool>(temp);
- FlattenableUtils::read(buffer, size, temp);
- mAddRetireCalled = static_cast<bool>(temp);
- FlattenableUtils::read(buffer, size, temp);
- mAddReleaseCalled = static_cast<bool>(temp);
+ uint8_t temp8 = 0;
+ FlattenableUtils::read(buffer, size, temp8);
+ mAddPostCompositeCalled = static_cast<bool>(temp8);
+ FlattenableUtils::read(buffer, size, temp8);
+ mAddReleaseCalled = static_cast<bool>(temp8);
FlattenableUtils::read(buffer, size, mPostedTime);
FlattenableUtils::read(buffer, size, mRequestedPresentTime);
return result != 0;
}
- virtual status_t getSupportedFrameTimestamps(
- std::vector<FrameEvent>* outSupported) const {
- if (!outSupported) {
- return UNEXPECTED_NULL;
- }
- outSupported->clear();
-
- Parcel data, reply;
-
- status_t err = data.writeInterfaceToken(
- ISurfaceComposer::getInterfaceDescriptor());
- if (err != NO_ERROR) {
- return err;
- }
-
- err = remote()->transact(
- BnSurfaceComposer::GET_SUPPORTED_FRAME_TIMESTAMPS,
- data, &reply);
- if (err != NO_ERROR) {
- return err;
- }
-
- int32_t result = 0;
- err = reply.readInt32(&result);
- if (err != NO_ERROR) {
- return err;
- }
- if (result != NO_ERROR) {
- return result;
- }
-
- std::vector<int32_t> supported;
- err = reply.readInt32Vector(&supported);
- if (err != NO_ERROR) {
- return err;
- }
-
- outSupported->reserve(supported.size());
- for (int32_t s : supported) {
- outSupported->push_back(static_cast<FrameEvent>(s));
- }
- return NO_ERROR;
- }
-
virtual sp<IDisplayEventConnection> createDisplayEventConnection()
{
Parcel data, reply;
reply->writeInt32(result);
return NO_ERROR;
}
- case GET_SUPPORTED_FRAME_TIMESTAMPS: {
- CHECK_INTERFACE(ISurfaceComposer, data, reply);
- std::vector<FrameEvent> supportedTimestamps;
- status_t result = getSupportedFrameTimestamps(&supportedTimestamps);
- status_t err = reply->writeInt32(result);
- if (err != NO_ERROR) {
- return err;
- }
- if (result != NO_ERROR) {
- return result;
- }
-
- std::vector<int32_t> supported;
- supported.reserve(supportedTimestamps.size());
- for (FrameEvent s : supportedTimestamps) {
- supported.push_back(static_cast<int32_t>(s));
- }
- return reply->writeInt32Vector(supported);
- }
case CREATE_DISPLAY_EVENT_CONNECTION: {
CHECK_INTERFACE(ISurfaceComposer, data, reply);
sp<IDisplayEventConnection> connection(createDisplayEventConnection());
mAutoRefresh(false),
mSharedBufferSlot(BufferItem::INVALID_BUFFER_SLOT),
mSharedBufferHasBeenQueued(false),
- mQueriedSupportedTimestamps(false),
- mFrameTimestampsSupportsPresent(false),
- mFrameTimestampsSupportsRetire(false),
mEnableFrameTimestamps(false),
mFrameEventHistory(std::make_unique<ProducerFrameEventHistory>())
{
const nsecs_t* outLastRefreshStartTime,
const nsecs_t* outGpuCompositionDoneTime,
const nsecs_t* outDisplayPresentTime,
- const nsecs_t* outDisplayRetireTime,
const nsecs_t* outDequeueReadyTime,
const nsecs_t* outReleaseTime) {
bool checkForLatch = (outLatchTime != nullptr) && !e->hasLatchInfo();
bool checkForDisplayPresent = (outDisplayPresentTime != nullptr) &&
!e->hasDisplayPresentInfo();
- // LastRefreshStart, DisplayRetire, DequeueReady, and Release are never
+ // LastRefreshStart, DequeueReady, and Release are never
// available for the last frame.
bool checkForLastRefreshStart = (outLastRefreshStartTime != nullptr) &&
!e->hasLastRefreshStartInfo() &&
(e->frameNumber != lastFrameNumber);
- bool checkForDisplayRetire = (outDisplayRetireTime != nullptr) &&
- !e->hasDisplayRetireInfo() && (e->frameNumber != lastFrameNumber);
bool checkForDequeueReady = (outDequeueReadyTime != nullptr) &&
!e->hasDequeueReadyInfo() && (e->frameNumber != lastFrameNumber);
bool checkForRelease = (outReleaseTime != nullptr) &&
// RequestedPresent and Acquire info are always available producer-side.
return checkForLatch || checkForFirstRefreshStart ||
checkForLastRefreshStart || checkForGpuCompositionDone ||
- checkForDisplayPresent || checkForDisplayRetire ||
- checkForDequeueReady || checkForRelease;
+ checkForDisplayPresent || checkForDequeueReady || checkForRelease;
}
static void getFrameTimestamp(nsecs_t *dst, const nsecs_t& src) {
nsecs_t* outRequestedPresentTime, nsecs_t* outAcquireTime,
nsecs_t* outLatchTime, nsecs_t* outFirstRefreshStartTime,
nsecs_t* outLastRefreshStartTime, nsecs_t* outGpuCompositionDoneTime,
- nsecs_t* outDisplayPresentTime, nsecs_t* outDisplayRetireTime,
- nsecs_t* outDequeueReadyTime, nsecs_t* outReleaseTime) {
+ nsecs_t* outDisplayPresentTime, nsecs_t* outDequeueReadyTime,
+ nsecs_t* outReleaseTime) {
ATRACE_CALL();
Mutex::Autolock lock(mMutex);
return INVALID_OPERATION;
}
- // Verify the requested timestamps are supported.
- querySupportedTimestampsLocked();
- if (outDisplayPresentTime != nullptr && !mFrameTimestampsSupportsPresent) {
- return BAD_VALUE;
- }
- if (outDisplayRetireTime != nullptr && !mFrameTimestampsSupportsRetire) {
- return BAD_VALUE;
- }
-
FrameEvents* events = mFrameEventHistory->getFrame(frameNumber);
if (events == nullptr) {
// If the entry isn't available in the producer, it's definitely not
if (checkConsumerForUpdates(events, mLastFrameNumber,
outLatchTime, outFirstRefreshStartTime, outLastRefreshStartTime,
outGpuCompositionDoneTime, outDisplayPresentTime,
- outDisplayRetireTime, outDequeueReadyTime, outReleaseTime)) {
+ outDequeueReadyTime, outReleaseTime)) {
FrameEventHistoryDelta delta;
mGraphicBufferProducer->getFrameTimestamps(&delta);
mFrameEventHistory->applyDelta(delta);
outGpuCompositionDoneTime, events->gpuCompositionDoneFence);
getFrameTimestampFence(
outDisplayPresentTime, events->displayPresentFence);
- getFrameTimestampFence(outDisplayRetireTime, events->displayRetireFence);
getFrameTimestampFence(outReleaseTime, events->releaseFence);
return NO_ERROR;
return err;
}
-void Surface::querySupportedTimestampsLocked() const {
- // mMutex must be locked when calling this method.
-
- if (mQueriedSupportedTimestamps) {
- return;
- }
- mQueriedSupportedTimestamps = true;
-
- std::vector<FrameEvent> supportedFrameTimestamps;
- status_t err = composerService()->getSupportedFrameTimestamps(
- &supportedFrameTimestamps);
-
- if (err != NO_ERROR) {
- return;
- }
-
- for (auto sft : supportedFrameTimestamps) {
- if (sft == FrameEvent::DISPLAY_PRESENT) {
- mFrameTimestampsSupportsPresent = true;
- } else if (sft == FrameEvent::DISPLAY_RETIRE) {
- mFrameTimestampsSupportsRetire = true;
- }
- }
-}
-
int Surface::query(int what, int* value) const {
ATRACE_CALL();
ALOGV("Surface::query");
static_cast<int>(durationUs);
return NO_ERROR;
}
- case NATIVE_WINDOW_FRAME_TIMESTAMPS_SUPPORTS_PRESENT: {
- querySupportedTimestampsLocked();
- *value = mFrameTimestampsSupportsPresent ? 1 : 0;
- return NO_ERROR;
- }
- case NATIVE_WINDOW_FRAME_TIMESTAMPS_SUPPORTS_RETIRE: {
- querySupportedTimestampsLocked();
- *value = mFrameTimestampsSupportsRetire ? 1 : 0;
- return NO_ERROR;
- }
case NATIVE_WINDOW_IS_VALID: {
*value = mGraphicBufferProducer != nullptr ? 1 : 0;
return NO_ERROR;
nsecs_t* outLastRefreshStartTime = va_arg(args, int64_t*);
nsecs_t* outGpuCompositionDoneTime = va_arg(args, int64_t*);
nsecs_t* outDisplayPresentTime = va_arg(args, int64_t*);
- nsecs_t* outDisplayRetireTime = va_arg(args, int64_t*);
nsecs_t* outDequeueReadyTime = va_arg(args, int64_t*);
nsecs_t* outReleaseTime = va_arg(args, int64_t*);
return getFrameTimestamps(frameId,
outRequestedPresentTime, outAcquireTime, outLatchTime,
outFirstRefreshStartTime, outLastRefreshStartTime,
outGpuCompositionDoneTime, outDisplayPresentTime,
- outDisplayRetireTime, outDequeueReadyTime, outReleaseTime);
+ outDequeueReadyTime, outReleaseTime);
}
int Surface::dispatchGetWideColorSupport(va_list args) {
public:
~FakeSurfaceComposer() override {}
- void setSupportedTimestamps(bool supportsPresent, bool supportsRetire) {
- mSupportsPresent = supportsPresent;
- mSupportsRetire = supportsRetire;
- }
-
sp<ISurfaceComposerClient> createConnection() override { return nullptr; }
sp<ISurfaceComposerClient> createScopedConnection(
const sp<IGraphicBufferProducer>& /* parent */) override {
const sp<IGraphicBufferProducer>& /*surface*/) const override {
return false;
}
-
- status_t getSupportedFrameTimestamps(std::vector<FrameEvent>* outSupported)
- const override {
- *outSupported = {
- FrameEvent::REQUESTED_PRESENT,
- FrameEvent::ACQUIRE,
- FrameEvent::LATCH,
- FrameEvent::FIRST_REFRESH_START,
- FrameEvent::LAST_REFRESH_START,
- FrameEvent::GPU_COMPOSITION_DONE,
- FrameEvent::DEQUEUE_READY,
- FrameEvent::RELEASE
- };
- if (mSupportsPresent) {
- outSupported->push_back(
- FrameEvent::DISPLAY_PRESENT);
- }
- if (mSupportsRetire) {
- outSupported->push_back(
- FrameEvent::DISPLAY_RETIRE);
- }
- return NO_ERROR;
- }
-
void setPowerMode(const sp<IBinder>& /*display*/, int /*mode*/) override {}
status_t getDisplayConfigs(const sp<IBinder>& /*display*/,
Vector<DisplayInfo>* /*configs*/) override { return NO_ERROR; }
kConsumerAcquireTime(frameStartTime + 301),
kLatchTime(frameStartTime + 500),
kDequeueReadyTime(frameStartTime + 600),
- kRetireTime(frameStartTime + 700),
- kReleaseTime(frameStartTime + 800),
+ kReleaseTime(frameStartTime + 700),
mRefreshes {
{ mFenceMap, frameStartTime + 410 },
{ mFenceMap, frameStartTime + 420 },
}
void signalReleaseFences() {
- mFenceMap.signalAllForTest(mRetire.mFence, kRetireTime);
mFenceMap.signalAllForTest(mRelease.mFence, kReleaseTime);
}
FenceAndFenceTime mAcquireConsumer { mFenceMap };
FenceAndFenceTime mAcquireProducer { mFenceMap };
- FenceAndFenceTime mRetire { mFenceMap };
FenceAndFenceTime mRelease { mFenceMap };
const nsecs_t kPostedTime;
const nsecs_t kConsumerAcquireTime;
const nsecs_t kLatchTime;
const nsecs_t kDequeueReadyTime;
- const nsecs_t kRetireTime;
const nsecs_t kReleaseTime;
RefreshEvents mRefreshes[3];
&outRequestedPresentTime, &outAcquireTime, &outLatchTime,
&outFirstRefreshStartTime, &outLastRefreshStartTime,
&outGpuCompositionDoneTime, &outDisplayPresentTime,
- &outDisplayRetireTime, &outDequeueReadyTime, &outReleaseTime);
+ &outDequeueReadyTime, &outReleaseTime);
}
void resetTimestamps() {
outLastRefreshStartTime = -1;
outGpuCompositionDoneTime = -1;
outDisplayPresentTime = -1;
- outDisplayRetireTime = -1;
outDequeueReadyTime = -1;
outReleaseTime = -1;
}
uint64_t nOldFrame = iOldFrame + 1;
uint64_t nNewFrame = iNewFrame + 1;
- // Latch, Composite, Retire, and Release the frames in a plausible
- // order. Note: The timestamps won't necessarily match the order, but
+ // Latch, Composite, and Release the frames in a plausible order.
+ // Note: The timestamps won't necessarily match the order, but
// that's okay for the purposes of this test.
std::shared_ptr<FenceTime> gpuDoneFenceTime = FenceTime::NO_FENCE;
newFrame->mRefreshes[0].mPresent.mFenceTime,
newFrame->mRefreshes[0].kCompositorTiming);
- // Retire the previous buffer just after compositing the new buffer.
- if (oldFrame != nullptr) {
- mCfeh->addRetire(nOldFrame, oldFrame->mRetire.mFenceTime);
- }
-
mCfeh->addPreComposition(nNewFrame, newFrame->mRefreshes[1].kStartTime);
gpuDoneFenceTime = gpuComposited ?
newFrame->mRefreshes[1].mGpuCompositionDone.mFenceTime :
newFrame->mRefreshes[1].kCompositorTiming);
}
- void QueryPresentRetireSupported(
- bool displayPresentSupported, bool displayRetireSupported);
- void PresentOrRetireUnsupportedNoSyncTest(
- bool displayPresentSupported, bool displayRetireSupported);
-
sp<IGraphicBufferProducer> mProducer;
sp<IGraphicBufferConsumer> mConsumer;
sp<FakeConsumer> mFakeConsumer;
int64_t outLastRefreshStartTime = -1;
int64_t outGpuCompositionDoneTime = -1;
int64_t outDisplayPresentTime = -1;
- int64_t outDisplayRetireTime = -1;
int64_t outDequeueReadyTime = -1;
int64_t outReleaseTime = -1;
EXPECT_EQ(4, mFakeConsumer->mGetFrameTimestampsCount);
}
-void GetFrameTimestampsTest::QueryPresentRetireSupported(
- bool displayPresentSupported, bool displayRetireSupported) {
- mSurface->mFakeSurfaceComposer->setSupportedTimestamps(
- displayPresentSupported, displayRetireSupported);
-
- // Verify supported bits are forwarded.
- int supportsPresent = -1;
- mWindow.get()->query(mWindow.get(),
- NATIVE_WINDOW_FRAME_TIMESTAMPS_SUPPORTS_PRESENT, &supportsPresent);
- EXPECT_EQ(displayPresentSupported, supportsPresent);
-
- int supportsRetire = -1;
- mWindow.get()->query(mWindow.get(),
- NATIVE_WINDOW_FRAME_TIMESTAMPS_SUPPORTS_RETIRE, &supportsRetire);
- EXPECT_EQ(displayRetireSupported, supportsRetire);
-}
-
-TEST_F(GetFrameTimestampsTest, QueryPresentSupported) {
- QueryPresentRetireSupported(true, false);
-}
-
-TEST_F(GetFrameTimestampsTest, QueryRetireSupported) {
- QueryPresentRetireSupported(false, true);
-}
-
TEST_F(GetFrameTimestampsTest, SnapToNextTickBasic) {
nsecs_t phase = 4000;
nsecs_t interval = 1000;
EXPECT_EQ(mFrames[0].mRefreshes[0].kGpuCompositionDoneTime,
outGpuCompositionDoneTime);
EXPECT_EQ(mFrames[0].mRefreshes[0].kPresentTime, outDisplayPresentTime);
- EXPECT_EQ(mFrames[0].kRetireTime, outDisplayRetireTime);
EXPECT_EQ(mFrames[0].kDequeueReadyTime, outDequeueReadyTime);
EXPECT_EQ(mFrames[0].kReleaseTime, outReleaseTime);
EXPECT_EQ(mFrames[1].mRefreshes[0].kGpuCompositionDoneTime,
outGpuCompositionDoneTime);
EXPECT_EQ(mFrames[1].mRefreshes[0].kPresentTime, outDisplayPresentTime);
- EXPECT_EQ(0, outDisplayRetireTime);
EXPECT_EQ(0, outDequeueReadyTime);
EXPECT_EQ(0, outReleaseTime);
}
// back to the producer and the producer saves its own fence.
TEST_F(GetFrameTimestampsTest, QueueTimestampsNoSync) {
enableFrameTimestamps();
- mSurface->mFakeSurfaceComposer->setSupportedTimestamps(true, true);
// Dequeue and queue frame 1.
const uint64_t fId1 = getNextFrameId();
int oldCount = mFakeConsumer->mGetFrameTimestampsCount;
int result = native_window_get_frame_timestamps(mWindow.get(), fId1,
&outRequestedPresentTime, &outAcquireTime, nullptr, nullptr,
- nullptr, nullptr, nullptr, nullptr, nullptr, nullptr);
+ nullptr, nullptr, nullptr, nullptr, nullptr);
EXPECT_EQ(oldCount, mFakeConsumer->mGetFrameTimestampsCount);
EXPECT_EQ(NO_ERROR, result);
EXPECT_EQ(mFrames[0].kRequestedPresentTime, outRequestedPresentTime);
oldCount = mFakeConsumer->mGetFrameTimestampsCount;
result = native_window_get_frame_timestamps(mWindow.get(), fId1,
&outRequestedPresentTime, &outAcquireTime, nullptr, nullptr,
- nullptr, nullptr, nullptr, nullptr, nullptr, nullptr);
+ nullptr, nullptr, nullptr, nullptr, nullptr);
EXPECT_EQ(oldCount, mFakeConsumer->mGetFrameTimestampsCount);
EXPECT_EQ(NO_ERROR, result);
EXPECT_EQ(mFrames[0].kRequestedPresentTime, outRequestedPresentTime);
oldCount = mFakeConsumer->mGetFrameTimestampsCount;
result = native_window_get_frame_timestamps(mWindow.get(), fId2,
&outRequestedPresentTime, &outAcquireTime, nullptr, nullptr,
- nullptr, nullptr, nullptr, nullptr, nullptr, nullptr);
+ nullptr, nullptr, nullptr, nullptr, nullptr);
EXPECT_EQ(oldCount, mFakeConsumer->mGetFrameTimestampsCount);
EXPECT_EQ(NO_ERROR, result);
EXPECT_EQ(mFrames[1].kRequestedPresentTime, outRequestedPresentTime);
oldCount = mFakeConsumer->mGetFrameTimestampsCount;
result = native_window_get_frame_timestamps(mWindow.get(), fId2,
&outRequestedPresentTime, &outAcquireTime, nullptr, nullptr,
- nullptr, nullptr, nullptr, nullptr, nullptr, nullptr);
+ nullptr, nullptr, nullptr, nullptr, nullptr);
EXPECT_EQ(oldCount, mFakeConsumer->mGetFrameTimestampsCount);
EXPECT_EQ(NO_ERROR, result);
EXPECT_EQ(mFrames[1].kRequestedPresentTime, outRequestedPresentTime);
TEST_F(GetFrameTimestampsTest, ZeroRequestedTimestampsNoSync) {
enableFrameTimestamps();
- mSurface->mFakeSurfaceComposer->setSupportedTimestamps(true, true);
// Dequeue and queue frame 1.
dequeueAndQueue(0);
// Verify a request for no timestamps doesn't result in a sync call.
int oldCount = mFakeConsumer->mGetFrameTimestampsCount;
int result = native_window_get_frame_timestamps(mWindow.get(), fId2,
- nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
+ nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
nullptr, nullptr, nullptr);
EXPECT_EQ(NO_ERROR, result);
EXPECT_EQ(oldCount, mFakeConsumer->mGetFrameTimestampsCount);
// side without an additional sync call to the consumer.
TEST_F(GetFrameTimestampsTest, FencesInProducerNoSync) {
enableFrameTimestamps();
- mSurface->mFakeSurfaceComposer->setSupportedTimestamps(true, true);
// Dequeue and queue frame 1.
const uint64_t fId1 = getNextFrameId();
EXPECT_EQ(mFrames[0].mRefreshes[2].kStartTime, outLastRefreshStartTime);
EXPECT_EQ(0, outGpuCompositionDoneTime);
EXPECT_EQ(0, outDisplayPresentTime);
- EXPECT_EQ(0, outDisplayRetireTime);
EXPECT_EQ(mFrames[0].kDequeueReadyTime, outDequeueReadyTime);
EXPECT_EQ(0, outReleaseTime);
EXPECT_EQ(mFrames[0].mRefreshes[2].kStartTime, outLastRefreshStartTime);
EXPECT_EQ(0, outGpuCompositionDoneTime);
EXPECT_EQ(0, outDisplayPresentTime);
- EXPECT_EQ(0, outDisplayRetireTime);
EXPECT_EQ(mFrames[0].kDequeueReadyTime, outDequeueReadyTime);
EXPECT_EQ(0, outReleaseTime);
EXPECT_EQ(mFrames[0].mRefreshes[0].kGpuCompositionDoneTime,
outGpuCompositionDoneTime);
EXPECT_EQ(mFrames[0].mRefreshes[0].kPresentTime, outDisplayPresentTime);
- EXPECT_EQ(mFrames[0].kRetireTime, outDisplayRetireTime);
EXPECT_EQ(mFrames[0].kDequeueReadyTime, outDequeueReadyTime);
EXPECT_EQ(mFrames[0].kReleaseTime, outReleaseTime);
}
// never exist.
TEST_F(GetFrameTimestampsTest, NoGpuNoSync) {
enableFrameTimestamps();
- mSurface->mFakeSurfaceComposer->setSupportedTimestamps(true, true);
// Dequeue and queue frame 1.
const uint64_t fId1 = getNextFrameId();
EXPECT_EQ(mFrames[0].mRefreshes[2].kStartTime, outLastRefreshStartTime);
EXPECT_EQ(0, outGpuCompositionDoneTime);
EXPECT_EQ(0, outDisplayPresentTime);
- EXPECT_EQ(0, outDisplayRetireTime);
EXPECT_EQ(mFrames[0].kDequeueReadyTime, outDequeueReadyTime);
EXPECT_EQ(0, outReleaseTime);
EXPECT_EQ(mFrames[0].mRefreshes[2].kStartTime, outLastRefreshStartTime);
EXPECT_EQ(0, outGpuCompositionDoneTime);
EXPECT_EQ(mFrames[0].mRefreshes[0].kPresentTime, outDisplayPresentTime);
- EXPECT_EQ(mFrames[0].kRetireTime, outDisplayRetireTime);
EXPECT_EQ(mFrames[0].kDequeueReadyTime, outDequeueReadyTime);
EXPECT_EQ(mFrames[0].kReleaseTime, outReleaseTime);
}
// the most recent frame, then a sync call is not done.
TEST_F(GetFrameTimestampsTest, NoRetireOrReleaseNoSync) {
enableFrameTimestamps();
- mSurface->mFakeSurfaceComposer->setSupportedTimestamps(true, true);
// Dequeue and queue frame 1.
const uint64_t fId1 = getNextFrameId();
EXPECT_EQ(mFrames[0].mRefreshes[2].kStartTime, outLastRefreshStartTime);
EXPECT_EQ(0, outGpuCompositionDoneTime);
EXPECT_EQ(0, outDisplayPresentTime);
- EXPECT_EQ(0, outDisplayRetireTime);
EXPECT_EQ(mFrames[0].kDequeueReadyTime, outDequeueReadyTime);
EXPECT_EQ(0, outReleaseTime);
mFrames[1].signalRefreshFences();
// Verify querying for all timestmaps of f2 does not do a sync call. Even
- // though the lastRefresh, retire, dequeueReady, and release times aren't
+ // though the lastRefresh, dequeueReady, and release times aren't
// available, a sync call should not occur because it's not possible for f2
// to encounter the final value for those events until another frame is
// queued.
EXPECT_EQ(mFrames[1].mRefreshes[1].kStartTime, outLastRefreshStartTime);
EXPECT_EQ(0, outGpuCompositionDoneTime);
EXPECT_EQ(mFrames[1].mRefreshes[0].kPresentTime, outDisplayPresentTime);
- EXPECT_EQ(0, outDisplayRetireTime);
EXPECT_EQ(0, outDequeueReadyTime);
EXPECT_EQ(0, outReleaseTime);
}
-// This test verifies there are no sync calls for present or retire times
-// when they aren't supported and that an error is returned.
-void GetFrameTimestampsTest::PresentOrRetireUnsupportedNoSyncTest(
- bool displayPresentSupported, bool displayRetireSupported) {
-
- enableFrameTimestamps();
- mSurface->mFakeSurfaceComposer->setSupportedTimestamps(
- displayPresentSupported, displayRetireSupported);
-
- // Dequeue and queue frame 1.
- const uint64_t fId1 = getNextFrameId();
- dequeueAndQueue(0);
-
- // Verify a query for the Present and Retire times do not trigger
- // a sync call if they are not supported.
- resetTimestamps();
- int oldCount = mFakeConsumer->mGetFrameTimestampsCount;
- int result = native_window_get_frame_timestamps(mWindow.get(), fId1,
- nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
- displayPresentSupported ? nullptr : &outDisplayPresentTime,
- displayRetireSupported ? nullptr : &outDisplayRetireTime,
- nullptr, nullptr);
- EXPECT_EQ(oldCount, mFakeConsumer->mGetFrameTimestampsCount);
- EXPECT_EQ(BAD_VALUE, result);
- EXPECT_EQ(-1, outDisplayRetireTime);
- EXPECT_EQ(-1, outDisplayPresentTime);
-}
-
-TEST_F(GetFrameTimestampsTest, PresentUnsupportedNoSync) {
- PresentOrRetireUnsupportedNoSyncTest(false, true);
-}
-
-TEST_F(GetFrameTimestampsTest, RetireUnsupportedNoSync) {
- PresentOrRetireUnsupportedNoSyncTest(true, false);
-}
-
}
#define EGL_LAST_COMPOSITION_START_TIME_ANDROID 0x3155
#define EGL_FIRST_COMPOSITION_GPU_FINISHED_TIME_ANDROID 0x3156
#define EGL_DISPLAY_PRESENT_TIME_ANDROID 0x3157
-#define EGL_DISPLAY_RETIRE_TIME_ANDROID 0x3158
-#define EGL_DEQUEUE_READY_TIME_ANDROID 0x3159
-#define EGL_READS_DONE_TIME_ANDROID 0x315A
+#define EGL_DEQUEUE_READY_TIME_ANDROID 0x3158
+#define EGL_READS_DONE_TIME_ANDROID 0x3159
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLBoolean eglGetNextFrameIdANDROID(EGLDisplay dpy, EGLSurface surface, EGLuint64KHR *frameId);
EGLAPI EGLBoolean eglGetCompositorTimingANDROID(EGLDisplay dpy, EGLSurface surface, EGLint numTimestamps, const EGLint *names, EGLnsecsANDROID *values);
nsecs_t* gpuCompositionDoneTime = nullptr;
nsecs_t* lastRefreshStartTime = nullptr;
nsecs_t* displayPresentTime = nullptr;
- nsecs_t* displayRetireTime = nullptr;
nsecs_t* dequeueReadyTime = nullptr;
nsecs_t* releaseTime = nullptr;
case EGL_DISPLAY_PRESENT_TIME_ANDROID:
displayPresentTime = &values[i];
break;
- case EGL_DISPLAY_RETIRE_TIME_ANDROID:
- displayRetireTime = &values[i];
- break;
case EGL_DEQUEUE_READY_TIME_ANDROID:
dequeueReadyTime = &values[i];
break;
int ret = native_window_get_frame_timestamps(s->getNativeWindow(), frameId,
requestedPresentTime, acquireTime, latchTime, firstRefreshStartTime,
lastRefreshStartTime, gpuCompositionDoneTime, displayPresentTime,
- displayRetireTime, dequeueReadyTime, releaseTime);
+ dequeueReadyTime, releaseTime);
switch (ret) {
case 0:
case EGL_FIRST_COMPOSITION_START_TIME_ANDROID:
case EGL_LAST_COMPOSITION_START_TIME_ANDROID:
case EGL_FIRST_COMPOSITION_GPU_FINISHED_TIME_ANDROID:
+ case EGL_DISPLAY_PRESENT_TIME_ANDROID:
case EGL_DEQUEUE_READY_TIME_ANDROID:
case EGL_READS_DONE_TIME_ANDROID:
return EGL_TRUE;
- case EGL_DISPLAY_PRESENT_TIME_ANDROID: {
- int value = 0;
- window->query(window, NATIVE_WINDOW_FRAME_TIMESTAMPS_SUPPORTS_PRESENT, &value);
- return value == 0 ? EGL_FALSE : EGL_TRUE;
- }
- case EGL_DISPLAY_RETIRE_TIME_ANDROID: {
- int value = 0;
- window->query(window, NATIVE_WINDOW_FRAME_TIMESTAMPS_SUPPORTS_RETIRE, &value);
- return value == 0 ? EGL_FALSE : EGL_TRUE;
- }
default:
return EGL_FALSE;
}
and display of window surfaces.
Some examples of how this might be used:
- - The display present or retire time can be used to calculate end-to-end
- latency of the entire graphics pipeline.
+ - The display present time can be used to calculate end-to-end latency
+ of the entire graphics pipeline.
- The queue time and rendering complete time can be used to determine
how long the application's rendering took to complete. Likewise, the
composition start time and finish time can be used to determine how
EGL_LAST_COMPOSITION_START_TIME_ANDROID 0x3155
EGL_FIRST_COMPOSITION_GPU_FINISHED_TIME_ANDROID 0x3156
EGL_DISPLAY_PRESENT_TIME_ANDROID 0x3157
- EGL_DISPLAY_RETIRE_TIME_ANDROID 0x3158
- EGL_DEQUEUE_READY_TIME_ANDROID 0x3159
- EGL_READS_DONE_TIME_ANDROID 0x315A
+ EGL_DEQUEUE_READY_TIME_ANDROID 0x3158
+ EGL_READS_DONE_TIME_ANDROID 0x3159
Add to the list of supported tokens for eglSurfaceAttrib in section 3.5.6
"Surface Attributes", page 43:
didn't do any rendering.
- EGL_DISPLAY_PRESENT_TIME_ANDROID - The time at which this frame
started to scan out to the physical display.
- - EGL_DISPLAY_RETIRE_TIME_ANDROID - The time at which this frame was
- replaced by the next frame on-screen.
- EGL_DEQUEUE_READY_TIME_ANDROID - The time when the buffer became
available for reuse as a buffer the client can target without
blocking. This is generally the point when all read commands of the
Revision History
+#6 (Brian Anderson, March 16, 2017)
+ - Remove DISPLAY_RETIRE_TIME_ANDROID.
+
#5 (Brian Anderson, January 13, 2017)
- Add eglGetCompositorTimingANDROID.
0x3155 EGL_LAST_COMPOSITION_START_TIME_ANDROID (EGL_ANDROID_get_frame_timestamps)
0x3156 EGL_FIRST_COMPOSITION_GPU_FINISHED_TIME_ANDROID (EGL_ANDROID_get_frame_timestamps)
0x3157 EGL_DISPLAY_PRESENT_TIME_ANDROID (EGL_ANDROID_get_frame_timestamps)
-0x3158 EGL_DISPLAY_RETIRE_TIME_ANDROID (EGL_ANDROID_get_frame_timestamps)
-0x3159 EGL_DEQUEUE_READY_TIME_ANDROID (EGL_ANDROID_get_frame_timestamps)
-0x315A EGL_READS_DONE_TIME_ANDROID (EGL_ANDROID_get_frame_timestamps)
-0x315B - 0x315F (unused)
+0x3158 EGL_DEQUEUE_READY_TIME_ANDROID (EGL_ANDROID_get_frame_timestamps)
+0x3159 EGL_READS_DONE_TIME_ANDROID (EGL_ANDROID_get_frame_timestamps)
+0x315A - 0x315F (unused)
return mDisplayData[displayId].lastPresentFence;
}
-bool HWComposer::presentFenceRepresentsStartOfScanout() const {
- return mAdapter ? false : true;
-}
-
sp<Fence> HWComposer::getLayerReleaseFence(int32_t displayId,
const std::shared_ptr<HWC2::Layer>& layer) const {
if (!isValidDisplay(displayId)) {
// get the present fence received from the last call to present.
sp<Fence> getPresentFence(int32_t displayId) const;
- // Returns true if the present fence represents the start of the display
- // controller's scan out. This should be true for all HWC2 implementations,
- // except for the wrapper around HWC1 implementations.
- bool presentFenceRepresentsStartOfScanout() const;
-
// Get last release fence for the given layer
sp<Fence> getLayerReleaseFence(int32_t displayId,
const std::shared_ptr<HWC2::Layer>& layer) const;
bool Layer::onPostComposition(const std::shared_ptr<FenceTime>& glDoneFence,
const std::shared_ptr<FenceTime>& presentFence,
- const std::shared_ptr<FenceTime>& retireFence,
const CompositorTiming& compositorTiming) {
mAcquireTimeline.updateSignalTimes();
mReleaseTimeline.updateSignalTimes();
Mutex::Autolock lock(mFrameEventHistoryMutex);
mFrameEventHistory.addPostComposition(mCurrentFrameNumber,
glDoneFence, presentFence, compositorTiming);
- if (mPreviousFrameNumber != 0) {
- mFrameEventHistory.addRetire(mPreviousFrameNumber,
- retireFence);
- }
}
// Update mFrameTracker.
if (presentFence->isValid()) {
mFrameTracker.setActualPresentFence(
std::shared_ptr<FenceTime>(presentFence));
- } else if (retireFence->isValid()) {
- mFrameTracker.setActualPresentFence(
- std::shared_ptr<FenceTime>(retireFence));
} else {
// The HWC doesn't support present fences, so use the refresh
// timestamp instead.
*/
bool onPostComposition(const std::shared_ptr<FenceTime>& glDoneFence,
const std::shared_ptr<FenceTime>& presentFence,
- const std::shared_ptr<FenceTime>& retireFence,
const CompositorTiming& compositorTiming);
#ifdef USE_HWC2
return mGraphicBufferProducerList.indexOf(surfaceTextureBinder) >= 0;
}
-status_t SurfaceFlinger::getSupportedFrameTimestamps(
- std::vector<FrameEvent>* outSupported) const {
- *outSupported = {
- FrameEvent::REQUESTED_PRESENT,
- FrameEvent::ACQUIRE,
- FrameEvent::LATCH,
- FrameEvent::FIRST_REFRESH_START,
- FrameEvent::LAST_REFRESH_START,
- FrameEvent::GPU_COMPOSITION_DONE,
- getHwComposer().presentFenceRepresentsStartOfScanout() ?
- FrameEvent::DISPLAY_PRESENT : FrameEvent::DISPLAY_RETIRE,
- FrameEvent::DEQUEUE_READY,
- FrameEvent::RELEASE,
- };
- return NO_ERROR;
-}
-
status_t SurfaceFlinger::getDisplayConfigs(const sp<IBinder>& display,
Vector<DisplayInfo>* configs) {
if ((configs == NULL) || (display.get() == NULL)) {
}
mGlCompositionDoneTimeline.updateSignalTimes();
- sp<Fence> displayFence = mHwc->getPresentFence(HWC_DISPLAY_PRIMARY);
- auto displayFenceTime = std::make_shared<FenceTime>(displayFence);
- mDisplayTimeline.push(displayFenceTime);
+ sp<Fence> presentFence = mHwc->getPresentFence(HWC_DISPLAY_PRIMARY);
+ auto presentFenceTime = std::make_shared<FenceTime>(presentFence);
+ mDisplayTimeline.push(presentFenceTime);
mDisplayTimeline.updateSignalTimes();
- const std::shared_ptr<FenceTime>* presentFenceTime = &FenceTime::NO_FENCE;
- const std::shared_ptr<FenceTime>* retireFenceTime = &FenceTime::NO_FENCE;
- if (mHwc->presentFenceRepresentsStartOfScanout()) {
- presentFenceTime = &displayFenceTime;
- } else {
- retireFenceTime = &displayFenceTime;
- }
-
nsecs_t vsyncPhase = mPrimaryDispSync.computeNextRefresh(0);
nsecs_t vsyncInterval = mPrimaryDispSync.getPeriod();
// when we started doing work for this frame, but that should be okay
// since updateCompositorTiming has snapping logic.
updateCompositorTiming(
- vsyncPhase, vsyncInterval, refreshStartTime, displayFenceTime);
+ vsyncPhase, vsyncInterval, refreshStartTime, presentFenceTime);
CompositorTiming compositorTiming;
{
std::lock_guard<std::mutex> lock(mCompositorTimingLock);
mDrawingState.traverseInZOrder([&](Layer* layer) {
bool frameLatched = layer->onPostComposition(glCompositionDoneFenceTime,
- *presentFenceTime, *retireFenceTime, compositorTiming);
+ presentFenceTime, compositorTiming);
if (frameLatched) {
recordBufferingStats(layer->getName().string(),
layer->getOccupancyHistory(false));
}
});
- if (displayFence->isValid()) {
- if (mPrimaryDispSync.addPresentFence(displayFence)) {
+ if (presentFence->isValid()) {
+ if (mPrimaryDispSync.addPresentFence(presentFence)) {
enableHardwareVsync();
} else {
disableHardwareVsync(false);
if (mAnimCompositionPending) {
mAnimCompositionPending = false;
- if (displayFenceTime->isValid()) {
+ if (presentFenceTime->isValid()) {
mAnimFrameTracker.setActualPresentFence(
- std::move(displayFenceTime));
+ std::move(presentFenceTime));
} else {
// The HWC doesn't support present fences, so use the refresh
// timestamp instead.
virtual void bootFinished();
virtual bool authenticateSurfaceTexture(
const sp<IGraphicBufferProducer>& bufferProducer) const;
- virtual status_t getSupportedFrameTimestamps(
- std::vector<FrameEvent>* outSupported) const;
virtual sp<IDisplayEventConnection> createDisplayEventConnection();
virtual status_t captureScreen(const sp<IBinder>& display,
const sp<IGraphicBufferProducer>& producer,
return mGraphicBufferProducerList.indexOf(surfaceTextureBinder) >= 0;
}
-status_t SurfaceFlinger::getSupportedFrameTimestamps(
- std::vector<FrameEvent>* outSupported) const {
- *outSupported = {
- FrameEvent::REQUESTED_PRESENT,
- FrameEvent::ACQUIRE,
- FrameEvent::LATCH,
- FrameEvent::FIRST_REFRESH_START,
- FrameEvent::LAST_REFRESH_START,
- FrameEvent::GPU_COMPOSITION_DONE,
- FrameEvent::DISPLAY_RETIRE,
- FrameEvent::DEQUEUE_READY,
- FrameEvent::RELEASE,
- };
- return NO_ERROR;
-}
-
status_t SurfaceFlinger::getDisplayConfigs(const sp<IBinder>& display,
Vector<DisplayInfo>* configs) {
if ((configs == NULL) || (display.get() == NULL)) {
}
mGlCompositionDoneTimeline.updateSignalTimes();
- sp<Fence> displayFence = mHwc->getDisplayFence(HWC_DISPLAY_PRIMARY);
- const std::shared_ptr<FenceTime>& presentFenceTime = FenceTime::NO_FENCE;
- auto retireFenceTime = std::make_shared<FenceTime>(displayFence);
+ sp<Fence> retireFence = mHwc->getDisplayFence(HWC_DISPLAY_PRIMARY);
+ auto retireFenceTime = std::make_shared<FenceTime>(retireFence);
mDisplayTimeline.push(retireFenceTime);
mDisplayTimeline.updateSignalTimes();
}
mDrawingState.traverseInZOrder([&](Layer* layer) {
+ // TODO(brianderson): The retire fence is incorrectly passed in as the
+ // present fence. Fix this if this file lives on.
bool frameLatched = layer->onPostComposition(glCompositionDoneFenceTime,
- presentFenceTime, retireFenceTime, compositorTiming);
+ retireFenceTime, compositorTiming);
if (frameLatched) {
recordBufferingStats(layer->getName().string(),
layer->getOccupancyHistory(false));
}
});
- if (displayFence->isValid()) {
- if (mPrimaryDispSync.addPresentFence(displayFence)) {
+ if (retireFence->isValid()) {
+ if (mPrimaryDispSync.addPresentFence(retireFence)) {
enableHardwareVsync();
} else {
disableHardwareVsync(false);
// supported, at startup time (since it may not be
// supported):
&actual_present_time,
- NULL, //&display_retire_time,
NULL, //&dequeue_ready_time,
NULL /*&reads_done_time*/);