diff options
author | 2010-05-07 15:58:44 -0700 | |
---|---|---|
committer | 2010-05-12 17:28:20 -0700 | |
commit | 59751dbf7d8f12aeb5c4c07719b7dbbf1f9b5d4b (patch) | |
tree | a1f1d7119a8109d06cfc2f24b26284ff7627de7a /libs/surfaceflinger/Layer.cpp | |
parent | 9f2c4fd9a14ea79e4cbbd3ab8925794711a6411c (diff) |
SharedBufferStack now can grow up to 16 buffers.
there is a new resize() api, which currently only allows growing.
Change-Id: Ia37b81b73be466d2491ffed7f3a23cd8e113c6fe
Diffstat (limited to 'libs/surfaceflinger/Layer.cpp')
-rw-r--r-- | libs/surfaceflinger/Layer.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/libs/surfaceflinger/Layer.cpp b/libs/surfaceflinger/Layer.cpp index 71573ac64e64..1fe997d415ea 100644 --- a/libs/surfaceflinger/Layer.cpp +++ b/libs/surfaceflinger/Layer.cpp @@ -208,6 +208,30 @@ void Layer::onDraw(const Region& clip) const drawWithOpenGL(clip, tex); } + +status_t Layer::setBufferCount(int bufferCount) +{ + // this ensures our client doesn't go away while we're accessing + // the shared area. + sp<Client> ourClient(client.promote()); + if (ourClient == 0) { + // oops, the client is already gone + return DEAD_OBJECT; + } + + status_t err; + + // FIXME: resize() below is NOT thread-safe, we need to synchronize + // the users of lcblk in our process (ie: retire), and we assume the + // client is not mucking with the SharedStack, which is only enforced + // by construction, therefore we need to protect ourselves against + // buggy and malicious client (as always) + + err = lcblk->resize(bufferCount); + + return err; +} + sp<GraphicBuffer> Layer::requestBuffer(int index, int usage) { sp<GraphicBuffer> buffer; @@ -642,6 +666,16 @@ sp<GraphicBuffer> Layer::SurfaceLayer::requestBuffer(int index, int usage) return buffer; } +status_t Layer::SurfaceLayer::setBufferCount(int bufferCount) +{ + status_t err = DEAD_OBJECT; + sp<Layer> owner(getOwner()); + if (owner != 0) { + err = owner->setBufferCount(bufferCount); + } + return err; +} + // --------------------------------------------------------------------------- |