100 lines
4.6 KiB
Diff
100 lines
4.6 KiB
Diff
From 9d29befb9b5d3a9c5a893e7abdab42656d67eb14 Mon Sep 17 00:00:00 2001
|
|
From: Peter Cai <peter@typeblog.net>
|
|
Date: Sun, 15 Jun 2025 18:32:42 -0400
|
|
Subject: [PATCH 5/6] Revert "Remove dead code from LayerFE"
|
|
|
|
This reverts commit 330571240ff3d44fdbecbe513309d73ba82404e6.
|
|
|
|
Change-Id: Idade7d609dbec06f2b0636df2640388937f68f62
|
|
|
|
Conflicts:
|
|
services/surfaceflinger/LayerFE.cpp
|
|
---
|
|
.../CompositionEngine/include/compositionengine/LayerFE.h | 3 +++
|
|
.../include/compositionengine/mock/LayerFE.h | 3 +++
|
|
services/surfaceflinger/LayerFE.cpp | 6 ++++++
|
|
services/surfaceflinger/LayerFE.h | 3 +++
|
|
4 files changed, 15 insertions(+)
|
|
|
|
diff --git a/services/surfaceflinger/CompositionEngine/include/compositionengine/LayerFE.h b/services/surfaceflinger/CompositionEngine/include/compositionengine/LayerFE.h
|
|
index e2ea0f1397..41d4afe207 100644
|
|
--- a/services/surfaceflinger/CompositionEngine/include/compositionengine/LayerFE.h
|
|
+++ b/services/surfaceflinger/CompositionEngine/include/compositionengine/LayerFE.h
|
|
@@ -154,6 +154,9 @@ public:
|
|
virtual std::optional<LayerSettings> prepareClientComposition(
|
|
ClientCompositionTargetSettings&) const = 0;
|
|
|
|
+ // Called after the layer is displayed to update the presentation fence
|
|
+ virtual void onLayerDisplayed(ftl::SharedFuture<FenceResult>, ui::LayerStack layerStack) = 0;
|
|
+
|
|
// Initializes a promise for a buffer release fence and provides the future for that
|
|
// fence. This should only be called when a promise has not yet been created, or
|
|
// after the previous promise has already been fulfilled. Attempting to call this
|
|
diff --git a/services/surfaceflinger/CompositionEngine/include/compositionengine/mock/LayerFE.h b/services/surfaceflinger/CompositionEngine/include/compositionengine/mock/LayerFE.h
|
|
index f65a9083c5..4733939ce2 100644
|
|
--- a/services/surfaceflinger/CompositionEngine/include/compositionengine/mock/LayerFE.h
|
|
+++ b/services/surfaceflinger/CompositionEngine/include/compositionengine/mock/LayerFE.h
|
|
@@ -50,6 +50,9 @@ public:
|
|
std::optional<compositionengine::LayerFE::LayerSettings>(
|
|
compositionengine::LayerFE::ClientCompositionTargetSettings&));
|
|
|
|
+ MOCK_METHOD(void, onLayerDisplayed, (ftl::SharedFuture<FenceResult>, ui::LayerStack),
|
|
+ (override));
|
|
+
|
|
MOCK_METHOD0(createReleaseFenceFuture, ftl::Future<FenceResult>());
|
|
MOCK_METHOD1(setReleaseFence, void(const FenceResult&));
|
|
MOCK_METHOD1(setReleasedBuffer, void(sp<GraphicBuffer>));
|
|
diff --git a/services/surfaceflinger/LayerFE.cpp b/services/surfaceflinger/LayerFE.cpp
|
|
index 3cd432cd2b..7ae407da1a 100644
|
|
--- a/services/surfaceflinger/LayerFE.cpp
|
|
+++ b/services/surfaceflinger/LayerFE.cpp
|
|
@@ -27,6 +27,7 @@
|
|
#include "LayerFE.h"
|
|
#include "SurfaceFlinger.h"
|
|
#include "ui/FenceResult.h"
|
|
+#include "ui/LayerStack.h"
|
|
|
|
namespace android {
|
|
|
|
@@ -352,6 +353,11 @@ void LayerFE::onPictureProfileCommitted() {
|
|
mCompositionResult.pictureProfileHandle = mSnapshot->pictureProfileHandle;
|
|
}
|
|
|
|
+void LayerFE::onLayerDisplayed(ftl::SharedFuture<FenceResult> futureFenceResult,
|
|
+ ui::LayerStack layerStack) {
|
|
+ mCompositionResult.releaseFences.emplace_back(std::move(futureFenceResult), layerStack);
|
|
+}
|
|
+
|
|
CompositionResult LayerFE::stealCompositionResult() {
|
|
CompositionResult result;
|
|
std::swap(mCompositionResult, result);
|
|
diff --git a/services/surfaceflinger/LayerFE.h b/services/surfaceflinger/LayerFE.h
|
|
index b897a90687..fad77e92a9 100644
|
|
--- a/services/surfaceflinger/LayerFE.h
|
|
+++ b/services/surfaceflinger/LayerFE.h
|
|
@@ -26,12 +26,14 @@
|
|
#include "compositionengine/LayerFE.h"
|
|
#include "compositionengine/LayerFECompositionState.h"
|
|
#include "renderengine/LayerSettings.h"
|
|
+#include "ui/LayerStack.h"
|
|
|
|
#include <ftl/future.h>
|
|
|
|
namespace android {
|
|
|
|
struct CompositionResult {
|
|
+ std::vector<std::pair<ftl::SharedFuture<FenceResult>, ui::LayerStack>> releaseFences;
|
|
sp<Fence> lastClientCompositionFence = nullptr;
|
|
bool wasPictureProfileCommitted = false;
|
|
// TODO(b/337330263): Why does LayerFE coming from SF have a null composition state?
|
|
@@ -47,6 +49,7 @@ public:
|
|
// compositionengine::LayerFE overrides
|
|
const compositionengine::LayerFECompositionState* getCompositionState() const override;
|
|
bool onPreComposition(bool updatingOutputGeometryThisFrame) override;
|
|
+ void onLayerDisplayed(ftl::SharedFuture<FenceResult>, ui::LayerStack) override;
|
|
const char* getDebugName() const override;
|
|
int32_t getSequence() const override;
|
|
bool hasRoundedCorners() const override;
|
|
--
|
|
2.48.1
|
|
|