ui freeze workaround: reenable triple buffering mode

we're seeing UI freezes when window updates and
composition are separated. for now we workaround this
by always doing a composition after window updates on
vsync. triple buffering is reenabled for performance.

Change-Id: I693d705000b7452489bb0b4918fbeadb9879315c
This commit is contained in:
Mathias Agopian 2012-02-05 01:49:16 -08:00
parent c95dbdc236
commit 303d538bb0
4 changed files with 22 additions and 8 deletions

View File

@ -32,6 +32,7 @@ ifeq ($(TARGET_BOARD_PLATFORM), omap3)
endif endif
ifeq ($(TARGET_BOARD_PLATFORM), omap4) ifeq ($(TARGET_BOARD_PLATFORM), omap4)
LOCAL_CFLAGS += -DHAS_CONTEXT_PRIORITY LOCAL_CFLAGS += -DHAS_CONTEXT_PRIORITY
LOCAL_CFLAGS += -DUSE_TRIPLE_BUFFERING
endif endif
ifeq ($(TARGET_BOARD_PLATFORM), s5pc110) ifeq ($(TARGET_BOARD_PLATFORM), s5pc110)
LOCAL_CFLAGS += -DHAS_CONTEXT_PRIORITY -DNEVER_DEFAULT_TO_ASYNC_MODE LOCAL_CFLAGS += -DHAS_CONTEXT_PRIORITY -DNEVER_DEFAULT_TO_ASYNC_MODE

View File

@ -98,7 +98,12 @@ void Layer::onFirstRef()
mSurfaceTexture = new SurfaceTextureLayer(mTextureName, this); mSurfaceTexture = new SurfaceTextureLayer(mTextureName, this);
mSurfaceTexture->setFrameAvailableListener(new FrameQueuedListener(this)); mSurfaceTexture->setFrameAvailableListener(new FrameQueuedListener(this));
mSurfaceTexture->setSynchronousMode(true); mSurfaceTexture->setSynchronousMode(true);
#ifdef USE_TRIPLE_BUFFERING
#warning "using triple buffering"
mSurfaceTexture->setBufferCountServer(3);
#else
mSurfaceTexture->setBufferCountServer(2); mSurfaceTexture->setBufferCountServer(2);
#endif
} }
Layer::~Layer() Layer::~Layer()

View File

@ -133,7 +133,8 @@ status_t MessageQueue::postMessage(
} }
void MessageQueue::invalidate() { void MessageQueue::invalidate() {
mHandler->signalInvalidate(); // mHandler->signalInvalidate();
mEvents->requestNextVsync();
} }
void MessageQueue::refresh() { void MessageQueue::refresh() {

View File

@ -403,7 +403,8 @@ bool SurfaceFlinger::threadLoop()
void SurfaceFlinger::onMessageReceived(int32_t what) void SurfaceFlinger::onMessageReceived(int32_t what)
{ {
switch (what) { switch (what) {
case MessageQueue::INVALIDATE: { case MessageQueue::REFRESH: {
// case MessageQueue::INVALIDATE: {
// check for transactions // check for transactions
if (CC_UNLIKELY(mConsoleSignals)) { if (CC_UNLIKELY(mConsoleSignals)) {
handleConsoleEvents(); handleConsoleEvents();
@ -419,19 +420,25 @@ void SurfaceFlinger::onMessageReceived(int32_t what)
// post surfaces (if needed) // post surfaces (if needed)
handlePageFlip(); handlePageFlip();
signalRefresh(); // signalRefresh();
} break; //
// } break;
//
// case MessageQueue::REFRESH: {
case MessageQueue::REFRESH: {
// NOTE: it is mandatory to call hw.compositionComplete()
// after handleRefresh()
const DisplayHardware& hw(graphicPlane(0).displayHardware());
handleRefresh(); handleRefresh();
const DisplayHardware& hw(graphicPlane(0).displayHardware());
// if (mDirtyRegion.isEmpty()) {
// return;
// }
if (CC_UNLIKELY(mHwWorkListDirty)) { if (CC_UNLIKELY(mHwWorkListDirty)) {
// build the h/w work list // build the h/w work list
handleWorkList(); handleWorkList();
} }
if (CC_LIKELY(hw.canDraw())) { if (CC_LIKELY(hw.canDraw())) {
// repaint the framebuffer (if needed) // repaint the framebuffer (if needed)
handleRepaint(); handleRepaint();