Loading libs/binder/ndk/include_platform/android/binder_manager.h +2 −1 Original line number Diff line number Diff line Loading @@ -31,7 +31,8 @@ __BEGIN_DECLS * * \return EX_NONE on success. */ binder_exception_t AServiceManager_addService(AIBinder* binder, const char* instance); __attribute__((warn_unused_result)) binder_exception_t AServiceManager_addService( AIBinder* binder, const char* instance); /** * Gets a binder object with this specific instance name. Will return nullptr immediately if the Loading libs/binder/ndk/tests/binderVendorDoubleLoadTest.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -163,7 +163,8 @@ int main(int argc, char** argv) { // LOCAL SERVERS std::shared_ptr<NdkServer> ndkServer = SharedRefBase::make<NdkServer>(); AServiceManager_addService(ndkServer->asBinder().get(), kLocalNdkServerName.c_str()); CHECK(STATUS_OK == AServiceManager_addService(ndkServer->asBinder().get(), kLocalNdkServerName.c_str())); return RUN_ALL_TESTS(); } services/surfaceflinger/FrameTimeline/FrameTimeline.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -327,7 +327,12 @@ void SurfaceFrame::setRenderRate(Fps renderRate) { std::optional<int32_t> SurfaceFrame::getJankType() const { std::scoped_lock lock(mMutex); if (mPresentState == PresentState::Dropped) { // Return no jank if it's a dropped frame since we cannot attribute a jank to a it. return JankType::None; } if (mActuals.presentTime == 0) { // Frame hasn't been presented yet. return std::nullopt; } return mJankType; Loading services/surfaceflinger/tests/unittests/TransactionSurfaceFrameTest.cpp +38 −0 Original line number Diff line number Diff line Loading @@ -328,6 +328,41 @@ public: EXPECT_EQ(PresentState::Presented, bufferlessSurfaceFrame2->getPresentState()); EXPECT_EQ(12, bufferlessSurfaceFrame2->getActuals().endTime); } void PendingSurfaceFramesRemovedAfterClassification() { sp<BufferStateLayer> layer = createBufferStateLayer(); sp<Fence> fence1(new Fence()); auto acquireFence1 = fenceFactory.createFenceTimeForTest(fence1); sp<GraphicBuffer> buffer1{new GraphicBuffer(1, 1, HAL_PIXEL_FORMAT_RGBA_8888, 1, 0)}; layer->setBuffer(buffer1, fence1, 10, 20, false, mClientCache, 1, std::nullopt, {/*vsyncId*/ 1, /*inputEventId*/ 0}); ASSERT_NE(nullptr, layer->mCurrentState.bufferSurfaceFrameTX); const auto droppedSurfaceFrame = layer->mCurrentState.bufferSurfaceFrameTX; sp<Fence> fence2(new Fence()); auto acquireFence2 = fenceFactory.createFenceTimeForTest(fence2); sp<GraphicBuffer> buffer2{new GraphicBuffer(1, 1, HAL_PIXEL_FORMAT_RGBA_8888, 1, 0)}; layer->setBuffer(buffer2, fence2, 10, 20, false, mClientCache, 1, std::nullopt, {/*vsyncId*/ 1, /*inputEventId*/ 0}); acquireFence2->signalForTest(12); ASSERT_NE(nullptr, layer->mCurrentState.bufferSurfaceFrameTX); auto& presentedSurfaceFrame = layer->mCurrentState.bufferSurfaceFrameTX; commitTransaction(layer.get()); bool computeVisisbleRegions; layer->updateTexImage(computeVisisbleRegions, 15, 0); // Both the droppedSurfaceFrame and presentedSurfaceFrame should be in // pendingJankClassifications. EXPECT_EQ(2u, layer->mPendingJankClassifications.size()); presentedSurfaceFrame->onPresent(20, JankType::None, Fps::fromPeriodNsecs(11), /*displayDeadlineDelta*/ 0, /*displayPresentDelta*/ 0); layer->releasePendingBuffer(25); EXPECT_EQ(0u, layer->mPendingJankClassifications.size()); } }; TEST_F(TransactionSurfaceFrameTest, PresentedBufferlessSurfaceFrame) { Loading Loading @@ -364,4 +399,7 @@ TEST_F(TransactionSurfaceFrameTest, MergePendingStates_BufferlessSurfaceFramesWithOverlappingToken(); } TEST_F(TransactionSurfaceFrameTest, PendingSurfaceFramesRemovedAfterClassification) { PendingSurfaceFramesRemovedAfterClassification(); } } // namespace android No newline at end of file Loading
libs/binder/ndk/include_platform/android/binder_manager.h +2 −1 Original line number Diff line number Diff line Loading @@ -31,7 +31,8 @@ __BEGIN_DECLS * * \return EX_NONE on success. */ binder_exception_t AServiceManager_addService(AIBinder* binder, const char* instance); __attribute__((warn_unused_result)) binder_exception_t AServiceManager_addService( AIBinder* binder, const char* instance); /** * Gets a binder object with this specific instance name. Will return nullptr immediately if the Loading
libs/binder/ndk/tests/binderVendorDoubleLoadTest.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -163,7 +163,8 @@ int main(int argc, char** argv) { // LOCAL SERVERS std::shared_ptr<NdkServer> ndkServer = SharedRefBase::make<NdkServer>(); AServiceManager_addService(ndkServer->asBinder().get(), kLocalNdkServerName.c_str()); CHECK(STATUS_OK == AServiceManager_addService(ndkServer->asBinder().get(), kLocalNdkServerName.c_str())); return RUN_ALL_TESTS(); }
services/surfaceflinger/FrameTimeline/FrameTimeline.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -327,7 +327,12 @@ void SurfaceFrame::setRenderRate(Fps renderRate) { std::optional<int32_t> SurfaceFrame::getJankType() const { std::scoped_lock lock(mMutex); if (mPresentState == PresentState::Dropped) { // Return no jank if it's a dropped frame since we cannot attribute a jank to a it. return JankType::None; } if (mActuals.presentTime == 0) { // Frame hasn't been presented yet. return std::nullopt; } return mJankType; Loading
services/surfaceflinger/tests/unittests/TransactionSurfaceFrameTest.cpp +38 −0 Original line number Diff line number Diff line Loading @@ -328,6 +328,41 @@ public: EXPECT_EQ(PresentState::Presented, bufferlessSurfaceFrame2->getPresentState()); EXPECT_EQ(12, bufferlessSurfaceFrame2->getActuals().endTime); } void PendingSurfaceFramesRemovedAfterClassification() { sp<BufferStateLayer> layer = createBufferStateLayer(); sp<Fence> fence1(new Fence()); auto acquireFence1 = fenceFactory.createFenceTimeForTest(fence1); sp<GraphicBuffer> buffer1{new GraphicBuffer(1, 1, HAL_PIXEL_FORMAT_RGBA_8888, 1, 0)}; layer->setBuffer(buffer1, fence1, 10, 20, false, mClientCache, 1, std::nullopt, {/*vsyncId*/ 1, /*inputEventId*/ 0}); ASSERT_NE(nullptr, layer->mCurrentState.bufferSurfaceFrameTX); const auto droppedSurfaceFrame = layer->mCurrentState.bufferSurfaceFrameTX; sp<Fence> fence2(new Fence()); auto acquireFence2 = fenceFactory.createFenceTimeForTest(fence2); sp<GraphicBuffer> buffer2{new GraphicBuffer(1, 1, HAL_PIXEL_FORMAT_RGBA_8888, 1, 0)}; layer->setBuffer(buffer2, fence2, 10, 20, false, mClientCache, 1, std::nullopt, {/*vsyncId*/ 1, /*inputEventId*/ 0}); acquireFence2->signalForTest(12); ASSERT_NE(nullptr, layer->mCurrentState.bufferSurfaceFrameTX); auto& presentedSurfaceFrame = layer->mCurrentState.bufferSurfaceFrameTX; commitTransaction(layer.get()); bool computeVisisbleRegions; layer->updateTexImage(computeVisisbleRegions, 15, 0); // Both the droppedSurfaceFrame and presentedSurfaceFrame should be in // pendingJankClassifications. EXPECT_EQ(2u, layer->mPendingJankClassifications.size()); presentedSurfaceFrame->onPresent(20, JankType::None, Fps::fromPeriodNsecs(11), /*displayDeadlineDelta*/ 0, /*displayPresentDelta*/ 0); layer->releasePendingBuffer(25); EXPECT_EQ(0u, layer->mPendingJankClassifications.size()); } }; TEST_F(TransactionSurfaceFrameTest, PresentedBufferlessSurfaceFrame) { Loading Loading @@ -364,4 +399,7 @@ TEST_F(TransactionSurfaceFrameTest, MergePendingStates_BufferlessSurfaceFramesWithOverlappingToken(); } TEST_F(TransactionSurfaceFrameTest, PendingSurfaceFramesRemovedAfterClassification) { PendingSurfaceFramesRemovedAfterClassification(); } } // namespace android No newline at end of file