diff options
author | Mathias Agopian <pixelflinger@google.com> | 2010-04-05 16:21:53 -0700 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2010-04-20 13:36:29 -0700 |
commit | 6bb5ebaa0305a30b5037f6533b3b989e0437d26c (patch) | |
tree | 68048832ea2c2560a94bf506647e9fee0357f548 /libs/surfaceflinger_client | |
parent | 796c5fc6abf01b1864223156d578288657fe9923 (diff) | |
download | frameworks_base-6bb5ebaa0305a30b5037f6533b3b989e0437d26c.zip frameworks_base-6bb5ebaa0305a30b5037f6533b3b989e0437d26c.tar.gz frameworks_base-6bb5ebaa0305a30b5037f6533b3b989e0437d26c.tar.bz2 |
add support for up to 16 buffers per surface
also increase the dirtyregion size from 1 to 6 rectangles.
Overall we now need 27KiB process instead of 4KiB
Change-Id: Iebda5565015158f49d9ca8dbcf55e6ad04855be3
Diffstat (limited to 'libs/surfaceflinger_client')
-rw-r--r-- | libs/surfaceflinger_client/SharedBufferStack.cpp | 42 |
1 files changed, 34 insertions, 8 deletions
diff --git a/libs/surfaceflinger_client/SharedBufferStack.cpp b/libs/surfaceflinger_client/SharedBufferStack.cpp index a17e8ac..5c4f920 100644 --- a/libs/surfaceflinger_client/SharedBufferStack.cpp +++ b/libs/surfaceflinger_client/SharedBufferStack.cpp @@ -73,13 +73,25 @@ status_t SharedBufferStack::setDirtyRegion(int buffer, const Region& dirty) return BAD_INDEX; // in the current implementation we only send a single rectangle - const Rect bounds(dirty.getBounds()); + size_t count; + Rect const* r = dirty.getArray(&count); FlatRegion& reg(dirtyRegion[buffer]); - reg.count = 1; - reg.rects[0] = uint16_t(bounds.left); - reg.rects[1] = uint16_t(bounds.top); - reg.rects[2] = uint16_t(bounds.right); - reg.rects[3] = uint16_t(bounds.bottom); + if (count > FlatRegion::NUM_RECT_MAX) { + const Rect bounds(dirty.getBounds()); + reg.count = 1; + reg.rects[0] = uint16_t(bounds.left); + reg.rects[1] = uint16_t(bounds.top); + reg.rects[2] = uint16_t(bounds.right); + reg.rects[3] = uint16_t(bounds.bottom); + } else { + reg.count = count; + for (size_t i=0 ; i<count ; i++) { + reg.rects[i*4 + 0] = uint16_t(r[i].left); + reg.rects[i*4 + 1] = uint16_t(r[i].top); + reg.rects[i*4 + 2] = uint16_t(r[i].right); + reg.rects[i*4 + 3] = uint16_t(r[i].bottom); + } + } return NO_ERROR; } @@ -90,7 +102,21 @@ Region SharedBufferStack::getDirtyRegion(int buffer) const return res; const FlatRegion& reg(dirtyRegion[buffer]); - res.set(Rect(reg.rects[0], reg.rects[1], reg.rects[2], reg.rects[3])); + if (reg.count > FlatRegion::NUM_RECT_MAX) + return res; + + if (reg.count == 1) { + res.set(Rect(reg.rects[0], reg.rects[1], reg.rects[2], reg.rects[3])); + } else { + for (size_t i=0 ; i<reg.count ; i++) { + const Rect r( + reg.rects[i*4 + 0], + reg.rects[i*4 + 1], + reg.rects[i*4 + 2], + reg.rects[i*4 + 3]); + res.orSelf(r); + } + } return res; } @@ -280,7 +306,7 @@ ssize_t SharedBufferClient::dequeue() { SharedBufferStack& stack( *mSharedStack ); - if (stack.head == tail && stack.available == 2) { + if (stack.head == tail && stack.available == mNumBuffers) { LOGW("dequeue: tail=%d, head=%d, avail=%d, queued=%d", tail, stack.head, stack.available, stack.queued); } |