[SurfaceFlinger] support EGLImage management in BLAST
This mirrors a performance optimization for BufferQueueLayers where
EGLImages were allocated in onFrameAvailable. Here when buffers are
passed over to SurfaceFlinger in a transaction, an EGLImage is also
created for that buffer.
This is critical for reducing jank when operating in higher refresh
rates, as eglCreateImageKHR can take long enough for frames to miss.
Bug: 133627730
Test: systrace of chrome in landscope orientation caches properly
Change-Id: I2022564fbecace7cadd00c89abdcc358d6323315
diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h
index 3712b2a..7aecc90 100644
--- a/services/surfaceflinger/Layer.h
+++ b/services/surfaceflinger/Layer.h
@@ -17,8 +17,6 @@
#ifndef ANDROID_LAYER_H
#define ANDROID_LAYER_H
-#include <sys/types.h>
-
#include <compositionengine/LayerFE.h>
#include <gui/BufferQueue.h>
#include <gui/ISurfaceComposerClient.h>
@@ -28,6 +26,7 @@
#include <math/vec4.h>
#include <renderengine/Mesh.h>
#include <renderengine/Texture.h>
+#include <sys/types.h>
#include <ui/FloatRect.h>
#include <ui/FrameStats.h>
#include <ui/GraphicBuffer.h>
@@ -44,16 +43,16 @@
#include <vector>
#include "Client.h"
+#include "ClientCache.h"
+#include "DisplayHardware/ComposerHal.h"
+#include "DisplayHardware/HWComposer.h"
#include "FrameTracker.h"
#include "LayerVector.h"
#include "MonitoredProducer.h"
+#include "RenderArea.h"
#include "SurfaceFlinger.h"
#include "TransactionCompletedThread.h"
-#include "DisplayHardware/ComposerHal.h"
-#include "DisplayHardware/HWComposer.h"
-#include "RenderArea.h"
-
using namespace android::surfaceflinger;
namespace android {
@@ -94,7 +93,7 @@
LayerMetadata metadata;
};
-class Layer : public virtual compositionengine::LayerFE {
+class Layer : public virtual compositionengine::LayerFE, public ClientCache::ErasedRecipient {
static std::atomic<int32_t> sSequence;
public:
@@ -690,6 +689,9 @@
compositionengine::OutputLayer* findOutputLayerForDisplay(
const sp<const DisplayDevice>& display) const;
+ // Inherit from ClientCache::ErasedRecipient
+ void bufferErased(const client_cache_t& /*clientCacheId*/) override {}
+
protected:
// constant
sp<SurfaceFlinger> mFlinger;