diff options
| -rw-r--r-- | libs/renderengine/skia/Cache.cpp | 8 | ||||
| -rw-r--r-- | services/surfaceflinger/Layer.cpp | 1 | ||||
| -rw-r--r-- | services/surfaceflinger/SurfaceFlinger.cpp | 19 | ||||
| -rw-r--r-- | services/surfaceflinger/SurfaceFlinger.h | 1 |
4 files changed, 15 insertions, 14 deletions
diff --git a/libs/renderengine/skia/Cache.cpp b/libs/renderengine/skia/Cache.cpp index 34577daf2c..d9d249669d 100644 --- a/libs/renderengine/skia/Cache.cpp +++ b/libs/renderengine/skia/Cache.cpp @@ -313,7 +313,13 @@ void Cache::primeShaderCache(SkiaRenderEngine* renderengine) { // The majority of shaders are related to sampling images. // These need to be generated with various source textures - for (auto texture : {srcTexture, externalTexture, f16ExternalTexture}) { + // The F16 texture may not be usable on all devices, so check first that it was created with + // the requested usage bit. + auto textures = {srcTexture, externalTexture}; + auto texturesWithF16 = {srcTexture, externalTexture, f16ExternalTexture}; + bool canUsef16 = f16ExternalBuffer->getUsage() & GRALLOC_USAGE_HW_TEXTURE; + + for (auto texture : canUsef16 ? texturesWithF16 : textures) { drawImageLayers(renderengine, display, dstTexture, texture); // Draw layers for b/185569240. drawClippedLayers(renderengine, display, dstTexture, texture); diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp index ad31b3fcad..1985ecbe6d 100644 --- a/services/surfaceflinger/Layer.cpp +++ b/services/surfaceflinger/Layer.cpp @@ -254,6 +254,7 @@ void Layer::addToCurrentState() { if (mRemovedFromDrawingState) { mRemovedFromDrawingState = false; mFlinger->mScheduler->registerLayer(this); + mFlinger->removeFromOffscreenLayers(this); } for (const auto& child : mCurrentChildren) { diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 8df0852a3e..af71b0919f 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -3254,17 +3254,6 @@ void SurfaceFlinger::commitTransactionLocked() { } } - // TODO(b/163019109): See if this traversal is needed at all... - if (!mOffscreenLayers.empty()) { - mDrawingState.traverse([&](Layer* layer) { - // If the layer can be reached when traversing mDrawingState, then the layer is no - // longer offscreen. Remove the layer from the offscreenLayer set. - if (mOffscreenLayers.count(layer)) { - mOffscreenLayers.erase(layer); - } - }); - } - commitOffscreenLayers(); mDrawingState.traverse([&](Layer* layer) { layer->updateMirrorInfo(); }); } @@ -6623,7 +6612,7 @@ void SurfaceFlinger::onLayerFirstRef(Layer* layer) { void SurfaceFlinger::onLayerDestroyed(Layer* layer) { mNumLayers--; - removeFromOffscreenLayers(layer); + removeHierarchyFromOffscreenLayers(layer); if (!layer->isRemovedFromCurrentState()) { mScheduler->deregisterLayer(layer); } @@ -6636,13 +6625,17 @@ void SurfaceFlinger::onLayerDestroyed(Layer* layer) { // from dangling children layers such that they are not reachable from the // Drawing state nor the offscreen layer list // See b/141111965 -void SurfaceFlinger::removeFromOffscreenLayers(Layer* layer) { +void SurfaceFlinger::removeHierarchyFromOffscreenLayers(Layer* layer) { for (auto& child : layer->getCurrentChildren()) { mOffscreenLayers.emplace(child.get()); } mOffscreenLayers.erase(layer); } +void SurfaceFlinger::removeFromOffscreenLayers(Layer* layer) { + mOffscreenLayers.erase(layer); +} + status_t SurfaceFlinger::setGlobalShadowSettings(const half4& ambientColor, const half4& spotColor, float lightPosY, float lightPosZ, float lightRadius) { diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h index 644f76f65a..1d53ed540c 100644 --- a/services/surfaceflinger/SurfaceFlinger.h +++ b/services/surfaceflinger/SurfaceFlinger.h @@ -313,6 +313,7 @@ public: void onLayerFirstRef(Layer*); void onLayerDestroyed(Layer*); + void removeHierarchyFromOffscreenLayers(Layer* layer); void removeFromOffscreenLayers(Layer* layer); TransactionCallbackInvoker& getTransactionCallbackInvoker() { |