Loading services/surfaceflinger/SurfaceFlinger.cpp +13 −3 Original line number Diff line number Diff line Loading @@ -590,7 +590,11 @@ uint32_t SurfaceFlinger::getNewTexture() { } void SurfaceFlinger::deleteTextureAsync(uint32_t texture) { postMessageAsync(new LambdaMessage([=] { getRenderEngine().deleteTextures(1, &texture); })); std::lock_guard lock(mTexturePoolMutex); // We don't change the pool size, so the fix-up logic in postComposition will decide whether // to actually delete this or not based on mTexturePoolSize mTexturePool.push_back(texture); ATRACE_INT("TexturePoolSize", mTexturePool.size()); } // Do not call property_set on main thread which will be blocked by init Loading Loading @@ -2078,12 +2082,18 @@ void SurfaceFlinger::postComposition() { std::lock_guard lock(mTexturePoolMutex); if (mTexturePool.size() < mTexturePoolSize) { const size_t refillCount = mTexturePoolSize - mTexturePool.size(); if (refillCount > 0) { const size_t offset = mTexturePool.size(); mTexturePool.resize(mTexturePoolSize); getRenderEngine().genTextures(refillCount, mTexturePool.data() + offset); ATRACE_INT("TexturePoolSize", mTexturePool.size()); } else if (mTexturePool.size() > mTexturePoolSize) { const size_t deleteCount = mTexturePool.size() - mTexturePoolSize; const size_t offset = mTexturePoolSize; getRenderEngine().deleteTextures(deleteCount, mTexturePool.data() + offset); mTexturePool.resize(mTexturePoolSize); ATRACE_INT("TexturePoolSize", mTexturePool.size()); } } Loading services/surfaceflinger/tests/unittests/CompositionTest.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -856,7 +856,7 @@ struct BufferLayerVariant : public BaseLayerVariant<LayerProperties> { } static void cleanupInjectedLayers(CompositionTest* test) { EXPECT_CALL(*test->mMessageQueue, postMessage(_, 0)).Times(2); EXPECT_CALL(*test->mMessageQueue, postMessage(_, 0)).Times(1); Base::cleanupInjectedLayers(test); } Loading Loading
services/surfaceflinger/SurfaceFlinger.cpp +13 −3 Original line number Diff line number Diff line Loading @@ -590,7 +590,11 @@ uint32_t SurfaceFlinger::getNewTexture() { } void SurfaceFlinger::deleteTextureAsync(uint32_t texture) { postMessageAsync(new LambdaMessage([=] { getRenderEngine().deleteTextures(1, &texture); })); std::lock_guard lock(mTexturePoolMutex); // We don't change the pool size, so the fix-up logic in postComposition will decide whether // to actually delete this or not based on mTexturePoolSize mTexturePool.push_back(texture); ATRACE_INT("TexturePoolSize", mTexturePool.size()); } // Do not call property_set on main thread which will be blocked by init Loading Loading @@ -2078,12 +2082,18 @@ void SurfaceFlinger::postComposition() { std::lock_guard lock(mTexturePoolMutex); if (mTexturePool.size() < mTexturePoolSize) { const size_t refillCount = mTexturePoolSize - mTexturePool.size(); if (refillCount > 0) { const size_t offset = mTexturePool.size(); mTexturePool.resize(mTexturePoolSize); getRenderEngine().genTextures(refillCount, mTexturePool.data() + offset); ATRACE_INT("TexturePoolSize", mTexturePool.size()); } else if (mTexturePool.size() > mTexturePoolSize) { const size_t deleteCount = mTexturePool.size() - mTexturePoolSize; const size_t offset = mTexturePoolSize; getRenderEngine().deleteTextures(deleteCount, mTexturePool.data() + offset); mTexturePool.resize(mTexturePoolSize); ATRACE_INT("TexturePoolSize", mTexturePool.size()); } } Loading
services/surfaceflinger/tests/unittests/CompositionTest.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -856,7 +856,7 @@ struct BufferLayerVariant : public BaseLayerVariant<LayerProperties> { } static void cleanupInjectedLayers(CompositionTest* test) { EXPECT_CALL(*test->mMessageQueue, postMessage(_, 0)).Times(2); EXPECT_CALL(*test->mMessageQueue, postMessage(_, 0)).Times(1); Base::cleanupInjectedLayers(test); } Loading