Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 303d538b authored by Mathias Agopian's avatar Mathias Agopian
Browse files

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
parent c95dbdc2
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ ifeq ($(TARGET_BOARD_PLATFORM), omap3)
endif
ifeq ($(TARGET_BOARD_PLATFORM), omap4)
	LOCAL_CFLAGS += -DHAS_CONTEXT_PRIORITY
	LOCAL_CFLAGS += -DUSE_TRIPLE_BUFFERING
endif
ifeq ($(TARGET_BOARD_PLATFORM), s5pc110)
	LOCAL_CFLAGS += -DHAS_CONTEXT_PRIORITY -DNEVER_DEFAULT_TO_ASYNC_MODE
+5 −0
Original line number Diff line number Diff line
@@ -98,7 +98,12 @@ void Layer::onFirstRef()
    mSurfaceTexture = new SurfaceTextureLayer(mTextureName, this);
    mSurfaceTexture->setFrameAvailableListener(new FrameQueuedListener(this));
    mSurfaceTexture->setSynchronousMode(true);
#ifdef USE_TRIPLE_BUFFERING
#warning "using triple buffering"
    mSurfaceTexture->setBufferCountServer(3);
#else
    mSurfaceTexture->setBufferCountServer(2);
#endif
}

Layer::~Layer()
+2 −1
Original line number Diff line number Diff line
@@ -133,7 +133,8 @@ status_t MessageQueue::postMessage(
}

void MessageQueue::invalidate() {
    mHandler->signalInvalidate();
//    mHandler->signalInvalidate();
    mEvents->requestNextVsync();
}

void MessageQueue::refresh() {
+14 −7
Original line number Diff line number Diff line
@@ -403,7 +403,8 @@ bool SurfaceFlinger::threadLoop()
void SurfaceFlinger::onMessageReceived(int32_t what)
{
    switch (what) {
        case MessageQueue::INVALIDATE: {
        case MessageQueue::REFRESH: {
//        case MessageQueue::INVALIDATE: {
            // check for transactions
            if (CC_UNLIKELY(mConsoleSignals)) {
                handleConsoleEvents();
@@ -419,19 +420,25 @@ void SurfaceFlinger::onMessageReceived(int32_t what)
            // post surfaces (if needed)
            handlePageFlip();

            signalRefresh();
        } break;
//            signalRefresh();
//
//        } break;
//
//        case MessageQueue::REFRESH: {

        case MessageQueue::REFRESH: {
            // NOTE: it is mandatory to call hw.compositionComplete()
            // after handleRefresh()
            const DisplayHardware& hw(graphicPlane(0).displayHardware());
            handleRefresh();

            const DisplayHardware& hw(graphicPlane(0).displayHardware());

//            if (mDirtyRegion.isEmpty()) {
//                return;
//            }

            if (CC_UNLIKELY(mHwWorkListDirty)) {
                // build the h/w work list
                handleWorkList();
            }

            if (CC_LIKELY(hw.canDraw())) {
                // repaint the framebuffer (if needed)
                handleRepaint();