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
This commit is contained in:
parent
05cec9d127
commit
702634a4da
@ -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);
|
// check that we received a buffer of the right size
|
||||||
if (oldOpacity != isOpaque()) {
|
// (Take the buffer's orientation into account)
|
||||||
recomputeVisibleRegions = true;
|
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
|
// update the layer size if needed
|
||||||
const Layer::State& front(drawingState());
|
const Layer::State& front(drawingState());
|
||||||
|
|
||||||
// FIXME: mPostedDirtyRegion = dirty & bounds
|
|
||||||
mPostedDirtyRegion.set(front.active.w, front.active.h);
|
|
||||||
|
|
||||||
if (front.active != front.requested) {
|
if (front.active != front.requested) {
|
||||||
// check that we received a buffer of the right size
|
bool isFixedSize = scalingMode != NATIVE_WINDOW_SCALING_MODE_FREEZE;
|
||||||
// (Take the buffer's orientation into account)
|
|
||||||
if (mCurrentTransform & Transform::ROT_90) {
|
|
||||||
swap(bufWidth, bufHeight);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isFixedSize() ||
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user