diff options
author | Mathias Agopian <mathias@google.com> | 2012-05-23 17:50:31 -0700 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2012-05-23 18:01:33 -0700 |
commit | 702634a4dad85cfc292618ac91eda6c00f42b7c5 (patch) | |
tree | a87a1c2ab47bef60cfd15b1c38b5d6d79d4d34e1 | |
parent | 05cec9d1275fd939c2d1aec235dca2bdb8edef63 (diff) | |
download | frameworks_native-702634a4dad85cfc292618ac91eda6c00f42b7c5.zip frameworks_native-702634a4dad85cfc292618ac91eda6c00f42b7c5.tar.gz frameworks_native-702634a4dad85cfc292618ac91eda6c00f42b7c5.tar.bz2 |
refactoring in preparation for bug:6498869 fix
here we just shuffle a bit the code inside lockPageFlip(),
we move the code that handles the buffer size closer to the call
to updateTexImage(). no functionality change.
Change-Id: Ie3193cd86cd32cf3c89532449fd747d145ca0ab6
-rw-r--r-- | services/surfaceflinger/Layer.cpp | 89 |
1 files changed, 47 insertions, 42 deletions
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp index 722813d..5e527cd 100644 --- a/services/surfaceflinger/Layer.cpp +++ b/services/surfaceflinger/Layer.cpp @@ -535,58 +535,25 @@ void Layer::lockPageFlip(bool& recomputeVisibleRegions) // update the active buffer mActiveBuffer = mSurfaceTexture->getCurrentBuffer(); - mFrameLatencyNeeded = true; - - if (oldActiveBuffer == NULL && mActiveBuffer != NULL) { - // the first time we receive a buffer, we need to trigger a - // geometry invalidation. - mFlinger->invalidateHwcGeometry(); - } - - Rect crop(mSurfaceTexture->getCurrentCrop()); - const uint32_t transform(mSurfaceTexture->getCurrentTransform()); - const uint32_t scalingMode(mSurfaceTexture->getCurrentScalingMode()); - if ((crop != mCurrentCrop) || - (transform != mCurrentTransform) || - (scalingMode != mCurrentScalingMode)) - { - mCurrentCrop = crop; - mCurrentTransform = transform; - mCurrentScalingMode = scalingMode; - mFlinger->invalidateHwcGeometry(); - } uint32_t bufWidth = mActiveBuffer->getWidth(); uint32_t bufHeight = mActiveBuffer->getHeight(); - if (oldActiveBuffer != NULL) { - if (bufWidth != uint32_t(oldActiveBuffer->width) || - bufHeight != uint32_t(oldActiveBuffer->height)) { - mFlinger->invalidateHwcGeometry(); - } - } + const uint32_t transform(mSurfaceTexture->getCurrentTransform()); + const uint32_t scalingMode(mSurfaceTexture->getCurrentScalingMode()); - mCurrentOpacity = getOpacityForFormat(mActiveBuffer->format); - if (oldOpacity != isOpaque()) { - recomputeVisibleRegions = true; + // check that we received a buffer of the right size + // (Take the buffer's orientation into account) + if (mCurrentTransform & Transform::ROT_90) { + swap(bufWidth, bufHeight); } - 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 if needed const Layer::State& front(drawingState()); - // FIXME: mPostedDirtyRegion = dirty & bounds - mPostedDirtyRegion.set(front.active.w, front.active.h); - if (front.active != front.requested) { - // check that we received a buffer of the right size - // (Take the buffer's orientation into account) - if (mCurrentTransform & Transform::ROT_90) { - swap(bufWidth, bufHeight); - } + bool isFixedSize = scalingMode != NATIVE_WINDOW_SCALING_MODE_FREEZE; - if (isFixedSize() || + if (isFixedSize || (bufWidth == front.requested.w && bufHeight == front.requested.h)) { @@ -613,7 +580,7 @@ void Layer::lockPageFlip(bool& recomputeVisibleRegions) "lockPageFlip: (layer=%p), buffer (%ux%u, tr=%02x), scalingMode=%d\n" " drawing={ active ={ wh={%4u,%4u} crop={%4d,%4d,%4d,%4d} (%4d,%4d) }\n" " requested={ wh={%4u,%4u} crop={%4d,%4d,%4d,%4d} (%4d,%4d) }}\n", - this, bufWidth, bufHeight, mCurrentTransform, mCurrentScalingMode, + this, bufWidth, bufHeight, transform, scalingMode, front.active.w, front.active.h, front.active.crop.left, front.active.crop.top, @@ -629,6 +596,44 @@ void Layer::lockPageFlip(bool& recomputeVisibleRegions) front.requested.crop.getWidth(), front.requested.crop.getHeight()); } + + mFrameLatencyNeeded = true; + + if (oldActiveBuffer == NULL && mActiveBuffer != NULL) { + // the first time we receive a buffer, we need to trigger a + // geometry invalidation. + mFlinger->invalidateHwcGeometry(); + } + + + Rect crop(mSurfaceTexture->getCurrentCrop()); + if ((crop != mCurrentCrop) || + (transform != mCurrentTransform) || + (scalingMode != mCurrentScalingMode)) + { + mCurrentCrop = crop; + mCurrentTransform = transform; + mCurrentScalingMode = scalingMode; + mFlinger->invalidateHwcGeometry(); + } + + if (oldActiveBuffer != NULL) { + if (bufWidth != uint32_t(oldActiveBuffer->width) || + bufHeight != uint32_t(oldActiveBuffer->height)) { + mFlinger->invalidateHwcGeometry(); + } + } + + mCurrentOpacity = getOpacityForFormat(mActiveBuffer->format); + if (oldOpacity != isOpaque()) { + recomputeVisibleRegions = true; + } + + // FIXME: mPostedDirtyRegion = dirty & bounds + mPostedDirtyRegion.set(front.active.w, front.active.h); + + 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); } } |