summaryrefslogtreecommitdiff
path: root/services/surfaceflinger/SurfaceFlinger.cpp
diff options
context:
space:
mode:
author Alec Mouri <alecmouri@google.com> 2023-08-16 14:56:30 +0000
committer Alec Mouri <alecmouri@google.com> 2023-08-17 16:47:20 +0000
commitc3a17824aed485229dba17819e5ee4e4ecf4db1e (patch)
tree1dd2cccac1a7245fecffa15884dcc70c8c6de5dc /services/surfaceflinger/SurfaceFlinger.cpp
parente2b61c6265d4cda693daeb1313d0aaab48874452 (diff)
Delete genTextures and deleteTextures from RenderEngine
These methods are no-ops with skia and cause thread bounces in practice so just remove these. Bug: 270628071 Test: builds Change-Id: I0dc549eb7c9a0d94def5a8727322ed49b010ef1f
Diffstat (limited to 'services/surfaceflinger/SurfaceFlinger.cpp')
-rw-r--r--services/surfaceflinger/SurfaceFlinger.cpp54
1 files changed, 0 insertions, 54 deletions
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 5dd1598299..9e6e934648 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -730,42 +730,6 @@ void SurfaceFlinger::bootFinished() {
}));
}
-uint32_t SurfaceFlinger::getNewTexture() {
- {
- std::lock_guard lock(mTexturePoolMutex);
- if (!mTexturePool.empty()) {
- uint32_t name = mTexturePool.back();
- mTexturePool.pop_back();
- ATRACE_INT("TexturePoolSize", mTexturePool.size());
- return name;
- }
-
- // The pool was too small, so increase it for the future
- ++mTexturePoolSize;
- }
-
- // The pool was empty, so we need to get a new texture name directly using a
- // blocking call to the main thread
- auto genTextures = [this] {
- uint32_t name = 0;
- getRenderEngine().genTextures(1, &name);
- return name;
- };
- if (std::this_thread::get_id() == mMainThreadId) {
- return genTextures();
- } else {
- return mScheduler->schedule(genTextures).get();
- }
-}
-
-void SurfaceFlinger::deleteTextureAsync(uint32_t 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());
-}
-
static std::optional<renderengine::RenderEngine::RenderEngineType>
chooseRenderEngineTypeViaSysProp() {
char prop[PROPERTY_VALUE_MAX];
@@ -3060,23 +3024,6 @@ void SurfaceFlinger::postComposition(PhysicalDisplayId pacesetterId,
// Cleanup any outstanding resources due to rendering a prior frame.
getRenderEngine().cleanupPostRender();
- {
- std::lock_guard lock(mTexturePoolMutex);
- if (mTexturePool.size() < mTexturePoolSize) {
- const size_t refillCount = mTexturePoolSize - mTexturePool.size();
- 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());
- }
- }
-
if (mNumTrustedPresentationListeners > 0) {
// We avoid any reverse traversal upwards so this shouldn't be too expensive
traverseLegacyLayers([&](Layer* layer) {
@@ -5553,7 +5500,6 @@ status_t SurfaceFlinger::createLayer(LayerCreationArgs& args, gui::CreateSurface
status_t SurfaceFlinger::createBufferStateLayer(LayerCreationArgs& args, sp<IBinder>* handle,
sp<Layer>* outLayer) {
- args.textureName = getNewTexture();
*outLayer = getFactory().createBufferStateLayer(args);
*handle = (*outLayer)->getHandle();
return NO_ERROR;