Merge changes I97807db6,I7d350bc0

* changes:
  workaround for an issue where the screen would flicker sometimes
  fix an issue in SF where we could miss some updates
This commit is contained in:
Mathias Agopian 2012-02-23 21:23:02 -08:00 committed by Android (Google) Code Review
commit 0c76ba2dd9
3 changed files with 33 additions and 30 deletions

View File

@ -42,7 +42,6 @@
#define DEBUG_RESIZE 0 #define DEBUG_RESIZE 0
namespace android { namespace android {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@ -55,7 +54,7 @@ Layer::Layer(SurfaceFlinger* flinger,
mCurrentTransform(0), mCurrentTransform(0),
mCurrentScalingMode(NATIVE_WINDOW_SCALING_MODE_FREEZE), mCurrentScalingMode(NATIVE_WINDOW_SCALING_MODE_FREEZE),
mCurrentOpacity(true), mCurrentOpacity(true),
mRefreshPending(0), mRefreshPending(false),
mFrameLatencyNeeded(false), mFrameLatencyNeeded(false),
mFrameLatencyOffset(0), mFrameLatencyOffset(0),
mFormat(PIXEL_FORMAT_NONE), mFormat(PIXEL_FORMAT_NONE),
@ -408,15 +407,9 @@ bool Layer::isCropped() const {
// pageflip handling... // pageflip handling...
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
bool Layer::onPreComposition() bool Layer::onPreComposition() {
{ mRefreshPending = false;
// if there was more than one pending update, request a refresh return mQueuedFrames > 0;
if (mRefreshPending >= 2) {
mRefreshPending = 0;
return true;
}
mRefreshPending = 0;
return false;
} }
void Layer::lockPageFlip(bool& recomputeVisibleRegions) void Layer::lockPageFlip(bool& recomputeVisibleRegions)
@ -428,9 +421,11 @@ void Layer::lockPageFlip(bool& recomputeVisibleRegions)
// because we cannot call updateTeximage() without a corresponding // because we cannot call updateTeximage() without a corresponding
// compositionComplete() call. // compositionComplete() call.
// we'll trigger an update in onPreComposition(). // we'll trigger an update in onPreComposition().
if (mRefreshPending++) { if (mRefreshPending) {
mPostedDirtyRegion.clear();
return; return;
} }
mRefreshPending = true;
// Capture the old state of the layer for comparisons later // Capture the old state of the layer for comparisons later
const bool oldOpacity = isOpaque(); const bool oldOpacity = isOpaque();
@ -541,25 +536,23 @@ void Layer::lockPageFlip(bool& recomputeVisibleRegions)
void Layer::unlockPageFlip( void Layer::unlockPageFlip(
const Transform& planeTransform, Region& outDirtyRegion) const Transform& planeTransform, Region& outDirtyRegion)
{ {
if (mRefreshPending >= 2) { Region postedRegion(mPostedDirtyRegion);
return; if (!postedRegion.isEmpty()) {
}
Region dirtyRegion(mPostedDirtyRegion);
if (!dirtyRegion.isEmpty()) {
mPostedDirtyRegion.clear(); mPostedDirtyRegion.clear();
// The dirty region is given in the layer's coordinate space if (!visibleRegionScreen.isEmpty()) {
// transform the dirty region by the surface's transformation // The dirty region is given in the layer's coordinate space
// and the global transformation. // transform the dirty region by the surface's transformation
const Layer::State& s(drawingState()); // and the global transformation.
const Transform tr(planeTransform * s.transform); const Layer::State& s(drawingState());
dirtyRegion = tr.transform(dirtyRegion); const Transform tr(planeTransform * s.transform);
postedRegion = tr.transform(postedRegion);
// At this point, the dirty region is in screen space. // At this point, the dirty region is in screen space.
// Make sure it's constrained by the visible region (which // Make sure it's constrained by the visible region (which
// is in screen space as well). // is in screen space as well).
dirtyRegion.andSelf(visibleRegionScreen); postedRegion.andSelf(visibleRegionScreen);
outDirtyRegion.orSelf(dirtyRegion); outDirtyRegion.orSelf(postedRegion);
}
} }
} }

View File

@ -116,7 +116,7 @@ private:
uint32_t mCurrentTransform; uint32_t mCurrentTransform;
uint32_t mCurrentScalingMode; uint32_t mCurrentScalingMode;
bool mCurrentOpacity; bool mCurrentOpacity;
size_t mRefreshPending; bool mRefreshPending;
bool mFrameLatencyNeeded; bool mFrameLatencyNeeded;
int mFrameLatencyOffset; int mFrameLatencyOffset;

View File

@ -1000,6 +1000,12 @@ void SurfaceFlinger::composeSurfaces(const Region& dirty)
drawWormhole(); drawWormhole();
} }
// FIXME: workaroud for b/6020860
glEnable(GL_SCISSOR_TEST);
glScissor(0,0,0,0);
glClear(GL_COLOR_BUFFER_BIT);
// end-workaround
/* /*
* and then, render the layers targeted at the framebuffer * and then, render the layers targeted at the framebuffer
*/ */
@ -1776,6 +1782,10 @@ status_t SurfaceFlinger::onTransact(
setTransactionFlags(eTransactionNeeded|eTraversalNeeded); setTransactionFlags(eTransactionNeeded|eTraversalNeeded);
return NO_ERROR; return NO_ERROR;
} }
case 1006:{ // send empty update
signalRefresh();
return NO_ERROR;
}
case 1008: // toggle use of hw composer case 1008: // toggle use of hw composer
n = data.readInt32(); n = data.readInt32();
mDebugDisableHWC = n ? 1 : 0; mDebugDisableHWC = n ? 1 : 0;