Loading libs/gui/tests/BLASTBufferQueue_test.cpp +0 −37 Original line number Diff line number Diff line Loading @@ -1348,43 +1348,6 @@ TEST_F(BLASTBufferQueueTest, QueryNativeWindowQueuesToWindowComposer) { ASSERT_EQ(queuesToNativeWindow, 1); } // Test a slow producer doesn't hold up a faster producer from the same client. Essentially tests // BBQ uses separate transaction queues. TEST_F(BLASTBufferQueueTest, OutOfOrderTransactionTest) { sp<SurfaceControl> bgSurface = mClient->createSurface(String8("BGTest"), 0, 0, PIXEL_FORMAT_RGBA_8888, ISurfaceComposerClient::eFXSurfaceBufferState); ASSERT_NE(nullptr, bgSurface.get()); Transaction t; t.setLayerStack(bgSurface, ui::DEFAULT_LAYER_STACK) .show(bgSurface) .setDataspace(bgSurface, ui::Dataspace::V0_SRGB) .setLayer(bgSurface, std::numeric_limits<int32_t>::max() - 1) .apply(); BLASTBufferQueueHelper slowAdapter(mSurfaceControl, mDisplayWidth, mDisplayHeight); sp<IGraphicBufferProducer> slowIgbProducer; setUpProducer(slowAdapter, slowIgbProducer); nsecs_t presentTimeDelay = std::chrono::nanoseconds(500ms).count(); queueBuffer(slowIgbProducer, 0 /* r */, 255 /* g */, 0 /* b */, presentTimeDelay); BLASTBufferQueueHelper fastAdapter(bgSurface, mDisplayWidth, mDisplayHeight); sp<IGraphicBufferProducer> fastIgbProducer; setUpProducer(fastAdapter, fastIgbProducer); uint8_t r = 255; uint8_t g = 0; uint8_t b = 0; queueBuffer(fastIgbProducer, r, g, b, 0 /* presentTimeDelay */); fastAdapter.waitForCallbacks(); // capture screen and verify that it is red ASSERT_EQ(NO_ERROR, captureDisplay(mCaptureArgs, mCaptureResults)); ASSERT_NO_FATAL_FAILURE( checkScreenCapture(r, g, b, {0, 0, (int32_t)mDisplayWidth, (int32_t)mDisplayHeight / 2})); } TEST_F(BLASTBufferQueueTest, TransformHint) { // Transform hint is provided to BBQ via the surface control passed by WM mSurfaceControl->setTransformHint(ui::Transform::ROT_90); Loading services/surfaceflinger/tests/unittests/TransactionApplicationTest.cpp +41 −0 Original line number Diff line number Diff line Loading @@ -306,6 +306,47 @@ public: ~FakeExternalTexture() = default; }; TEST_F(TransactionApplicationTest, ApplyTokensUseDifferentQueues) { auto applyToken1 = sp<BBinder>::make(); auto applyToken2 = sp<BBinder>::make(); // Transaction 1 has a buffer with an unfired fence. It should not be ready to be applied. TransactionState transaction1; transaction1.applyToken = applyToken1; transaction1.id = 42069; transaction1.states.emplace_back(); transaction1.states[0].state.what |= layer_state_t::eBufferChanged; transaction1.states[0].state.bufferData = std::make_shared<fake::BufferData>(/* bufferId */ 1, /* width */ 1, /* height */ 1, /* pixelFormat */ 0, /* outUsage */ 0); transaction1.states[0].externalTexture = std::make_shared<FakeExternalTexture>(*transaction1.states[0].state.bufferData); transaction1.states[0].state.surface = sp<Layer>::make(LayerCreationArgs(mFlinger.flinger(), nullptr, "TestLayer", 0, {})) ->getHandle(); auto fence = sp<mock::MockFence>::make(); EXPECT_CALL(*fence, getStatus()).WillRepeatedly(Return(Fence::Status::Unsignaled)); transaction1.states[0].state.bufferData->acquireFence = std::move(fence); transaction1.states[0].state.bufferData->flags = BufferData::BufferDataChange::fenceChanged; transaction1.isAutoTimestamp = true; // Transaction 2 should be ready to be applied. TransactionState transaction2; transaction2.applyToken = applyToken2; transaction2.id = 2; transaction2.isAutoTimestamp = true; mFlinger.setTransactionStateInternal(transaction1); mFlinger.setTransactionStateInternal(transaction2); mFlinger.flushTransactionQueues(); auto transactionQueues = mFlinger.getPendingTransactionQueue(); // Transaction 1 is still in its queue. EXPECT_EQ(transactionQueues[applyToken1].size(), 1u); // Transaction 2 has been dequeued. EXPECT_EQ(transactionQueues[applyToken2].size(), 0u); } class LatchUnsignaledTest : public TransactionApplicationTest { public: void TearDown() override { Loading Loading
libs/gui/tests/BLASTBufferQueue_test.cpp +0 −37 Original line number Diff line number Diff line Loading @@ -1348,43 +1348,6 @@ TEST_F(BLASTBufferQueueTest, QueryNativeWindowQueuesToWindowComposer) { ASSERT_EQ(queuesToNativeWindow, 1); } // Test a slow producer doesn't hold up a faster producer from the same client. Essentially tests // BBQ uses separate transaction queues. TEST_F(BLASTBufferQueueTest, OutOfOrderTransactionTest) { sp<SurfaceControl> bgSurface = mClient->createSurface(String8("BGTest"), 0, 0, PIXEL_FORMAT_RGBA_8888, ISurfaceComposerClient::eFXSurfaceBufferState); ASSERT_NE(nullptr, bgSurface.get()); Transaction t; t.setLayerStack(bgSurface, ui::DEFAULT_LAYER_STACK) .show(bgSurface) .setDataspace(bgSurface, ui::Dataspace::V0_SRGB) .setLayer(bgSurface, std::numeric_limits<int32_t>::max() - 1) .apply(); BLASTBufferQueueHelper slowAdapter(mSurfaceControl, mDisplayWidth, mDisplayHeight); sp<IGraphicBufferProducer> slowIgbProducer; setUpProducer(slowAdapter, slowIgbProducer); nsecs_t presentTimeDelay = std::chrono::nanoseconds(500ms).count(); queueBuffer(slowIgbProducer, 0 /* r */, 255 /* g */, 0 /* b */, presentTimeDelay); BLASTBufferQueueHelper fastAdapter(bgSurface, mDisplayWidth, mDisplayHeight); sp<IGraphicBufferProducer> fastIgbProducer; setUpProducer(fastAdapter, fastIgbProducer); uint8_t r = 255; uint8_t g = 0; uint8_t b = 0; queueBuffer(fastIgbProducer, r, g, b, 0 /* presentTimeDelay */); fastAdapter.waitForCallbacks(); // capture screen and verify that it is red ASSERT_EQ(NO_ERROR, captureDisplay(mCaptureArgs, mCaptureResults)); ASSERT_NO_FATAL_FAILURE( checkScreenCapture(r, g, b, {0, 0, (int32_t)mDisplayWidth, (int32_t)mDisplayHeight / 2})); } TEST_F(BLASTBufferQueueTest, TransformHint) { // Transform hint is provided to BBQ via the surface control passed by WM mSurfaceControl->setTransformHint(ui::Transform::ROT_90); Loading
services/surfaceflinger/tests/unittests/TransactionApplicationTest.cpp +41 −0 Original line number Diff line number Diff line Loading @@ -306,6 +306,47 @@ public: ~FakeExternalTexture() = default; }; TEST_F(TransactionApplicationTest, ApplyTokensUseDifferentQueues) { auto applyToken1 = sp<BBinder>::make(); auto applyToken2 = sp<BBinder>::make(); // Transaction 1 has a buffer with an unfired fence. It should not be ready to be applied. TransactionState transaction1; transaction1.applyToken = applyToken1; transaction1.id = 42069; transaction1.states.emplace_back(); transaction1.states[0].state.what |= layer_state_t::eBufferChanged; transaction1.states[0].state.bufferData = std::make_shared<fake::BufferData>(/* bufferId */ 1, /* width */ 1, /* height */ 1, /* pixelFormat */ 0, /* outUsage */ 0); transaction1.states[0].externalTexture = std::make_shared<FakeExternalTexture>(*transaction1.states[0].state.bufferData); transaction1.states[0].state.surface = sp<Layer>::make(LayerCreationArgs(mFlinger.flinger(), nullptr, "TestLayer", 0, {})) ->getHandle(); auto fence = sp<mock::MockFence>::make(); EXPECT_CALL(*fence, getStatus()).WillRepeatedly(Return(Fence::Status::Unsignaled)); transaction1.states[0].state.bufferData->acquireFence = std::move(fence); transaction1.states[0].state.bufferData->flags = BufferData::BufferDataChange::fenceChanged; transaction1.isAutoTimestamp = true; // Transaction 2 should be ready to be applied. TransactionState transaction2; transaction2.applyToken = applyToken2; transaction2.id = 2; transaction2.isAutoTimestamp = true; mFlinger.setTransactionStateInternal(transaction1); mFlinger.setTransactionStateInternal(transaction2); mFlinger.flushTransactionQueues(); auto transactionQueues = mFlinger.getPendingTransactionQueue(); // Transaction 1 is still in its queue. EXPECT_EQ(transactionQueues[applyToken1].size(), 1u); // Transaction 2 has been dequeued. EXPECT_EQ(transactionQueues[applyToken2].size(), 0u); } class LatchUnsignaledTest : public TransactionApplicationTest { public: void TearDown() override { Loading