SurfaceFlinger: Remove display freezing code

This change removes the dead code from SurfaceFlinger that resulted from
disabling support for freezing the display.

Change-Id: I4e5ff00c94b4c7a79af2f65c9850c135210068ed
This commit is contained in:
Jamie Gennis 2011-10-14 16:44:08 -07:00
parent 23c2c5d1c6
commit a402c4c991
5 changed files with 5 additions and 157 deletions

View File

@ -146,8 +146,6 @@ public:
GET_CBLK,
SET_TRANSACTION_STATE,
SET_ORIENTATION,
FREEZE_DISPLAY,
UNFREEZE_DISPLAY,
CAPTURE_SCREEN,
TURN_ELECTRON_BEAM_OFF,
TURN_ELECTRON_BEAM_ON,

View File

@ -368,18 +368,6 @@ uint32_t Layer::doTransaction(uint32_t flags)
mCurrentScalingMode);
if (!isFixedSize()) {
// we're being resized and there is a freeze display request,
// acquire a freeze lock, so that the screen stays put
// until we've redrawn at the new size; this is to avoid
// glitches upon orientation changes.
if (mFlinger->hasFreezeRequest()) {
// if the surface is hidden, don't try to acquire the
// freeze lock, since hidden surfaces may never redraw
if (!(front.flags & ISurfaceComposer::eLayerHidden)) {
mFreezeLock = mFlinger->getFreezeLock();
}
}
// this will make sure LayerBase::doTransaction doesn't update
// the drawing state's size
Layer::State& editDraw(mDrawingState);
@ -393,14 +381,6 @@ uint32_t Layer::doTransaction(uint32_t flags)
temp.requested_h);
}
if (temp.sequence != front.sequence) {
if (temp.flags & ISurfaceComposer::eLayerHidden || temp.alpha == 0) {
// this surface is now hidden, so it shouldn't hold a freeze lock
// (it may never redraw, which is fine if it is hidden)
mFreezeLock.clear();
}
}
return LayerBase::doTransaction(flags);
}
@ -474,7 +454,7 @@ void Layer::lockPageFlip(bool& recomputeVisibleRegions)
glTexParameterx(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameterx(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
// update the layer size and release freeze-lock
// update the layer size if needed
const Layer::State& front(drawingState());
// FIXME: mPostedDirtyRegion = dirty & bounds
@ -511,9 +491,6 @@ void Layer::lockPageFlip(bool& recomputeVisibleRegions)
// recompute visible region
recomputeVisibleRegions = true;
// we now have the correct size, unfreeze the screen
mFreezeLock.clear();
}
LOGD_IF(DEBUG_RESIZE,
@ -546,11 +523,6 @@ void Layer::unlockPageFlip(
dirtyRegion.andSelf(visibleRegionScreen);
outDirtyRegion.orSelf(dirtyRegion);
}
if (visibleRegionScreen.isEmpty()) {
// an invisible layer should not hold a freeze-lock
// (because it may never be updated and therefore never release it)
mFreezeLock.clear();
}
}
void Layer::dump(String8& result, char* buffer, size_t SIZE) const
@ -568,9 +540,9 @@ void Layer::dump(String8& result, char* buffer, size_t SIZE) const
snprintf(buffer, SIZE,
" "
"format=%2d, activeBuffer=[%4ux%4u:%4u,%3X],"
" freezeLock=%p, transform-hint=0x%02x, queued-frames=%d\n",
" transform-hint=0x%02x, queued-frames=%d\n",
mFormat, w0, h0, s0,f0,
getFreezeLock().get(), getTransformHint(), mQueuedFrames);
getTransformHint(), mQueuedFrames);
result.append(buffer);

View File

@ -39,7 +39,6 @@ namespace android {
// ---------------------------------------------------------------------------
class FreezeLock;
class Client;
class GLExtensions;
@ -80,7 +79,6 @@ public:
virtual wp<IBinder> getSurfaceTextureBinder() const;
// only for debugging
inline const sp<FreezeLock>& getFreezeLock() const { return mFreezeLock; }
inline const sp<GraphicBuffer>& getActiveBuffer() const { return mActiveBuffer; }
protected:
@ -124,9 +122,6 @@ private:
bool mProtectedByApp; // application requires protected path to external sink
Region mPostedDirtyRegion;
// page-flip thread and transaction thread (currently main thread)
sp<FreezeLock> mFreezeLock;
// binder thread, transaction thread
mutable Mutex mLock;
};

View File

@ -84,10 +84,7 @@ SurfaceFlinger::SurfaceFlinger()
mBootTime(systemTime()),
mVisibleRegionsDirty(false),
mHwWorkListDirty(false),
mFreezeDisplay(false),
mElectronBeamAnimationMode(0),
mFreezeCount(0),
mFreezeDisplayTime(0),
mDebugRegion(0),
mDebugBackground(0),
mDebugDDMS(0),
@ -190,11 +187,6 @@ void SurfaceFlinger::binderDied(const wp<IBinder>& who)
{
// the window manager died on us. prepare its eulogy.
// unfreeze the screen in case it was... frozen
mFreezeDisplayTime = 0;
mFreezeCount = 0;
mFreezeDisplay = false;
// reset screen orientation
setOrientation(0, eOrientationDefault, 0);
@ -322,33 +314,7 @@ void SurfaceFlinger::waitForEvent()
{
while (true) {
nsecs_t timeout = -1;
const nsecs_t freezeDisplayTimeout = ms2ns(5000);
if (UNLIKELY(isFrozen())) {
// wait 5 seconds
const nsecs_t now = systemTime();
if (mFreezeDisplayTime == 0) {
mFreezeDisplayTime = now;
}
nsecs_t waitTime = freezeDisplayTimeout - (now - mFreezeDisplayTime);
timeout = waitTime>0 ? waitTime : 0;
}
sp<MessageBase> msg = mEventQueue.waitMessage(timeout);
// see if we timed out
if (isFrozen()) {
const nsecs_t now = systemTime();
nsecs_t frozenTime = (now - mFreezeDisplayTime);
if (frozenTime >= freezeDisplayTimeout) {
// we timed out and are still frozen
LOGW("timeout expired mFreezeDisplay=%d, mFreezeCount=%d",
mFreezeDisplay, mFreezeCount);
mFreezeDisplayTime = 0;
mFreezeCount = 0;
mFreezeDisplay = false;
}
}
if (msg != 0) {
switch (msg->what) {
case MessageQueue::INVALIDATE:
@ -451,7 +417,7 @@ bool SurfaceFlinger::threadLoop()
}
const DisplayHardware& hw(graphicPlane(0).displayHardware());
if (LIKELY(hw.canDraw() && !isFrozen())) {
if (LIKELY(hw.canDraw())) {
// repaint the framebuffer (if needed)
const int index = hw.getCurrentBufferIndex();
@ -582,13 +548,6 @@ void SurfaceFlinger::handleTransactionLocked(uint32_t transactionFlags)
mDirtyRegion.set(hw.bounds());
}
if (mCurrentState.freezeDisplay != mDrawingState.freezeDisplay) {
// freezing or unfreezing the display -> trigger animation if needed
mFreezeDisplay = mCurrentState.freezeDisplay;
if (mFreezeDisplay)
mFreezeDisplayTime = 0;
}
if (currentLayers.size() > mDrawingState.layersSortedByZ.size()) {
// layers have been added
mVisibleRegionsDirty = true;
@ -614,11 +573,6 @@ void SurfaceFlinger::handleTransactionLocked(uint32_t transactionFlags)
commitTransaction();
}
sp<FreezeLock> SurfaceFlinger::getFreezeLock() const
{
return new FreezeLock(const_cast<SurfaceFlinger *>(this));
}
void SurfaceFlinger::computeVisibleRegions(
const LayerVector& currentLayers, Region& dirtyRegion, Region& opaqueRegion)
{
@ -1276,34 +1230,6 @@ void SurfaceFlinger::setTransactionState(const Vector<ComposerState>& state,
}
}
status_t SurfaceFlinger::freezeDisplay(DisplayID dpy, uint32_t flags)
{
if (UNLIKELY(uint32_t(dpy) >= DISPLAY_COUNT))
return BAD_VALUE;
Mutex::Autolock _l(mStateLock);
mCurrentState.freezeDisplay = 1;
setTransactionFlags(eTransactionNeeded);
// flags is intended to communicate some sort of animation behavior
// (for instance fading)
return NO_ERROR;
}
status_t SurfaceFlinger::unfreezeDisplay(DisplayID dpy, uint32_t flags)
{
if (UNLIKELY(uint32_t(dpy) >= DISPLAY_COUNT))
return BAD_VALUE;
Mutex::Autolock _l(mStateLock);
mCurrentState.freezeDisplay = 0;
setTransactionFlags(eTransactionNeeded);
// flags is intended to communicate some sort of animation behavior
// (for instance fading)
return NO_ERROR;
}
int SurfaceFlinger::setOrientation(DisplayID dpy,
int orientation, uint32_t flags)
{
@ -1608,8 +1534,7 @@ status_t SurfaceFlinger::dump(int fd, const Vector<String16>& args)
mWormholeRegion.dump(result, "WormholeRegion");
const DisplayHardware& hw(graphicPlane(0).displayHardware());
snprintf(buffer, SIZE,
" display frozen: %s, freezeCount=%d, orientation=%d, canDraw=%d\n",
mFreezeDisplay?"yes":"no", mFreezeCount,
" orientation=%d, canDraw=%d\n",
mCurrentState.orientation, hw.canDraw());
result.append(buffer);
snprintf(buffer, SIZE,
@ -1662,8 +1587,6 @@ status_t SurfaceFlinger::onTransact(
case CREATE_CONNECTION:
case SET_TRANSACTION_STATE:
case SET_ORIENTATION:
case FREEZE_DISPLAY:
case UNFREEZE_DISPLAY:
case BOOT_FINISHED:
case TURN_ELECTRON_BEAM_OFF:
case TURN_ELECTRON_BEAM_ON:
@ -1735,10 +1658,6 @@ status_t SurfaceFlinger::onTransact(
GraphicLog::getInstance().setEnabled(enabled);
return NO_ERROR;
}
case 1007: // set mFreezeCount
mFreezeCount = data.readInt32();
mFreezeDisplayTime = 0;
return NO_ERROR;
case 1008: // toggle use of hw composer
n = data.readInt32();
mDebugDisableHWC = n ? 1 : 0;

View File

@ -46,7 +46,6 @@ namespace android {
class Client;
class DisplayHardware;
class FreezeLock;
class Layer;
class LayerDim;
struct surface_flinger_cblk_t;
@ -169,8 +168,6 @@ public:
virtual void bootFinished();
virtual void setTransactionState(const Vector<ComposerState>& state,
int orientation, uint32_t flags);
virtual status_t freezeDisplay(DisplayID dpy, uint32_t flags);
virtual status_t unfreezeDisplay(DisplayID dpy, uint32_t flags);
virtual int setOrientation(DisplayID dpy, int orientation, uint32_t flags);
virtual bool authenticateSurfaceTexture(const sp<ISurfaceTexture>& surface) const;
@ -244,12 +241,10 @@ private:
struct State {
State() {
orientation = ISurfaceComposer::eOrientationDefault;
freezeDisplay = 0;
}
LayerVector layersSortedByZ;
uint8_t orientation;
uint8_t orientationFlags;
uint8_t freezeDisplay;
};
virtual bool threadLoop();
@ -308,20 +303,6 @@ private:
status_t renderScreenToTextureLocked(DisplayID dpy,
GLuint* textureName, GLfloat* uOut, GLfloat* vOut);
friend class FreezeLock;
sp<FreezeLock> getFreezeLock() const;
inline void incFreezeCount() {
if (mFreezeCount == 0)
mFreezeDisplayTime = 0;
mFreezeCount++;
}
inline void decFreezeCount() { if (mFreezeCount > 0) mFreezeCount--; }
inline bool hasFreezeRequest() const { return mFreezeDisplay; }
inline bool isFrozen() const {
return (mFreezeDisplay || mFreezeCount>0) && mBootFinished;
}
void debugFlashRegions();
void debugShowFPS() const;
void drawWormhole() const;
@ -364,10 +345,7 @@ private:
Region mWormholeRegion;
bool mVisibleRegionsDirty;
bool mHwWorkListDirty;
bool mFreezeDisplay;
int32_t mElectronBeamAnimationMode;
int32_t mFreezeCount;
nsecs_t mFreezeDisplayTime;
Vector< sp<LayerBase> > mVisibleLayersSortedByZ;
@ -402,20 +380,6 @@ private:
volatile int32_t mSecureFrameBuffer;
};
// ---------------------------------------------------------------------------
class FreezeLock : public LightRefBase<FreezeLock> {
SurfaceFlinger* mFlinger;
public:
FreezeLock(SurfaceFlinger* flinger)
: mFlinger(flinger) {
mFlinger->incFreezeCount();
}
~FreezeLock() {
mFlinger->decFreezeCount();
}
};
// ---------------------------------------------------------------------------
}; // namespace android