summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Robert Carr <racarr@google.com> 2018-12-20 14:54:47 -0800
committer android-build-merger <android-build-merger@google.com> 2018-12-20 14:54:47 -0800
commit3d556521a785bd5847facac943d18bfe08fb3d3b (patch)
tree1349941332f944c0b9e7c4f1e352eef6eff22d1a
parent984538bfdd0079b1a578c56505d4421b50772354 (diff)
parentd6f7035d6a6c26862e1d7ebed4473e70c2f8941f (diff)
SurfaceFlinger: Expose construction of container layers.
am: d6f7035d6a Change-Id: Icb370d034c03eacc8c06b0f6fbb00292b6f8508b
-rw-r--r--libs/gui/include/gui/ISurfaceComposerClient.h1
-rw-r--r--services/surfaceflinger/Layer.cpp17
-rw-r--r--services/surfaceflinger/Layer.h2
-rw-r--r--services/surfaceflinger/SurfaceFlinger.cpp15
-rw-r--r--services/surfaceflinger/SurfaceFlinger.h4
5 files changed, 21 insertions, 18 deletions
diff --git a/libs/gui/include/gui/ISurfaceComposerClient.h b/libs/gui/include/gui/ISurfaceComposerClient.h
index 8dfc99a4b7..b4fd956b0f 100644
--- a/libs/gui/include/gui/ISurfaceComposerClient.h
+++ b/libs/gui/include/gui/ISurfaceComposerClient.h
@@ -42,6 +42,7 @@ public:
eFXSurfaceNormal = 0x00000000,
eFXSurfaceColor = 0x00020000,
+ eFXSurfaceContainer = 0x00080000,
eFXSurfaceMask = 0x000F0000,
};
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 90e0e9e0d7..0caac9b16d 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -133,22 +133,7 @@ Layer::Layer(SurfaceFlinger* flinger, const sp<Client>& client, const String8& n
CompositorTiming compositorTiming;
flinger->getCompositorTiming(&compositorTiming);
mFrameEventHistory.initializeCompositorTiming(compositorTiming);
-}
-
-void Layer::onFirstRef() NO_THREAD_SAFETY_ANALYSIS {
- if (!isCreatedFromMainThread()) {
- // Grab the SF state lock during this since it's the only way to safely access HWC
- mFlinger->mStateLock.lock();
- }
-
- const auto& hwc = mFlinger->getHwComposer();
- const auto& activeConfig = hwc.getActiveConfig(HWC_DISPLAY_PRIMARY);
- nsecs_t displayPeriod = activeConfig->getVsyncPeriod();
- mFrameTracker.setDisplayRefreshPeriod(displayPeriod);
-
- if (!isCreatedFromMainThread()) {
- mFlinger->mStateLock.unlock();
- }
+ mFrameTracker.setDisplayRefreshPeriod(compositorTiming.interval);
}
Layer::~Layer() {
diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h
index 22396796ed..301f190e16 100644
--- a/services/surfaceflinger/Layer.h
+++ b/services/surfaceflinger/Layer.h
@@ -618,8 +618,6 @@ protected:
: mFlinger(flinger), mLayer(layer) {}
};
- virtual void onFirstRef();
-
friend class impl::SurfaceInterceptor;
void commitTransaction(const State& stateToCommit);
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 28b447f7aa..e693dd28dd 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -3645,6 +3645,11 @@ status_t SurfaceFlinger::createLayer(
uniqueName, w, h, flags,
handle, &layer);
break;
+ case ISurfaceComposerClient::eFXSurfaceContainer:
+ result = createContainerLayer(client,
+ uniqueName, w, h, flags,
+ handle, &layer);
+ break;
default:
result = BAD_VALUE;
break;
@@ -3736,6 +3741,16 @@ status_t SurfaceFlinger::createColorLayer(const sp<Client>& client,
return NO_ERROR;
}
+status_t SurfaceFlinger::createContainerLayer(const sp<Client>& client,
+ const String8& name, uint32_t w, uint32_t h, uint32_t flags,
+ sp<IBinder>* handle, sp<Layer>* outLayer)
+{
+ *outLayer = new ContainerLayer(this, client, name, w, h, flags);
+ *handle = (*outLayer)->getHandle();
+ return NO_ERROR;
+}
+
+
status_t SurfaceFlinger::onLayerRemoved(const sp<Client>& client, const sp<IBinder>& handle)
{
// called by a client when it wants to remove a Layer
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
index 0148ab6754..463a551bfe 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -541,6 +541,10 @@ private:
uint32_t w, uint32_t h, uint32_t flags, sp<IBinder>* outHandle,
sp<Layer>* outLayer);
+ status_t createContainerLayer(const sp<Client>& client, const String8& name,
+ uint32_t w, uint32_t h, uint32_t flags, sp<IBinder>* outHandle,
+ sp<Layer>* outLayer);
+
String8 getUniqueLayerName(const String8& name);
// called in response to the window-manager calling