From 2a8c49eb5dd51b2e60c9a78bea00870867d91c03 Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Thu, 15 Nov 2012 17:19:48 -0800 Subject: [PATCH 1/2] fix an out-of-bounds memory access in this particular case, this OOB is always harmless (and that's why it didn't get fixed from MR1), however, it interfers with valgrind debugging. Change-Id: Ic977e03287e59c4b124a89146c9023bd0cb540a8 --- libs/gui/BufferQueue.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libs/gui/BufferQueue.cpp b/libs/gui/BufferQueue.cpp index 590946a85..607e0bdbe 100644 --- a/libs/gui/BufferQueue.cpp +++ b/libs/gui/BufferQueue.cpp @@ -314,10 +314,12 @@ status_t BufferQueue::dequeueBuffer(int *outBuf, sp& outFence, * the consumer may still have pending reads of the * buffers in flight. */ - bool isOlder = mSlots[i].mFrameNumber < - mSlots[found].mFrameNumber; - if (found < 0 || isOlder) { - found = i; + if (found >= 0) { + bool isOlder = mSlots[i].mFrameNumber < + mSlots[found].mFrameNumber; + if (isOlder) { + found = i; + } } } } From 93f838b3a6ccf6a6a17b0bc345391b139c34185d Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Mon, 19 Nov 2012 15:07:33 -0800 Subject: [PATCH 2/2] workaround: don't reset compositionType to HWC_FRAMEBUFFER [DO NOT MERGE] This workaround a HWC HAL issue in Nexus 7, which causes videos and live wallpapers to animate slowly. Bug: 7563862 Change-Id: I16ad85317e3e7f47f005e7397357c14186b0a13d --- services/surfaceflinger/DisplayHardware/HWComposer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.cpp b/services/surfaceflinger/DisplayHardware/HWComposer.cpp index 29b778d85..2eb74b727 100644 --- a/services/surfaceflinger/DisplayHardware/HWComposer.cpp +++ b/services/surfaceflinger/DisplayHardware/HWComposer.cpp @@ -804,7 +804,7 @@ public: getLayer()->acquireFenceFd = fenceFd; } virtual void setPerFrameDefaultState() { - getLayer()->compositionType = HWC_FRAMEBUFFER; + //getLayer()->compositionType = HWC_FRAMEBUFFER; } virtual void setDefaultState() { getLayer()->compositionType = HWC_FRAMEBUFFER;