Loading include/private/ui/SharedBufferStack.h +20 −8 Original line number Diff line number Diff line Loading @@ -69,12 +69,6 @@ class SharedClient; // ---------------------------------------------------------------------------- struct FlatRegion { // 12 bytes static const unsigned int NUM_RECT_MAX = 1; uint32_t count; uint16_t rects[4*NUM_RECT_MAX]; }; // should be 128 bytes (32 longs) class SharedBufferStack { Loading @@ -84,6 +78,18 @@ class SharedBufferStack friend class SharedBufferServer; public: struct FlatRegion { // 12 bytes static const unsigned int NUM_RECT_MAX = 1; uint32_t count; uint16_t rects[4*NUM_RECT_MAX]; }; struct Statistics { // 4 longs typedef int32_t usecs_t; usecs_t totalTime; usecs_t reserved[3]; }; SharedBufferStack(); void init(int32_t identity); status_t setDirtyRegion(int buffer, const Region& reg); Loading @@ -100,7 +106,8 @@ public: volatile int32_t reallocMask; int32_t identity; // surface's identity (const) int32_t reserved32[13]; int32_t reserved32[9]; Statistics stats; FlatRegion dirtyRegion[NUM_BUFFER_MAX]; // 12*4=48 bytes }; Loading Loading @@ -257,6 +264,8 @@ private: }; int32_t tail; // statistics... nsecs_t mDequeueTime[NUM_BUFFER_MAX]; }; // ---------------------------------------------------------------------------- Loading @@ -275,6 +284,9 @@ public: Region getDirtyRegion(int buffer) const; SharedBufferStack::Statistics getStats() const; private: struct UnlockUpdate : public UpdateBase { const int lockedBuffer; Loading libs/surfaceflinger/SurfaceFlinger.cpp +3 −2 Original line number Diff line number Diff line Loading @@ -1521,6 +1521,7 @@ status_t SurfaceFlinger::dump(int fd, const Vector<String16>& args) /*** Layer ***/ sp<Layer> l = LayerBase::dynamicCast< Layer* >(layer.get()); if (l != 0) { SharedBufferStack::Statistics stats = l->lcblk->getStats(); result.append( l->lcblk->dump(" ") ); sp<const Buffer> buf0(l->getBuffer(0)); sp<const Buffer> buf1(l->getBuffer(1)); Loading @@ -1539,10 +1540,10 @@ status_t SurfaceFlinger::dump(int fd, const Vector<String16>& args) snprintf(buffer, SIZE, " " "format=%2d, [%3ux%3u:%3u] [%3ux%3u:%3u]," " freezeLock=%p\n", " freezeLock=%p, dq-q-time=%u us\n", l->pixelFormat(), w0, h0, s0, w1, h1, s1, l->getFreezeLock().get()); l->getFreezeLock().get(), stats.totalTime); result.append(buffer); buffer[0] = 0; } Loading libs/ui/SharedBufferStack.cpp +15 −1 Original line number Diff line number Diff line Loading @@ -277,6 +277,8 @@ ssize_t SharedBufferClient::dequeue() tail, stack.head, stack.available, stack.queued); } const nsecs_t dequeueTime = systemTime(SYSTEM_TIME_THREAD); //LOGD("[%d] about to dequeue a buffer", // mSharedStack->identity); DequeueCondition condition(this); Loading @@ -296,6 +298,8 @@ ssize_t SharedBufferClient::dequeue() LOGD_IF(DEBUG_ATOMICS, "dequeued=%d, tail=%d, %s", dequeued, tail, dump("").string()); mDequeueTime[dequeued] = dequeueTime; return dequeued; } Loading @@ -321,6 +325,9 @@ status_t SharedBufferClient::queue(int buf) QueueUpdate update(this); status_t err = updateCondition( update ); LOGD_IF(DEBUG_ATOMICS, "queued=%d, %s", buf, dump("").string()); SharedBufferStack& stack( *mSharedStack ); const nsecs_t now = systemTime(SYSTEM_TIME_THREAD); stack.stats.totalTime = ns2us(now - mDequeueTime[buf]); return err; } Loading Loading @@ -393,5 +400,12 @@ Region SharedBufferServer::getDirtyRegion(int buffer) const return stack.getDirtyRegion(buffer); } SharedBufferStack::Statistics SharedBufferServer::getStats() const { SharedBufferStack& stack( *mSharedStack ); return stack.stats; } // --------------------------------------------------------------------------- }; // namespace android Loading
include/private/ui/SharedBufferStack.h +20 −8 Original line number Diff line number Diff line Loading @@ -69,12 +69,6 @@ class SharedClient; // ---------------------------------------------------------------------------- struct FlatRegion { // 12 bytes static const unsigned int NUM_RECT_MAX = 1; uint32_t count; uint16_t rects[4*NUM_RECT_MAX]; }; // should be 128 bytes (32 longs) class SharedBufferStack { Loading @@ -84,6 +78,18 @@ class SharedBufferStack friend class SharedBufferServer; public: struct FlatRegion { // 12 bytes static const unsigned int NUM_RECT_MAX = 1; uint32_t count; uint16_t rects[4*NUM_RECT_MAX]; }; struct Statistics { // 4 longs typedef int32_t usecs_t; usecs_t totalTime; usecs_t reserved[3]; }; SharedBufferStack(); void init(int32_t identity); status_t setDirtyRegion(int buffer, const Region& reg); Loading @@ -100,7 +106,8 @@ public: volatile int32_t reallocMask; int32_t identity; // surface's identity (const) int32_t reserved32[13]; int32_t reserved32[9]; Statistics stats; FlatRegion dirtyRegion[NUM_BUFFER_MAX]; // 12*4=48 bytes }; Loading Loading @@ -257,6 +264,8 @@ private: }; int32_t tail; // statistics... nsecs_t mDequeueTime[NUM_BUFFER_MAX]; }; // ---------------------------------------------------------------------------- Loading @@ -275,6 +284,9 @@ public: Region getDirtyRegion(int buffer) const; SharedBufferStack::Statistics getStats() const; private: struct UnlockUpdate : public UpdateBase { const int lockedBuffer; Loading
libs/surfaceflinger/SurfaceFlinger.cpp +3 −2 Original line number Diff line number Diff line Loading @@ -1521,6 +1521,7 @@ status_t SurfaceFlinger::dump(int fd, const Vector<String16>& args) /*** Layer ***/ sp<Layer> l = LayerBase::dynamicCast< Layer* >(layer.get()); if (l != 0) { SharedBufferStack::Statistics stats = l->lcblk->getStats(); result.append( l->lcblk->dump(" ") ); sp<const Buffer> buf0(l->getBuffer(0)); sp<const Buffer> buf1(l->getBuffer(1)); Loading @@ -1539,10 +1540,10 @@ status_t SurfaceFlinger::dump(int fd, const Vector<String16>& args) snprintf(buffer, SIZE, " " "format=%2d, [%3ux%3u:%3u] [%3ux%3u:%3u]," " freezeLock=%p\n", " freezeLock=%p, dq-q-time=%u us\n", l->pixelFormat(), w0, h0, s0, w1, h1, s1, l->getFreezeLock().get()); l->getFreezeLock().get(), stats.totalTime); result.append(buffer); buffer[0] = 0; } Loading
libs/ui/SharedBufferStack.cpp +15 −1 Original line number Diff line number Diff line Loading @@ -277,6 +277,8 @@ ssize_t SharedBufferClient::dequeue() tail, stack.head, stack.available, stack.queued); } const nsecs_t dequeueTime = systemTime(SYSTEM_TIME_THREAD); //LOGD("[%d] about to dequeue a buffer", // mSharedStack->identity); DequeueCondition condition(this); Loading @@ -296,6 +298,8 @@ ssize_t SharedBufferClient::dequeue() LOGD_IF(DEBUG_ATOMICS, "dequeued=%d, tail=%d, %s", dequeued, tail, dump("").string()); mDequeueTime[dequeued] = dequeueTime; return dequeued; } Loading @@ -321,6 +325,9 @@ status_t SharedBufferClient::queue(int buf) QueueUpdate update(this); status_t err = updateCondition( update ); LOGD_IF(DEBUG_ATOMICS, "queued=%d, %s", buf, dump("").string()); SharedBufferStack& stack( *mSharedStack ); const nsecs_t now = systemTime(SYSTEM_TIME_THREAD); stack.stats.totalTime = ns2us(now - mDequeueTime[buf]); return err; } Loading Loading @@ -393,5 +400,12 @@ Region SharedBufferServer::getDirtyRegion(int buffer) const return stack.getDirtyRegion(buffer); } SharedBufferStack::Statistics SharedBufferServer::getStats() const { SharedBufferStack& stack( *mSharedStack ); return stack.stats; } // --------------------------------------------------------------------------- }; // namespace android