am c7c8334f: am 702634a4: refactoring in preparation for bug:6498869 fix

* commit 'c7c8334f059e42106c7cfa27cdead277fd5e135d':
  refactoring in preparation for bug:6498869 fix
This commit is contained in:
Mathias Agopian 2012-05-29 19:53:50 -07:00 committed by Android Git Automerger
commit 9f36ebdb5b

View File

@ -535,58 +535,25 @@ void Layer::lockPageFlip(bool& recomputeVisibleRegions)
// update the active buffer // update the active buffer
mActiveBuffer = mSurfaceTexture->getCurrentBuffer(); 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 bufWidth = mActiveBuffer->getWidth();
uint32_t bufHeight = mActiveBuffer->getHeight(); uint32_t bufHeight = mActiveBuffer->getHeight();
if (oldActiveBuffer != NULL) { const uint32_t transform(mSurfaceTexture->getCurrentTransform());
if (bufWidth != uint32_t(oldActiveBuffer->width) || const uint32_t scalingMode(mSurfaceTexture->getCurrentScalingMode());
bufHeight != uint32_t(oldActiveBuffer->height)) {
mFlinger->invalidateHwcGeometry();
}
}
mCurrentOpacity = getOpacityForFormat(mActiveBuffer->format);
if (oldOpacity != isOpaque()) {
recomputeVisibleRegions = true;
}
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 // check that we received a buffer of the right size
// (Take the buffer's orientation into account) // (Take the buffer's orientation into account)
if (mCurrentTransform & Transform::ROT_90) { if (mCurrentTransform & Transform::ROT_90) {
swap(bufWidth, bufHeight); swap(bufWidth, bufHeight);
} }
if (isFixedSize() || // update the layer size if needed
const Layer::State& front(drawingState());
if (front.active != front.requested) {
bool isFixedSize = scalingMode != NATIVE_WINDOW_SCALING_MODE_FREEZE;
if (isFixedSize ||
(bufWidth == front.requested.w && (bufWidth == front.requested.w &&
bufHeight == front.requested.h)) bufHeight == front.requested.h))
{ {
@ -613,7 +580,7 @@ void Layer::lockPageFlip(bool& recomputeVisibleRegions)
"lockPageFlip: (layer=%p), buffer (%ux%u, tr=%02x), scalingMode=%d\n" "lockPageFlip: (layer=%p), buffer (%ux%u, tr=%02x), scalingMode=%d\n"
" drawing={ active ={ wh={%4u,%4u} crop={%4d,%4d,%4d,%4d} (%4d,%4d) }\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", " 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.w, front.active.h,
front.active.crop.left, front.active.crop.left,
front.active.crop.top, front.active.crop.top,
@ -629,6 +596,44 @@ void Layer::lockPageFlip(bool& recomputeVisibleRegions)
front.requested.crop.getWidth(), front.requested.crop.getWidth(),
front.requested.crop.getHeight()); 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);
} }
} }