summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2012-07-24 21:41:09 -0700
committerMathias Agopian <mathias@google.com>2012-07-24 21:42:27 -0700
commit8785578391eacd4192333d7b0ce3afedd7d163e6 (patch)
tree62249d4b8556b12eede54e09c9b5a5f34f9e52ec
parent8b33f032327f8de0dcc0e6d0d43ed80f834b51f6 (diff)
downloadframeworks_native-8785578391eacd4192333d7b0ce3afedd7d163e6.zip
frameworks_native-8785578391eacd4192333d7b0ce3afedd7d163e6.tar.gz
frameworks_native-8785578391eacd4192333d7b0ce3afedd7d163e6.tar.bz2
add a layerStack attribute to Layers.
this attribute can be set through a regular transaction using SurfaceComposerClient (just like any other attribute, eg: position or size) Change-Id: I701a47c677ea6442ca713728a93335328cd2b172
-rw-r--r--include/gui/ISurfaceComposer.h1
-rw-r--r--include/gui/SurfaceComposerClient.h1
-rw-r--r--include/private/gui/LayerState.h3
-rw-r--r--libs/gui/SurfaceComposerClient.cpp17
-rw-r--r--services/surfaceflinger/LayerBase.cpp10
-rw-r--r--services/surfaceflinger/LayerBase.h4
-rw-r--r--services/surfaceflinger/SurfaceFlinger.cpp4
7 files changed, 38 insertions, 2 deletions
diff --git a/include/gui/ISurfaceComposer.h b/include/gui/ISurfaceComposer.h
index de1d65d..0d4a76b 100644
--- a/include/gui/ISurfaceComposer.h
+++ b/include/gui/ISurfaceComposer.h
@@ -67,6 +67,7 @@ public:
eMatrixChanged = 0x00000010,
eTransparentRegionChanged = 0x00000020,
eVisibilityChanged = 0x00000040,
+ eLayerStackChanged = 0x00000080,
eCropChanged = 0x00000100,
};
diff --git a/include/gui/SurfaceComposerClient.h b/include/gui/SurfaceComposerClient.h
index 9f3ef35..aef4223 100644
--- a/include/gui/SurfaceComposerClient.h
+++ b/include/gui/SurfaceComposerClient.h
@@ -119,6 +119,7 @@ public:
status_t setPosition(SurfaceID id, float x, float y);
status_t setSize(SurfaceID id, uint32_t w, uint32_t h);
status_t setCrop(SurfaceID id, const Rect& crop);
+ status_t setLayerStack(SurfaceID id, uint32_t layerStack);
status_t destroySurface(SurfaceID sid);
private:
diff --git a/include/private/gui/LayerState.h b/include/private/gui/LayerState.h
index 97891e4..61acaac 100644
--- a/include/private/gui/LayerState.h
+++ b/include/private/gui/LayerState.h
@@ -35,7 +35,7 @@ struct layer_state_t {
layer_state_t()
: surface(0), what(0),
- x(0), y(0), z(0), w(0), h(0),
+ x(0), y(0), z(0), w(0), h(0), layerStack(0),
alpha(0), flags(0), mask(0),
reserved(0)
{
@@ -60,6 +60,7 @@ struct layer_state_t {
uint32_t z;
uint32_t w;
uint32_t h;
+ uint32_t layerStack;
float alpha;
uint8_t flags;
uint8_t mask;
diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp
index 8aa0c55..4930e33 100644
--- a/libs/gui/SurfaceComposerClient.cpp
+++ b/libs/gui/SurfaceComposerClient.cpp
@@ -124,6 +124,8 @@ public:
status_t setOrientation(int orientation);
status_t setCrop(const sp<SurfaceComposerClient>& client, SurfaceID id,
const Rect& crop);
+ status_t setLayerStack(const sp<SurfaceComposerClient>& client,
+ SurfaceID id, uint32_t layerStack);
static void closeGlobalTransaction(bool synchronous) {
Composer::getInstance().closeGlobalTransactionImpl(synchronous);
@@ -255,6 +257,17 @@ status_t Composer::setAlpha(const sp<SurfaceComposerClient>& client,
return NO_ERROR;
}
+status_t Composer::setLayerStack(const sp<SurfaceComposerClient>& client,
+ SurfaceID id, uint32_t layerStack) {
+ Mutex::Autolock _l(mLock);
+ layer_state_t* s = getLayerStateLocked(client, id);
+ if (!s)
+ return BAD_INDEX;
+ s->what |= ISurfaceComposer::eLayerStackChanged;
+ s->layerStack = layerStack;
+ return NO_ERROR;
+}
+
status_t Composer::setMatrix(const sp<SurfaceComposerClient>& client,
SurfaceID id, float dsdx, float dtdx,
float dsdy, float dtdy) {
@@ -443,6 +456,10 @@ status_t SurfaceComposerClient::setAlpha(SurfaceID id, float alpha) {
return getComposer().setAlpha(this, id, alpha);
}
+status_t SurfaceComposerClient::setLayerStack(SurfaceID id, uint32_t layerStack) {
+ return getComposer().setLayerStack(this, id, layerStack);
+}
+
status_t SurfaceComposerClient::setMatrix(SurfaceID id, float dsdx, float dtdx,
float dsdy, float dtdy) {
return getComposer().setMatrix(this, id, dsdx, dtdx, dsdy, dtdy);
diff --git a/services/surfaceflinger/LayerBase.cpp b/services/surfaceflinger/LayerBase.cpp
index f4eebb2..f654445 100644
--- a/services/surfaceflinger/LayerBase.cpp
+++ b/services/surfaceflinger/LayerBase.cpp
@@ -77,6 +77,7 @@ void LayerBase::initStates(uint32_t w, uint32_t h, uint32_t flags)
mCurrentState.active.crop.makeInvalid();
mCurrentState.z = 0;
mCurrentState.alpha = 0xFF;
+ mCurrentState.layerStack = 0;
mCurrentState.flags = layerFlags;
mCurrentState.sequence = 0;
mCurrentState.transform.set(0, 0);
@@ -169,6 +170,15 @@ bool LayerBase::setCrop(const Rect& crop) {
return true;
}
+bool LayerBase::setLayerStack(uint32_t layerStack) {
+ if (mCurrentState.layerStack == layerStack)
+ return false;
+ mCurrentState.sequence++;
+ mCurrentState.layerStack = layerStack;
+ requestTransaction();
+ return true;
+}
+
void LayerBase::setVisibleRegion(const Region& visibleRegion) {
// always called from main thread
this->visibleRegion = visibleRegion;
diff --git a/services/surfaceflinger/LayerBase.h b/services/surfaceflinger/LayerBase.h
index 80bc4c3..aeafe4f 100644
--- a/services/surfaceflinger/LayerBase.h
+++ b/services/surfaceflinger/LayerBase.h
@@ -79,6 +79,7 @@ public:
Geometry active;
Geometry requested;
uint32_t z;
+ uint32_t layerStack;
uint8_t alpha;
uint8_t flags;
uint8_t reserved[2];
@@ -113,7 +114,8 @@ public:
bool setTransparentRegionHint(const Region& opaque);
bool setFlags(uint8_t flags, uint8_t mask);
bool setCrop(const Rect& crop);
-
+ bool setLayerStack(uint32_t layerStack);
+
void commitTransaction();
bool requestTransaction();
void forceVisibilityTransaction();
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 8da2543..b70c720 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -1572,6 +1572,10 @@ uint32_t SurfaceFlinger::setClientStateLocked(
if (layer->setCrop(s.crop))
flags |= eTraversalNeeded;
}
+ if (what & eLayerStackChanged) {
+ if (layer->setLayerStack(s.layerStack))
+ flags |= eTraversalNeeded;
+ }
}
return flags;
}