diff options
author | Mathias Agopian <mathias@google.com> | 2010-05-07 15:58:44 -0700 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2010-05-12 17:28:20 -0700 |
commit | b5b7f260da2c1a2a82e0311e2015d49a82f43667 (patch) | |
tree | 69976a2b04a39bfce83035777ea8d35e4a5fc401 /libs/surfaceflinger/Layer.cpp | |
parent | d606de6bb6877dc4ab93ec0be0c6bda4a8ee1ce8 (diff) | |
download | frameworks_native-b5b7f260da2c1a2a82e0311e2015d49a82f43667.zip frameworks_native-b5b7f260da2c1a2a82e0311e2015d49a82f43667.tar.gz frameworks_native-b5b7f260da2c1a2a82e0311e2015d49a82f43667.tar.bz2 |
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 71573ac..1fe997d 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; +} + // --------------------------------------------------------------------------- |