clean-up unneeded code
now that we removed the notion of a "inUse" buffer in surfaceflinger a lot of code can be simplified / removed. noteworthy, the whole concept of "unlockClient" wrt. "compositionComplete" is also gone. Change-Id: I210413d4c8c0998dae05c8620ebfc895d3e6233d
This commit is contained in:
parent
0b181742aa
commit
2bd1d95efe
|
@ -105,7 +105,7 @@ public:
|
||||||
volatile int32_t head; // server's current front buffer
|
volatile int32_t head; // server's current front buffer
|
||||||
volatile int32_t available; // number of dequeue-able buffers
|
volatile int32_t available; // number of dequeue-able buffers
|
||||||
volatile int32_t queued; // number of buffers waiting for post
|
volatile int32_t queued; // number of buffers waiting for post
|
||||||
volatile int32_t inUse; // buffer currently in use by SF
|
volatile int32_t reserved1;
|
||||||
volatile status_t status; // surface's status code
|
volatile status_t status; // surface's status code
|
||||||
|
|
||||||
// not part of the conditions
|
// not part of the conditions
|
||||||
|
@ -275,7 +275,6 @@ public:
|
||||||
int32_t identity);
|
int32_t identity);
|
||||||
|
|
||||||
ssize_t retireAndLock();
|
ssize_t retireAndLock();
|
||||||
status_t unlock(int buffer);
|
|
||||||
void setStatus(status_t status);
|
void setStatus(status_t status);
|
||||||
status_t reallocateAll();
|
status_t reallocateAll();
|
||||||
status_t reallocateAllExcept(int buffer);
|
status_t reallocateAllExcept(int buffer);
|
||||||
|
@ -356,12 +355,6 @@ private:
|
||||||
inline const char* name() const { return "BuffersAvailableCondition"; }
|
inline const char* name() const { return "BuffersAvailableCondition"; }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct UnlockUpdate : public UpdateBase {
|
|
||||||
const int lockedBuffer;
|
|
||||||
inline UnlockUpdate(SharedBufferBase* sbb, int lockedBuffer);
|
|
||||||
inline ssize_t operator()();
|
|
||||||
};
|
|
||||||
|
|
||||||
struct RetireUpdate : public UpdateBase {
|
struct RetireUpdate : public UpdateBase {
|
||||||
const int numBuffers;
|
const int numBuffers;
|
||||||
inline RetireUpdate(SharedBufferBase* sbb, int numBuffers);
|
inline RetireUpdate(SharedBufferBase* sbb, int numBuffers);
|
||||||
|
|
|
@ -58,7 +58,6 @@ SharedBufferStack::SharedBufferStack()
|
||||||
|
|
||||||
void SharedBufferStack::init(int32_t i)
|
void SharedBufferStack::init(int32_t i)
|
||||||
{
|
{
|
||||||
inUse = -2;
|
|
||||||
status = NO_ERROR;
|
status = NO_ERROR;
|
||||||
identity = i;
|
identity = i;
|
||||||
}
|
}
|
||||||
|
@ -199,9 +198,9 @@ String8 SharedBufferBase::dump(char const* prefix) const
|
||||||
SharedBufferStack& stack( *mSharedStack );
|
SharedBufferStack& stack( *mSharedStack );
|
||||||
snprintf(buffer, SIZE,
|
snprintf(buffer, SIZE,
|
||||||
"%s[ head=%2d, available=%2d, queued=%2d ] "
|
"%s[ head=%2d, available=%2d, queued=%2d ] "
|
||||||
"reallocMask=%08x, inUse=%2d, identity=%d, status=%d",
|
"reallocMask=%08x, identity=%d, status=%d",
|
||||||
prefix, stack.head, stack.available, stack.queued,
|
prefix, stack.head, stack.available, stack.queued,
|
||||||
stack.reallocMask, stack.inUse, stack.identity, stack.status);
|
stack.reallocMask, stack.identity, stack.status);
|
||||||
result.append(buffer);
|
result.append(buffer);
|
||||||
result.append("\n");
|
result.append("\n");
|
||||||
return result;
|
return result;
|
||||||
|
@ -302,22 +301,6 @@ ssize_t SharedBufferClient::CancelUpdate::operator()() {
|
||||||
return NO_ERROR;
|
return NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
SharedBufferServer::UnlockUpdate::UnlockUpdate(
|
|
||||||
SharedBufferBase* sbb, int lockedBuffer)
|
|
||||||
: UpdateBase(sbb), lockedBuffer(lockedBuffer) {
|
|
||||||
}
|
|
||||||
ssize_t SharedBufferServer::UnlockUpdate::operator()() {
|
|
||||||
if (stack.inUse != lockedBuffer) {
|
|
||||||
LOGE("unlocking %d, but currently locked buffer is %d "
|
|
||||||
"(identity=%d, token=%d)",
|
|
||||||
lockedBuffer, stack.inUse,
|
|
||||||
stack.identity, stack.token);
|
|
||||||
return BAD_VALUE;
|
|
||||||
}
|
|
||||||
android_atomic_write(-1, &stack.inUse);
|
|
||||||
return NO_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
SharedBufferServer::RetireUpdate::RetireUpdate(
|
SharedBufferServer::RetireUpdate::RetireUpdate(
|
||||||
SharedBufferBase* sbb, int numBuffers)
|
SharedBufferBase* sbb, int numBuffers)
|
||||||
: UpdateBase(sbb), numBuffers(numBuffers) {
|
: UpdateBase(sbb), numBuffers(numBuffers) {
|
||||||
|
@ -327,9 +310,6 @@ ssize_t SharedBufferServer::RetireUpdate::operator()() {
|
||||||
if (uint32_t(head) >= SharedBufferStack::NUM_BUFFER_MAX)
|
if (uint32_t(head) >= SharedBufferStack::NUM_BUFFER_MAX)
|
||||||
return BAD_VALUE;
|
return BAD_VALUE;
|
||||||
|
|
||||||
// Preventively lock the current buffer before updating queued.
|
|
||||||
android_atomic_write(stack.headBuf, &stack.inUse);
|
|
||||||
|
|
||||||
// Decrement the number of queued buffers
|
// Decrement the number of queued buffers
|
||||||
int32_t queued;
|
int32_t queued;
|
||||||
do {
|
do {
|
||||||
|
@ -345,7 +325,6 @@ ssize_t SharedBufferServer::RetireUpdate::operator()() {
|
||||||
head = (head + 1) % numBuffers;
|
head = (head + 1) % numBuffers;
|
||||||
const int8_t headBuf = stack.index[head];
|
const int8_t headBuf = stack.index[head];
|
||||||
stack.headBuf = headBuf;
|
stack.headBuf = headBuf;
|
||||||
android_atomic_write(headBuf, &stack.inUse);
|
|
||||||
|
|
||||||
// head is only modified here, so we don't need to use cmpxchg
|
// head is only modified here, so we don't need to use cmpxchg
|
||||||
android_atomic_write(head, &stack.head);
|
android_atomic_write(head, &stack.head);
|
||||||
|
@ -546,13 +525,6 @@ ssize_t SharedBufferServer::retireAndLock()
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t SharedBufferServer::unlock(int buf)
|
|
||||||
{
|
|
||||||
UnlockUpdate update(this, buf);
|
|
||||||
status_t err = updateCondition( update );
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SharedBufferServer::setStatus(status_t status)
|
void SharedBufferServer::setStatus(status_t status)
|
||||||
{
|
{
|
||||||
if (status < NO_ERROR) {
|
if (status < NO_ERROR) {
|
||||||
|
@ -694,12 +666,6 @@ status_t SharedBufferServer::shrink(int newNumBuffers)
|
||||||
stack.head = 0;
|
stack.head = 0;
|
||||||
stack.headBuf = 0;
|
stack.headBuf = 0;
|
||||||
|
|
||||||
// If one of the buffers is in use it must be the head buffer, which we are
|
|
||||||
// renaming to buffer 0.
|
|
||||||
if (stack.inUse > 0) {
|
|
||||||
stack.inUse = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Free the buffers from the end of the list that are no longer needed.
|
// Free the buffers from the end of the list that are no longer needed.
|
||||||
for (int i = newNumBuffers; i < mNumBuffers; i++) {
|
for (int i = newNumBuffers; i < mNumBuffers; i++) {
|
||||||
mBufferList.remove(i);
|
mBufferList.remove(i);
|
||||||
|
|
|
@ -691,22 +691,6 @@ void Layer::unlockPageFlip(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Layer::finishPageFlip()
|
|
||||||
{
|
|
||||||
ClientRef::Access sharedClient(mUserClientRef);
|
|
||||||
SharedBufferServer* lcblk(sharedClient.get());
|
|
||||||
if (lcblk) {
|
|
||||||
int buf = mBufferManager.getActiveBufferIndex();
|
|
||||||
if (buf >= 0) {
|
|
||||||
status_t err = lcblk->unlock( buf );
|
|
||||||
LOGE_IF(err!=NO_ERROR,
|
|
||||||
"layer %p, buffer=%d wasn't locked!",
|
|
||||||
this, buf);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Layer::dump(String8& result, char* buffer, size_t SIZE) const
|
void Layer::dump(String8& result, char* buffer, size_t SIZE) const
|
||||||
{
|
{
|
||||||
LayerBaseClient::dump(result, buffer, SIZE);
|
LayerBaseClient::dump(result, buffer, SIZE);
|
||||||
|
|
|
@ -75,7 +75,6 @@ public:
|
||||||
virtual uint32_t doTransaction(uint32_t transactionFlags);
|
virtual uint32_t doTransaction(uint32_t transactionFlags);
|
||||||
virtual void lockPageFlip(bool& recomputeVisibleRegions);
|
virtual void lockPageFlip(bool& recomputeVisibleRegions);
|
||||||
virtual void unlockPageFlip(const Transform& planeTransform, Region& outDirtyRegion);
|
virtual void unlockPageFlip(const Transform& planeTransform, Region& outDirtyRegion);
|
||||||
virtual void finishPageFlip();
|
|
||||||
virtual bool needsBlending() const { return mNeedsBlending; }
|
virtual bool needsBlending() const { return mNeedsBlending; }
|
||||||
virtual bool needsDithering() const { return mNeedsDithering; }
|
virtual bool needsDithering() const { return mNeedsDithering; }
|
||||||
virtual bool needsFiltering() const;
|
virtual bool needsFiltering() const;
|
||||||
|
|
|
@ -273,10 +273,6 @@ void LayerBase::unlockPageFlip(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LayerBase::finishPageFlip()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void LayerBase::invalidate()
|
void LayerBase::invalidate()
|
||||||
{
|
{
|
||||||
if ((android_atomic_or(1, &mInvalidate)&1) == 0) {
|
if ((android_atomic_or(1, &mInvalidate)&1) == 0) {
|
||||||
|
|
|
@ -173,11 +173,6 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual void unlockPageFlip(const Transform& planeTransform, Region& outDirtyRegion);
|
virtual void unlockPageFlip(const Transform& planeTransform, Region& outDirtyRegion);
|
||||||
|
|
||||||
/**
|
|
||||||
* finishPageFlip - called after all surfaces have drawn.
|
|
||||||
*/
|
|
||||||
virtual void finishPageFlip();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* needsBlending - true if this surface needs blending
|
* needsBlending - true if this surface needs blending
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -394,14 +394,10 @@ bool SurfaceFlinger::threadLoop()
|
||||||
logger.log(GraphicLog::SF_SWAP_BUFFERS, index);
|
logger.log(GraphicLog::SF_SWAP_BUFFERS, index);
|
||||||
postFramebuffer();
|
postFramebuffer();
|
||||||
|
|
||||||
logger.log(GraphicLog::SF_UNLOCK_CLIENTS, index);
|
|
||||||
unlockClients();
|
|
||||||
|
|
||||||
logger.log(GraphicLog::SF_REPAINT_DONE, index);
|
logger.log(GraphicLog::SF_REPAINT_DONE, index);
|
||||||
} else {
|
} else {
|
||||||
// pretend we did the post
|
// pretend we did the post
|
||||||
hw.compositionComplete();
|
hw.compositionComplete();
|
||||||
unlockClients();
|
|
||||||
usleep(16667); // 60 fps period
|
usleep(16667); // 60 fps period
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -920,17 +916,6 @@ void SurfaceFlinger::composeSurfaces(const Region& dirty)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SurfaceFlinger::unlockClients()
|
|
||||||
{
|
|
||||||
const LayerVector& drawingLayers(mDrawingState.layersSortedByZ);
|
|
||||||
const size_t count = drawingLayers.size();
|
|
||||||
sp<LayerBase> const* const layers = drawingLayers.array();
|
|
||||||
for (size_t i=0 ; i<count ; ++i) {
|
|
||||||
const sp<LayerBase>& layer = layers[i];
|
|
||||||
layer->finishPageFlip();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void SurfaceFlinger::debugFlashRegions()
|
void SurfaceFlinger::debugFlashRegions()
|
||||||
{
|
{
|
||||||
const DisplayHardware& hw(graphicPlane(0).displayHardware());
|
const DisplayHardware& hw(graphicPlane(0).displayHardware());
|
||||||
|
|
|
@ -314,7 +314,6 @@ private:
|
||||||
void handleRepaint();
|
void handleRepaint();
|
||||||
void postFramebuffer();
|
void postFramebuffer();
|
||||||
void composeSurfaces(const Region& dirty);
|
void composeSurfaces(const Region& dirty);
|
||||||
void unlockClients();
|
|
||||||
|
|
||||||
|
|
||||||
ssize_t addClientLayer(const sp<Client>& client,
|
ssize_t addClientLayer(const sp<Client>& client,
|
||||||
|
|
Loading…
Reference in New Issue