Skip to content

Commit cf7f0c7

Browse files
committed
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
1 parent 077f29f commit cf7f0c7

File tree

4 files changed

+22
-8
lines changed

4 files changed

+22
-8
lines changed

services/surfaceflinger/Android.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ ifeq ($(TARGET_BOARD_PLATFORM), omap3)
3232
endif
3333
ifeq ($(TARGET_BOARD_PLATFORM), omap4)
3434
LOCAL_CFLAGS += -DHAS_CONTEXT_PRIORITY
35+
LOCAL_CFLAGS += -DUSE_TRIPLE_BUFFERING
3536
endif
3637
ifeq ($(TARGET_BOARD_PLATFORM), s5pc110)
3738
LOCAL_CFLAGS += -DHAS_CONTEXT_PRIORITY -DNEVER_DEFAULT_TO_ASYNC_MODE

services/surfaceflinger/Layer.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,12 @@ void Layer::onFirstRef()
9898
mSurfaceTexture = new SurfaceTextureLayer(mTextureName, this);
9999
mSurfaceTexture->setFrameAvailableListener(new FrameQueuedListener(this));
100100
mSurfaceTexture->setSynchronousMode(true);
101+
#ifdef USE_TRIPLE_BUFFERING
102+
#warning "using triple buffering"
103+
mSurfaceTexture->setBufferCountServer(3);
104+
#else
101105
mSurfaceTexture->setBufferCountServer(2);
106+
#endif
102107
}
103108

104109
Layer::~Layer()

services/surfaceflinger/MessageQueue.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ status_t MessageQueue::postMessage(
133133
}
134134

135135
void MessageQueue::invalidate() {
136-
mHandler->signalInvalidate();
136+
// mHandler->signalInvalidate();
137+
mEvents->requestNextVsync();
137138
}
138139

139140
void MessageQueue::refresh() {

services/surfaceflinger/SurfaceFlinger.cpp

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,8 @@ bool SurfaceFlinger::threadLoop()
403403
void SurfaceFlinger::onMessageReceived(int32_t what)
404404
{
405405
switch (what) {
406-
case MessageQueue::INVALIDATE: {
406+
case MessageQueue::REFRESH: {
407+
// case MessageQueue::INVALIDATE: {
407408
// check for transactions
408409
if (CC_UNLIKELY(mConsoleSignals)) {
409410
handleConsoleEvents();
@@ -419,19 +420,25 @@ void SurfaceFlinger::onMessageReceived(int32_t what)
419420
// post surfaces (if needed)
420421
handlePageFlip();
421422

422-
signalRefresh();
423-
} break;
423+
// signalRefresh();
424+
//
425+
// } break;
426+
//
427+
// case MessageQueue::REFRESH: {
424428

425-
case MessageQueue::REFRESH: {
426-
// NOTE: it is mandatory to call hw.compositionComplete()
427-
// after handleRefresh()
428-
const DisplayHardware& hw(graphicPlane(0).displayHardware());
429429
handleRefresh();
430430

431+
const DisplayHardware& hw(graphicPlane(0).displayHardware());
432+
433+
// if (mDirtyRegion.isEmpty()) {
434+
// return;
435+
// }
436+
431437
if (CC_UNLIKELY(mHwWorkListDirty)) {
432438
// build the h/w work list
433439
handleWorkList();
434440
}
441+
435442
if (CC_LIKELY(hw.canDraw())) {
436443
// repaint the framebuffer (if needed)
437444
handleRepaint();

0 commit comments

Comments
 (0)